<!--
function check(theForm)
{
	if(theForm.name.value== "")        
   {
   alert("Please enter your name");
   theForm.name.focus();
   return false;
   }
   	if(theForm.address.value== "")        
   {
   alert("Please enter your address");
   theForm.address.focus();
   return false;
   }
   	if(theForm.city.value== "")        
   {
   alert("Please enter your city");
   theForm.city.focus();
   return false;
   }
   	if(theForm.state.value == "null")        
   {
   alert("Please select your state");
   theForm.state.focus();
   return false;
   } 
   	if(theForm.zip.value== "")        
   {
   alert("Please enter your zip code");
   theForm.zip.focus();
   return false;
   }

   if(theForm.phone.value != "")
   if(!validatePhone(theForm.phone.value))
	{
		theForm.phone.focus();
		return false;
	}

   if(theForm.email.value != "")
   {
	emailString = theForm.email.value;
	if(emailCheck(emailString));
	else {theForm.email.focus(); return false; }
   }
   return true;
}
function validatePhone(pno)
{
    var s = pno;
    if(isNaN(s))
    {
        if(s.charAt(3) == "-" && s.charAt(7) == "-")
        {
            s = s.replace("-", "");
            s = s.replace("-", "");
            if(!isNaN(s))
            {
				if(s.length < 10 || s.length > 10)
				{
					alert("Length of Phone Number must be 10 digits. \nFormat is xxx-xxx-xxxx or xxxxxxxxxx");
					return false;	
				}
				else
					return true;	
			}
			else
			{
				alert("Please enter numeric value for Phone Number. \nFormat is xxx-xxx-xxxx or xxxxxxxxxx");
				return false;
			}
        }
        else
        {
			alert("Please enter numeric value for Phone Number. \nFormat is xxx-xxx-xxxx or xxxxxxxxxx");
			return false;
		}
	}
	else
	{
	   if(s.length < 10 || s.length > 10)
	   {
			alert("Length of Phone Number must be 10 digits. \nFormat is xxx-xxx-xxxx or xxxxxxxxxx");
			return false;	
	   }
	   else
		return true;	
    }
}
function emailCheck (emailStr) {

var checkTLD=1;

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

var emailPat=/^(.+)@(.+)$/;

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

var validChars="\[^\\s" + specialChars + "\]";

var quotedUser="(\"[^\"]*\")";

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

var atom=validChars + '+';

var word="(" + atom + "|" + quotedUser + ")";

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).
var c;c=0;
var flag = new Array();
for (i=0; i<user.length; i++) {
	if ( (user.charCodeAt(i)>=48 && user.charCodeAt(i)<= 57 )||(user.charCodeAt(i)>=65 && user.charCodeAt(i)<=90 ) ||(user.charCodeAt(i)==95 ) ||(user.charCodeAt(i)==46 )|| (user.charCodeAt(i)>=97 && user.charCodeAt(i) <= 122 ) ) 
	{      
		if((user.charCodeAt(i)==95 ) ||(user.charCodeAt(i)==46 )) {flag[c++] = i;}
		if(c == 2 && flag[0] == i-1) 	{
			alert("There is no two Special characters followed.");
			return false;           }
	}
	 else
	{
		alert("Ths username contains invalid characters.");
		return false;
 	} 
}

for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
		alert("The domain name does not seem to be valid.");
		return false;
 	  }
	
	for(j=0;j<domArr[i].length;j++)
		if ((domArr[i].charCodeAt(j)>=48 && domArr[i].charCodeAt(j)<= 57 ) || (domArr[i].charCodeAt(j)>=65 && domArr[i].charCodeAt(j)<=90 ) || (domArr[i].charCodeAt(j)>=97 && domArr[i].charCodeAt(j) <= 122 ) ) ;
	else{
		alert("Invalid Character in the domain name.");
		return false;
	}
}

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}
//-->