// JavaScript Document

function check_login(){
 if(document.form1.email.value.length<1){
   alert("E-mail can not be empty!");
   document.form1.email.focus();
   return (false);  
}
 var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
 if(!filter.test(document.form1.email.value)){
   alert("E-mail format error!");
   document.form1.email.focus();
   return (false); 
}
 if(document.form1.password.value.length<6||document.form1.password.value.length>12){
   alert("Password median error(6-12 bit)!");
   document.form1.password.focus();
   return (false);  
}
}

function check_reg(){
 var f_name=document.reg_form.f_name.value;
 if(f_name.length<1){
   alert("First name can not be empty!");
   document.reg_form.f_name.focus();
   return (false);  
}
 var l_name=document.reg_form.l_name.value;
 if(l_name.length<1){
   alert("Last name can not be empty!");
   document.reg_form.l_name.focus();
   return (false);  
}
 var email=document.reg_form.email.value;
 if(email.length<1){
   alert("E-Mail address can not be empty!");
   document.reg_form.email.focus();
   return (false);  
}
 var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
 if(!filter.test(document.reg_form.email.value)){
   alert("E-Mail address format error!");
   document.reg_form.email.focus();
   return (false); 
}
 if(document.reg_form.password.value.length<6||document.reg_form.password.value.length>12){
   alert("Password median error(6-12 bit)!");
   document.reg_form.password.focus();
   return (false);  
}
 if(document.reg_form.password.value!=document.reg_form.password2.value){
   alert("Two different passwords!");
   document.reg_form.password.focus();	 
   return (false); 
}
 var address_1=document.reg_form.address_1.value;
 if(address_1.length<1){
   alert("Address Line 1 can not be empty!");
   document.reg_form.address_1.focus();
   return (false);  
}
 var country=document.reg_form.country.value;
 if(country==""){
   alert("Country can not be empty!");
   document.reg_form.country.focus();
   return (false);  
}
 var state=document.reg_form.state.value;
 if(state==""){
   alert("State can not be empty!");
   document.reg_form.state.focus();
   return (false);  
}
 var city=document.reg_form.city.value;
 if(city.length<1){
   alert("City can not be empty!");
   document.reg_form.city.focus();
   return (false);  
}
 var zip=document.reg_form.zip.value;
 if(zip.length<1){
   alert("Zip Code can not be empty!");
   document.reg_form.zip.focus();
   return (false);  
}
 var phone=document.reg_form.phone.value;
 if(phone.length<1){
   alert("Telephone number can not be empty!");
   document.reg_form.phone.focus();
   return (false);  
}
}

function check_info(){
 var f_name=document.reg_form.f_name.value;
 if(f_name.length<1){
   alert("First name can not be empty!");
   document.reg_form.f_name.focus();
   return (false);  
}
 var l_name=document.reg_form.l_name.value;
 if(l_name.length<1){
   alert("Last name can not be empty!");
   document.reg_form.l_name.focus();
   return (false);  
}
 var email=document.reg_form.email.value;
 if(email.length<1){
   alert("E-Mail address can not be empty!");
   document.reg_form.email.focus();
   return (false);  
}
 var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
 if(!filter.test(email)){
   alert("E-Mail address format error!");
   document.reg_form.email.focus();
   return (false); 
}
 var address_1=document.reg_form.address_1.value;
 if(address_1.length<1){
   alert("Address can not be empty!");
   document.reg_form.address_1.focus();
   return (false);  
}
 var state=document.reg_form.state.value;
 if(state==""){
   alert("State can not be empty!");
   document.reg_form.state.focus();
   return (false);  
}
 var city=document.reg_form.city.value;
 if(city.length<1){
   alert("City can not be empty!");
   document.reg_form.city.focus();
   return (false);  
}
 var zip=document.reg_form.zip.value;
 if(zip.length<1){
   alert("Zip Code can not be empty!");
   document.reg_form.zip.focus();
   return (false);  
}
 var country=document.reg_form.country.value;
 if(country.length<1){
   alert("Country can not be empty!");
   document.reg_form.country.focus();
   return (false);  
}
 var phone=document.reg_form.phone.value;
 if(phone.length<1){
   alert("Telephone number can not be empty!");
   document.reg_form.phone.focus();
   return (false);  
}
}

