
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 Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true
	}

function Validate_Form(){

  if (document.buyer_details.firstname.value.length < 2) {
    alert( "Your first name is too short." )  ;
    document.buyer_details.firstname.focus() ;
    return false ;
  }

  if (document.buyer_details.lastname.value.length < 2) {
    alert( "Your last name is too short." )  ;
    document.buyer_details.lastname.focus() ;
    return false ;
  }

  if (document.buyer_details.address1.value.length < 2) {
    alert( "Your address is too short." )  ;
    document.buyer_details.address1.focus() ;
    return false ;
  }

  if (document.buyer_details.city.value.length < 3) {
    alert( "Your city name is too short." )  ;
    document.buyer_details.city.focus() ;
    return false ;
  }

  if (document.buyer_details.postcode.value.length < 4) {
    alert( "Your postcode is too short." )  ;
    document.buyer_details.postcode.focus() ;
    return false ;
  }

  if (document.buyer_details.telephone.value.length < 6) {
    alert( "Your telephone is not real." )  ;
    document.buyer_details.telephone.focus() ;
    return false ;
  }

  if (document.buyer_details.password.value.length < 8) {
    alert( "Your password must be min 8 chars long." )  ;
    document.buyer_details.password.focus() ;
    return false ;
  }

  if (document.buyer_details.email.value.length < 6) {
    alert( "Your email must be valid to activate your account!" )  ;
    document.buyer_details.email.focus() ;
    return false ;
  }

	return true;
 }
