<!--
function no_framies()	{
	if (top.location != location)	{
		top.location.href = document.location.href;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function addItem(a)	{
	if (a.id.substr(0,1)=='c')	{
		box1=document.getElementById("city1");
		box2=document.getElementById("city2");
		document.getElementById("searchmethod").value="cities";
	}
	else if (a.id.substr(0,1)=='s')	{
		box1=document.getElementById("school1");
		box2=document.getElementById("school2");
		document.getElementById("searchmethod").value="schools";
	}
	else if (a.id.substr(0,1)=='z')	{
		box1=document.getElementById("zip1");
		box2=document.getElementById("zip2");
		document.getElementById("searchmethod").value="zips";
	}
	var doAdd='Y';
	if (a.id==box1.id)	{
		if (a.selectedIndex>0)	{
			var newIndex=a.selectedIndex;
			var newText=a.options[newIndex].text;
			var newValue=a.options[newIndex].value;
           for (var i=0, l = box2.options.length;i<l;i++) {
		   		if (box2.options[i].text==newText)	{
					doAdd='N';
				}
		   }
		   if (doAdd=='Y') {
				box2.options[box2.length] = new Option(newText, newValue)
			}
		}
	}
}
function addItemFromIndex(i)	{
	box1=document.getElementById("city1");
	box2=document.getElementById("city2");
	var newText=box1.options[i].text;
	var newValue=box1.options[i].value;
		box2.options[box2.length]=new Option(newText,newValue)
}

function removeItem(a)	{
	if (a.selectedIndex>0)	{
		a.options[a.selectedIndex]=null;
		}
}
function toggleImg(gt,ac)	{
	document.getElementById("searchby"+gt).src="../images/homesearch/searchby_"+gt+"_"+ac+".gif";
}
function searchType(j)	{
	if (j != '')	{
		j=j.toLowerCase();
		if (j=='schools')	{
			document.getElementById("tblCities").style.display='none';
			document.getElementById("tblZips").style.display='none';
			document.getElementById("tblSchools").style.display='block';
			document.getElementById("searchmethod").value="schools";
			document.getElementById("school1").options[0].selected=true;
			toggleImg('school','on');
			toggleImg('city','off');
			toggleImg('zip','off');
		}
		else if (j=='cities')	{
			document.getElementById("tblSchools").style.display='none';
			document.getElementById("tblZips").style.display='none';
			document.getElementById("tblCities").style.display="block";
			document.getElementById("searchmethod").value="cities";
			document.getElementById("city1").options[0].selected=true;
			toggleImg('city','on');
			toggleImg('school','off');
			toggleImg('zip','off');
		}
		else if (j=='zips')	{
			document.getElementById("tblSchools").style.display='none';
			document.getElementById("tblCities").style.display="none";
			document.getElementById("tblZips").style.display='block';
			document.getElementById("searchmethod").value="zips";
//			document.getElementById("zip1").options[0].selected=true;
			toggleImg('zip','on');
			toggleImg('city','off');
			toggleImg('school','off');
			document.getElementById("zip2").focus();
		}
	}
}
function handleEnter (field, event, dw) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			if (dw=='')	{
				field.form.elements[i].focus();
			}
			return false;
		} 
		else
		return true;
	}      

