function validate()
{
  if(document.frm.name.value=="")
     {
	   alert("Please Enter Your Name.");
	   document.frm.name.focus();
	   return false;
	 }
  else if(document.frm.email.value=="")
     { alert("Please Enter Your Email Address.");
	       document.frm.email.focus();
	         return false;
	 }
   else 
        {    var emailStr=document.frm.email.value;
         // checks if the e-mail address is valid
          var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
          var matchArray = emailStr.match(emailPat);
           if (matchArray == null) {
              alert("Your email address seems incorrect.  Please try again (check the '@' and '.'s in the email address)");
			  document.frm.email.focus();
               return false;   
		    }	  	
        }	 

if(!document.getElementById("verify").value){
alert('Please enter the verification code given below');
document.getElementById("verify").focus();
return false;
}
if(document.getElementById("verify").value!=document.getElementById("vp").value){
alert('Verification code does not match');
document.getElementById("verify").value='';
document.getElementById("verify").focus();
return false;
}	
}

function checkForm()
{
	
	if(!document.getElementById("NAME").value)
	{
		alert("NAME IS REQUIRED FIELD !");
		document.getElementById("NAME").focus();
		return false;
	}
	if(!document.getElementById("STREET").value)
	{
		alert("STREET IS REQUIRED FIELD !");
		document.getElementById("STREET").focus();
		return false;
	}
	if(!document.getElementById("CITY").value)
	{
		alert("CITY IS REQUIRED FIELD !");
		document.getElementById("CITY").focus();
		return false;
	}
	if(!document.getElementById("STATE").value)
	{
		alert("STATE IS REQUIRED FIELD !");
		document.getElementById("STATE").focus();
		return false;
	}
	if(!document.getElementById("POSTCODE").value)
	{
		alert("POSTCODE IS REQUIRED FIELD !");
		document.getElementById("POSTCODE").focus();
		return false;
	}
	if(!document.getElementById("EMAIL").value)
	{
		alert("EMAIL IS REQUIRED FIELD !");
		document.getElementById("EMAIL").focus();
		return false;
	}
	else
	{    
			var emailStr=document.getElementById("EMAIL").value;   
			var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
			var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!(!reg1.test(emailStr) && reg2.test(emailStr))) 
			{
				alert("Please check your Email Address.");
				document.getElementById("EMAIL").focus();
				return false; 
				i=1;
		  	}				

    }
	if(!document.getElementById("PHONE").value)
	{
		alert("PHONE IS REQUIRED FIELD !");
		document.getElementById("PHONE").focus();
		return false;
	}
	if(document.getElementById("PLEASE_CONTACT_ME_BY1").checked==false && document.getElementById("PLEASE_CONTACT_ME_BY2").checked==false)
	{
		alert("Please check contact options");
		document.getElementById("PLEASE_CONTACT_ME_BY1").focus();
		return false;
	}
	if(!document.getElementById("COMMENTS").value)
	{
		alert("COMMENTS IS REQUIRED FIELD !");
		document.getElementById("COMMENTS").focus();
		return false;
	}
	if(!document.getElementById("verify").value){
alert('Please enter the verification code given below');
document.getElementById("verify").focus();
return false;
}
if(document.getElementById("verify").value!=document.getElementById("vp").value){
alert('Verification code does not match');
document.getElementById("verify").value='';
document.getElementById("verify").focus();
return false;
}	
}