//Validate fax number
function checkFax(customer_fax) {
	var faxVal=customer_fax.value;
	var faxLen=faxVal.length;
	var Nums = "0123456789-.()";
	var theDigit="";
	var soFar="";
    var theDigit="";
	for (i=0;i<faxLen;i++) {
		theDigit = faxVal.charAt(i);
		if (Nums.indexOf(theDigit)==-1) {
			customer_fax.value=soFar;
			alert("Fax numbers may not contain  " + theDigit + ".  Please enter a valid Fax Number in this format - xxx-xxx-xxxx.");
			customer_fax.focus();
			customer_fax.select();
			return false;
			}
			soFar=soFar+theDigit;
		}
		return true;
	}

//Validate Phone Number
function checkPhone(customer_phone) {
	var phoneVal=customer_phone.value;
	var phoneLen=phoneVal.length;
	var Nums = "0123456789-.()";
	var theDigit="";
	var soFar="";
    var theDigit="";
	for (i=0;i<phoneLen;i++) {
		theDigit = phoneVal.charAt(i);
		if (Nums.indexOf(theDigit)==-1) {
			customer_phone.value=soFar;
			alert("Phone numbers may not contain  " + theDigit + ".  Please enter a valid Phone Number in this format - xxx-xxx-xxxx.");
			customer_phone.focus();
			customer_phone.select();
			return false;
			}
			soFar=soFar+theDigit;
		}
		return true;
	}

//Validate Part number
function engNo(part_no){
    var partVal=part_no.value;
	if(isNaN(partVal)){
	 alert("You must enter a number for part number");
	 part_no.focus();
	 part_no.select();
	} 
}	



function check(form){

	if (form.customer_name.value =="") {
		alert("You Must Fill in the Requester Name.");
  		form.customer_name.focus();
   	return false;
   	}
   	else

	if (form.customer_company.value =="") {
		alert("You Must Fill in the Company Name.");
  		form.customer_company.focus();
   	return false;
   	}
   	else
	
	if (form.c_state.value =="") {
		alert("You Must Fill in the State.");
  		form.c_state.focus();
   	return false;
   	}
   	else
	if (validEmail(form.customer_email) == false){
		alert("Please Enter a Valid Email Address.");
  		form.customer_email.focus();
		return false;
		}
   
   else
   {   
          return true;
    }   
}



function check2(form){

	if (form.customer_name.value =="") {
		alert("You Must Fill in the Requester Name.");
  		form.customer_name.focus();
   	return false;
   	}
   	else

	if (form.customer_phone.value =="") {
		alert("You Must Fill in the Phone number.");
  		form.customer_phone.focus();
   	return false;
   	}
   	else
	
	if (validEmail(form.customer_email) == false){
		alert("Please Enter a Valid Email Address.");
  		form.customer_email.focus();
		return false;
		}
   
   else
   {   
          return true;
    }   
}



// Validate E-mail address format
function validEmail(elm) {
if (elm.length < 7)  { 
    return false;
}
else
if (elm.value.indexOf("@") == "-1" || 
	    elm.value.indexOf(".") == "-1")
	return false;
	else return true;
} 

function checkFax(customer_fax) {
	var faxVal=customer_fax.value;
	var faxLen=faxVal.length;
	var Nums = "0123456789-.()";
	var theDigit="";
	var soFar="";
    var theDigit="";
	for (i=0;i<faxLen;i++) {
		theDigit = faxVal.charAt(i);
		if (Nums.indexOf(theDigit)==-1) {
			customer_fax.value=soFar;
			alert("Fax numbers may not contain  " + theDigit + ".  Please enter a valid Fax Number in this format - xxx-xxx-xxxx.");
			customer_fax.focus();
			customer_fax.select();
			return false;
			}
			soFar=soFar+theDigit;
		}
		return true;
	}


function checkPhone(customer_phone) {
	var phoneVal=customer_phone.value;
	var phoneLen=phoneVal.length;
	var Nums = "0123456789-.()";
	var theDigit="";
	var soFar="";
    var theDigit="";
	for (i=0;i<phoneLen;i++) {
		theDigit = phoneVal.charAt(i);
		if (Nums.indexOf(theDigit)==-1) {
			customer_phone.value=soFar;
			alert("Phone numbers may not contain  " + theDigit + ".  Please enter a valid Phone Number in this format - xxx-xxx-xxxx.");
			customer_phone.focus();
			customer_phone.select();
			return false;
			}
			soFar=soFar+theDigit;
		}
		return true;
	}

	
//Validate Part number
function partNo(part_no){
    var partVal=part_no.value;
	if(isNaN(partVal)){
	 alert("You must enter a number for number of engines.");
	 part_no.focus();
	 part_no.select();
	} 
}	