function doSubmit1(){
	if ( validate1()) {
		form_sellyourcar.submit(true);
	}	
}

function doSubmit2(){
	if ( validate2()) {
		form_sellyourcar.submit(true);
	}	
}

function doSubmit3(){
	if ( validate3()) {
		form_sellyourcar.submit(true);
	}	
}

function doSubmit4(){
	if ( validate4()) {
		form_sellyourcar.submit(true);
	}	
}

function doSubmit5(){
	if ( validate5()) {
		form_sellyourcar.submit(true);
	}	
}


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;
		}

		else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}

		else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}

		else if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 else if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 else if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		 
		else{
 		 return true;
		}
	}


function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}

function validate1(){
  	if (document.form_sellyourcar.txtMake.value == "") {
    	alert("Please enter make of your car.");
   		document.form_sellyourcar.txtMake.focus();
    	return false;
  	}
	else if (document.form_sellyourcar.txtModel.value == "") {
    	alert("Please enter model of your car.");
   		document.form_sellyourcar.txtModel.focus();
    	return false;
  	}
	else if (document.form_sellyourcar.txtReg.value == "") {
    	alert("Please enter registration number of your car.");
   		document.form_sellyourcar.txtReg.focus();
    	return false;
  	}
	else if (document.form_sellyourcar.txtYear.value == "") {
    	alert("Please enter registration year of your car.");
   		document.form_sellyourcar.txtYear.focus();
    	return false;
  	}
	else{
		return true;
	}
}


function validate2(){
  	if (document.form_sellyourcar.txtMileage.value == "") {
    	alert("Please enter mileage of your car.");
   		document.form_sellyourcar.txtMileage.focus();
    	return false;
  	}
	else{
			return true;
	}
}


function validate3(){
			return true;
}

function validate4(){
			return true;
}


function validate5(){

  	if (document.form_sellyourcar.txtForename.value == "") {
    	alert("Please enter your forename.");
   		document.form_sellyourcar.txtForename.focus();
    	return false;
  	}
	else if (document.form_sellyourcar.txtSurname.value == "") {
    	alert("Please enter your surname.");
   		document.form_sellyourcar.txtSurname.focus();
    	return false;
  	}
  	else if (echeck(document.form_sellyourcar.txtEmail.value)==false){
		document.form_sellyourcar.txtEmail.focus();
		return false;
	}
	else if (document.form_sellyourcar.txtPostcode.value == "") {
    	alert("Please enter your postcode.");
   		document.form_sellyourcar.txtPostcode.focus();
    	return false;
  	}
	else if (document.form_sellyourcar.txtContact.value == "") {
    	alert("Please enter your contact number.");
   		document.form_sellyourcar.txtContact.focus();
    	return false;
  	}
	else{
			return true;
	}
}
