function CheckForm () {
	if (document.frmMsg.name.value==""){
		alert("Please enter your name.");
		document.frmMsg.name.focus();
		return false;
	}

	if (document.frmMsg.email.value == "")
	{
		alert("Please specify your E-mail Address.");
		document.frmMsg.email.focus();
		return false;
	}
	if(!validEmail(document.frmMsg.email.value))
	{
	alert("You have entered an invalid email address. Please re-enter it.");
		document.frmMsg.email.focus();
		return false;
	}	     

	document.frmMsg.accept.value="True";
	return true;
}

function validEmail(email)
{
	invalidchars = " /:;"

// remove leading spaces
	while(email.substring(0,1)==" ")
	{
		email = email.substring(1,email.length);
	}

// remove trailing spaces
	while(email.substring(email.length-1,email.length)==" ")
	{

		email = email.substring(0,email.length-1);
	}

	if(email == "")
	{			//checks to see if blank field
		return false
	}
			
	for(i=0;i<invalidchars.length;i++)
	{ //checks for invalid chars
			
		badchars = invalidchars.charAt(i)
			
		if(email.indexOf(badchars,0)!= -1)
		{
			return false
		}	
	}
	
	atPos = email.indexOf("@",1)  //holds position of "@"
			
	if(atPos == -1) 
	{	//checks to see if "@" present
		return false
	}
							
	if(email.indexOf("@",atPos+1) != -1) 
	{ //checks for second "@"
		return false
	}
							
	periodPos = email.indexOf(".",atPos) //holds position of "."
			
	if(periodPos == -1)
	{ //checks for presence of "."
		return false
	}
	if(periodPos+3 > email.length)
	{//makes sure at least two chars after the period
		return false
	}
	return true 
}
function checkPhoneLength(PhnName)
{
//auto advance
	if (PhnName==1)
	{
		if (document.frmMsg.PhoneArea.value.length == 3)
		{
			document.frmMsg.PhoneExch.focus();
		}
	}
	if (PhnName==2)
	{
		if (document.frmMsg.PhoneExch.value.length == 3)
		{
			document.frmMsg.Phone.focus();
		}
	}
	
}
