// Default the search type to mls
var SearchType = "address";

function RemoveInputText(I)
{
	I.value = "";
}

function InputMouseOut(I, DefText)
{
	// If something was entered, highlight the text
	if (I.value == "") {
		I.value = DefText;
	}
	
	// Set search type based on the last input box that was typed in
	if (I.id == "StreetName") {
		SearchType = "address";
	} else if (I.id == "HomeID") {
		SearchType = "mls";
	}
	
}

function SearchClick()
{
	doSearch(SearchType);
}

function doSearch(type)
{
	if (type == "mls") {
		document.frm.action = "viewhome.asp";
		
	} else if (type == "address") {
		document.frm.action = "listagenthomes.asp";
		
	} else if (type == "advanced") {
		document.frm.action = "findhomerequest.asp?TSearch=Advanced";
		
	}
	

	document.frm.submit();
	
}

function SetSearchType(ddl)
{
	SearchType = ddl.value;
	if (SearchType == "mls")
		document.getElementById("searchbox").name = "HomeID";
	else
		document.getElementById("searchbox").name = "StreetName";
}

function CustomSearchKeyDown(T) {
	if (window.event.keyCode == 13)
	{
	    //alert(SearchType);
		doSearch(SearchType);	
    }
}