
function whenreset()
{
if(confirm('This will lose your changes, do you want to continue?'))
{
document.form1.reset();
}
return false;
}
function openmypage(){ //Define arbitrary function to run desired DHTML Window widget codes
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "terms.php", "Terms & Conditions", "width=663px,height=315px,left=300px,top=100px,resize=1,scrolling=1")
ajaxwin.onclose=function(){return window.confirm("Please, Check the box if you are agree.")} //Run custom code when window is about to be closed
}

var emailFilter=/^.+@.+\..{2,3}$/;
var namefilter=/^([a-zA-Z])+$/;
var passfilter=/^([a-zA-Z0-9_\.])+$/;
var zipfilter=/^([0-9]{5})+$/;
var phonefilter=/^([0-9-]{5,20})+$/;
var number=/^([0-9a-zA-Z]{6})+$/;
//register form
function checkform()
{
            if(document.form1.email.value==""){
			alert("Please enter email!");
			document.form1.email.focus();
			return false;
			}
			if(!emailFilter.test(document.form1.email.value)){
			alert("Please enter correct email!");
			document.form1.email.focus();
			return false;
			}
			// password form
if(document.form1.password.value=="")
{
alert("Please enter  password!");
document.form1.password.focus();
return  false;
}
if(document.form1.password2.value=="")
{
alert("Please re type password!");
document.form1.password2.focus();
return  false;
}
if((document.form1.password.value!=document.form1.password2.value))
{
alert("Confirm password does not match!");
document.form1.password2.focus();
return  false;
}
            if(document.form1.fname.value=="")
			{
			alert("Please enter first name!");
			document.form1.fname.focus();
			return false;
			}
			if(!namefilter.test(document.form1.fname.value))
			{
			alert("Please enter first name in character!");
			document.form1.fname.focus();
			return false;
			}
if(document.form1.lname.value=="")
{
alert("Please enter last name!");
document.form1.lname.focus();
return false;
}
if(!namefilter.test(document.form1.lname.value))
{
alert("Please enter last name in character!");
document.form1.lname.focus();
return false;
}
             if(document.form1.address.value==""){
			alert("Please enter address!");
			document.form1.address.focus();
			return false;
			}
if(document.form1.city.value==""){
alert("Please enter city!");
document.form1.city.focus();
return false;
}
if(!namefilter.test(document.form1.city.value))
{
alert("Please enter city in character!");
document.form1.city.focus();
return false;
}
              if(document.form1.state.value==""){
              alert("Please select state!");
              document.form1.state.focus();
              return false;
              }
if(document.form1.zip.value==""){
alert("Please enter zip code!");
document.form1.zip.focus();
return false;
}
if(!zipfilter.test(document.form1.zip.value))
{
alert("Please enter valid zip code!");
document.form1.zip.focus();
return false;
}
            if(document.form1.country.value==""){
              alert("Please select country!");
              document.form1.country.focus();
              return false;
              }	
if(document.form1.phone.value==""){
alert("Please enter phone number!");
document.form1.phone.focus();
return false;
}
if(!phonefilter.test(document.form1.phone.value))
{
alert("Please enter valid phone number!");
document.form1.phone.focus();
return false;
}			  
			  		  
			  
else{
return confirm("Thank you! Select OK if everything is correct.");
}
}
//login



function checkform1(){
if(document.form1.email.value==""){
			alert("Please enter email!");
			document.form1.email.focus();
			return false;
			}
			if(!emailFilter.test(document.form1.email.value)){
			alert("Please enter correct email!");
			document.form1.email.focus();
			return false;
			}
if(document.form1.password.value=="")
{
alert("Please enter  password!");
document.form1.password.focus();
return  false;
}			
			else{
            return true;
            }
            }
			
//forget password
			
function checkform2(){
if(document.form1.email.value==""){
			alert("Please enter email!");
			document.form1.email.focus();
			return false;
			}
			if(!emailFilter.test(document.form1.email.value)){
			alert("Please enter correct email!");
			document.form1.email.focus();
			return false;
			}

			else{
            return true;
            }
            }
			
			
//change password
			
function checkform3()
{
if(document.form1.old_password.value=="")
{
alert("Please enter old  password!");
document.form1.old_password.focus();
return  false;
}
if(document.form1.new_password.value=="")
{
alert("Please enter new password!");
document.form1.new_password.focus();
return  false;
}
if(document.form1.c_new_password.value=="")
{
alert("Please re type new password!");
document.form1.c_new_password.focus();
return  false;
}
if((document.form1.new_password.value!=document.form1.c_new_password.value))
{
alert("Confirm password does not match!");
document.form1.c_new_password.focus();
return  false;
}
			else{
return confirm("Are you sure");
}
            }



	
