
function stateHandler(theField)
{
	var STATE = theField.options[theField.selectedIndex].value;

	if (theField) {
		if (theField.selectedIndex < 1) {
			alert( "Please choose a State");
			return false;
		} else {
			if (stateHandlerJShomepage == "/") {
				window.location.href = "/cgi-bin/aa.fcgi?go=so&l=2&state=" + STATE;
			} else {
				window.location.href = stateHandlerJShomepage + "/cgi-bin/aa.fcgi?go=so&l=2&state=" + STATE;
			}
			return true;
		}
	}
	return true;
}
function statecodeHandler(theField)
{
	var STATECODE = theField.options[theField.selectedIndex].value;

	if (theField) {
		if (theField.selectedIndex < 1) {
			alert( "Please choose a State");
			return false;
		} else {
			if (stateHandlerJShomepage == "/") {
				window.location.href = "/cgi-bin/aa.fcgi?go=so&l=2&statecode=" + STATECODE;
			} else {
				window.location.href = stateHandlerJShomepage + "/cgi-bin/aa.fcgi?go=so&l=2&statecode=" + STATECODE;
			}
			return true;
		}
	}
	return true;
}
function areaHandler(theField, field, desc)
{
	var VALUE = theField.options[theField.selectedIndex].value;

	if (theField) {
		if (theField.selectedIndex < 1) {
			alert( "Please choose " + desc);
			return false;
		} else {
			if (stateHandlerJShomepage == "/") {
				window.location.href = "/cgi-bin/aa.fcgi?go=so&l=2&" + field + "=" + VALUE;
			} else {
				window.location.href = stateHandlerJShomepage + "/cgi-bin/aa.fcgi?go=so&l=2&" + field + "=" + VALUE;
			}
			return true;
		}
	}
	return true;
}
function agentHandler(theField)
{
	var STATE = theField.options[theField.selectedIndex].value;

	if (theField) {
		if (theField.selectedIndex < 1) {
			alert( "Please choose a State");
			return false;
		} else {
			if (stateHandlerJShomepage == "/") {
				window.location.href = "/cgi-bin/aa.fcgi?go=so&l=2&asearch=1&state=" + STATE;
			} else {
				window.location.href = stateHandlerJShomepage + "/cgi-bin/aa.fcgi?go=so&l=2&asearch=1&state=" + STATE;
			}
			return true;
		}
	}
	return true;
}
function VerifyState(theForm)
{
	if (theForm.state) {
		if (theForm.state.selectedIndex < 1) {
			alert( "Please choose a State");
			return false;
		} else {
			return true;
		}
	}
	return true;
}
function VerifyArea(theForm)
{
	if (theForm.county) {
		if (theForm.county.selectedIndex < 1) {
			alert( "Please choose an Area");
			return false;
		} else {
			return true;
		}
	}
	return true;
}
function VerifyCountyCode(theForm)
{
	if (theForm.countycode) {
		if (theForm.countycode.selectedIndex < 1) {
			alert( "Please choose an Area");
			return false;
		} else {
			return true;
		}
	}
	return true;
}
function VerifyMLS(theForm)
{
	if (theForm.mls) {
		if (theForm.mls.value == '') {
			alert( "Please enter a valid MLS #");
			return false;
		} else {
			return true;
		}
	}
	return true;
}
function VerifyWaterFront(theForm)
{
	if (theForm.waterfront_yn)
	{
		if ((theForm.waterfront_yn.selectedIndex == 1) &&
			(theForm.wateroriented_yn.selectedIndex == 2))
		{
			theForm.wateroriented_yn.selectedIndex = 0;
		}
	}
	return true;
}
function VerifyWaterOriented(theForm)
{
	if (theForm.wateroriented_yn)
	{
		if ((theForm.wateroriented_yn.selectedIndex == 2) &&
			(theForm.waterfront_yn.selectedIndex == 1))
		{
			theForm.waterfront_yn.selectedIndex = 2;
		}
	}
	return true;
}
function resetNav(theField)
{
	theField.selectedIndex = 0;
}
function CheckNumZips(theForm)
{
	var zips = theForm.zip;
	var count = 0;

	for(var i=0;i<zips.length;i++)
	{
		if (zips.options[i].selected)
		{
			count++;
		}
	}
	if (count > 30)
	{
		return confirm("NOTICE!\n\nYou have selected more than 30 zip codes.\n\nOnly the first 30 zip codes selected will be used in your search. If you would like to go back and select less zip codes click cancel. To continue your search using only the first 30 selected zip codes click OK");
	}
	return true;
}


