//javascript validation for user side

function chk_form_validation(frm_registration)
{
	var val = document.frm_registration;
	var re = /^\s{1,}$/g;
    
   if ((val.customer_name.value==null) || (val.customer_name.value=="") || (val.customer_name.length=="") || 
       (val.customer_name.value.search(re))> -1)
	{
		alert("Username should not be blank...");
		val.customer_name.focus();
		return false;
	}
	
	 if (val.customer_name.value.length < 6) 
	{
	  alert("Username should not be less than six characters...");
	  val.customer_name.focus();
	  return false;
	}
	
	if ((val.customer_fname.value==null) || (val.customer_fname.value=="") || (val.customer_fname.length=="") || 
       (val.customer_fname.value.search(re))> -1)
	{
		alert("First Name should not be blank...");
		val.customer_fname.focus();
		return false;
	}
	
	if ((val.customer_lname.value==null) || (val.customer_lname.value=="") || (val.customer_lname.length=="") || 
       (val.customer_lname.value.search(re))> -1)
	{
		alert("Last Name should not be blank...");
		val.customer_lname.focus();
		return false;
	}
	
	if ((val.customer_street.value==null) || (val.customer_street.value=="") || (val.customer_street.length=="") || 
       (val.customer_street.value.search(re))> -1)
	{
		alert("Street Address should not be blank...");
		val.customer_street.focus();
		return false;
	}
	
	if ((val.customer_city.value==null) || (val.customer_city.value=="") || (val.customer_city.length=="") || 
       (val.customer_city.value.search(re))> -1)
	{
		alert("City should not be blank...");
		val.customer_city.focus();
		return false;
	}
	
/*	if ((val.customer_state.value==null) || (val.customer_state.value=="") || (val.customer_state.length=="") || 
       (val.customer_state.value.search(re))> -1)
	{
		alert("State should not be blank...");
		val.customer_state.focus();
		return false;
	}*/
	
	if(val.customer_state.value=="0")
	{
		alert("Please select State...");
		val.customer_state.focus();
		return false;
	}
	
	
	if ((val.customer_country.value==null) || (val.customer_country.value=="") || (val.customer_country.length=="") || 
       (val.customer_country.value.search(re))> -1)
	{
		alert("Country should not be blank...");
		val.customer_country.focus();
		return false;
	}
	
	if ((val.customer_zipcode.value==null) || (val.customer_zipcode.value=="") || (val.customer_zipcode.length=="") || 
       (val.customer_zipcode.value.search(re))> -1)
	{
		alert("Zipcode should not be blank...");
		val.customer_zipcode.focus();
		return false;
	}else{
			if(isNaN(val.customer_zipcode.value))
			{
				alert("Zipcode should be numeric..");
				val.customer_zipcode.focus();
				return false;
			}
	     }
	
		
	
	
	
	
	/*if ((val.customer_dob.value==null) || (val.customer_dob.value=="") || (val.customer_dob.value.search(re))> -1)
	{
		alert("Date of birth should not be blank...");
		val.customer_dob.focus();
		return false;
	}
	
	if(val.month.value=="0")
	{
		alert("Please select month...");
		val.month.focus();
		return false;
	}
	if(val.day.value=="0")
	{
		alert("Please select day...");
		val.day.focus();
		return false;
	}
	if(val.year.value=="0")
	{
		alert("Please select year...");
		val.year.focus();
		return false;
	}*/
	
	if(val.customer_email.value=="")
	{
		alert("E-mail Id should not be blank...");
		val.customer_email.focus();
		return false;
	}else{
			if(val.customer_email.value.search(/^[A-Za-z]+\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1 )
			{
				alert("Invalid E-mail Id.");
				val.customer_email.focus();
				return false;
			}	
	     } 
	
	
	if ((val.customer_phone.value==null) || (val.customer_phone.value=="") || (val.customer_phone.length=="") || 
       (val.customer_phone.value.search(re))> -1)
	{
		alert("Phone number not be blank...");
		val.customer_phone.focus();
		return false;
	}/*else{
			if(isNaN(val.customer_phone.value))
			{
				alert("Phone number should be numeric..");
				val.customer_phone.focus();
				return false;
			}
	     }*/
	
	
	if ((val.customer_password.value==null) || (val.customer_password.value=="") || (val.customer_password.value.search(re))> -1)
	{
		alert("Password should not be blank...");
		val.customer_password.focus();
		return false;
	}
	 
	 
    if (val.customer_password.value.length < 6) 
	{
	  alert("Password should not be less than six characters...");
	  val.customer_password.focus();
	  return false;
	}
		
	if ((val.cpassword.value==null) || (val.cpassword.value=="") || (val.cpassword.length >= 6) || (val.cpassword.value.search(re))> -1)
	{
		alert("Confirm password should not be blank...");
		val.cpassword.focus();
		return false;
	}else{
			if(val.customer_password.value!=val.cpassword.value)
			{
				alert("Password and Confirm password does not match...");
				val.cpassword.focus();
				return false;
			}
	
	     }
	
	if(val.terms.checked == false)
	{
		alert("Please accept terms and conditions...");
		val.terms.focus();
		return false;
	}
	
}//function chk_form_validation(frm_reg_2nd_step)


function login_validate(frm_login)
{
	var val = document.frm_login;
	var re = /^\s{1,}$/g;

    if ((val.customer_name1.value==null) || (val.customer_name1.value=="") || (val.customer_name1.length=="") || 
       (val.customer_name1.value.search(re))> -1)
	{
		alert("Username should not be blank...");
		val.customer_name1.focus();
		return false;
	}

    if ((val.customer_password1.value==null) || (val.customer_password1.value=="") || (val.customer_password1.value.search(re))> -1)
	{
		alert("Password should not be blank...");
		val.customer_password1.focus();
		return false;
	}
}