//billingshipping	
function checkform4(){

			if(document.frm1.BillingFirstname.value=="")
			{
			alert("Please enter  billing first name!");
			document.frm1.BillingFirstname.focus();
			return false;
			}
			if(!namefilter.test(document.frm1.BillingFirstname.value))
			{
			alert("Please enter billing first name in character!");
			document.frm1.BillingFirstname.focus();
			return false;
			}
if(document.frm1.BillingLastname.value=="")
{
alert("Please enter billing last name!");
document.frm1.BillingLastname.focus();
return false;
}
if(!namefilter.test(document.frm1.BillingLastname.value))
{
alert("Please enter billing last name in character!");
document.frm1.BillingLastname.focus();
return false;
}
             if(document.frm1.Billingaddress.value==""){
			alert("Please enter billing address!");
			document.frm1.Billingaddress.focus();
			return false;
			}
if(document.frm1.Billingcity.value==""){
alert("Please enter city!");
document.frm1.Billingcity.focus();
return false;
}
/*if(!namefilter.test(document.frm1.Billingcity.value))
{
alert("Please enter billing city in character!");
document.frm1.Billingcity.focus();
return false;
}*/
              if(document.frm1.Billingstate.value==""){
              alert("Please billing select state!");
              document.frm1.Billingstate.focus();
              return false;
              }
if(document.frm1.Billingzip.value==""){
alert("Please enter billing zip code!");
document.frm1.Billingzip.focus();
return false;
}
if(!zipfilter.test(document.frm1.Billingzip.value))
{
alert("Please enter valid billing zip code!");
document.frm1.Billingzip.focus();
return false;
}
            if(document.frm1.Billingcountry.value==""){
              alert("Please select Billing country!");
              document.frm1.Billingcountry.focus();
              return false;
              }	
if(document.frm1.Billinginternational_number.value==""){
alert("Please enter billing phone number!");
document.frm1.Billinginternational_number.focus();
return false;
}
if(!phonefilter.test(document.frm1.Billinginternational_number.value))
{
alert("Please enter valid billing phone number!");
document.frm1.Billinginternational_number.focus();
return false;
}			  
if(document.frm1.Billingemail.value==""){
			alert("Please Billing enter email!");
			document.frm1.Billingemail.focus();
			return false;
			}
			if(!emailFilter.test(document.frm1.Billingemail.value)){
			alert("Please enter correct Billing email!");
			document.frm1.Billingemail.focus();
			return false;
			}			  		  
			
//shipping
if(document.frm1.ShippingFirstname.value=="")
			{
			alert("Please enter  Shipping first name!");
			document.frm1.ShippingFirstname.focus();
			return false;
			}
			if(!namefilter.test(document.frm1.ShippingFirstname.value))
			{
			alert("Please enter Shipping first name in character!");
			document.frm1.ShippingFirstname.focus();
			return false;
			}
if(document.frm1.ShippingLastname.value=="")
{
alert("Please enter Shipping last name!");
document.frm1.ShippingLastname.focus();
return false;
}
if(!namefilter.test(document.frm1.ShippingLastname.value))
{
alert("Please enter Shipping last name in character!");
document.frm1.ShippingLastname.focus();
return false;
}
             if(document.frm1.Shippingaddress.value==""){
			alert("Please enter Shipping address!");
			document.frm1.Shippingaddress.focus();
			return false;
			}
if(document.frm1.Shippingcity.value==""){
alert("Please enter city!");
document.frm1.Shippingcity.focus();
return false;
}
/*if(!namefilter.test(document.frm1.Shippingcity.value))
{
alert("Please enter Shipping city in character!");
document.frm1.Shippingcity.focus();
return false;
}*/
              if(document.frm1.Shippingstate.value==""){
              alert("Please Shipping select state!");
              document.frm1.Shippingstate.focus();
              return false;
              }
if(document.frm1.Shippingzip.value==""){
alert("Please enter Shipping zip code!");
document.frm1.Shippingzip.focus();
return false;
}
if(!zipfilter.test(document.frm1.Shippingzip.value))
{
alert("Please enter valid Shipping zip code!");
document.frm1.Shippingzip.focus();
return false;
}
            if(document.frm1.Shippingcountry.value==""){
              alert("Please select Shipping country!");
              document.frm1.Shippingcountry.focus();
              return false;
              }	
if(document.frm1.Shippinginternational_number.value==""){
alert("Please enter Shipping phone number!");
document.frm1.Shippinginternational_number.focus();
return false;
}
if(!phonefilter.test(document.frm1.Shippinginternational_number.value))
{
alert("Please enter valid Shipping phone number!");
document.frm1.Shippinginternational_number.focus();
return false;
}			  
if(document.frm1.Shippingemail.value==""){
			alert("Please Shipping enter email!");
			document.frm1.Shippingemail.focus();
			return false;
			}
			if(!emailFilter.test(document.frm1.Shippingemail.value)){
			alert("Please enter correct Shipping email!");
			document.frm1.Shippingemail.focus();
			return false;
			}
			
			if(document.frm1.registernow2.checked==false){
			alert("Please check if you agree with terms.");
			document.frm1.registernow2.focus();
			return false;
			}
		if(document.frm1.hearabout.value==""){
			alert("Please Select How Did You Here About Desire Your Cooking!");
			document.frm1.hearabout.focus();
			return false;
			}
else{
return true;
}
            }
					
	
function checkform5(){
	if(document.form1.qty.value==""){
alert("Please enter minimum quantity 1!");
return false;
}
if(document.form1.qty.value=="0"){
alert("Please enter minimum quantity 1!");
return false;
}
}

function checkformcontact(){
	if(document.formcontact.name.value==""){
alert("Please Enter Name!");
document.formcontact.name.focus();
return false;
}
if(!namefilter.test(document.formcontact.name.value)){
			alert("Please a valid Name!");
			document.formcontact.name.focus();
			return false;
			}
if(document.formcontact.email.value=="0"){
alert("Please Enter E-mail Address!");
document.formcontact.email.focus();
return false;
}
if(!emailFilter.test(document.formcontact.email.value)){
			alert("Please a valid E-mail Address!");
			document.formcontact.email.focus();
			return false;
			}
if(document.formcontact.subject.value==""){
alert("Please Enter Subject!");
document.formcontact.subject.focus();
return false;
}
if(document.formcontact.comment.value==""){
alert("Please Enter Questions / Comments!");
document.formcontact.comment.focus();
return false;
}
if(document.formcontact.code.value==""){
alert("Please Enter the Code !");
document.formcontact.code.focus();
return false;
}
//alert(document.formcontact.hide.value);
if(!number.test(document.formcontact.hide.value)!=!number.test(document.formcontact.code.value))
{
alert("The security code doesn't match");
document.formcontact.code.focus();
return false;
}
}