$(document).ready(function(){
	$("#regform").submit(function(){
		
		var email = $("#email").val();
		if (email.trim() == "" || email.length < 6 )
		{
			$("#email_msg").html("Please specify a valid e-mail address.");
			$("#email").focus();
			return false;			
		}
		else if(chekEmail(email)==false)
		{
			$("#email_msg").html("The email address must be in example@eing.com format.");
			$("#email").focus();
			return false;	
		}
		else
		{
			
		//$("#email_msg").load("/indexs/reg_email/", {email: $("#email").val()});
			$("#email_msg").html("");
		}
		var pwd = $("#pwd1").val();
		if (pwd.trim() == "" || pwd.length < 6)
		{
			$("#pwd_msg").html("Please specify your Password.");
			$("#pwd1").focus();
			return false;
		}
		else
		{
			$("#pwd_msg").html("");
		}
		var pwd2 = $("#pwd2").val();
		if (pwd2.trim() == "")
		{
			$("#pwd2_msg").html("Please specify your Password.");
			$("#pwd2").focus();
			return false;
		}
		else if (pwd != pwd2)
		{
			$("#pwd2_msg").html("Your password entries did not match.");
			$("#pwd2").focus();
			return false;
		}
		else
		{
			$("#pwd2_msg").html("");
		}
		var fname = $("#fname").val();
		if (fname.trim() == "")
		{
			$("#fname_msg").html("Please specify a First Name.");
			$("#fname").focus();
			return false;
		}
		else
		{
			$("#fname_msg").html("");
		}
		var lname = $("#lname").val();
		if (lname.trim() == "")
		{
			$("#lname_msg").html("Please specify a Last Name.");
			return false;
		}
		else
		{
			$("#lname_msg").html("");
		}
		var country = $("#country").val();
		if (country.trim() == "0")
		{
			$("#country_msg").html("Please specify a Last Name.");
			return false;
		}
		else
		{
			$("#country_msg").html("");
		}
		var phone = $("#phone").val();
		if (phone.trim() == "" )
		{
			$("#phone_msg").html("Please specify your Contact Phone.");
			$("#phone").focus();
			return false;			
		}
		else if(chekNumeric(phone)==false)
		{
			$("#phone_msg").html("The Phone numbers must be in digital format.");
			$("#phone").focus();
			return false;	
		}
		else
		{
			$("#phone_msg").html("");
		}
		var country = $("#country").val();
		if (country.trim() == "0")
		{
			$("#country_msg").html("Please specify a Country.");
			return false;
		}
		else
		{
			$("#country_msg").html("");
		}
		var state = $("#state").val();
		if (state.trim() == "")
		{
			$("#state_msg").html("Please specify your State or Province.");
			return false;
		}
		else
		{
			$("#state_msg").html("");
		}
		var city = $("#city").val();
		if (city.trim() == "")
		{
			$("#city_msg").html("Please specify your City.");
			return false;
		}
		else
		{
			$("#city_msg").html("");
		}
		var address = $("#address").val();
		if (address.trim() == "")
		{
			$("#address_msg").html("Please specify your Address.");
			return false;
		}
		else
		{
			$("#address_msg").html("");
		}
		var zip = $("#zip").val();
		if (zip.trim() == "")
		{
			$("#zip_msg").html("Please specify a Zip or Postal Code.");
			return false;
		}
		else
		{
			$("#zip_msg").html("");
		}
		 var form=document.forms[2];  
		 len=form.length-2;
		 var flag=false;
		 for(i=0;i<len;i++)
		 {
			 if(form.elements[i].type=="checkbox")
			 {
				 
				  if(form.elements[i].checked==true)
				  {
					  flag=true;
					 $("#checkmsg1").html("");
					 break;
				  }
			 }
		 }
		  
		 if(!flag)
		 {
			 $("#checkmsg1").html("Please one game");
			 return false;
		 }
		
	});	

});	
