var a;if(!ndcw)var ndcw={};$(document).ready(function(){if(GBrowserIsCompatible()){tour=new ndcw.Tour($("#ndw_tour_map"),$("#side_bar"),$("#info_bar_tab"),$("#tip"));tour.loadData("get_data.php")}else alert("Sorry, your browser is not supported")});$(window).unload(GUnload);
ndcw.Tour=function(b,c,d,e){this.DEFAULT_ICON=new MIcon("images/marker.png",new GSize(20,34),{anchor:new GPoint(10,34)});this.LAST_ICON=new MIcon("images/swedish_flag.png",new GSize(32,36));this.mapJc=b;this.listJc=c;this.statusJc=d;this.tooltipJc=e;this.markers=[];this.center=new GLatLng(49.844182,-124.49295);this.map=new GMap2(b[0]);this.map.setCenter(this.center,4);this.map.enableContinuousZoom();this.map.setUIToDefault()};a=ndcw.Tour.prototype;
a.loadData=function(b){this.showStatus('<img src="images/ajax_loader_status.gif" />Loading markers...');var c=this;$.getJSON(b,{},function(d){c.drawOverlays(d)})};
a.drawOverlays=function(b){var c,d=[];this.listJc.append(document.createElement("ul"));var e=this;$.each(b,function(g,f){c=e.createMarker(f);e.map.addOverlay(c);d.push(c.latlng);e.createListItem(c)});c.setIcon(this.LAST_ICON);c.setZIndex(1E4);this.map.addOverlay(new GPolyline(d,"#0000ff",3));b=(new Querystring).get("id");b in this.markers?this.showInfoWindow(b):this.showInfoWindow(c.id);this.showStatus("Click marker or link to display information")};
a.createMarker=function(b){var c=new MarkerLight(new GLatLng(b[1],b[2]),b[3]==null?this.DEFAULT_ICON:new MIcon(b[3],new GSize(20,20)));c.id=b[0];c.title=b[4];var d=this;GEvent.addListener(c,"click",function(){d.markerOnClick(c)});GEvent.addListener(c,"mouseover",function(){d.markerOnMouseOver(c)});GEvent.addListener(c,"mouseout",function(){d.markerOnMouseOut(c)});return this.markers[c.id]=c};a.createListItem=function(b){$("#a"+b.id).click(function(c){GEvent.trigger(b,"click");c.preventDefault()})};
a.showInfoWindow=function(b){GEvent.trigger(this.markers[b],"click")};a.markerOnClick=function(b){if(b.content)this.openInfoWindow(b,b.content);else{this.openInfoWindow(b,'<div id="content_'+b.id+'"><img src="images/ajax_loader_content.gif" />Loading content...</div>');var c=this;$.getJSON("get_content.php?id="+b.id,function(d){c.markerOnContent(b,d)})}this.tooltipJc&&this.tooltipJc.hide()};
a.markerOnMouseOver=function(b){var c=this.map.fromLatLngToContainerPixel(b.latlng),d=this.mapJc.position();if(this.tooltipJc){this.tooltipJc.html(b.title);this.tooltipJc.css({left:d.left+c.x+b.icon.size.width+5+"px",top:d.top+c.y-b.icon.size.height+"px"});this.tooltipJc.show()}};a.markerOnMouseOut=function(){this.tooltipJc&&this.tooltipJc.hide()};a.openInfoWindow=function(b,c){var d={maxWidth:340,pixelOffset:new GSize(b.width/2,-b.height)};this.map.openInfoWindowHtml(b.latlng,c,d)};
a.markerOnContent=function(b,c){c="<p><strong>"+c.title+"</strong> "+c.date+"</p>"+c.description+'<p><a href="?p=tour/view&amp;id='+c.id+'" target="_blank">Read more...</a></p>';b.content=c;this.openInfoWindow(b,c)};a.showStatus=function(b){this.statusJc.html(b)};a.showMarker=function(b){GEvent.trigger(this.markers[b],"click")};function MIcon(b,c,d){this.src=b;this.size=c;if(d){this.anchor=d.anchor||new GPoint(0,c.height);this.imageOver=d.imageOver||null}else this.anchor=new GPoint(0,c.height)}function MarkerLight(b,c){this.latlng=b;this.icon=c;this.height=c.size.height;this.width=c.size.width;this.top=this.left=0;this.zIndex=GOverlay.getZIndex(this.latlng.lat())}MarkerLight.prototype=new GOverlay;a=MarkerLight.prototype;
a.initialize=function(b){var c=document.createElement("div");c.style.position="absolute";c.style.cursor="pointer";c.style.zIndex=this.zIndex;var d=document.createElement("img");d.src=this.icon.src;d.width=this.icon.size.width;d.height=this.icon.size.height;c.appendChild(d);var e=this;GEvent.addDomListener(c,"click",function(){GEvent.trigger(e,"click")});GEvent.addDomListener(c,"mouseover",function(){c.style.zIndex=1E9;if(e.icon.imageOver)d.src=e.icon.imageOver;GEvent.trigger(e,"mouseover")});GEvent.addDomListener(c,
"mouseout",function(){c.style.zIndex=e.zIndex;d.src=e.icon.src;GEvent.trigger(e,"mouseout")});b.getPane(G_MAP_MARKER_PANE).appendChild(c);this.img_=d;this.map_=b;this.div_=c};a.remove=function(){this.div_.parentNode.removeChild(this.div_)};a.copy=function(){var b={};b.height=this.height;b.width=this.width;return new MarkerLight(this.latlng,new MIcon(this.icon.src,this.icon.size),b)};
a.redraw=function(b){if(b){b=this.map_.fromLatLngToDivPixel(this.latlng);this.left=b.x-this.icon.anchor.x;this.top=b.y-this.icon.anchor.y;this.div_.style.top=this.top+"px";this.div_.style.left=this.left+"px"}};a.setZIndex=function(b){this.zIndex=b;this.div_.style.zIndex=b};a.getPoint=function(){return this.latlng};a.setStyle=function(b){for(s in b)this.div_.style[s]=b[s]};
a.setIcon=function(b){this.div_.style.left=this.left-b.anchor.x+this.icon.anchor.x+"px";this.div_.style.top=this.top-b.anchor.y+this.icon.anchor.y+"px";this.icon=b;this.img_.src=b.src;this.setWidth(b.size.width);this.setHeight(b.size.height)};a.setWidth=function(b){this.width=b;if(this.div_)this.div_.style.width=this.width+"px";if(this.img_)this.img_.width=this.width};a.setHeight=function(b){this.height=b;if(this.div_)this.div_.style.height=b+"px";if(this.img_)this.img_.height=b};function Querystring(b){this.params={};if(b==null)b=location.search.substring(1,location.search.length);if(b.length!=0){b=b.replace(/\+/g," ");b=b.split("&");for(var c=0;c<b.length;c++){var d=b[c].split("="),e=decodeURIComponent(d[0]);d=d.length==2?decodeURIComponent(d[1]):e;this.params[e]=d}}}Querystring.prototype.get=function(b,c){b=this.params[b];return b!=null?b:c};Querystring.prototype.contains=function(b){return this.params[b]!=null};