function check_order(){
 if($("#card_name").val().length<1){
	 alert("Credit Card Owner can not be empty!");
     document.reg_form.card_name.focus();
     return (false); 
	 }
 if($("#card_number").val().length<1){
	 alert("Credit Card Number can not be empty!");
     document.reg_form.card_number.focus();
     return (false); 
	 }
 if($("#card_month").val()==""){
	 alert("Credit Card Expiry Date can not be empty!");
     document.reg_form.card_month.focus();
     return (false); 
	 }
 if($("#card_year").val()==""){
	 alert("Credit Card Expiry Date can not be empty!");
     document.reg_form.card_year.focus();
     return (false); 
	 }
 if($("#card_cvc").val().length<1){
	 alert("Credit Card Check Number(CVC) can not be empty!");
     document.reg_form.card_cvc.focus();
     return (false); 
	 }
if($("#advcheck").attr("checked")==true){
 if($("#f_name_1").val().length<1){
	 alert("First name can not be empty!");
     document.reg_form.f_name_1.focus();
     return (false); 
	 }
 if($("#l_name_1").val().length<1){
	 alert("Last name can not be empty!");
     document.reg_form.l_name_1.focus();
     return (false); 
	 }
 if($("#address_1_1").val().length<1){
	 alert("Address: can not be empty!");
     document.reg_form.address_1_1.focus();
     return (false); 
	 }
 if($("#city_1").val().length<1){
	 alert("City can not be empty!");
     document.reg_form.city_1.focus();
     return (false); 
	 }
 if($("#state_1").val().length<1){
	 alert("State can not be empty!");
     document.reg_form.state_1.focus();
     return (false); 
	 }
 if($("#zip_1").val().length<1){
	 alert("Zip Code can not be empty!");
     document.reg_form.zip_1.focus();
     return (false); 
	 }
 if($("#country_1").val().length<1){
	 alert("Country can not be empty!");
     document.reg_form.country_1.focus();
     return (false); 
	 }
}
}


function check_edit(){
 var f_name=document.reg_form.f_name.value;
 if(f_name.length<1){
   alert("First name can not be empty!");
   document.reg_form.f_name.focus();
   return (false);  
}
 var l_name=document.reg_form.l_name.value;
 if(l_name.length<1){
   alert("Last name can not be empty!");
   document.reg_form.l_name.focus();
   return (false);  
}
if(document.reg_form.password.value.length>0||document.reg_form.password2.value.length>0){
 if(document.reg_form.password.value.length<6||document.reg_form.password.value.length>12){
   alert("Password median error(6-12 bit)!");
   document.reg_form.password.focus();
   return (false);  
}
 if(document.reg_form.password.value!=document.reg_form.password2.value){
   alert("Two different passwords!");
   document.reg_form.password.focus();	 
   return (false); 
}
}
var address_1=document.reg_form.address_1.value;
 if(address_1.length<1){
   alert("Address can not be empty!");
   document.reg_form.address_1.focus();
   return (false);  
}
 var country=document.reg_form.country.value;
 if(country==""){
   alert("Country can not be empty!");
   document.reg_form.country.focus();
   return (false);  
}
 var state=document.reg_form.state.value;
 if(state==""){
   alert("State can not be empty!");
   document.reg_form.state.focus();
   return (false);  
}
 var city=document.reg_form.city.value;
 if(city.length<1){
   alert("City can not be empty!");
   document.reg_form.city.focus();
   return (false);  
}
 var zip=document.reg_form.zip.value;
 if(zip.length<1){
   alert("Zip Code can not be empty!");
   document.reg_form.zip.focus();
   return (false);  
}
 var country=document.reg_form.country.value;
 if(country.length<1){
   alert("Country can not be empty!");
   document.reg_form.country.focus();
   return (false);  
}
 var phone=document.reg_form.phone.value;
 if(phone.length<1){
   alert("Telephone number can not be empty!");
   document.reg_form.phone.focus();
   return (false);  
}
}


