function formvalidation(thisform)
{	
	var phone1element =  document.getElementById("phone1");
	var phone2element =  document.getElementById("phone2");
	with(thisform)
	{
		if(emptyvalidation(fname,"Please fill in your First Name.")==false) 
			{
			fname.focus();
			return false;
			}
		if(emptyvalidation(lname,"Please fill in your Last Name.")==false) 
			{
			lname.focus();
			return false;
			}
		if(emptyvalidation(email,"Please fill in your Email Address.")==false) 
			{
			email.focus();
			return false;
			}
		if(validate_email(email)==false)
			{
			email.select();
			email.focus();
			return false;
			}
		if (emptyvalidation(phone,"Please enter your phone number with the area code.")==false) 
			{
			phone.focus();
			return false;
			}
		else
		 {
		   		 for(var i=0;i<phone.value.length;i++)
				  {
					  if(!isDigit(phone.value.charAt(i)))
					  {
						alert("Sorry,Phone number cannot contain characters.");
						phone.select();
						return false;
					  }
				  }
		 }	
		 if(phone.value.length<3)
		 {
		  // alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		  alert("Please enter your phone number with the area code.");	
		   phone.focus();
		   return false;
		 }
		//}
        if(phone1element.value =="")
			{
				//alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");
				alert("Please enter your phone number with the area code.");	
				phone1element.focus();
				return false;
			}
		else
		 {
		    	 for(var i=0;i<phone1element.value.length;i++)
				  {
					  if(!isDigit(phone1element.value.charAt(i)))
					  {
						alert("Sorry,Phone number cannot contain characters.");
						phone1element.select();
						return false;
					  }
				  }
				
		 }		
         if(phone1element.value.length<3)
		 {
		  // alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		  alert("Please enter your phone number with the area code.");	
		   phone1element.focus();
		   return false;
		 }
		if(phone2element.value == "" )
			{
				// alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");
				alert("Please enter your phone number with the area code.");	
				phone2element.focus();
				return false;
			}

         else
		 {
		      
				 for(var i=0;i<phone2element.value.length;i++)
				  {
					  if(!isDigit(phone2element.value.charAt(i)))
					  {
						alert("Sorry,Phone number cannot contain characters.");
						phone2element.select();
						return false;
					  }
				  }
				
		 }	
		 if(phone2element.value.length<4)
		 {
		  // alert("Please enter your area code and full phone number (xxx xxx xxxx) in order to submit your form. Thank you!");	
		  alert("Please enter your phone number with the area code.");	
		   phone2element.focus();
		   return false;
		 }
		if (thisform.state.value=='') 
			{
			alert("Please select State/Province.");
			thisform.state.focus();
			return false;
			}
			 thisform.submit();
			 document.getElementById("load_button").innerHTML='<img  src="images/loading.gif" alt="" width="120" height="15" />';
			 return true;
	 }
	
}

function isDigit(num)
{
	 if(num.length>1)
	   {
		return false;
	   }
    var string="1234567890";

	 if(string.indexOf(num)!=-1)
	  {
	   return true;
	  }
 return false;
}
