function prepareForm() {		if (!document.getElementById || !document.getElementById('moh_download_form')) return false;		var e = document.getElementById('moh_download_form');		e.onsubmit = function() {				return validation(this);			}	}addLoadEvent(function() {	var country = document.getElementById('country');	country.onchange = function(country) {		var countryValue = document.getElementById('country')[document.getElementById('country').selectedIndex].value;		if (countryValue == 'United States') {			document.getElementById('state_field').className = '';			document.getElementById('zip_field').className = '';			} else {			document.getElementById('state_field').className = 'hide';			document.getElementById('zip_field').className = 'hide';			}	}});addLoadEvent(prepareForm);/* BEGIN: CODE FOR THE ENTIRE FORM VALIDATION *//* ============================= */// begin validation of the formvar warning_color = "#FFCCCC";var normal_color = "#EEEEEE";// Create new main array. Good for empty text fieldsvar txt_name = new Array() // Form field names is listed first followed by a descriptive name to be show in the js pop up if left blanktxt_name[0] = new Array("first_name","First Name") txt_name[1] = new Array("last_name","Last Name") txt_name[1] = new Array("country","Country") txt_name[2] = new Array("city","City") // txt_name[3] = new Array("state","State") // txt_name[4] = new Array("zip","Zip Code") txt_name[3] = new Array("phone","Telephone") txt_name[4] = new Array("email","Email") // check for blank text fieldsfunction missing_content(field){	// check the regular text fields for empty content	var j;	var missing_empty = "";	// [01] CHECK THE TEXT FIELDS FROM THE ARRAY ABOVE	for (j=0; j<txt_name.length; j++){		if (field[txt_name[j][0]].value == "") {			missing_empty+= txt_name[j][1] + "\n";			field[txt_name[j][0]].style.backgroundColor = warning_color;		} else {			field[txt_name[j][0]].style.backgroundColor = normal_color;		}	}	return missing_empty;}// email validationfunction checkEmail(myForm) {	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm)){		return (true)	}	return (false)}function validation(which){ // validation of the entire form.	var missing = "";		// ck for blank fields	missing += missing_content(which);		// If country is US, require state + zip, otherwise hide them	var country = document.getElementById('country')[document.getElementById('country').selectedIndex].value;	if (country == 'United States') {		document.getElementById('state_field').className = '';		document.getElementById('zip_field').className = '';		if (document.getElementById('zip').value == '' || document.getElementById('state').selectedIndex == 0) {			missing += "State and Zip are required for US downloads\n";			which["zip"].style.backgroundColor = warning_color;			which["state"].style.backgroundColor = warning_color;		} else {			which["zip"].style.backgroundColor = normal_color;			which["state"].style.backgroundColor = normal_color;				}	}		// if the email field is filled in, we need to verify that the email is correct	if (which["email"].value != ""){		email = checkEmail(which["email"].value);			if (email == false){			missing+= "Invalid Email Address\n";			which["email"].style.backgroundColor = warning_color;		} else {			which["email"].style.backgroundColor = normal_color;		}	}	// Insert Additional Validation Here		// FINALE: is anything missing?	if (missing != ""){		missing_hdr = "Please fill in the required information:\n";		alert (missing_hdr + missing);		return false;	} else {			return true;	}}/* END: CODE FOR THE ENTIRE FORM VALIDATION */