var searchType = "destination"; var sactive = ""; var sinput = ""; var snkdinput = ""; var ccscA = new Array("continent","country","state","city"); function lookup(inputString,page) { if(inputString.length == 0) { refresh_msg() } else { //sinput comming from parent js.. $j(sinput).removeClass('sug_inac'); $j(sinput).addClass('sug_ac'); $j.post("http://"+document.domain+"/cedsrch.php", {queryString: ""+inputString+"",page: ""+page+"",ctype: "alccsc"}, function(data){ if(data.length >0 && trim($j(sinput).val()) != "Search Business Location") { $j('#suggestions').show(); $j('#autoSuggestionsList').html(data); $j('#autoSuggestionsList li').click(function(){ var cedid = ""; var cedtype = ""; var typarr = []; var narr =[]; var cenav = ""; var ccscv = ""; typeA = []; idA = []; closeSug(); cedid = $j(this).attr("val"); cedtype = $j(this).attr("type"); ccscv = $j(this).attr("ccscv"); $j("#suggestions").hide(); typarr.push(cedtype); narr.push(cedid); ccscv = ccscv.split(","); $j.each(ccscv,function(m,n){ if(n!=1){ typeA.push(ccscA[m]); idA.push(ccscv[m]); } }) getCCSC(typeA,idA,"auto"); addPolygon("click",cedid,typarr,narr); $j("#map span").hide(); $j("#did").val(cedid); }) } }); } } // lookup function closeSug(){ $j('#suggestions').toggle(); $j('#inputString:first').val("Search Business Location"); $j('#inputString:first').removeClass('sug_ac'); $j('#inputString:first').addClass('sug_inac'); //$j('#suggestions').hide(); refresh_msg() } function trim(str){ a = str.replace(/^\s+/, ''); return a.replace(/\s+$/, ''); } function refresh_msg(){ $j('#autoSuggestionsList').html("
  • Instant matching results comes here...Try out!!!
  • "); } $j("document").ready(function(){ try{ sinput = $j("#inputString"); $j("#inputString").keyup(function(e){ sinput = this; lookup($j(this).val(),0); }); }catch(e){ //alert(e) } })