// Default the search type to mls
var SearchType = "mls";

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";
	} else if (I.id == "AgentName") {
		SearchType = "agent";
	}
	
}
function searchkeydown(searchtype)
{
	SearchType = searchtype;
	if (window.event.keyCode == 13)
		doSearch(searchtype);
	
}

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";
		
	} else if (type == "agent") {
		document.frm.action = "menuagent.asp";
		
	}
	
	document.frm.submit();
}

