<!-- //

// check for valid year 
function validYear(theString) {
   for (var i=0;i<theString.length;i++) {
      theChar = theString.charAt(i);
      if ((theChar < "0") || (theChar > "9") || (theString.length != 4) || (theString > 2100) || (theString < 1900)) {
         return false;
      }
   }
   return true;
}

// check for currency
function validcurrency(theString) {
   for (var i=0;i<theString.length;i++) {
      theChar = theString.charAt(i);
      if ((theChar >= "0" && theChar <= "9") || (theChar = ".")) {
         return true;
      }
   }
   return false;
}

// check for SS format
function checkSS(theString) {
   for (var i=0;i<theString.length;i++) {
      theChar = theString.charAt(i);
      if ((theChar >= "0" && theChar <= "9") || (theChar == "-") || (theChar == " ")) {
         return true;
      }
   }
   return false;
}

function form1Check() {

	if (document.form.name.value=="") {
		alert("Your company name is required.");
		document.form.name.focus();
		return false;
	}
        if (document.form.name.value.length > 255) {
		alert("Your company name is too long, please abbreviated to within 255 characters.");
		document.form.name.focus();
		return false;
	}

	if (document.form.address.value=="") {
		alert("We need your business address for our records.");
		document.form.address.focus();
		return false;
	}
        if (document.form.address.value.length > 50) {
		alert("Your address is too long, please abbreviated to within 50 characters.");
		document.form.address.focus();
		return false;
	}

	if (document.form.city.value=="") {
		alert("We need to know the city where you are located.");
		document.form.city.focus();
		return false;
	}
        if (document.form.city.value.length > 50) {
		alert("The city field is too long, please abbreviated to within 50 characters.");
		document.form.city.focus();
		return false;
	}

	if (document.form.zip.value=="") {
		alert("We need to know the zipcode.");
		document.form.zip.focus();
		return false;
	}
        if (document.form.zip.value.length > 15) {
		alert("The zipcode field is too long, please abbreviated to within 15 characters.");
		document.form.zip.focus();
		return false;
	}
	if (document.form.phone.value=="") {
		alert("We need to know the company phone number.");
		document.form.phone.focus();
		return false;
	}
        if (document.form.phone.value.length > 30) {
		alert("Please limit the your phone number to 30 characters.");
		document.form.phone.focus();
		return false;
	}
        if (document.form.fax.value.length > 30) {
		alert("Please limit the your fax number to 30 characters.");
		document.form.fax.focus();
		return false;
	}
   
}


function form2Check() {
	if (document.form.Pname1.value=="") {
		alert("We must have at least one principal information filled out");
		document.form.Pname1.focus();
		return false;
	}
        if (document.form.Pname1.value.length > 100) {
		alert("Please limit the principal name to within 100 characters.");
		document.form.Pname1.focus();
		return false;
	}
	if (document.form.Pssnum1.value=="") {
		alert("We need to know the principal's social security number");
		document.form.Pssnum1.focus();
		return false;
	}
        if (document.form.Pssnum1.value.length > 15){
		alert("This does not appear to be a valid social security number");
		document.form.Pssnum1.focus();
		return false;
	}
	if (document.form.Pphone1.value=="") {
		alert("We must have the principal's phone number.");
		document.form.Pphone1.focus();
		return false;
	}
        if (document.form.Pphone1.value.length > 30) {
		alert("Please limit the principal phone number to within 30 characters.");
		document.form.Pphone1.focus();
		return false;
	}
        if (document.form.Pname2.value.length > 100) {
		alert("Please limit the second principal name to within 100 characters.");
		document.form.Pname2.focus();
		return false;
	}
        if (document.form.Pssnum2.value.length > 15){
		alert("This does not appear to be a valid social security number");
		document.form.Pssnum2.focus();
		return false;
	}
        if (document.form.Pphone1.value.length > 30) {
		alert("Please limit the second principal phone number to within 30 characters.");
		document.form.Pphone1.focus();
		return false;
	}


	if (document.form.Bname1.value=="" || document.form.Branch.value=="") {
		alert("We need to know a bank reference with branch");
		document.form.Bname1.focus();
		return false;
	}

}


function form3Check() {

	if (document.form.financeamt.value=="") {
		alert("We must know how much money you want to finance");
		document.form.financeamt.focus();
		return false;
	}
	if (document.form.terms.value=="") {
		alert("We must know how many terms you want");
		document.form.terms.focus();
		return false;
	}
        if (document.form.terms.value.length > 3) {
		alert("Thats way too long.");
		document.form.terms.focus();
		return false;
	}
	if (document.form.Eyear1.value == "" && document.form.EPrice1.value != "") {
		alert("The first vehicle has a price but no year.  Please enter the year for the vehicle");
		document.form.Eyear1.focus();
		return false;
	}
	if (document.form.Eyear2.value == "" && document.form.EPrice2.value != "") {
		alert("The second vehicle has a price but no year.  Please enter the year for the vehicle");
		document.form.Eyear2.focus();
		return false;
	}
	if (document.form.Eyear3.value == "" && document.form.EPrice3.value != "") {
		alert("The third vehicle has a price but no year.  Please enter the year for the vehicle");
		document.form.Eyear3.focus();
		return false;
	}

}

function PasswordCheck() 
{

	if (document.form.password.value!=document.form.repassword.value) {
		alert("Your password does not match the re-entered password.  Please try again");
		document.form.password.focus();
		return false;
	}
}
// -->
