function validateEml() {
    //  Will check for @, period after @ and text in between
		var e1 = document.promoform.x_email.value;
		var e2 = document.promoform.x_email2.value;
    if (e1=="")  
      {  return false;  }

    var in_space = e1.indexOf(" ");
    if (in_space != -1)
      { alert ("Email address should contain no spaces and be of the format jdoe\@aol.com");
           promoform.x_email.focus();
           return false;  }
    var len = e1.length;
    var alpha = e1.indexOf("@");
    var last_alpha = e1.lastIndexOf("@");

    if (alpha != last_alpha)
       {  alert ("Please check your email address, it should contain only one @ and be of the format jdoe\@aol.com");
          promoform.x_email.focus();
           return false; }

    // No @, in first position, or name too short
    if (alpha == -1 || alpha == 0 || len<6 )
       {  alert ("Please check your email address, it should contain an @ and be of the format jdoe\@aol.com");
           promoform.x_email.focus();
           return false; }

     var last_p = e1.lastIndexOf(".");
          // Be sure period at least two spaces after @, but not last char.
     if (last_p - alpha < 2 || last_p == (len - 1) )
        {  alert ("Please check your email address, it should contain a period after the @ and be of the format jdoe\@aol.com");
           promoform.x_email.focus();
            return false; }

		// check for a value in both fields.
		if (e1 == '' || e2 == '') {
			alert('Please enter your email address twice.');
			promoform.x_email2.focus();
			return false;
		}
		// check for spaces
		if (document.promoform.x_email.value.indexOf(invalid) > -1) {
			alert("Sorry, spaces are not allowed.");
			promoform.x_email.focus();
			return false;
		} else {
			if (e1 != e2) {
			alert ("You did not enter the same email address twice. Please re-enter your email.");
			promoform.x_email2.focus();
			return false;
			}
		}
			
     return true;
   }


function formCheck(formobj){
	// name of mandatory fields
	var fieldRequired = Array("Customer_Name","Address","City","State","Zip","Phone","email","How_Long_in_Business","PO_Number","Owner_Name","Bank_Company1","Bank_Phone1","Bank_Fax1","Bank_Contact1","Bank_Address1","Bank_City1","Bank_State1","Bank_Zip1","Trade_Company1","Trade_Phone1","Trade_Fax1","Trade_Contact1","Trade_Address1","Trade_City1","Trade_State1","Trade_Zip1","Trade_Company2","Trade_Phone2","Trade_Fax2","Trade_Contact2","Trade_Address2","Trade_City2","Trade_State2","Trade_Zip2","Trade_Company3","Trade_Phone3","Trade_Fax3","Trade_Contact3","Trade_Address3","Trade_City3","Trade_State3","Trade_Zip3");
	// field description to appear in the dialog box
	var fieldDescription = Array("Customer Name","Address","City","State","Zip","Phone","Email","How Long in Business","PO_Numbers","Owner's Name","Bank Reference Name","Bank Phone","Bank Fax","Bank Contact","Bank Address","Bank City","Bank State","Bank Zip","(1) Company Reference Name","(1) Company Phone","(1) Company Fax","(1) Company Contact","(1) Company Address","(1) Company City","(1) Company State","(1) Company Zip","(2) Company Reference Name","(2) Company Phone","(2) Company Fax","(2) Company Contact","(2) Company Address","(2) Company City","(2) Company State","(2) Company Zip","(3) Company Reference Name","(3) Company Phone","(3) Company Fax","(3) Company Contact","(3) Company Address","(3) Company City","(3) Company State","(3) Company Zip");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			if (obj.type == null){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				continue;
			}

			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


