

function formtypeclick(type){
	//alert(type);
	document.location = 'index.php?page=[thispage]&office_id=[office_id]&sid=[sid][homeid]&formtype=' + type;
}

//build states array by script
var officeState = new Array();
//jsloop2
/*function changeOffice(state){
	//alert(state);
	theindex = officeState[state];
	//alert(theindex);
	document.emailform.office_loc.selectedIndex = theindex;
}*/
function changeState(theid){
	//alert(theid);
	var theindex = officeState[theid];
	//alert(theindex);
	//alert(officeState[theid]);
	document.emailform.inquiry_pref_state.selectedIndex = theindex;
}

function chkform(theform){
	if(theform.inquiry_fname.value==""){
		alert("In order to better process your request, please enter your first name");
		theform.inquiry_fname.focus();
		return false;
	}
	if(theform.inquiry_lname.value==""){
		alert("In order to better process your request, please enter your last name");
		theform.inquiry_lname.focus();
		return false;
	}
	/*if(theform.inquiry_phone.value=="" && theform.inquiry_email.value==""){
		alert("In order to better process your request, please enter a phone number or an email address for your inquiry");
		theform.inquiry_phone.focus();
		return false;
	}*/

	if(theform.inquiry_phone.value==""){
		alert("In order to better process your request, please enter a phone number for your inquiry");
		theform.inquiry_phone.focus();
		return false;
	}
	if(theform.inquiry_email.value==""){
		alert("In order to better process your request, please enter an email address for your inquiry");
		theform.inquiry_email.focus();
		return false;
	}

	/*if(theform.inquiry_email.value==""){
		alert("In order to better process your request, please enter an email address for your inquiry");
		theform.inquiry_email.focus();
		return false;
	}*/
	/*if(theform.inquiry_address.value==""){
		alert("In order to better process your request, please enter an address for your inquiry");
		theform.inquiry_address.focus();
		return false;
	}
	if(theform.inquiry_city.value==""){
		alert("In order to better process your request, please enter a current city for your inquiry");
		theform.inquiry_city.focus();
		return false;
	}
	if(theform.inquiry_state.value==""){
		alert("In order to better process your request, please enter a current state for your inquiry");
		theform.inquiry_state.focus();
		return false;
	}
	if(theform.inquiry_zip.value==""){
		alert("In order to better process your request, please enter a current zip code for your inquiry");
		theform.inquiry_zip.focus();
		return false;
	}
	
	if(theform.inquiry_calltime.value==""){
		alert("In order to better process your request, please select a call time for your inquiry");
		theform.inquiry_calltime.focus();
		return false;
	}*/
	//mad 2-22-07 fixed wording to be more understandable.
	/*if(theform.office_loc.value==""){
		alert("In order to better process your request, please select a location for your inquiry");
		theform.office_loc.focus();
		return false;
	}*/
	//2-22-07 mad added validation for the source
	if(theform.cat_id.value == ""){
		alert("In order to better process your request, please select how you heard about Showhomes for your inquiry");
		theform.cat_id.focus();
		return false;
	}
	if(theform.app_source.value == "" || theform.app_source.value == -1){
		alert("In order to better process your request, please select how you heard about Showhomes for your inquiry");
		theform.app_source.focus();
		return false;
	}
	return true;
}