function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
function setptype()
{
	window.document.frmpr.bt.disabled = false;
	window.document.frmpr.ge.disabled = false;
	window.document.frmpr.fe.disabled = false;
	window.document.frmpr.ca.disabled = false;
	window.document.frmpr.nr.disabled = false;
	window.document.frmpr.ss.disabled = false;
//	window.document.frmpr.Bt.disabled = false;
	window.document.frmpr.beds.disabled = false;
	window.document.frmpr.baths.disabled = false;
	window.document.frmpr.vt.disabled = false;
	window.document.frmpr.action = "PerformSearch.asp";
	if (window.document.frmpr.ptype.options[5].selected == true) {
		window.document.frmpr.bt.disabled = true;
		window.document.frmpr.ge.disabled = true;
		window.document.frmpr.fe.disabled = true;
		window.document.frmpr.ca.disabled = true;
		window.document.frmpr.nr.disabled = true;
		window.document.frmpr.ss.disabled = true;
		window.document.frmpr.beds.disabled = true;
		window.document.frmpr.baths.disabled = true;
		window.document.frmpr.vt.disabled = true;
		window.document.frmpr.action = "PerformLandSearch.asp";
		window.document.frmpr.minprice.disabled = false;
		}
	if (window.document.frmpr.ptype.options[2].selected == true)	{
		window.document.frmpr.action = "PerformMultiSearch.asp";
		window.document.frmpr.minprice.disabled = false;
		window.document.frmpr.bt.disabled = true;
		window.document.frmpr.ge.disabled = true;
		window.document.frmpr.fe.disabled = true;
		window.document.frmpr.ca.disabled = true;
		window.document.frmpr.nr.disabled = true;
		window.document.frmpr.ss.disabled = true;
		window.document.frmpr.beds.disabled = true;
		window.document.frmpr.baths.disabled = true;
		window.document.frmpr.vt.disabled = true;
		}

	if (window.document.frmpr.ptype.options[3].selected == true)	{
		window.document.frmpr.action = "REOSearch.asp";
		window.document.frmpr.bt.disabled = true;
		window.document.frmpr.ge.disabled = true;
		window.document.frmpr.fe.disabled = true;
		window.document.frmpr.ca.disabled = true;
		window.document.frmpr.nr.disabled = true;
		window.document.frmpr.ss.disabled = true;
		window.document.frmpr.beds.disabled = true;
		window.document.frmpr.baths.disabled = true;
		window.document.frmpr.minprice.disabled = false;
		window.document.frmpr.vt.disabled = true;
		if (confirm("To BROWSE a list of all bank-owned properties, click OK.\nTo SEARCH bank-owned properties, click Cancel."))

			{
				window.location.href = "REOList.asp";
			}
	}
	if (window.document.frmpr.ptype.options[4].selected == true)	{
		window.document.frmpr.action = "PerformSearch.asp";
		window.document.frmpr.bt.disabled = false;
		window.document.frmpr.ge.disabled = false;
		window.document.frmpr.fe.disabled = false;
		window.document.frmpr.ca.disabled = false;
		window.document.frmpr.nr.disabled = false;
		window.document.frmpr.ss.disabled = false;
		window.document.frmpr.beds.disabled = false;
		window.document.frmpr.baths.disabled = false;
		window.document.frmpr.vt.disabled = false;
		window.document.frmpr.minprice.options[23].selected = true;
	}
	if (window.document.frmpr.ptype.options[6].selected==true)	{
		window.location.href="commercial.html";
	}
	if (window.document.frmpr.ptype.options[7].selected==true)	{
		window.location.href='hudhomes.html';	
	}
}

function checkminprice()
{
  if (window.document.frmpr.maxprice.selectedIndex > 0) 	{
	if (window.document.frmpr.minprice.selectedIndex >= window.document.frmpr.maxprice.selectedIndex) 	{
		var j
		j = window.document.frmpr.minprice.selectedIndex; j = j + 1
		window.document.frmpr.maxprice.options[j].selected = true
	}
	if (window.document.frmpr.ptype.options[4].selected == true)	{
		var h
		h = window.document.frmpr.minprice.selectedIndex;
		if (h < 12) {
			alert("To search our Preview Properties, you must include a minimum search price of at least $300,000.")
			window.document.frmpr.minprice.options[12].selected = true;
		}
	}
  }
}

function checkmaxprice()
{
  if (window.document.frmpr.maxprice.selectedIndex < 42) {
	if (window.document.frmpr.minprice.selectedIndex >= window.document.frmpr.maxprice.selectedIndex)	{
		var j
		j = window.document.frmpr.maxprice.selectedIndex; j = j - 1
		if (j < 0)	{
			j = 0
		}
		window.document.frmpr.minprice.options[j].selected = true
	}
  }
}
function MM_validateForm() {
	errors='' 
//	window.document.frmpr.imageField2.disabled=true;
	var sm=document.getElementById("searchmethod").value;
	if (sm=='cities')	{
		var box1=document.getElementById("city1");
		var box2=document.getElementById("city2");
	}
	else if (sm=='schools')	{
		var box1=document.getElementById("school1");
		var box2=document.getElementById("school2");
	}
	else if (sm=='zips')	{
//		var box1=document.getElementById("zip1");
		var box2=document.getElementById("zip2");
	}
	var errors
	if (sm!='zips')	{
	 	if (box2.length==1)	{
			if (box1.selectedIndex<1)	{
				if (window.document.frmpr.MLS.value == "")	{
				  if (window.document.frmpr.Address.value == "") {
					errors = "To perform a search, you must either choose both a region and neighborhood, or enter an Ad Code/MLS #"
					}
				}
			}
		}
	}else{
		//do zip stuff here
		if (box2.value.length<5)	{
			errors='To search by zip code, you must enter at least ONE zip code in the box provided.';
		}
	}
	if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
	if (errors=='')	{
	    if (box2.options.length != 0) { 
	        for (var i=1, l = box2.options.length;i<l;i++) {
	           box2.options[i].selected='true'; 
	        }
		}
		document.getElementById("frmpr").submit();
	}
}

//-->