/*########################################################,
|   Review Gabriels API for search before editing
|   http://ajc-staging.gabriels.net/api/search/
|----------------------------------------------------------*/
var txtSearch = new GTSRESearch("txtSearch", GTSRE_PIPELINE_LISTINGS, GTSRE_CHANNEL_S, null);
txtSearch.AddSuggest("searchterm", "location_input");
txtSearch.AddResponseContainer("response", "suggest");
document.onload = txtSearch.Load();


function closeError() {
	$("#error_box").css("display","none");
	$("#quick-search #txtSearch").focus()
}

function idsearch(form,urlPath) {    
	
var webID = document.searchform.userinput.value;
var fValue = parseFloat( webID );
if (urlPath == null) {urlPath = "for-sale"};

if ( isNaN( fValue ) )
{
alert( "Please enter a valid number for the MLS/WebID/Photo Search " );
}

if ( isFinite( fValue ) )
{
window.open("http://homes.ajchomefinder.com/"+urlPath+"/id/" + webID, "_self"); 
}
}


function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}


function jump(menu)
{
ref=menu.adv_links_select.options[menu.adv_links_select.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}

function prepareAdvInputs() {
$("adv_webid_input").focus( function() {
    if ($("adv_webid_input").attr("value") == "Enter a MLS or Web ID") {
        $("adv_webid_input").attr("value", "");
    }
});
}

addLoadEvent(prepareAdvInputs);