
function checkYear(manufact_year){
    var yearVal=manufact_year.value;
	if(isNaN(yearVal)){
	 alert("You must enter a number for year");
	 manufact_year.focus();
	 manufact_year.select();
	} 
}	

function checkTerm(term){
    var termVal=term.value;
	if(isNaN(termVal)){
	 alert("You must enter a number for term");
	 term.focus();
	 term.select();
	} 
}	

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;
	}

function checkRadio(form){
    specifyOption = -1
	for(i=0; i<form.specify.length; i++){
	  if(form.specify[i].checked){
	    specifyOption = i
	  }
	}
	
	if (specifyOption==-1){
	  alert("Please choose broker or  airline")
	  return false;
	}
	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 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.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
	if (form.customer_country.value ==""){
		alert("Please enter the name of your country.");
  		form.customer_country.focus();
		return false;
	}
    
	else	
    specifyOption = -1
	for(i=0; i<form.specify.length; i++){
	  if(form.specify[i].checked){
	    specifyOption = i
	  }
	}
	
	if (specifyOption==-1){
	  alert("Please choose broker or  airline")
	  return false;
	}
    else
	if (specifyOption==1 && form.region.value==""){
	  alert("Please enter the region of the airline client");
	  form.region.focus();
	  return false;
	}  
	
	else
	if(form.aircraft_details.value==""){
	  alert("Please enter Aircraft Details");
	  form.aircraft_details.focus();
	  return false;
	}

	else
	if(form.engines.value==""){
	  alert("Please enter the Engines");
	  form.engines.focus();
	  return false;
	}
	
	else
	if(form.manufact_year.value==""){
	  alert("Please enter Year of Manufacture");
	  form.manufact_year.focus();
	  return false;
	}

	else
	if(form.term.value==""){
	  alert("Please enter the Term");
	  form.term.focus();
	  return false;
	}
	
	else	
    transType = -1
	for(i=0; i<form.trans_type.length; i++){
	  if(form.trans_type[i].checked){
	    transType = i
	  }
	}
	
	if (transType==-1){
	  alert("Please choose the type of transaction")
	  return false;
	}
	

	else	
    leaseType = -1
	for(i=0; i<form.lease_type.length; i++){
	  if(form.lease_type[i].checked){
	    leaseType = i
	  }
	}
	
	if (leaseType==-1){
	  alert("Please choose Wet Lease or  Dry Lease")
	  return false;
	}
	else
	return true; 	
}


	