var loc_latitude=js_var.loc_latitude;var loc_longitude=js_var.loc_longitude;var loc_zoomlevel=js_var.loc_zoomlevel;var loc_title=js_var.loc_title;var loc_loctype_title=js_var.loc_loctype_title;var loc_address=js_var.loc_address;var loc_phone=js_var.loc_phone;var loc_url=js_var.loc_url;var loc_urlname=js_var.loc_urlname;var loc_href=js_var.loc_href;var loc_reviews=js_var.loc_reviews;var loc_features=js_var.loc_features;var features_dict=js_var.features_dict;var map;var bounds;var checked_related_types;var showlocationlist=[];var eventlist=[];var limit=5;var offset=0;var current_page=1;var paginator;var current_eventpage=1;var eventpaginator;var lettered_points_list=[];var lettered_event_points_list=[];var date_string="";var loadingBar;var AjaxObject;var resultstringarray;var callback;var eventcallback;var marker_list=[];var lcObj;var ecObj;var overlay;function clearMarkers(){var a;for(a=0;a<marker_list.length;a+=1){marker_list[a].setMap(null)}marker_list=[]}function zindex_top(){return 20}function zindex(){return 10}function zfill(a,b){var c=a+"";while(c.length<b){c="0"+c}return c}function VanNearbyControl(){var a,c,b;a=document.getElementById("googlemap");b=document.createElement("div");c=document.getElementById("nearbyForm");b.appendChild(c);google.maps.event.addDomListener(c,"click",function(){});a.appendChild(b);return b}function VanCalendarControl(){var b,a,c;b=document.getElementById("googlemap");c=document.createElement("div");a=document.getElementById("mapCalPopup");c.appendChild(a);google.maps.event.addDomListener(a,"click",function(){});b.appendChild(c);return c}function Overlay(a){this.setMap(a)}Overlay.prototype=new google.maps.OverlayView();Overlay.prototype.draw=function(){if(!this.ready){this.ready=true;google.maps.event.trigger(this,"ready")}};function initialize(){var g,i,c,a,d,f,h;f={zoom:loc_zoomlevel,center:new google.maps.LatLng(loc_latitude,loc_longitude)};f.mapTypeId=google.maps.MapTypeId.ROADMAP;map=new google.maps.Map(document.getElementById("googlemap"),f);overlay=new Overlay(map);google.maps.event.addListener(map,"center_changed",function(){if(loadingBar!==undefined){loadingBar.start()}get_related_locations();get_related_events();if(typeof(loadingBar)!==undefined){loadingBar.remove()}});google.maps.event.addListener(map,"tilesloaded",function(){if(loadingBar===undefined){loadingBar=new LoadingControl(map);loadingBar.start()}if(typeof(loadingBar)!==undefined){loadingBar.start()}get_related_locations();get_related_events();if(typeof(loadingBar)!==undefined){loadingBar.remove()}});map.controls[google.maps.ControlPosition.RIGHT].push(new VanNearbyControl());map.controls[google.maps.ControlPosition.RIGHT].push(new VanCalendarControl());h=new google.maps.LatLng(loc_latitude,loc_longitude);g=map_util.get_marker_image(js_var.loc_tags,"lg","TARGET");i=map_util.get_marker_special("shadow");a=["<b>",loc_title,"<","/b> (",loc_loctype_title,")<br />",loc_address,"<br />",loc_phone,"<br />",loc_url].join("");d=createMarker(h,g,i,a,loc_reviews,loc_href,loc_title);paginator=new YAHOO.widget.Paginator({rowsPerPage:limit,totalRecords:showlocationlist.length,containers:["pag1","pag2"],template:"{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink}",pageReportTemplate:"Showing {startRecord} to {endRecord} of {totalRecords}"});function e(j){if(current_page!==j.page){current_page=j.page;paginator.setState(j);if(typeof(loadingBar)!=="undefined"){loadingBar.start("update")}showLocations();if(typeof(loadingBar)!=="undefined"){loadingBar.remove()}}else{current_page=j.page;paginator.setState(j)}}paginator.subscribe("changeRequest",e);eventpaginator=new YAHOO.widget.Paginator({rowsPerPage:limit,totalRecords:eventlist.length,containers:["eventpag1","eventpag2"],template:"{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink}",pageReportTemplate:"Showing {startRecord} to {endRecord} of {totalRecords}"});function b(j){if(current_eventpage!==j.page){current_eventpage=j.page;eventpaginator.setState(j);if(typeof(loadingBar)!=="undefined"){loadingBar.start("update")}showLocations();if(typeof(loadingBar)!=="undefined"){loadingBar.remove()}}else{current_page=j.page;eventpaginator.setState(j)}}eventpaginator.subscribe("changeRequest",b)}createMarker=function(g,d,h,i,c,f,b,e){var a;a=new google.maps.Marker({title:b,position:g,map:map,icon:d,shadow:h});google.maps.event.addListener(a,"click",function(){curMarkerType=e;curMarkerURL=f;showClickInfo(this,extInfoDiv)});google.maps.event.addListener(a,"infowindowclose",function(){get_related_locations();get_related_events()});return a};function get_related_locations(a){if(typeof(loadingBar)!=="undefined"){loadingBar.start("update")}checked_related_types=[];if(document.locForm.related_location_types!==undefined){if(document.locForm.related_location_types.length===undefined){if(document.locForm.related_location_types.checked===true){checked_related_types.push(document.locForm.related_location_types.value)}}else{for(var b=0;b<document.locForm.related_location_types.length;b+=1){if(document.locForm.related_location_types[b].checked===true){checked_related_types.push(document.locForm.related_location_types[b].value)}}}}if(typeof(loadingBar)!=="undefined"){loadingBar.start()}bounds=map.getBounds();AjaxObject.startRequest()}function openMarkerWindow(a){location.hash="map";google.maps.event.trigger(lettered_points_list[a],"click");return false}function openEventMarkerWindow(a){location.hash="map";google.maps.event.trigger(lettered_event_points_list[a],"click");return false}function showUnletteredLocation(b,c){var e,g,d,a,f;e=map_util.get_marker_image(showlocationlist[c].tags,"sm");g=map_util.get_marker_special("shadow","sm");d=['<a href="',showlocationlist[c].href,'">',showlocationlist[c].title,"</a>"].join("");a=[d," (",showlocationlist[c].location_type_title,")<br />",showlocationlist[c].address].join("");f=createMarker(showlocationlist[c].point,e,g,a,showlocationlist[c].reviews,showlocationlist[c].href,showlocationlist[c].title);marker_list.push(f)}function showLetteredEvent(k,f){var c=String.fromCharCode("A".charCodeAt(0)+(f-offset)),j,m,i,h,a,b,d,g,e;j=map_util.get_marker_special("event","lg",c);m=map_util.get_marker_special("shadow");if(eventlist[f].startdate!==eventlist[f].enddate){resultstringarray.push('<div class="location_result"><div class="img">','<img src="',j,'" onclick="javascript: openEventMarkerWindow(',f,')"></div><div class="address"><h4><a href="',eventlist[f].url,'">',eventlist[f].title,"</a></h4>",eventlist[f].address,'<span class="startdate">',eventlist[f].startdate,"</span>",' - <span class="enddate">',eventlist[f].enddate,"</span>",'</div><div class="details">')}else{resultstringarray.push('<div class="location_result"><div class="img">','<img src="',j,'" onclick="javascript: openEventMarkerWindow(',f,')"></div><div class="address"><h4><a href="',eventlist[f].url,'">',eventlist[f].title,"</a></h4>",eventlist[f].address,'<span class="startdate">',eventlist[f].startdate,"</span>",'</div><div class="details">')}resultstringarray.push('<p class="description">',eventlist[f].description,"</p>");if(eventlist[f].categories.length>0){for(h=0;h<eventlist[f].categories.length;h+=1){resultstringarray.push('<span class="feats">',features_dict[eventlist[f].categories[h]],"</span>")}}if(eventlist[f].reviews.length>0){resultstringarray.push("<h5>Review(s):</h5>");resultstringarray.push('<ul class="reviewlist">');for(a=0;a<eventlist[f].reviews.length;a+=1){resultstringarray.push('<li class="reviewlistitem"><a href="',eventlist[f].reviews[a].url,'">',eventlist[f].reviews[a].title,"</a></li>")}resultstringarray.push("</ul>")}resultstringarray.push("</div></div>");b=['<b><a href="',eventlist[f].location_href,'">',eventlist[f].location_title,"</a></b>"].join("");d=[b," (",eventlist[f].location_type_title,")<br />",eventlist[f].address,"<br />"];if(eventlist[f].categories.length>0){for(h=0;h<eventlist[f].categories.length;h+=1){d.push(features_dict[eventlist[f].categories[h]]);if(h<eventlist[f].categories.length-1){d.push(", ")}}}g=d.join("");e=createMarker(eventlist[f].point,j,m,g,eventlist[f].reviews,eventlist[f].url,eventlist[f].title,"events");lettered_event_points_list[f]=e;marker_list.push(e)}function showUnletteredEvent(b,c){var e,g,d,a,f;d=['<a href="',eventlist[c].url,'">',eventlist[c].title,"</a>"].join("");a=[d," (",eventlist[c].location_type_title,")<br />",eventlist[c].address].join("");e=map_util.get_marker_special("event","sm");g=map_util.get_marker_special("shadow","sm");f=createMarker(eventlist[c].point,e,g,a,eventlist[c].reviews,eventlist[c].url,eventlist[c].title,"events");marker_list.push(f)}function showLocations(){var d,b,a,i,h,f,c,o,e,k,n,g,m,j;if(typeof(loadingBar)!==undefined){loadingBar.start("update")}clearMarkers();d=new google.maps.LatLng(loc_latitude,loc_longitude);b=['<a href="',loc_href,'">',loc_title,"</a>"].join("");a=["<b>",b,"<","/b> (",loc_loctype_title,")<br />",loc_address,"<br />",loc_phone,"<br />",loc_url,"<br />"];if(js_var.loc_features.length>0){for(i=0;i<js_var.loc_features.length;i+=1){a.push(features_dict[js_var.loc_features[i]]);if(i<js_var.loc_features.length-1){a.push(", ")}}}h=a.join("");k=map_util.get_marker_image(js_var.loc_tags,"lg","TARGET");n=map_util.get_marker_special("shadow");f=createMarker(d,k,n,h,loc_reviews,loc_href,loc_title);marker_list.push(f);c=document.getElementById("nearby_locations_box");c.style.display="none";o=document.getElementById("location_list_right_div");o.innerHTML="";resultstringarray=[];offset=(current_page-1)*limit;if(showlocationlist.length>0){c.style.display="block"}for(e=0;e<showlocationlist.length;e+=1){if(offset<=e&&e<offset+limit){showLetteredLocation(o,e)}else{showUnletteredLocation(o,e)}}o.innerHTML=resultstringarray.join("");if(showlocationlist.length>0){document.getElementById("pag1").style.display="block";document.getElementById("pag2").style.display="block";paginator.setTotalRecords(showlocationlist.length);paginator.render()}else{document.getElementById("pag1").style.display="none";document.getElementById("pag2").style.display="none"}j=document.getElementById("nearby_events_box");j.style.display="none";o=document.getElementById("event_list_right_div");o.innerHTML="";resultstringarray=[];offset=(current_eventpage-1)*limit;if(eventlist.length>0){j.style.display="block";g=document.getElementById("date1");m=document.getElementById("nearby_events_date");m.innerHTML=g.innerHTML}for(e=0;e<eventlist.length;e+=1){if(offset<=e&&e<offset+limit){showLetteredEvent(o,e)}else{showUnletteredEvent(o,e)}}o.innerHTML=resultstringarray.join("");if(eventlist.length>0){document.getElementById("eventpag1").style.display="block";document.getElementById("eventpag2").style.display="block";eventpaginator.setTotalRecords(eventlist.length);eventpaginator.render()}else{document.getElementById("eventpag1").style.display="none";document.getElementById("eventpag2").style.display="none"}if(typeof(loadingBar)!=="undefined"){loadingBar.remove()}}AjaxObject={handleSuccess:function(a){this.processResult(a)},handleFailure:function(a){},processResult:function(r){var p,e=YAHOO.lang.JSON.parse(r.responseText),s=e.Results,c,t,g,d,w,y,z,x,v,A,m,f,h,k,C,n,l,q,D,B,u,b,a;showlocationlist=[];for(x=0;x<s.length;x+=1){c=[];t=[];g=[];d=s[x].features;for(w=0;w<d.length;w+=1){y=d[w];c.push(d[w])}z=s[x].reviews;for(w=0;w<z.length;w+=1){v={};v.title=z[w].title;v.url=z[w].url;t.push(v)}A=s[x].title;m=s[x].urlname;f=s[x].href;h=s[x].description;k=s[x].address;C=s[x].latitude;n=s[x].longitude;l=s[x].has_listing;q=s[x].listing_url;D=s[x].listing_title;B=s[x].listing_description;u=new google.maps.LatLng(C,n);b={};b.title=A;b.description=h;b.address=k;b.latitude=C;b.longitude=n;b.point=u;b.tags=s[x].tags;b.location_type_title=s[x].location_type_title;b.features=c;b.reviews=t;b.events=g;b.urlname=m;b.href=f;b.has_listing=l;b.listing_url=q;b.listing_title=D;b.listing_description=B;showlocationlist.push(b)}showLocations();a=false},startRequest:function(){YAHOO.util.Connect.abort(lcObj);YAHOO.util.Connect.setDefaultXhrHeader(false);lcObj=YAHOO.util.Connect.asyncRequest("POST","location-json/bounds+"+bounds.getSouthWest().lat()+"+"+bounds.getSouthWest().lng()+"+"+bounds.getNorthEast().lat()+"+"+bounds.getNorthEast().lng()+"/related_types+"+checked_related_types.join("+")+"/page_size+5000",callback,"")}};callback={success:AjaxObject.handleSuccess,failure:AjaxObject.handleFailure,scope:AjaxObject};var EventAjaxObject={handleSuccess:function(a){this.processResult(a)},handleFailure:function(a){},processResult:function(s){var d=YAHOO.lang.JSON.parse(s.responseText),t=d.Results,B,f,u,e,C,y,D,m,A,g,h,F,n,a,x,w,c,l,r,H,z,q,k,p,G,E,v,b;eventlist=[];for(B=0;B<t.length;B+=1){f=[];u=[];e=[];C=t[B].categories;for(y=0;y<C.length;y+=1){f.push(C[y])}D=t[B].title;m=t[B].urlname;A=t[B].url;g=t[B].description;h=t[B].address;F=t[B].latitude;n=t[B].longitude;a=t[B].location_title;x=t[B].location_type_title;w=t[B].location_urlname;c=t[B].location_href;l=t[B].event_image;r=t[B].startdate;H=t[B].enddate;z=t[B].startdate_filter;q=t[B].enddate_filter;k=t[B].has_listing;p=t[B].listing_url;G=t[B].listing_title;E=t[B].listing_description;v=new google.maps.LatLng(F,n);b={};b.title=D;b.description=g;b.address=h;b.latitude=F;b.longitude=n;b.point=v;b.location_title=a;b.location_urlname=w;b.location_href=c;b.location_type_title=x;b.event_image=l;b.startdate=r;b.enddate=H;b.startdate_filter=z;b.enddate_filter=q;b.categories=f;b.reviews=u;b.events=e;b.urlname=m;b.url=A;b.has_listing=k;b.listing_url=p;b.listing_title=G;b.listing_description=E;eventlist.push(b)}showLocations()},startRequest:function(){if(date_string===""){YAHOO.util.Connect.abort(ecObj);YAHOO.util.Connect.setDefaultXhrHeader(false);ecObj=YAHOO.util.Connect.asyncRequest("POST","event-json/bounds+"+bounds.getSouthWest().lat()+"+"+bounds.getSouthWest().lng()+"+"+bounds.getNorthEast().lat()+"+"+bounds.getNorthEast().lng()+"/page_size+5000",eventcallback,"")}else{YAHOO.util.Connect.abort(ecObj);YAHOO.util.Connect.setDefaultXhrHeader(false);ecObj=YAHOO.util.Connect.asyncRequest("POST","event-json/bounds+"+bounds.getSouthWest().lat()+"+"+bounds.getSouthWest().lng()+"+"+bounds.getNorthEast().lat()+"+"+bounds.getNorthEast().lng()+"/search_date+"+date_string+"/page_size+5000",eventcallback,"")}}};eventcallback={success:EventAjaxObject.handleSuccess,failure:EventAjaxObject.handleFailure,scope:EventAjaxObject};function get_related_events(a){var b=document.getElementById("show_events").checked;if(typeof(loadingBar)!=="undefined"){loadingBar.start("update")}if(typeof(loadingBar)!=="undefined"){loadingBar.start()}if(b===true){bounds=map.getBounds();EventAjaxObject.startRequest()}else{eventlist=[];showLocations()}};
