//Function to trim form fields
//------------------------------------------------------------------------------------
function strTrim(tmpStr)
{
	tmpStr = tmpStr.replace(/^\s+/,"");//remove leading
	tmpStr = tmpStr.replace(/\s+$/,"");//remove trailing
	return tmpStr;
}
function trimFields()
{
	for(var i=0; i < obj.elements.length; i++)
	{
		if(obj.elements[i].type == "text" || obj.elements[i].type == "textarea" || obj.elements[i].type == "password")
		{
			obj.elements[i].value = strTrim(obj.elements[i].value);
		}
	}
}

// Function to validate email
//------------------------------------------------------------------------------------
function chkEmail(tmpStr)
{
	var email_pat = /^[a-z][a-z0-9_\.\-]*[a-z0-9]@[a-z0-9]+[a-z0-9\.\-_]*\.[a-z]+$/i;
	return(email_pat.test(tmpStr));
}

//Slide weather
//------------------------------------------------------------------------------------
$(document).ready(function(){
	$('#btn_wr').toggle(
		function(){
			$('#wr_con2').css("display", "none");
			$('#sub_wr_con3').show(1500);
			document.getElementById('btn_wr').src = 'img/btn_weather_r.gif';
		},
		function(){
			$('#wr_con2').css("display", "block");
			$('#sub_wr_con3').hide(1500);
			document.getElementById('btn_wr').src = 'img/btn_weather.gif';
		}
	);
});

//------------------------------------------------------------------------------------
// Function to open in a new window
//------------------------------------------------------------------------------------
function newWindow(pageName, w, h)
{
	w = w || '570';
	h = h || '550';
	window.open(pageName, '', 'width='+w+',height='+h+',toolbar=0,menubar=0,location=0,left=25,top=25');
}

//------------------------------------------------------------------------------------
function NewWindow(pageName, Width, Height)
{
	window.open(pageName, '', 'width='+Width+',height='+Height+',toolbar=0,menubar=0,location=0,left=50,top=75');
}
