function ValidateContactUs()
{
 	var ErrMsg="";
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.txtEmail.value.match(emailPat);
	var ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if(document.Form1.txtFname.value=="" )
	{
		alert("First name required\n");
		document.Form1.txtFname.focus();
		return false;
	}
	
	if(document.Form1.txtFname.value.charAt(0)==' ')
	{    alert("First name required"); 
		 document.Form1.txtFname.focus();
		 return false;
	 }
	
	if(document.Form1.txtEmail.value=="")
	{
	    alert("Email required");		
		document.Form1.txtEmail.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.txtEmail.focus();
		return false;
	}
	
	 if(document.Form1.txtComments.value=="")
	{
	    alert("Comments required");
		document.Form1.txtComments.focus();
		return false;		
	}
	
	if(document.Form1.txtComments.value.charAt(0)==' ')
	{  
	    alert("No spaces allowed.");
	    document.Form1.txtComments.focus();
		return false;
    }
	if(document.Form1.txtComments.value.length > 250)
	 {
			alert("Please enter only 250 characters");
			document.Form1.txtComments.focus();
			return false; 
	 }
	 
	if(document.Form1.CodeNumberTextBox.value=="")
	{
		alert("Verification code required");
		document.Form1.CodeNumberTextBox.focus();
		return false;
	}
	
	if (ErrMsg=="")
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+ErrMsg);
		return false;
	}
}

function loopy() {
		loc = window.location.href
		sPos =loc.lastIndexOf("/")+1;
		if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search
		window.location = loc+'logout.aspx';
	}

function popup(url)
{
	width = 450;
	height = 345;
	xx = window.screen.width;
	yy = window.screen.height;
	xx = (xx/2) - (width/2);
	yy = (yy/2) - (height);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
	newwindow=window.open(url,'name',style);
	if (window.focus) {newwindow.focus()}
}

function HeaderEmailValidation()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.newsletter.m_txtNewsLetter.value.match(emailPat);
	if(document.newsletter.m_txtNewsLetter.value=="Enter Email ...")
	{
		alert("Enter Email address.");
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.newsletter.m_txtNewsLetter.value="";
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
}