function doSubmit(theform) {
	if (processForm(theform)) {
		theform.submit();
	}
}

function processForm(theform) {
	var astring,sError;
	sError='';


	// Validation script for field 'txtTitle' (Title)

  if (theform.txtTitle.value == "")
  {
    alert("Please enter a value for the \"Title\" field.");
    theform.txtTitle.focus();
    return (false);
  }

  if (theform.txtTitle.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Title\" field.");
    theform.txtTitle.focus();
    return (false);
  }

  if (theform.txtTitle.value.length > 10)
  {
    alert("Please enter at most 10 characters in the \"Title\" field.");
    theform.txtTitle.focus();
    return (false);
  }

  // Validation script for field txtFirstname (First Name)
  if (theform.txtFirstname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theform.txtFirstname.focus();
    return (false);
  }

  if (theform.txtFirstname.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"First Name\" field.");
    theform.txtFirstname.focus();
    return (false);
  }

  if (theform.txtFirstname.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"First Name\" field.");
    theform.txtFirstname.focus();
    return (false);
  }

  // Validation script for field txtLastname (Last Name)
  if (theform.txtLastname.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theform.txtLastname.focus();
    return (false);
  }

  if (theform.txtLastname.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Last Name\" field.");
    theform.txtLastname.focus();
    return (false);
  }

  if (theform.txtLastname.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Last Name\" field.");
    theform.txtLastname.focus();
    return (false);
  }


  // Validation script for field 'txtAddress' (Address 1)
  if (theform.txtAddress.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theform.txtAddress.focus();
    return (false);
  }

  if (theform.txtAddress.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Address\" field.");
    theform.txtAddress.focus();
    return (false);
  }

  if (theform.txtAddress.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Address\" field.");
    theform.txtAddress.focus();
    return (false);
  }
  
// AUST VERSION
   // Validation script for field 'txtSuburb' (Town/City)
  if (theform.txtSuburb.value == "")
  {
    alert("Please enter a value for the \"Town/City\" field.");
    theform.txtSuburb.focus();
    return (false);
  }

  if (theform.txtSuburb.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Town/City\" field.");
    theform.txtSuburb.focus();
    return (false);
  }

  if (theform.txtSuburb.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Town/City\" field.");
    theform.txtSuburb.focus();
    return (false);
  }

//aust version  
  // Validation script for field 'txtState' (State)
  if (theform.txtState.value == "")
  {
    alert("Please enter a value for the \"State\" field.");
    theform.txtState.focus();
    return (false);
  }

  if (theform.txtState.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"State\" field.");
    theform.txtState.focus();
    return (false);
  }

  if (theform.txtState.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"State\" field.");
    theform.txtState.focus();
    return (false);
  }
 
	astring=document.forms[0].txtState.value;
	astring=astring.substring(0,1);
	astring=astring.toUpperCase();
	if (astring == 'A' || astring == 'V' || astring == 'N' || astring == 'Q' || astring == 'S' || astring == 'W' || astring == 'T' || astring.length==0) 
	{astring='';}
	else	
	{alert("Please enter valid state\n");return(false);}
  
  

  // Validation script for field 'postcode' (Postcode)
  
 if (theform.txtPostcode.value == "")
 {
   alert("Please enter a value for the \"Postcode\" field.");
   theform.txtPostcode.focus();
    return (false);
  }

  if (theform.txtPostcode.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Postcode\" field.");
    theform.txtPostcode.focus();
    return (false);
  }

  if (theform.txtPostcode.value.length > 4)
  {
    alert("Please enter at most 4 characters in the \"Postcode\" field.");
    theform.txtPostcode.focus();
    return (false);
  }

    // Validation script for field 'Daytime Phone' 
  
 if (theform.txtPhone.value == "")
 {
   alert("Please enter a value for the \"Phone\" field.");
   theform.txtPhone.focus();
    return (false);
  }

  if (theform.txtPhone.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"Phone\" field.");
    theform.txtPhone.focus();
    return (false);
  }

  if (theform.txtPhone.value.length > 20)
  {
    alert("Please enter at most 20 characters in the \"Phone\" field.");
    theform.txtPhone.focus();
    return (false);
  }
  
  // Email field validation
  // Validation script for field 'email' (Email)
  if (theform.txtEmail.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theform.txtEmail.focus();
    return (false);
  }

  if (theform.txtEmail.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Email\" field.");
    theform.txtEmail.focus();
    return (false);
  }

  if (theform.txtEmail.value.length > 70)
  {
    alert("Please enter at most 70 characters in the \"Email\" field.");
    theform.txtEmail.focus();
    return (false);
  }

  if (theform.txtEmail.value.indexOf("@",1) == -1)
  {
    alert("Not a valid e-mail address.");
    theform.txtEmail.focus();
    return (false);
  }

  if (theform.txtEmail.value.indexOf(".",theform.txtEmail.value.indexOf("@")+1) == -1)
  {
    alert("Not a valid e-mail address.");
    theform.txtEmail.focus();
    return (false);
  }

//if (theform.chkBro_93Conv.checked == false && theform.chkBro_95.checked == false && theform.chkBro_93SS.checked == false && theform.chkTest_93Conv.checked == false && theform.chkTest_95.checked == false && theform.chkTest_93SS.checked == false)
//{
  // alert("Please select 'request information' or 'test drive'.");
   //return (false);
 //}
  
  
	return true;
	
}
