<!---- all form check Java Scripts --->

// Clears fields and puts focus on Name form or next active field
function Reset(){   
    for (var i = 0; i < 22; i++){
	   document.forms[0].elements[i].value = "";
	}                                                                                  
}
// Reports if all elements of the form have been filled out properly - add && (isEemail()) to check email.
function testForms(){   
	if ((isFirstname()) && (isLastname()) && (isEemail()) && (isAddress()) && (isCity()) && (isState()) && (isPostal_code()) && (isCountry())  ) {      
	    return true;
    } 
	return false;		  
}
// Checks the  irst NAME field.
function isFirstname(){   
	var str = document.forms[0].firstname.value;   
	
	// Return false if project name field is blank.   
	if (str == ""){      
		alert("\nThe FIRST NAME field is blank.\n\nPlease enter your First Name.")      
		document.forms[0].firstname.focus();      
		return false;      
	}   
	return true;   
}

// Checks the  irst NAME field.
function isLastname(){   
	var str = document.forms[0].lastname.value;   
	
	// Return false if project name field is blank.   
	if (str == ""){      
		alert("\nThe LAST NAME field is blank.\n\nPlease enter your Last Name.")      
		document.forms[0].lastname.focus();      
		return false;      
	}   
	return true;   
}

// Checks the  adddress field.
function isAddress(){   
	var str = document.forms[0].address.value;   
	
	// Return false if location field is blank.   
	if (str == ""){      
		alert("\nThe ADDRESS field is blank.\n\nPlease enter your Address.")      
		document.forms[0].address.focus();      
		return false;      
	}      
	return true;   
}

// Checks the  city field.
function isCity(){   
	var str = document.forms[0].city.value;   
	
	// Return false if location field is blank.   
	if (str == ""){      
		alert("\nThe CITY field is blank.\n\nPlease enter your City.")      
		document.forms[0].city.focus();      
		return false;      
	}      
	return true;   
}

// Checks the  state field.
function isState(){   
	var str = document.forms[0].state.value;   
	
	// Return false if location field is blank.   
	if (str == ""){      
		alert("\nThe STATE field is blank.\n\nPlease enter your State.")      
		document.forms[0].state.focus();      
		return false;      
	}      
	return true;   
}


// Checks the  zip field.
function isPostal_code(){   
	var str = document.forms[0].postal_code.value;   
	
	// Return false if location field is blank.   
	if (str == ""){      
		alert("\nThe ZIP CODE field is blank.\n\nPlease enter your Zip Code.")      
		document.forms[0].postal_code.focus();      
		return false;      
	}      
	return true;   
}

// Checks the  PHONE field.
function isPhone_hm(){   
	var str = document.forms[0].phone_hm.value;   
	
	// Return false if date field is blank.   
	if (str == ""){      
		alert("\nThe HOME PHINE field is blank.\n\nPlease enter your HOME PHONE.")      
		document.forms[0].phone_hm.focus();      
		return false;      
	}      
	return true;   
}

// Checks the  country field.
function isCountry(){   
	var str = document.forms[0].country.value;   
	
	// Return false if date field is blank.   
	if (str == ""){      
		alert("\nThe COUNTRY field is blank.\n\nPlease enter your Country.")      
		document.forms[0].country.focus();      
		return false;      
	}      
	return true;   
}

// Checks the  FAX field.
function isFax(){   
	var str = document.forms[0].fax.value;   
	
	// Return false if date field is blank.   
	if (str == ""){      
		alert("\nThe FAX NUMBER field is blank.\n\nPlease enter your Fax number.")      
		document.forms[0].fax.focus();      
		return false;      
	}      
	return true;   
}


// Checks the E-MAIL field.
function isEemail(){   
	// Return false if e-mail field is blank.   
	if (document.forms[0].eemail.value == ""){      
		alert("\nThe E-MAIL field is blank.\n\nPlease enter your E-Mail address.")      
		document.forms[0].eemail.focus();      
		return false;       
	}   
	// Return false if e-mail field does not contain a '@' and '.' .   
	if (document.forms[0].eemail.value.indexOf ('@',0) == -1 || document.forms[0].eemail.value.indexOf ('.',0) == -1){      
		alert("\nTo be valid, the E-MAIL field requires an \"@\" and a \".\" be used.\n\nPlease re-enter your valid E-Mail address.")      
		document.forms[0].eemail.select();            
		document.forms[0].eemail.focus();      
		return false;      
	}   
	else {      
		return true;      
	}   
}
