var popupList=[];var map;var markerArr=[];var oldDivId=-1;var oldMarkerId=-1;var noOfItemsPerPage=10;var normalHTML=[];var currentPage;var query;var zipcodequery="{searchZip}";var zipValue;var mapContainer;var controlContainer;var trafficControl;var baseIcon;var xmlHttp;var isDataLoaded=false;var markersInfo=new Array;
var markers=new Array;var locationId=-1;var ajaxRequestTimer;var allowLoadNextData=false;var localSearchResultCounter=0;var localSearchResultTotalCount=0;var abortSearchRequest=false;function isValidSearchInput(){var A=document.getElementById("searchZipInput").value;geocoder.getLocations(A,checkValidZipPlaceLocalSearch);
}function checkValidZipPlaceLocalSearch(A){if(A&&A.Placemark){place=A.Placemark[0];if(place&&place.AddressDetails&&place.AddressDetails.Country&&place.AddressDetails.Country.CountryNameCode&&("CA"==place.AddressDetails.Country.CountryNameCode||"US"==place.AddressDetails.Country.CountryNameCode)){search();
}else{document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="<div class='local_error_content'>"+"<div class='local_error_icon'><img src='images/errorIcon.gif'/></div>"+"<div class='local_error_msg'>The requested location is not found. Please try another location.</div></div>";
}}else{document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="<div class='local_error_content'>"+"<div class='local_error_icon'><img src='images/errorIcon.gif'/></div>"+"<div class='local_error_msg'>The requested location is not found. Please try another location.</div></div>";
}}function search(){abortSearchRequest=true;oldDivId=-1;zipValue=document.getElementById("searchZipInput").value;query=document.getElementById("searchInput").value;var A="Please enter a location";if(zipValue&&(zipValue.trim()!=""||zipValue.trim()!=A)&&query&&query.trim()!=""){document.getElementById("pageTotalCount").innerHTML="";
document.getElementById("SearchListId").innerHTML="";localSearchResultCounter=0;localSearchResultTotalCount=0;if(map){map.clearOverlays();}updateCircleCommon(map,zipCodeVal);document.getElementById("searchResultsLocalSearch").innerHTML="";geocoder.getLatLng(document.getElementById("searchZipInput").value,function(B){zipcodequery=document.getElementById("searchZipInput").value;
query=document.getElementById("searchInput").value;if(!B){document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="<div class='local_error_content'>"+"<div class='local_error_icon'><img src='images/errorIcon.gif'/></div>"+"<div class='local_error_msg'>The requested location is not found. Please try another location.</div></div>";
}else{query=document.getElementById("searchInput").value;currentPage=1;getLocalURLAjaxRequest(query,0,zipcodequery);}});}else{if(!zipValue||zipValue.trim()==""){document.getElementById("searchZipInput").value=A;document.getElementById("searchZipInput").focus();}}}function getLocalURLAjaxRequest(B,E,A){isDataLoaded=false;
var D;if(ajaxRequestTimer){clearTimeout(ajaxRequestTimer);}if(xmlHttp){xmlHttp.abort();}try{xmlHttp=new XMLHttpRequest();}catch(C){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(C){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(C){alert("Your browser does not support AJAX!");return false;
}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4&&xmlHttp.status==200){var F=xmlHttp.responseXML;isDataLoaded=true;searchCompleteAjaxRequest(F);}};ajaxRequestTimer=setTimeout("ajaxTimeout();",20000);xmlHttp.open("GET","localLanding.htm?isChangeLocation=0&start="+E+"&searchKey="+B+"&searchZip="+A+"&ajaxRequest=0",true);
xmlHttp.send(null);}function ajaxTimeout(){if(!isDataLoaded){if(xmlHttp){xmlHttp.abort();}document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="<div class='local_error_content'>"+"<div class='local_error_icon'><img src='images/errorIcon.gif'/></div>"+"<div class='local_error_msg'>Error while Retreiving the Data. Please try again.</div></div>";
}}function initializeLocalSearchMap(){map=null;map=new GMap2(document.getElementById("mapLocal"),{size:new GSize(528,418)});map.setUIToDefault();map.removeMapType(G_HYBRID_MAP);map.removeMapType(G_PHYSICAL_MAP);trafficControl=new ExtMapTypeControl({showTraffic:true,showTrafficKey:false});map.addControl(trafficControl);
}function removePersonImageMarker(){if(personImagemarker){map.removeOverlay(personImagemarker);}}function removeCircleImageMarker(){if(circleMarker){map.removeOverlay(circleMarker);}}function removeMapMarkers(C,A){if(C){for(var B=1;B<C.length;B++){if(C[B]){A.removeOverlay(C[B]);}}}}function searchCompleteAjaxRequest(AA){initializeLocalSearchMap();
removeMapMarkers(markers,map);markers=null;markers=new Array();abortSearchRequest=false;bounds=new GLatLngBounds();controlContainer=document.getElementById("searchResultsLocalSearch");controlContainer.innerHTML="";document.getElementById("pageTotalCount").innerHTML="";updateCircleCommon(map,zipCodeVal);
if(AA){var Y=AA.getElementsByTagName("Local");if(Y&&Y[0]){var m=Y[0].getElementsByTagName("LocalError");var A=Y[0].getElementsByTagName("Refinement");if(m&&m[0]){var Z=Y[0].getElementsByTagName("LocalError")[0];var l=Z.firstChild.nodeValue;var b=getSuggestionVal(Y[0].getElementsByTagName("Suggestion"));
if(b&&l){l="<div class='suggest'><span class='didyou'>Did You Mean :</span> <a href='javascript: void(0);' onclick=searchKey('"+escape(b)+"');>"+b+"</a><br/><br/>"+l+"</div>";setLocalSearchMap();}else{if(b){l="<div class='suggest'>"+l+"</div>";setLocalSearchMap();}}document.getElementById("searchResultsLocalSearch").innerHTML=l;
document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";}else{if(A&&A.length>0){var r="<h5>Select Nearest Location<h5>";for(var t=0;t<A.length;t++){var x=A[t].getElementsByTagName("RefinementNear")[0];var o;if(x.attributes&&x.attributes.length>0){for(var v=0;
v<x.attributes.length;v++){if(x.attributes[v].nodeName=="unformatted"){o=x.attributes[v].nodeValue;}}}var f=A[t].getElementsByTagName("RefinementQuery")[0];var Q;for(var v=0;v<f.attributes.length;v++){if(f.attributes[v].nodeName=="unformatted"){Q=f.attributes[v].nodeValue;}}r=r+"<br/><h4><a href='javascript: void(0);' onclick=alternateSearch('"+escape(Q)+"','"+escape(o)+"');>"+o+"</a></h4>";
}document.getElementById("searchResultsLocalSearch").innerHTML=r;document.getElementById("SearchListId").innerHTML="";document.getElementById("pageTotalCount").innerHTML="";}else{var b=getSuggestionVal(Y[0].getElementsByTagName("Suggestion"));if(b){var H=document.createElement("div");var l="<div class='suggest'><span class='didyou'>Did You Mean :</span> <a href='javascript:' onclick=searchKey('"+escape(b)+"');>"+b+"</a></div><br/>";
H.innerHTML=l;controlContainer.appendChild(H);}var P=Y[0].getElementsByTagName("Results");if(P!=null&&P[0]){document.getElementById("SearchListId").style.display="block";var s=P[0].getElementsByTagName("Listings");if(s&&s[0]){localSearchResultTotalCount=s[0].childNodes.length;localSearchResultTotalCount-=1;
for(var w=1,v=0;w<(noOfItemsPerPage+1);w++,v++){if(abortSearchRequest){abortSearchRequest=false;removeMapMarkers(markers,map);markers=null;return ;}var W=s[0].getElementsByTagName("Listing")[w-1];if(W){var E=String.fromCharCode("A".charCodeAt(0)+v);var G="";var y=W.getElementsByTagName("Region");var p;
var n;var u;var c;var N=W.getElementsByTagName("City");var R=W.getElementsByTagName("Addr");var K=W.getElementsByTagName("Name");var O="";var e=W.getElementsByTagName("Lat");var D="";var J=W.getElementsByTagName("Long");var h="";var S;var a="";var q="";var g="";var U="";var M="";var F="";var d="";var T="";
if(K&&K[0]){O=K[0].firstChild.nodeValue;}if(R&&R[0]){q=R[0].firstChild.nodeValue;}if(N&&N[0]){g=N[0].firstChild.nodeValue;}if(y&&y[0]){U=y[0].firstChild.nodeValue;}if(e&&e[0]){D=e[0].firstChild.nodeValue;}if(J&&J[0]){h=J[0].firstChild.nodeValue;}if(W.getElementsByTagName("Homepage")&&W.getElementsByTagName("Homepage")[0]){var C=W.getElementsByTagName("Homepage")[0];
if(C.getElementsByTagName("U")&&C.getElementsByTagName("U")[0]){p=C.getElementsByTagName("U")[0];F=p.firstChild.nodeValue;}if(C.getElementsByTagName("T")&&C.getElementsByTagName("T")[0]){n=C.getElementsByTagName("T")[0];d=n.firstChild.nodeValue;}}if(W.getElementsByTagName("Location")&&W.getElementsByTagName("Location")[0]){var L=W.getElementsByTagName("Location")[0];
u=L.attributes.getNamedItem("lat").value;c=L.attributes.getNamedItem("long").value;if(L.getElementsByTagName("Address")[0]){R=L.getElementsByTagName("Address")[0];if(R){if(R.firstChild){M=R.firstChild.nodeValue;}else{M="";}}else{M="";}}}if(W.getElementsByTagName("Distance")&&W.getElementsByTagName("Distance")[0]){S=W.getElementsByTagName("Distance")[0];
if(S.getElementsByTagName("ValueInMiles")&&S.getElementsByTagName("ValueInMiles")[0]){a=S.getElementsByTagName("ValueInMiles")[0].firstChild.nodeValue;var z=a;a=roundDecimals(parseFloat(z),2);}}if(W.getElementsByTagName("Phone")&&W.getElementsByTagName("Phone")){var I=W.getElementsByTagName("Phone")[0];
G="";if(I!=null&&I.firstChild!=null){G=I.firstChild.nodeValue;}}popupList[w]=O+"|"+q+"|"+g+"|"+U+"|"+G+"|"+T+"|"+F+"|"+d+"|"+D+"|"+h+"|"+a+"|"+M;var X=document.createElement("div");X.id=w;controlContainer.appendChild(X);formatSearchResultLocal(X,w,"images/balloon_localSearch"+V+"_icon"+E+".png",O,P.URL,q,g,U,G,D,h,a,M);
var B=new google.maps.LatLng(parseFloat(u),parseFloat(c));formatSearchResultLocalPopup(w,"images/balloon_localSearch"+V+"_icon"+E+".png",O,q,g,U,G,null,T,F,d,D,h,a,M,false,AA);bounds.extend(B);}}map.setCenter(bounds.getCenter(),(map.getBoundsZoomLevel(bounds)-1));}else{printNoDataResults();}}else{printNoDataResults();
}}}}else{printNoDataResults();}}else{printNoDataResults();}}function formatSearchResultLocalPopup(D,J,P,M,G,O,Q,H,C,E,B,L,N,A,F,K,I){if(geocoder==null){geocoder=new GClientGeocoder();}geocoder.getLocations(F,function(T){var R="";var S;if(T!=null&&T.Placemark!=null&&T.Placemark.length>0){S=T.Placemark[0];
point=new GLatLng(S.Point.coordinates[1],S.Point.coordinates[0]);}try{if(S!=null&&S.AddressDetails!=null&&S.AddressDetails.Country!=null&&S.AddressDetails.Country.AdministrativeArea!=null){try{if(S.AddressDetails.Country.AdministrativeArea.Locality!=null&&S.AddressDetails.Country.AdministrativeArea.Locality.PostalCode!=null){R=S.AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber;
}}catch(U){}if(R==""){try{if(S.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea!=null&&S.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality!=null&&S.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode!=null){R=S.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;
}}catch(W){}}}}catch(U){}gStreetView=new GStreetviewClient();gStreetView.getNearestPanoramaLatLng(new GLatLng(L,N),function(c){var j;if(c){j="http://cbk0.google.com/cbk?output=thumbnail&w=90&h=68&ll="+L+","+N;}else{j="images/blank_weburl_img.gif";}var Y=M;var a=Y.split(",");if(a[1]){a[1]=a[1]+", <br>";
}else{a[1]="";}var d="<div class='iw'>"+"<div class='basics'>"+"<div class='maxtitle title'>"+P+"</div>"+"<div class='closeIconPopup'><img src='images/close_btn.gif' height='15' width='15' border'0' onclick='javascript:closepop("+D+");' /></div>"+"<div class='clearBoth'></div><table>"+"  <tr>"+"    <td bgcolor='#FFFFFF' class='basicinfo'>"+"  <div class='addr'>"+"      <span>"+a[0]+", "+"</span><br>"+"      <span>"+a[1]+"</span>"+"      <span>"+G+", "+O+" </span>"+"      <span>"+R+"</span><br>"+"      <span>"+Q+"</span><br>"+"      <span><a target='_blank' href="+E+"><u>"+B+"</u></a></span><br>"+"	   <span>Distance: "+A+" miles</span>"+"  </div>"+"    </td>"+"    <td style='vertical-align: top;'>"+"	<div class='rimg'>"+"  <img  src='"+j+"' height='65' width='85' border'0'/>"+"   </div>"+"    </td></tr>"+"    <tr><td colspan='2'>"+"   <div id='getDirectLink' style='display:block;'><a onclick='javascript:showDirection("+D+");'>Get Directions</a></div>"+"    </td></tr>"+" </table>"+"</div>"+"</div>";
var h=F;localDirectionAddress[D]=h;var Z='getDirectionForLocalEnterKey(event, "LOCAL-DIRECTIONFROM-SEARCH", '+D+");";var e='getDirectionForLocalEnterKey(event, "LOCAL-DIRECTIONTO-SEARCH", '+D+"); ";normalHTML[D]=d;getDirectionHTML="<div class='iw'>"+"<div class='basics'>"+"<div class='maxtitle title'>"+P+"</div>"+"<div class='closeIconPopup'><img src='images/close_btn.gif' height='15' width='15' border'0' onclick='javascript:closepop("+D+");' /></div>"+"<table>"+"  <tr>"+"    <td bgcolor='#FFFFFF' class='basicinfo'>"+"  <div class='addr'>"+"      <span>"+a[0]+", "+"</span><br>"+"      <span>"+a[1]+"</span>"+"      <span>"+G+", "+O+" </span>"+"      <span>"+R+"</span><br>"+"      <span>"+Q+"</span><br>"+"      <span><a target='_blank' href="+E+"><u>"+B+"</u></a></span><br>"+"	   <span>Distance: "+A+" miles</span>"+"  </div>"+"    </td>"+"    <td style='vertical-align: top;'>"+"	<div class='rimg'>"+"  <img  src='"+j+"' height='65' width='85' border'0'/>"+"   </div>"+"    </td></tr>"+"    <tr><td colspan='2'>"+"   <div id='getDirectLink' style='display:none;'>Get Directions</div>"+"   <div id='getDirectNormal' style='display:block;'><table><tr><td width='70'>Get Directions</td><td width='45'><span id='getToNormal' style='display:block;'>To here</span><span id='getToLink' style='display:none;'><a href='javascript: void(0);' onclick='showToDirection();'>To here</a></span></td><td width='65'><span id='getFromNormal' style='display:none;'>From here</span><span id='getFromLink' style='display:block;'><a href='javascript: void(0);' onclick='showFromDirection();'>From here</a></span></td></tr></table></div><div class='clearBoth'></div>"+"	<div id='directStart' class='getDirectFromText' style='display:block;'>Start Address.</div><div id='directEnd' class='getDirectFromText' style='display:none;'>End Address.</div><div class='clearBoth'></div>"+"   <div id='directTextToField' class='getDirectionTextBoxBar' style='display:block;'><table><tr><td width='135' style='padding-top:3px;'><input id='inputTextFromAddress' type='text' value='"+zipCodeVal+"' width='100' onKeyPress='"+Z+"'></td><td>"+"   <a href='javascript: void(0);'><img class='goButton' id='"+getDirectionAddress+"' src='images/go_local_popup_btn.gif' border='0' onclick='javascript:directionFrom("+D+");return false;'></a></td></tr></table></div><div id='directTextFromField' class='getDirectionTextBoxBar' style='display:none;'><table><tr><td width='135' style='padding-top:3px;'><input id='inputTextToAddress' type='text' value='"+zipCodeVal+"' width='100' onKeyPress='"+e+"'></td><td><a href='javascript: void(0);'><img class='goButton' id='"+getDirectionAddress+"' src='images/go_local_popup_btn.gif' onclick='javascript:directionTo("+D+");return false;' border='0'></a></td></tr></table></div>"+"    </td></tr>"+"    <tr><td bgcolor='#FFFFFF' height='15' colspan='2'>"+"		<span id='directBackBtn' style='display:block;'><a href='javascript:hideDirection("+D+");'>Back</a></span>"+"    </td>"+"  </tr>"+" </table>"+"</div>"+"</div>";
directionHTML[D]=getDirectionHTML;if(K){if(markers[D]!=null){markers[D].openInfoWindowHtml(d,{noCloseOnClick:"true",buttons:{close:{show:"0"}}});}}else{if(abortSearchRequest){removeMapMarkers(markers,map);markers=null;return ;}markersInfo[D]=d;var X=String.fromCharCode("A".charCodeAt(0)+(D-1));var g=new GLatLng(L,N);
markers[D]=createMarker(g,X,markersInfo[D],D);map.addOverlay(markers[D]);localSearchResultCounter++;var f=map.getPane(G_MAP_MARKER_PANE).childNodes;if(f){for(var b=0;b<f.length;b++){f[b].style.height="35px";f[b].style.width="21px";}}if(I){if(localSearchResultCounter==localSearchResultTotalCount){addPaginationLinksAjaxRequest(I);
}}}});});}function getSuggestionVal(B){var A;if(B||B[0]){if(B[0]){B=B[0];}if(B.attributes&&B.attributes.length>0){for(var C=0;C<B.attributes.length;C++){if(B.attributes[C]&&B.attributes[C].nodeName=="q"){A=B.attributes[C].nodeValue;}}}}return A;}function addPaginationLinksAjaxRequest(W){var P=W.getElementsByTagName("Local")[0];
var L=P.getElementsByTagName("Results")[0];var F=L.attributes.getNamedItem("start").value;var D=L.attributes.getNamedItem("end").value;var E=L.attributes.getNamedItem("estresults").value;var B=document.createElement("div");B.className="localSearchSortbyCountLink";var H=document.createElement("a");if(currentPage>1){H.href="javascript:previous()";
H.innerHTML="<span> Prev </span>";B.appendChild(H);}var S=parseInt((F/40))*4+1;var N;for(var Q=0;Q<4;Q++){N=S+Q;if((D-F)<9){E=D;var A=E%10;if(A>0){currentPage=((E-A)/10)+1;}else{currentPage=E/10;}}if((N*10)<E){if(currentPage==N){var J=document.createTextNode(" "+N+" ");B.appendChild(J);}else{H=document.createElement("a");
H.href="javascript:pageClick("+(N-1)*noOfItemsPerPage+","+N+")";H.innerHTML="<span>"+N+"</span>";H.style.marginRight="5px";H.style.marginLeft="5px";B.appendChild(H);}}else{var A=E%10;if(A>0){if(currentPage=N){if(E>10){var J=document.createTextNode(" "+N+" ");B.appendChild(J);}}else{H=document.createElement("a");
H.href="javascript:pageClick("+(N-1)*noOfItemsPerPage+","+N+")";H.innerHTML="<span>"+N+"</span>";H.style.marginRight="5px";H.style.marginLeft="5px";B.appendChild(H);}}break;}}if((D-F)==9){if((currentPage*noOfItemsPerPage)<E){H=document.createElement("a");H.href="javascript:next()";H.innerHTML="<span> Next </span>";
B.appendChild(H);}}var T=document.getElementById("SearchListId");T.innerHTML="";T.appendChild(B);var M=(currentPage-1)*noOfItemsPerPage+1;var R=(currentPage-1)*noOfItemsPerPage+noOfItemsPerPage;if(R>E){R=E;}if((D-F)<9){E=D;}var K=document.getElementById("pageTotalCount");if(K){var O="<b>"+F+" - "+D+" </b> of <b>"+(E)+'</b> results for <b>" '+query+'"</b>  near <b>" '+zipcodequery+'" </b>';
var G=O.length;var U=Math.ceil(G/60);var C=360;var I=18;if(U>1){C=360-(U)*I;I=I+(U-1)*I;}controlContainer.style.height=C+"px";document.getElementById("localSearchSortbyCountId").style.height=I+"px";K.innerHTML="<b>"+F+" - "+D+" </b> of <b>"+(E)+'</b> results for <b>" '+query+'"</b>  near <b>" '+zipcodequery+'" </b>';
K.style.display="block";}}function pageClick(B,A){localSearchResultCounter=0;localSearchResultTotalCount=0;removeMapMarkers(markers,map);document.getElementById("pageTotalCount").innerHTML="";document.getElementById("SearchListId").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="";
oldDivId=-1;currentPage=A;getLocalURLAjaxRequest(query,B,zipcodequery);}function next(){localSearchResultCounter=0;localSearchResultTotalCount=0;removeMapMarkers(markers,map);currentPage=currentPage+1;oldDivId=-1;document.getElementById("pageTotalCount").innerHTML="";document.getElementById("SearchListId").innerHTML="";
document.getElementById("searchResultsLocalSearch").innerHTML="";getLocalURLAjaxRequest(query,((currentPage-1)*noOfItemsPerPage),zipValue);}function previous(){localSearchResultCounter=0;localSearchResultTotalCount=0;oldDivId=-1;if(currentPage>=0){removeMapMarkers(markers,map);document.getElementById("pageTotalCount").innerHTML="";
document.getElementById("SearchListId").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="";currentPage=currentPage-1;if(currentPage<=0){currentPage=1;}getLocalURLAjaxRequest(query,((currentPage-1)*noOfItemsPerPage),zipValue);}}function formatSearchResultLocal(M,C,G,L,B,I,F,K,E,H,J,A,D){if(geocoder==null){geocoder=new GClientGeocoder();
}geocoder.getLocations(D,function(P){var N="";var O;if(P!=null&&P.Placemark!=null&&P.Placemark.length>0){O=P.Placemark[0];point=new GLatLng(O.Point.coordinates[1],O.Point.coordinates[0]);}try{if(O!=null&&O.AddressDetails!=null&&O.AddressDetails.Country!=null&&O.AddressDetails.Country.AdministrativeArea!=null){try{if(O.AddressDetails.Country.AdministrativeArea.Locality!=null&&O.AddressDetails.Country.AdministrativeArea.Locality.PostalCode!=null){N=O.AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber;
}}catch(Q){}if(N==""){try{if(O.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea!=null&&O.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality!=null&&O.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode!=null){N=O.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;
}}catch(S){}}}}catch(Q){}var R="<div class='localSearchResultOutlineDiv'><div class='ballonImgDiv'>";if(G){R+="<img src='"+G+"'/> </div>";}R+="    <div id='searchmouseOverId"+C+"' class='searchDataNormalDiv'>"+"      <h4><a href='javascript: void(0);' onclick='createNewPopup("+C+"); mouseOverTdColor("+C+")' onMouseOver='mouseOverSearchSelect("+C+");''> "+L+"</a></h4>"+"      "+I+", "+"      "+F+", "+K+" "+N+" "+"      "+E+"<br>"+"       Distance: "+A+" miles <br></div></div>";
M.innerHTML=R;});}function createNewPopup(A){var C=new Array();C=popupList[A].split("|");if(!(locationId==A)){var B="";var D=formatSearchResultLocalPopup(A,null,C[0],C[1],C[2],C[3],C[4],C[5],B,C[6],C[7],C[8],C[9],C[10],C[11],true,null);}}function closepop(A){locationId=-1;markers[A].closeInfoWindow();
}function updateMarker(A,B){GEvent.addListener(A,"click",function(){locationId=A.id;A.openInfoWindowHtml(B,{noCloseOnClick:"true",buttons:{close:{show:"0"}}});});GEvent.addListener(A,"infowindowclose",function(){locationId=-1;A.closeInfoWindow();});GEvent.addListener(A,"mouseover",function(){mouseOverSearchSelectOnMarker(A.id);
});}function mouseOverSearchSelectOnMarker(A){controlContainer.scrollTop=0;if(A>4){controlContainer.scrollTop+=(parseInt(A)*50);}mouseOverSearchSelect(A);}function mouseOverSearchSelect(A){var B=markerArr[parseInt(A)];mouseOverTdColor(A);markerArr[parseInt(A)]=B;if(oldMarkerId!=-1&&parseInt(A)!=oldMarkerId){markerArr[oldMarkerId]=B;
}oldMarkerId=parseInt(A);}function mouseOverTdColor(A){document.getElementById("searchmouseOverId"+A).className="searchDataDiv";if(oldDivId&&oldDivId!=-1&&oldDivId!=A){document.getElementById("searchmouseOverId"+oldDivId).className="searchDataNormalDiv";}oldDivId=A;}function showDirection(A){markers[A].openInfoWindowHtml(directionHTML[A],{noCloseOnClick:"true",buttons:{close:{show:"0"}}});
}function hideDirection(A){markers[A].openInfoWindowHtml(normalHTML[A],{noCloseOnClick:"true",buttons:{close:{show:"0"}}});}function directionFrom(B){getDirectionAddress=localDirectionAddress[B];var A=document.getElementById("inputTextFromAddress").value;directionTabRequestOnGetDirections(A,getDirectionAddress);
}function directionTo(B){getDirectionAddress=localDirectionAddress[B];var A=document.getElementById("inputTextToAddress").value;directionTabRequestOnGetDirections(getDirectionAddress,A);}function createMarker(B,F,E,D){if(baseIcon==null){baseIcon=new GIcon();baseIcon.shadow="../images/google/shadow50.png";
baseIcon.iconSize=new GSize(20,34);baseIcon.shadowSize=new GSize(37,34);baseIcon.iconAnchor=new GPoint(9,34);baseIcon.infoWindowAnchor=new GPoint(9,2);baseIcon.infoShadowAnchor=new GPoint(18,25);}var A=new GIcon(baseIcon);A.image="images/balloon_localSearch"+V+"_icon"+F+".png";markerOptions={icon:A};
var C=new GMarker(B,markerOptions);C.id=D;GEvent.addListener(C,"click",function(){C.openInfoWindowHtml(E,{noCloseOnClick:"true",buttons:{close:{show:"0"}}});});GEvent.addListener(C,"mouseover",function(){mouseOverSearchSelectOnMarker(C.id);});return C;}function searchKey(A){localSearchResultCounter=0;
localSearchResultTotalCount=0;oldDivId=-1;document.getElementById("pageTotalCount").innerHTML="";document.getElementById("SearchListId").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="";document.getElementById("searchInput").value=unescape(A);removeMapMarkers(markers,map);
query=unescape(A);currentPage=1;getLocalURLAjaxRequest((unescape(A)+","+zipcodequery),0,"");}function alternateSearch(B,A){localSearchResultCounter=0;localSearchResultTotalCount=0;oldDivId=-1;document.getElementById("pageTotalCount").innerHTML="";document.getElementById("SearchListId").innerHTML="";document.getElementById("searchResultsLocalSearch").innerHTML="";
removeMapMarkers(markers,map);query=unescape(B);zipcodequery=unescape(A);document.getElementById("searchZipInput").value=unescape(A);getLocalURLAjaxRequest(B,0,unescape(A));}function printNoDataResults(){var A=document.createElement("img");A.src="images/nodata_img.gif";controlContainer.appendChild(A);
document.getElementById("SearchListId").style.display="none";document.getElementById("pageTotalCount").style.display="none";}function findZipCodeForLocalSearch(B){if(!B||B.Status.code!=200){}else{var A;if(B.Placemark!=null&&B.Placemark.length>0){A=B.Placemark[0];point=new GLatLng(A.Point.coordinates[1],A.Point.coordinates[0]);
}try{if(A.AddressDetails.Country.AdministrativeArea!=null){stateString=A.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;try{cityString=A.AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber;}catch(C){}if(cityString==""){try{cityString=A.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;
}catch(D){}}}}catch(C){}}}