// Developed By: Md. Arifur Rahman (Sobuj)
//mobile : 01920774505
//email : sobuj_22@yahoo.com

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


function CheckForm () {

																																						
	if (document.registration.email.value==""){
		alert("Please enter Your Email Address");
		document.registration.email.focus();
		return false;
	}
	
	if (echeck(document.registration.email.value)==false){
		document.registration.email.value=""
		document.registration.email.focus()
		return false
	}
	
	if (document.registration.u_name.value==""){
		alert("Please enter Your User Name");
		document.registration.u_name.focus();
		return false;
	}
	
	if (document.registration.password.value==""){
		alert("Please enter Your Password");
		document.registration.password.focus();
		return false;
	}
		
	
	if (document.registration.address.value==""){
		alert("Please Enter Address");
		document.registration.address.focus();
		return false;
	}	
	
	if (document.registration.city.value==""){
		alert("Please Enter City Name");
		document.registration.city.focus();
		return false;
	}	
	
	if (document.registration.region.value==""){
		alert("Please Enter State/Province/Region");
		document.registration.region.focus();
		return false;
	}
	
	if (document.registration.postal_code.value==""){
		alert("Please Enter Zip/Postal Code");
		document.registration.postal_code.focus();
		return false;
	}
	
	if (document.registration.country.value=="Not_Selected"){
		alert("Please Select Country!");
		document.registration.country.focus();
		return false;
	}
	
	if (document.registration.Date_Month.value=="Not_Selected"){
		alert("Please Select Date of Birth Month!");
		document.registration.Date_Month.focus();
		return false;
	}
	
	if (document.registration.Date_Day.value=="Not_Selected"){
		alert("Please Select Date of Birth Day!");
		document.registration.Date_Day.focus();
		return false;
	}
	
	if (document.registration.Date_Year.value=="Not_Selected"){
		alert("Please Select Date of Birth Year!");
		document.registration.Date_Year.focus();
		return false;
	}
	
	if (document.registration.sex.value==""){
		alert("Please Select Sex!");
		document.registration.sex.focus();
		return false;
	}
	
	
	if (document.registration.aggree.checked==false){
		alert("You Don't Aggree With Our Terms and Condition.Please read the terms and condition then check the I aggree Check Box!");
		return false;
	}
	

																																					
	return true
}

