
						function FormValidator(theForm)
						{
						if(theForm.menu1.value=="")
						{
						 alert('Please select Title');
						 theForm.menu1.focus();
						 return false;
						}
						if(theForm.fname.value<1)
						{
						alert('please enter FirstName');
						theForm.fname.focus();
						return false;
						}
						var reg1 = /^([A-Za-z]{1,20})$/;
						if(reg1.test(theForm.fname.value)== false)
						{
						alert('Name Field should have only alphabets')
						theForm.fname.value="";
						theForm.fname.focus();
						return false;
						}
						if(theForm.lname.value<1)
						{
						alert('please enter LastName');
						theForm.lname.focus();
						return false;
						}
						var reg1 = /^([A-Za-z]{1,20})$/;
						if(reg1.test(theForm.lname.value)== false)
						{
						alert('Name Field should have only alphabets')
						theForm.lname.value="";
						theForm.lname.focus();
						return false;
						}						 	 
						
						if(theForm.bill_address1.value<1)
						{
						alert('please enter Address1');
						theForm.bill_address1.focus();
						return false;
						}
						
						if(theForm.bill_city.value<1)
						{
						alert('please enter City');
						theForm.bill_city.focus();
						return false;
						}
						var reg1 = /^([A-Za-z, ']{1,100})$/;
						if(reg1.test(theForm.bill_city.value)== false)
						{
						alert('City Field should have only alphabets')
						theForm.bill_city.value="";
						theForm.bill_city.focus();
						return false;
						}
						if(theForm.bill_country.value<1)
						{
						alert('please enter Country');
						theForm.bill_country.focus();
						return false;
						}
						if(theForm.bill_state.value<1)
						{
						alert('please enter State');
						theForm.bill_state.focus();
						return false;
						}
						var reg1 = /^([A-Za-z]{1,20})$/;
						if(reg1.test(theForm.bill_state.value)== false)
						{
						alert('State Field should have only alphabets')
						theForm.bill_state.value="";
						theForm.bill_state.focus();
						return false;
						}
						
						if(theForm.bill_zipcode.value<1)
						{
						alert('please enter Zip Code');
						theForm.bill_zipcode.focus();
						return false;
						}						
						if(theForm.ship_address1.value<1)
						{
						alert('please enter Address1');
						theForm.ship_address1.focus();
						return false;
						}
						
						if(theForm.ship_city.value<1)
						{
						alert('please enter City');
						theForm.ship_city.focus();
						return false;
						}
						
						if(theForm.ship_country.value==" ")
						{
						alert('please enter Country');
						theForm.ship_country.focus();
						return false;
						}
						if(theForm.ship_state.value<1)
						{
						alert('please enter State');
						theForm.ship_state.focus();
						return false;
						}
						if(theForm.ship_zipcode.value<1)
						{
						alert('please enter Zip Code');
						theForm.ship_zipcode.focus();
						return false;
						}						
						if(theForm.phone_number1.value=='')
						{
						alert('please enter Phone number');
						theForm.phone_number1.focus();
						return false;
						} 
						/*var regphone1 = /^\+([0-9]{1,3})$/;
						if(regphone1.test(theForm.phone_number1.value)== false)
						{
						alert('Phone Number Code Field should have only numbers along with + in the begining ')
						theForm.phone_number1.value="";
						theForm.phone_number1.focus();
						return false;
						}*/
						
						if(theForm.phone_number2.value =='' )
						{
						alert('please enter Phone number');
						theForm.phone_number2.focus();
						return false;
						} 
						
						var regphone2 = /^([0-9]{1,4})$/;
						if(regphone2.test(theForm.phone_number2.value)== false)
						{
						alert('Phone Number  Field should have only numbers')
						theForm.phone_number2.value="";
						theForm.phone_number2.focus();
						return false;
						}
						
						
						if(theForm.phone_number3.value == '')
						{
						alert('please enter Phone number');
						theForm.phone_number3.focus();
						return false;
						} 						
						
						var regphone3 = /^([0-9]{1,10})$/;
						if(regphone3.test(theForm.phone_number3.value)== false)
						{
						alert('Phone Number  Field should have only numbers')
						theForm.phone_number3.value="";
						theForm.phone_number3.focus();
						return false;
						}
						
						var email1 = document.form.email.value;
						if(email1 == "")  
						{
						alert("please enter Email"); 
						document.form.email.focus();
						return false;
						}   
						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
						var address = document.form.email.value;
						if(reg.test(address) == false)
						{
						alert("Invalid Email Address");
						document.form.email.focus();
						return false;
						}
						
						if(theForm.password.value==null)
						{
						alert('Please Enter  Password');
						theForm.password.focus();
						return false;
						}
						// check for minimum length
						var minLength=6;
						var str=theForm.password.value;
						var x=str.length;	
						if (x < minLength) {
						alert('Your password must be at least 6  characters long. Try again.');
						theForm.password.focus();
						return false;
						}
						
						
						if(theForm.pass1.value==null)
						{
						alert('Please Re-enter  Password');
						theForm.pass1.focus();
						return false;
						}
						
						if(  theForm.password.value != theForm.pass1.value)
						{
						alert('Passwords not matching!');
						theForm.password.focus();
						return false;
						}
						//end check validations
						return true;
						}	
						function check()
						{
						if(document.form3.check1.checked==true)
						{
							
					/*	document.form3.ship_address1.value=document.form3.bill_address1.value;
						document.form3.ship_address2.value=document.form3.bill_address2.value;
						document.form3.ship_city.value=document.form3.bill_city.value;
						document.form3.ship_state.value=document.form3.bill_state.value;
						document.form3.ship_country.value=document.form3.bill_country.value;
						document.form3.ship_zipcode.value=document.form3.bill_zipcode.value; */							
								
						if(document.form3.bill_country.value=='US' || document.form3.bill_country.value=='CA')
							{
							    var x=document.form3.bill_country.value+"."+document.form3.bill_state.value;
							   states_ship_check(x);
							}  
							else
							{
							document.getElementById("ship_state_label").innerHTML="State";  
						document.getElementById("ship_star").innerHTML="*";   					
					document.getElementById("ship_response").innerHTML="<input name=\"ship_state\" type=\"text\" id=\"ship_state\" />";
					document.form3.ship_state.value=document.form3.bill_state.value;
					         }
						document.form3.ship_address1.value=document.form3.bill_address1.value;
						document.form3.ship_address2.value=document.form3.bill_address2.value;
						document.form3.ship_city.value=document.form3.bill_city.value;						
						document.form3.ship_country.value=document.form3.bill_country.value;
						document.form3.ship_zipcode.value=document.form3.bill_zipcode.value;								
							
						}
						else
						{
						document.getElementById("ship_state_label").innerHTML="";
						document.getElementById("ship_star").innerHTML="";
						document.getElementById("ship_response").innerHTML="";
						document.form3.ship_address1.value="";
						document.form3.ship_address2.value="";
						document.form3.ship_city.value="";
						//document.form3.ship_state.value="";
						document.form3.ship_country.value="";
						document.form3.ship_zipcode.value="";
						}
						} 
                function email_fun()
				{
					  
				        if(document.form3.email.value)
						{
						  document.form3.username.value=document.form3.email.value;						  
						   return false;
						}
						if(document.form3.email.value==null)
						{							
						 document.form3.username.value="";
						   return false;	 
						}	
				}
				
function states_ship_check(n)
{
if(window.XMLHttpRequest)
req1=new XMLHttpRequest();
else if(window.ActiveXObject)
req1=new ActiveXObject("Microsoft.XMLHTTP");
var da=new Date(); 
var url="states_ship_check.php?comb="+n;

req1.onreadystatechange=handleStateChangeship3;
req1.open("GET",url); 
req1.send(null);


}
function handleStateChangeship3()
{

if(req1.readyState==4)
if(req1.status==200) 
{
var ship_response = req1.responseText;


document.getElementById("ship_state_label").innerHTML="State";  
document.getElementById("ship_star").innerHTML="*";  
document.getElementById("ship_response").innerHTML=ship_response;

} 
}