// JavaScript Document
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}


	function validateForm(){
		if(document.AppForm.fname.value == ""){
			alert("Please enter your name !?");
			document.AppForm.fname.focus();
			return false;
		}
		if(document.AppForm.lname.value == ""){
			alert("Please enter your last name !?");
			document.AppForm.lname.focus();
			return false;
		}
		if(document.AppForm.email.value == ""){
			alert("Please enter your email !?");
			document.AppForm.email.focus();
			return false;
			}
		if (document.AppForm.email.value.indexOf("@") == -1) {
		alert("Your email is invalid !?");
		document.AppForm.email.focus();
		return false;
		}
		if (document.AppForm.email.value.indexOf(".") == -1) {
			alert("Your email is invalid !?");
			document.AppForm.email.focus();
			return false;
		}
		if(AppForm.mnumber.value != ""){
			if(! IsNumeric(AppForm.mnumber.value)){
				alert('Amount Saved Must be numeric');	
				AppForm.mnumber.value = "";
				AppForm.mnumber.focus();
				return false;
			}	
		}
		if(document.AppForm.address.value == ""){
			alert("Please enter your address !?");
			document.AppForm.address.focus();
			return false;
		}else{
			document.AppForm.submit();
			return true;
		}
	}
	
	
	function validateRentalForm(){
		if(document.RentalForm.pick.value == "Other" && document.RentalForm.otherpick.value == ""){
			alert("Please enter your pick up location !?");
			document.RentalForm.otherpick.focus();
			return false;
		}
		if(document.RentalForm.drop.value == "Other" && document.RentalForm.otherdrop.value == ""){
			alert("Please enter your drop location !?");
			document.RentalForm.otherdrop.focus();
			return false;
		}else{
			document.RentalForm.submit();
			return true;
		}
	}
	
	
	function validateConForm(){
		if(document.contact_form.feedback_name.value == ""){
			alert("Please enter your name !?");
			document.contact_form.feedback_name.focus();
			return false;
		}
		if(document.contact_form.feedback_phone.value == ""){
			alert("Please enter your phone !?");
			document.contact_form.feedback_phone.focus();
			return false;
		}
		if(contact_form.feedback_phone.value != ""){
			if(! IsNumeric(contact_form.feedback_phone.value)){
				alert('Your Phone number must be numeric');	
				contact_form.feedback_phone.value = "";
				contact_form.feedback_phone.focus();
				return false;
			}	
		}
		if(document.contact_form.feedback_email.value == ""){
			alert("Please enter your email !?");
			document.contact_form.feedback_email.focus();
			return false;
			}
		if (document.contact_form.feedback_email.value.indexOf("@") == -1) {
			alert("Your email is invalid !?");
			document.contact_form.feedback_email.focus();
			return false;
			}
		if (document.contact_form.feedback_email.value.indexOf(".") == -1) {
			alert("Your email is invalid !?");
			document.contact_form.email.focus();
			return false;
		}
		if(document.contact_form.feedback_comments.value == ""){
			alert("Please enter your comments !?");
			document.contact_form.feedback_comments.focus();
			return false;
		}else{
			document.contact_form.submit();
			return true;
		}
	}