// JavaScript Document
<!--

function changeColor(theID,color)
{
document.getElementById(theID).style.background=color;
}


// error checking
	var check = new Array(5);
	var addOn = new Array(5);
	addOn[0] = "name";
	addOn[1] = "phone number";
	addOn[2] = "address";
	addOn[3] = "city";
	addOn[4] = "zip";
	var form = "";
	var form1 = "";
	var form2 = "";
	var form3 = "";
	var form4 = "";
		
// Regular expression for the phone number
	var form_phone = /^\(\d{3}\)\s?\d{3}-\d{4}$/

function form_valid(){
		// phone if statement
	if (form_phone.test(document.information_request_form.phone.value) && (document.information_request_form.phone.value != "(000)000-0000")){
		form1 = "true";
		check[1] = 0;
	} else {
		document.information_request_form.phone.focus();
		document.information_request_form.phone.select();
		check[1] = 1;
		form1 = "false";
	}
		
// name if statement
	if ((document.information_request_form.name.value == "") || (document.information_request_form.name.value == null)){
		document.information_request_form.name.focus();
		document.information_request_form.name.select();
		check[0] = 1;
		form = "false";
	} else {
		check[0] = 0;
		form = "true";
	}
	
	// address if statement
	if ((document.information_request_form.address.value == "") || (document.information_request_form.address.value == null)){
		document.information_request_form.address.focus();
		document.information_request_form.address.select();
		check[2] = 1;
		form2 = "false";
	} else {
		check[2] = 0;
		form2 = "true";
	}
	
	// city if statement
	if ((document.information_request_form.city.value == "") || (document.information_request_form.city.value == null)){
		document.information_request_form.city.focus();
		document.information_request_form.city.select();
		check[3] = 1;
		form3 = "false";
	} else {
		check[3] = 0;
		form3 = "true";
	}
	
	// zip if statement
	if ((document.information_request_form.zip.value == "") || (document.information_request_form.zip.value == null)){
		document.information_request_form.zip.focus();
		document.information_request_form.zip.select();
		check[4] = 1;
		form4 = "false";
	} else {
		check[4] = 0;
		form4 = "true";
	}
// check to see if all if statements are true
if ((form == "true") && (form1 == "true") && (form2 == "true") && (form3 == "true") && (form4 == "true")){
	return true;
} else {
	var c = 0;
	var mess = "Please fill in the following field(s):";
	var error = "";
while (c <= 4){
	if (check[c] == 1){
		changeColor(c,"#FFFF66");
		if (error != ""){
			error = error + ", " + addOn[c];
		} else {
			error = addOn[c];
		}
	} else {
		changeColor(c,"#FFFFFF");
	}
	c++;
}
window.alert(mess +" "+ error);
	return false;
}
}

//-->