// JavaScript Document

function requestInspection(){
	var f = document.forms[0];
	
	//check for required information
	if (!reqFieldsPresent()){ return; }

	f.submit();
}

function reqFieldsPresent(){
	var f = document.forms[0];
	var errMsg = 'Please provide us with ';
	var arReq = new Array();
	var ele, reqName, eleValue;
	
	arReq[arReq.length] = 'fullName|your name.';
	arReq[arReq.length] = 'address1|your address.';
	arReq[arReq.length] = 'city|your city.';
	arReq[arReq.length] = 'state|your state.';
	arReq[arReq.length] = 'zip|your zip code.';
	arReq[arReq.length] = 'telephone1|at least 1 telephone number.';
	arReq[arReq.length] = "inspection|the type of inspection you're interested in.";
	
	for (var i = 0; i <arReq.length; i++){
		var arEle = arReq[i].split('|');
		ele = eval('f.' + arEle[0]);
		eleValue = ele.value;
		if  ((eleValue == '') || (eleValue == null)){
			alert(errMsg + arEle[1]);
			ele.focus();
			return false;
		}
	}
	
	return true;
}
