if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};
Silverlight.isInstalled=function(version){var isVersionSupported=false;Silverlight.available=false;var container=null;try{var control=null;try{control=new ActiveXObject("AgControl.AgControl");if(version==null){isVersionSupported=true;Silverlight.available=true}else if(control.IsVersionSupported(version)){isVersionSupported=true;Silverlight.available=true}control=null}catch(e){var plugin=navigator.plugins["Silverlight Plug-In"];if(plugin)if(version===null){isVersionSupported=true;Silverlight.available=
true}else{var actualVer=plugin.description;if(actualVer==="1.0.30226.2")actualVer="2.0.30226.2";var actualVerArray=actualVer.split(".");while(actualVerArray.length>3)actualVerArray.pop();while(actualVerArray.length<4)actualVerArray.push(0);var reqVerArray=version.split(".");while(reqVerArray.length>4)reqVerArray.pop();var requiredVersionPart;var actualVersionPart;var index=0;do{requiredVersionPart=parseInt(reqVerArray[index]);actualVersionPart=parseInt(actualVerArray[index]);index++}while(index<reqVerArray.length&&
requiredVersionPart===actualVersionPart);if(requiredVersionPart<=actualVersionPart&&!isNaN(requiredVersionPart)){isVersionSupported=true;Silverlight.available=true}}}}catch(e){isVersionSupported=false;Silverlight.available=false}if(container)document.body.removeChild(container);return isVersionSupported};
Silverlight.WaitForInstallCompletion=function(){if(!Silverlight.isBrowserRestartRequired&&Silverlight.onSilverlightInstalled){try{navigator.plugins.refresh()}catch(e){}if(Silverlight.isInstalled(null))Silverlight.onSilverlightInstalled();else setTimeout(Silverlight.WaitForInstallCompletion,3E3)}};
Silverlight.__startup=function(){Silverlight.isBrowserRestartRequired=Silverlight.isInstalled(null);if(!Silverlight.isBrowserRestartRequired)Silverlight.WaitForInstallCompletion();if(window.removeEventListener)window.removeEventListener("load",Silverlight.__startup,false);else window.detachEvent("onload",Silverlight.__startup)};if(window.addEventListener)window.addEventListener("load",Silverlight.__startup,false);else window.attachEvent("onload",Silverlight.__startup);
Silverlight.createObject=function(source,parentElement,id,properties,events,initParams,userContext){var slPluginHelper=new Object;var slProperties=properties;var slEvents=events;slPluginHelper.version=slProperties.version;slProperties.source=source;slPluginHelper.alt=slProperties.alt;if(initParams)slProperties.initParams=initParams;if(slProperties.isWindowless&&!slProperties.windowless)slProperties.windowless=slProperties.isWindowless;if(slProperties.framerate&&!slProperties.maxFramerate)slProperties.maxFramerate=
slProperties.framerate;if(id&&!slProperties.id)slProperties.id=id;delete slProperties.ignoreBrowserVer;delete slProperties.inplaceInstallPrompt;delete slProperties.version;delete slProperties.isWindowless;delete slProperties.framerate;delete slProperties.data;delete slProperties.src;delete slProperties.alt;if(Silverlight.isInstalled(slPluginHelper.version)){for(var name in slEvents)if(slEvents[name]){if(name=="onLoad"&&typeof slEvents[name]=="function"&&slEvents[name].length!=1){var onLoadHandler=
slEvents[name];slEvents[name]=function(sender){return onLoadHandler(document.getElementById(id),userContext,sender)}}var handlerName=Silverlight.__getHandlerName(slEvents[name]);if(handlerName!=null){slProperties[name]=handlerName;slEvents[name]=null}else throw"typeof events."+name+" must be 'function' or 'string'";}slPluginHTML=Silverlight.buildHTML(slProperties)}else slPluginHTML=Silverlight.buildPromptHTML(slPluginHelper);if(parentElement)parentElement.innerHTML=slPluginHTML;else return slPluginHTML};
Silverlight.buildHTML=function(slProperties){var htmlBuilder=[];htmlBuilder.push('<object type="application/x-silverlight" data="data:application/x-silverlight,"');if(slProperties.id!=null)htmlBuilder.push(' id="'+slProperties.id+'"');if(slProperties.width!=null)htmlBuilder.push(' width="'+slProperties.width+'"');if(slProperties.height!=null)htmlBuilder.push(' height="'+slProperties.height+'"');htmlBuilder.push(" >");delete slProperties.id;delete slProperties.width;delete slProperties.height;for(var name in slProperties)if(slProperties[name])htmlBuilder.push('<param name="'+
Silverlight.HtmlAttributeEncode(name)+'" value="'+Silverlight.HtmlAttributeEncode(slProperties[name])+'" />');htmlBuilder.push("</object>");return htmlBuilder.join("")};Silverlight.createObjectEx=function(params){var parameters=params;var html=Silverlight.createObject(parameters.source,parameters.parentElement,parameters.id,parameters.properties,parameters.events,parameters.initParams,parameters.context);if(parameters.parentElement==null)return html};
Silverlight.buildPromptHTML=function(slPluginHelper){var slPluginHTML="";var urlRoot=Silverlight.fwlinkRoot;var shortVer=slPluginHelper.version;if(slPluginHelper.alt)slPluginHTML=slPluginHelper.alt;else{if(!shortVer)shortVer="";slPluginHTML="<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>";slPluginHTML=slPluginHTML.replace("{1}",shortVer);slPluginHTML=slPluginHTML.replace("{2}",
urlRoot+"108181")}return slPluginHTML};Silverlight.getSilverlight=function(version){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var shortVer="";var reqVerArray=String(version).split(".");if(reqVerArray.length>1){var majorNum=parseInt(reqVerArray[0]);if(isNaN(majorNum)||majorNum<2)shortVer="1.0";else shortVer=reqVerArray[0]+"."+reqVerArray[1]}var verArg="";if(shortVer.match(/^\d+\056\d+$/))verArg="&v="+shortVer;Silverlight.followFWLink("114576"+verArg)};
Silverlight.followFWLink=function(linkid){top.location=Silverlight.fwlinkRoot+String(linkid)};Silverlight.HtmlAttributeEncode=function(strInput){var c;var retVal="";if(strInput==null)return null;for(var cnt=0;cnt<strInput.length;cnt++){c=strInput.charCodeAt(cnt);if(c>96&&c<123||c>64&&c<91||c>43&&c<58&&c!=47||c==95)retVal=retVal+String.fromCharCode(c);else retVal=retVal+"&#"+c+";"}return retVal};
Silverlight.default_error_handler=function(sender,args){var iErrorCode;var errorType=args.ErrorType;iErrorCode=args.ErrorCode;var errMsg="\nSilverlight error message     \n";errMsg+="ErrorCode: "+iErrorCode+"\n";errMsg+="ErrorType: "+errorType+"       \n";errMsg+="Message: "+args.ErrorMessage+"     \n";if(errorType=="ParserError"){errMsg+="XamlFile: "+args.xamlFile+"     \n";errMsg+="Line: "+args.lineNumber+"     \n";errMsg+="Position: "+args.charPosition+"     \n"}else if(errorType=="RuntimeError"){if(args.lineNumber!=
0){errMsg+="Line: "+args.lineNumber+"     \n";errMsg+="Position: "+args.charPosition+"     \n"}errMsg+="MethodName: "+args.methodName+"     \n"}alert(errMsg)};Silverlight.__cleanup=function(){for(var i=Silverlight._silverlightCount-1;i>=0;i--)window["__slEvent"+i]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};
Silverlight.__getHandlerName=function(handler){var handlerName="";if(typeof handler=="string")handlerName=handler;else if(typeof handler=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var count=Silverlight._silverlightCount++;handlerName="__slEvent"+count;window[handlerName]=handler}else handlerName=null;return handlerName};function createCampgroundMapPlugin(){Silverlight.createObject(mapSource,parentPluginElement,"slViewmapPlugin",{width:"464",height:"464",inplaceInstallPrompt:true,background:"#D6D6D6",isWindowless:"false",framerate:"24",version:"1.0"},{onError:errorHandler,onLoad:null},null)}
function createSmallMapPlugin(){if(Silverlight.isInstalled("1.0"))Silverlight.createObject(mapSource,parentPluginElement,"slViewmapPlugin",{width:"180",height:"180",inplaceInstallPrompt:true,background:"#D6D6D6",isWindowless:"false",framerate:"24",version:"1.0"},{onError:errorHandler,onLoad:null},null);else{pageTracker._trackPageview("/thumbnail/silverlight/notinstalled");if(document.getElementById("basicMapUrl")){var imgSrc=document.getElementById("basicMapUrl").value;var innerHTML='<a href="'+urlToCgMap+
'" title="Campsite Map">';innerHTML+='<img src="'+imgSrc+'" id="mapSample" width="180.0" height="180.0" class="sidemap"/></a>';parentPluginElement.innerHTML=innerHTML}}}if(!window.Silverlight)window.Silverlight={};
Silverlight.InstallAndCreateSilverlight=function(version,SilverlightDiv,installExperienceHTML,installPromptDivID,createSilverlightDelegate){var RetryTimeout=3E3;if(Silverlight.isInstalled(version)){pageTracker._trackPageview("/campsitemap/silverlight/installed");createSilverlightDelegate()}else{if(installExperienceHTML&&SilverlightDiv){pageTracker._trackPageview("/campsitemap/silverlight/notinstalled");SilverlightDiv.innerHTML=installExperienceHTML;document.body.innerHTML}if(installPromptDivID){var installPromptDiv=
document.getElementById(installPromptDivID);if(installPromptDiv)installPromptDiv.innerHTML=Silverlight.createObject(null,null,null,{version:version,inplaceInstallPrompt:true},{},null)}TimeoutDelegate=function(){Silverlight.InstallAndCreateSilverlight(version,null,null,null,createSilverlightDelegate)};setTimeout(TimeoutDelegate,RetryTimeout)}};
Silverlight.InstallAndCreateSilverlight_new=function(version,SilverlightDiv,installExperienceHTML,installPromptDivID,createSilverlightDelegate){var RetryTimeout=3E3;var installed=false;try{try{slControl=new ActiveXObject("AgControl.AgControl");installed=true}catch(e){if(navigator.plugins["Silverlight Plug-In"])installed=true}}catch(e){}if(installed){pageTracker._trackPageview("/campsitemap/silverlight/installed");createSilverlightDelegate()}else{if(installExperienceHTML&&SilverlightDiv){pageTracker._trackPageview("/campsitemap/silverlight/notinstalled");
SilverlightDiv.innerHTML=installExperienceHTML;document.body.innerHTML}if(installPromptDivID){var installPromptDiv=document.getElementById(installPromptDivID);if(installPromptDiv)installPromptDiv.innerHTML=Silverlight.createObject(null,null,null,{version:version,inplaceInstallPrompt:true},{},null)}TimeoutDelegate=function(){Silverlight.InstallAndCreateSilverlight(version,null,null,null,createSilverlightDelegate)};setTimeout(TimeoutDelegate,RetryTimeout)}};var loadTime=60*1E3;var timedOut=true;var bgMapUrl;var mouseDownX=-1;var mouseDownY=-1;var inView=false;var plugin;var pluginHeight=464;var pluginWidth=464;var deltaPan=0.25;var deltaPanX=pluginWidth*deltaPan;var deltaPanY=pluginHeight*deltaPan;var grey=0.2;var greyX=pluginWidth/2;var greyY=pluginHeight/2;var scaleHeight;var scaleWidth;var previousSelectedSiteIcon=new Array;var currentSelectedRB;var bubble=null;var mouseDownPosition=0;var mouseDownValue=-1;var eventsForWheel=null;var zoomOutSliderLimit;
var zoomInSliderLimit;var zoomSliderPosition;var zoomSliderGranularity=30;var zoomSliderStep;var zoomToSiteFactor=5/6;var maxScaleFactor;var showBubble=false;var sitesAvail=new Array;var availStatus=new Array;availStatus[0]="";availStatus[1]="Available";availStatus[2]="By Phone Only";availStatus[3]="Walkup Only";availStatus[4]="Not Available";availStatus[5]="In Lottery";var bgFillAv;var bgFillAvNoMatch;var bgFillUnav;var bgFillUnavNoMatch;var availInfoReady=false;var keySiteAttrsXML=null;
var maxKeySiteAttrs=6;function rootLoaded(sender,eventArgs){new mapScene(sender)}
function mapScene(sender){plugin=sender.getHost();pluginParent=plugin.parentNode;if(!document.getElementById("viewmap")){pluginHeight=180;pluginWidth=180}if(pluginParent.clientHeight>0){pluginHeight=pluginParent.clientHeight;deltaPanY=pluginHeight*deltaPan;greyY=pluginHeight*grey}if(pluginParent.clientHeight>0){pluginWidth=pluginParent.clientWidth;deltaPanX=pluginWidth*deltaPan;greyX=pluginWidth*grey}scaleHeight=pluginHeight/1E3;scaleWidth=pluginWidth/1E3;var progressCanvas=sender.findName("Layer_1");
progressCanvas.setValue("Canvas.Left",pluginWidth-progressCanvas.getValue("Width"));if(document.getElementById("viewmap")){maxScaleFactor=1.8/mapIconScale;var zoomOutButton=sender.findName("zoomOutButton");var zoomOutButtonRect=sender.findName("zoomOutButtonRect");new button(zoomOutButton,zoomOutButtonRect,"#FFF8F8F8","#FFF0F0F0",onZoomOutClicked);var zoomInButton=sender.findName("zoomInButton");var zoomInButtonRect=sender.findName("zoomInButtonRect");new button(zoomInButton,zoomInButtonRect,"#FFF8F8F8",
"#FFF0F0F0",onZoomInClicked);var panLeftButton=sender.findName("panLeftButton");var panLeftButtonRect=sender.findName("panLeftButtonRect");new button(panLeftButton,panLeftButtonRect,"#FFF8F8F8","#FFF0F0F0",onPanLeftClicked);var panRightButton=sender.findName("panRightButton");var panRightButtonRect=sender.findName("panRightButtonRect");new button(panRightButton,panRightButtonRect,"#FFF8F8F8","#FFF0F0F0",onPanRightClicked);var panUpButton=sender.findName("panUpButton");var panUpButtonRect=sender.findName("panUpButtonRect");
new button(panUpButton,panUpButtonRect,"#FFF8F8F8","#FFF0F0F0",onPanUpClicked);var panDownButton=sender.findName("panDownButton");var panDownButtonRect=sender.findName("panDownButtonRect");new button(panDownButton,panDownButtonRect,"#FFF8F8F8","#FFF0F0F0",onPanDownClicked);var resetButton=sender.findName("resetButton");var resetButtonRect=sender.findName("resetButtonRect");new button(resetButton,resetButtonRect,"#FFF8F8F8","#FFF0F0F0",onResetClicked);var sceneClipCanvas=sender.findName("sceneHostCanvas");
sceneClipCanvas.addEventListener("mouseLeftButtonUp",sceneMouseUp);sceneClipCanvas.addEventListener("mouseLeftButtonDown",sceneMouseDown);sceneClipCanvas.addEventListener("mouseEnter",sceneMouseEnter);sceneClipCanvas.addEventListener("mouseLeave",sceneMouseLeave);sceneClipCanvas.addEventListener("mouseMove",sceneMouseMove);var bubbleCanvas=plugin.content.findName("MapBubble");bubbleCanvas.setValue("Canvas.Left",pluginWidth/2-128);bubbleCanvas.setValue("Canvas.Top",pluginHeight/2-(keySiteAttrs?216:
190));zoomOutSliderLimit=sender.findName("rail")["Canvas.Top"]+sender.findName("rail").height-sender.findName("slider_button").height-2;zoomInSliderLimit=sender.findName("rail")["Canvas.Top"]-2;zoomSliderStep=(zoomOutSliderLimit-zoomInSliderLimit)/zoomSliderGranularity;slider_SetValue(sender.findName("zoom_slider"),zoomOutSliderLimit)}else maxScaleFactor=2/mapIconScale;if(maxScaleFactor<1)maxScaleFactor=1;bgMapUrl="/getXamlFragment.do?slAction=getCampgroundMap";if(document.getElementById("slMapParkId"))bgMapUrl+=
"&parkId="+document.getElementById("slMapParkId").value;if(document.getElementById("reload")){var rnd=Math.floor(Math.random()*101);bgMapUrl+="&reload="+rnd}this.mapLoader=plugin.createObject("Downloader");this.mapLoader.addEventListener("Completed",mapDownloadCompleted);this.mapLoader.addEventListener("DownloadFailed",mapDownloadFailed);this.mapLoader.open("Get",bgMapUrl);this.mapLoader.send();window.setTimeout("checkDownloadTime()",loadTime);insertTips(sender)}
function mapDownloadFailed(sender,args){timedOut=false;if(document.getElementById("viewmap"))displayErrorPopup();else if(document.getElementById("basicMapUrl")){var imgSrc=document.getElementById("basicMapUrl").value;var innerHTML='<a href="'+urlToCgMap+'" title="Campsite Map">';innerHTML+='<img src="'+imgSrc+'" id="mapSample" width="180.0" height="180.0" class="sidemap" alt="Campsite Map"/></a>';parentPluginElement.innerHTML=innerHTML}}
function mapDownloadCompleted(sender,args){timedOut=false;removeErrorPopup();if(document.getElementById("viewmap")){this.sitesLoader=plugin.createObject("Downloader");this.sitesLoader.addEventListener("completed","sitesDownloadCompleted");this.sitesLoader.open("Get","/getXamlFragment.do?slAction=getAvailability");this.sitesLoader.send();availInfoReady=false}else progressStop();try{var xamlFragment=plugin.content.createFromXamlDownloader(sender,"");if(xamlFragment){var sceneHostCanvas=plugin.content.findName("sceneHostCanvas");
sceneHostCanvas.children.add(xamlFragment)}else throw"exception";}catch(exception){mapDownloadFailed(sender,args);return}if(document.getElementById("viewmap")){if(document.getElementById("selectedSiteRb"))delaySelectRb();else if(document.getElementById("fullMapView"))window.setTimeout("fullCampgroundView()",1);else window.setTimeout("allMatchingCampsites()",1);if(document.getElementById("mapload"))document.getElementById("mapload").value="loaded"}else if(document.getElementById("selectedSiteRb")){var siteId=
document.getElementById("selectedSiteRb").value;var sceneHostCanvas=plugin.content.findName("sceneHostCanvas");var siteSelectedCanvas=plugin.content.findName("S_"+siteId);if(siteSelectedCanvas!=null)changeSelectedSiteOnMap(siteId);else{var childrenSites=new Array;findChildrenFor(sceneHostCanvas,"S_"+siteId+"_",childrenSites);if(childrenSites.length>0)changeSelectedSiteOnMap(siteId,childrenSites);else{var errorTextBlock=plugin.content.findName("errorTextBlock");errorTextBlock.Text="Site Location Not Available";
errorTextBlock["Canvas.Left"]=(pluginWidth-errorTextBlock.ActualWidth)/2;errorTextBlock.Visibility="Visible";travelTo(0,0,scaleWidth,scaleHeight)}}}}
function delaySelectRb(){if(!availInfoReady){window.setTimeout("delaySelectRb()",1E3);return}if(currentSelectedRB!=null)window.setTimeout("currentSelectedRB.onclick.apply(currentSelectedRB)",1);else if(document.getElementById("selectedSiteRb")){var siteId=document.getElementById("selectedSiteRb").value;var siteSelectedCanvas=plugin.content.findName("S_"+siteId);if(siteSelectedCanvas!=null)changeSelectedSiteOnMap(siteId);else{var sceneHostCanvas=plugin.content.findName("sceneHostCanvas");var childrenSites=
new Array;findChildrenFor(sceneHostCanvas,"S_"+siteId+"_",childrenSites);changeSelectedSiteOnMap(siteId,childrenSites)}}}function progressStop(){var sceneHostCanvas=plugin.content.findName("sceneHostCanvas");var progress=sceneHostCanvas.findName("SpinColor");progress.stop();var progressCanvas=sceneHostCanvas.findName("Layer_1");progressCanvas.Visibility="Collapsed"}
function sitesDownloadCompleted(sender,args){var xmlDoc=getDownloadedXMLContent(sender,args);if(xmlDoc==null)return;var root=xmlDoc.getElementsByTagName("sitesAvailInfo")[0];if(root){bgFillAv=root.getAttribute("bgAvail");bgFillAvNoMatch=root.getAttribute("bgAvNoMatch");bgFillUnav=root.getAttribute("bgUnav");bgFillUnavNoMatch=root.getAttribute("bgUnavNoMatch");sitesAvail=root.getElementsByTagName("availinfo");window.setTimeout(updateAvail,1)}}
function getDownloadedXMLContent(sender,args){var xmlDoc;var xmlFragment=sender.responseText;try{xmlDoc=new ActiveXObject("Msxml2.DOMDocument.3.0");xmlDoc.async="false";xmlDoc.loadXML(xmlFragment)}catch(e){try{var parser=new DOMParser;xmlDoc=parser.parseFromString(xmlFragment,"text/xml")}catch(e){}}return xmlDoc}
function updateAvail(){if(sitesAvail.length>0){var tmpCanvas;var siteKey;var siteId;var avTxt;for(var i=0;i<sitesAvail.length;i++){siteIdAttr=sitesAvail[i].getAttribute("siteId");siteId=getSiteIdFromName(siteIdAttr);var tmp=new Array;tmp=siteIdAttr.split("_");var siteKeys=new Array;if(tmp.length>2){var j=0;for(var idx=2;idx<tmp.length;idx++)siteKeys[j++]="_"+tmp[1]+"_"+tmp[idx]}else siteKeys[0]=siteIdAttr;avTxt=sitesAvail[i].getAttribute("avTxt");for(var index=0;index<siteKeys.length;index++){siteKey=
siteKeys[index];var siteCanvas=plugin.content.findName("S"+siteKey);tmpCanvas=plugin.content.findName("avail"+siteKey);if(tmpCanvas)tmpCanvas.Text=availStatus[avTxt];tmpCanvas=plugin.content.findName("rate"+siteKey);if(tmpCanvas)tmpCanvas.Text=sitesAvail[i].getAttribute("rateTxt");tmpCanvas=plugin.content.findName("bg"+siteKey);if(tmpCanvas){var bg=tmpCanvas.children.getItem(0);var match=false;if(document.getElementById("rb"+siteId))match=true;if(avTxt==0||avTxt==1||avTxt==5){bg.Fill=bgFillAv;if(!match)siteCanvas.Opacity=
".33"}else{bg.Fill=bgFillUnav;if(!match)siteCanvas.Opacity=".33"}}}}}availInfoReady=true;progressStop()}function fullCampgroundView(){if(!Silverlight.available)return;closeBubble();travelTo(0,0,scaleWidth,scaleHeight);slider_SetValue(plugin.content,zoomOutSliderLimit)}
function travelTo(transX,transY,scaleX,scaleY){plugin.content.findName("travelAnimScaleX").To=scaleX;plugin.content.findName("travelAnimScaleY").To=scaleY;plugin.content.findName("travelAnimX").To=transX;plugin.content.findName("travelAnimY").To=transY;plugin.content.findName("travelAnim").begin()}function travelAnimCompleted(sender,args){if(showBubble&&bubble!=null){var bubbleCanvas=plugin.content.findName("MapBubble");bubbleCanvas.children.insert(0,bubble);showBubble=false}}
function slider_line_MouseLeftButtonDown(sender,args){var coordinate=args.getPosition(null).y-sender["Canvas.Top"];var delta=slider_GetValue(sender)-coordinate;if(delta<0)delta+=sender.findName("slider_button").height;zoomToSlider(sender,delta,false)}function slider_MouseLeftButtonDown(sender,args){var slider=sender.findName("zoom_slider");sender.captureMouse();mouseDownValue=slider_GetValue(slider);mouseDownPosition=args.getPosition(null).y}
function slider_MouseLeftButtonUp(sender,args){if(mouseDownValue>-1){sender.releaseMouseCapture();var delta=mouseDownValue-slider_GetValue(sender);var counter=Math.round(Math.abs(delta)/zoomSliderStep);if(counter>zoomSliderGranularity)counter=zoomSliderGranularity;if(delta!=0)delta=delta/Math.abs(delta)*counter*zoomSliderStep;var newValue=mouseDownValue-delta;zoomToSlider(sender,delta,true);mouseDownValue=-1;slider_SetValue(sender,newValue)}}
function slider_MouseMove(sender,args){var slider=sender.findName("zoom_slider");if(mouseDownValue!=-1){var newValue=mouseDownValue+(args.getPosition(null).y-mouseDownPosition);slider_SetValue(slider,newValue)}}function slider_GetValue(sender){var thumb=sender.findName("zoom_slider");return thumb["Canvas.Top"]+0.5*thumb.height}
function slider_SetValue(sender,newValue){if(sender){var goodToMove=true;if(newValue>zoomOutSliderLimit){newValue=zoomOutSliderLimit;goodToMove=slider_GetValue(sender)<zoomOutSliderLimit}if(newValue<zoomInSliderLimit){newValue=zoomInSliderLimit;goodToMove=slider_GetValue(sender)>zoomInSliderLimit}var thumb=sender.findName("zoom_slider");var delta=slider_GetValue(sender)-newValue;thumb["Canvas.Top"]=newValue-0.5*thumb.height;zoomSliderPosition=newValue;return goodToMove}else return false}
function zoomToSlider(sender,delta,sliderIsInPosition){var counter=Math.round(Math.abs(delta)/zoomSliderStep);if(counter>zoomSliderGranularity)counter=zoomSliderGranularity;for(var index=0;index<counter;index++)if(delta>0)onZoomInClicked(sender,null,sliderIsInPosition);else if(delta<0)onZoomOutClicked(sender,null,sliderIsInPosition);return counter}
function onZoomInClicked(sender,eventArgs,sliderIsInPosition){closeBubble();if(sender==null){sender=plugin.content;sliderIsInPosition=false}if(sliderIsInPosition||slider_SetValue(sender,zoomSliderPosition-zoomSliderStep)){var sceneScale=plugin.content.findName("sceneScale");var sceneTranslate=plugin.content.findName("sceneTranslate");var x;var y;if(eventsForWheel!=null){x=eventsForWheel.getPosition(null).X;y=eventsForWheel.getPosition(null).Y}else{x=pluginWidth/2;y=pluginHeight/2}var perX=(sceneTranslate.X-
x)/(1E3*sceneScale.scaleX);var perY=(sceneTranslate.Y-y)/(1E3*sceneScale.scaleY);var zoomLevel=getZoomLevel();sceneScale.scaleX=zoomLevel;sceneScale.scaleY=zoomLevel;sceneTranslate.X=perX*sceneScale.scaleX*1E3+x;sceneTranslate.Y=perY*sceneScale.scaleY*1E3+y}}
function onZoomOutClicked(sender,eventArgs,sliderIsInPosition){closeBubble();if(sender==null){sender=plugin.content;sliderIsInPosition=false}if(sliderIsInPosition||slider_SetValue(sender,zoomSliderPosition+zoomSliderStep)){var sceneScale=plugin.content.findName("sceneScale");var sceneTranslate=plugin.content.findName("sceneTranslate");var x;var y;if(eventsForWheel!=null){x=eventsForWheel.getPosition(null).X;y=eventsForWheel.getPosition(null).Y}else{x=pluginWidth/2;y=pluginHeight/2}var perX=(sceneTranslate.X-
x)/(1E3*sceneScale.scaleX);var perY=(sceneTranslate.Y-y)/(1E3*sceneScale.scaleY);if(sceneScale.scaleX<=scaleWidth&&sceneScale.scaleY<=scaleHeight)return;var zoomLevel=getZoomLevel();sceneScale.scaleX=zoomLevel;sceneScale.scaleY=zoomLevel;if(sceneScale.scaleX<scaleWidth)sceneScale.scaleX=scaleWidth;if(sceneScale.scaleY<scaleHeight)sceneScale.scaleY=scaleHeight;sceneTranslate.X=perX*sceneScale.scaleX*1E3+x;if(sceneTranslate.X>0)sceneTranslate.X=0;var newScaleX=Math.round(sceneScale.scaleX*1E3);newScaleX=
newScaleX-pluginWidth;if(Math.abs(sceneTranslate.X)>=newScaleX)sceneTranslate.X=-newScaleX;sceneTranslate.Y=perY*sceneScale.scaleY*1E3+y;if(sceneTranslate.Y>0)sceneTranslate.Y=0;var newScaleY=Math.round(sceneScale.scaleY*1E3);newScaleY=newScaleY-pluginHeight;if(Math.abs(sceneTranslate.Y)>=newScaleY)sceneTranslate.Y=-newScaleY}}
function onPanLeftClicked(sender,eventArgs){closeBubble();var sceneTranslate=sender.findName("sceneTranslate");var delta=deltaPanX;if(sceneTranslate.X+delta>0)delta=-sceneTranslate.X+greyX;sceneTranslate.X=sceneTranslate.X+delta}
function onPanRightClicked(sender,eventArgs){closeBubble();var sceneTranslate=sender.findName("sceneTranslate");var sceneScale=sender.findName("sceneScale");var scale=Math.round(sceneScale.scaleX*100);scale=scale/100*1E3-pluginWidth;var delta=deltaPanX;if(Math.abs(sceneTranslate.X-delta)>=scale)delta=sceneTranslate.X+scale+greyX;sceneTranslate.X=sceneTranslate.X-delta}
function onPanUpClicked(sender,eventArgs){closeBubble();var sceneTranslate=sender.findName("sceneTranslate");var delta=deltaPanY;if(sceneTranslate.Y+delta>0)delta=-sceneTranslate.Y+greyY;sceneTranslate.Y=sceneTranslate.Y+delta}
function onPanDownClicked(sender,eventArgs){closeBubble();var sceneTranslate=sender.findName("sceneTranslate");var sceneScale=sender.findName("sceneScale");var scale=Math.round(sceneScale.scaleY*100);scale=scale/100*1E3-pluginHeight;var delta=deltaPanY;if(Math.abs(sceneTranslate.Y-delta)>=scale)delta=sceneTranslate.Y+scale+greyY;sceneTranslate.Y=sceneTranslate.Y-delta}function onResetClicked(sender,eventArgs){allMatchingCampsites()}
function sceneMouseUp(sender,eventArgs){mouseDownX=-1;mouseDownY=-1;sender.Cursor="Default"}function sceneMouseDown(sender,eventArgs){closeBubble();var sceneTranslate=sender.findName("sceneTranslate");mouseDownX=eventArgs.getPosition(null).X-sceneTranslate.X;mouseDownY=eventArgs.getPosition(null).Y-sceneTranslate.Y;sender.Cursor="Hand"}
function sceneMouseMove(sender,eventArgs){try{if(mouseDownX!=-1&&mouseDownY!=-1){var sceneTranslate=sender.findName("sceneTranslate");var sceneScale=sender.findName("sceneScale");var scale=Math.round(sceneScale.scaleX*100);scale=scale/100*1E3-pluginWidth;if(eventArgs.getPosition(null).X-mouseDownX<=greyX&&Math.abs(eventArgs.getPosition(null).X-mouseDownX)<=scale+greyX)sceneTranslate.X=eventArgs.getPosition(null).X-mouseDownX;if(eventArgs.getPosition(null).Y-mouseDownY<=greyY&&Math.abs(eventArgs.getPosition(null).Y-
mouseDownY)<=scale+greyY)sceneTranslate.Y=eventArgs.getPosition(null).Y-mouseDownY}else eventsForWheel=eventArgs}catch(e){}}function sceneMouseLeave(sender,eventArgs){try{sceneMouseUp(sender,eventArgs);inView=false;eventsForWheel=null;wheelHelper.detach()}catch(e){}}function sceneMouseEnter(sender,eventArgs){try{inView=true;wheelHelper=new WheelHelper;wheelHelper.wheelScrolled=processMouseWheel}catch(e){}}
function processMouseWheel(delta){if(inView)if(delta<0)onZoomOutClicked();else onZoomInClicked()}function setSelectedRB(rb){currentSelectedRB=rb}
function changeSelectedSiteOnMap(siteId,childrenSites){if(!Silverlight.available)return;currentSelectedRB=null;closeBubble();if(keySiteAttrs){keySiteAttrsXML=null;downloadKeySiteAttr(siteId)}if(previousSelectedSiteIcon!=null&&previousSelectedSiteIcon.length>0)for(var i=0;i<previousSelectedSiteIcon.length;i++)if(previousSelectedSiteIcon[i]>""){var previousSiteSelectedCanvas=plugin.content.findName(previousSelectedSiteIcon[i]);var highlightName="siteHighlighter_"+previousSelectedSiteIcon[i];var highlight=
previousSiteSelectedCanvas.findName(highlightName);try{if(highlight!=null){previousSiteSelectedCanvas.children.remove(highlight);previousSiteSelectedCanvas["Canvas.ZIndex"]=0}}catch(exception){}}var siteSelectedCanvas;var siteSelectedCanvasForBubble;var siteIconIndicator="S_"+siteId;if(plugin!=null){if(childrenSites){previousSelectedSiteIcon=new Array(childrenSites.length);var minX=1E3;var maxX=0;var minY=1E3;var maxY=0;var j=0;var siteIsOnMap=false;for(var i=0;i<childrenSites.length;i++){var canvasName=
siteIconIndicator+"_"+childrenSites[i];siteSelectedCanvas=plugin.content.findName(canvasName);if(siteSelectedCanvas!=null){if(!siteIsOnMap)siteSelectedCanvasForBubble=siteSelectedCanvas;siteIsOnMap=true;minX=siteSelectedCanvas.getValue("Canvas.Left")<minX?siteSelectedCanvas.getValue("Canvas.Left"):minX;maxX=siteSelectedCanvas.getValue("Canvas.Left")>maxX?siteSelectedCanvas.getValue("Canvas.Left"):maxX;minY=siteSelectedCanvas.getValue("Canvas.Top")<minY?siteSelectedCanvas.getValue("Canvas.Top"):minY;
maxY=siteSelectedCanvas.getValue("Canvas.Top")>maxY?siteSelectedCanvas.getValue("Canvas.Top"):maxY;try{var childHighlighter=createHighlighter(canvasName);siteSelectedCanvas.children.insert(0,childHighlighter);previousSelectedSiteIcon[j++]=canvasName}catch(exception){alert("changeSelectedSiteOnMap2: "+exception.message)}}}if(siteIsOnMap){zoomToSites(minX,maxX,minY,maxY);bubble=createBubble(siteSelectedCanvasForBubble,siteId,true)}else{travelTo(0,0,scaleWidth,scaleHeight);bubble=missingSiteOnMapBubble(siteId,
true)}}else{siteSelectedCanvas=plugin.content.findName(siteIconIndicator);if(siteSelectedCanvas!=null)try{var highlighter=createHighlighter(siteIconIndicator);siteSelectedCanvas.children.insert(0,highlighter);siteSelectedCanvas["Canvas.ZIndex"]=9999;previousSelectedSiteIcon=new Array(1);previousSelectedSiteIcon[0]=siteIconIndicator;zoomToSite(siteSelectedCanvas.getValue("Canvas.Left"),siteSelectedCanvas.getValue("Canvas.Top"));bubble=createBubble(siteSelectedCanvas,siteId,false)}catch(exception){alert("changeSelectedSiteOnMap3: "+
exception+" - "+exception.message)}else{travelTo(0,0,scaleWidth,scaleHeight);bubble=missingSiteOnMapBubble(siteId,false)}}showBubble=true}applyRbSelectionToDiv(siteId)}function applyRbSelectionToDiv(siteId){var rbDiv=document.getElementById("div"+siteId);if(rbDiv){var div=document.getElementById("sitelistdiv");if(rbDiv.offsetTop<div.scrollTop||rbDiv.offsetTop>div.scrollTop+div.clientHeight-rbDiv.clientHeight)div.scrollTop=rbDiv.offsetTop-div.clientHeight/2}}
function zoomToSite(x,y){var sceneScale=plugin.content.findName("sceneScale");var zoomToScale=getZoomLevel(zoomToSiteFactor);var transX=0-x*zoomToScale+pluginWidth/2;var transY=0-y*zoomToScale+pluginHeight/2;travelTo(transX,transY,zoomToScale,zoomToScale)}
function zoomToSites(minX,maxX,minY,maxY){if(minX>maxX||minY>maxY)return;var x=(minX+maxX)/2;var y=(minY+maxY)/2;var sceneScale=plugin.content.findName("sceneScale");var sceneTranslate=plugin.content.findName("sceneTranslate");var dx=maxX-minX;var dy=maxY-minY;var d=(dx>dy?dx:dy)+29;var zoomFactor=pluginWidth/d;var msf=maxScaleFactor-scaleHeight;if(zoomFactor>msf)zoomFactor=msf;var scaleX=zoomFactor;var scaleY=zoomFactor;var transX=0-x*scaleX+pluginWidth/2;var transY=0-y*scaleY+pluginHeight/2;travelTo(transX,
transY,scaleX,scaleY);var zFactIdx=(zoomFactor-scaleHeight)/(maxScaleFactor-scaleHeight);if(zFactIdx<0)zFactIdx=0;var zSldIdx=Math.sqrt(zFactIdx);var newValue=zoomOutSliderLimit-zSldIdx*(zoomOutSliderLimit-zoomInSliderLimit);slider_SetValue(plugin.content.findName("zoom_slider"),newValue)}function goToSiteDetails(sender,args){var siteId=getSiteIdFromName(previousSelectedSiteIcon[0]);gotoSiteDetailsPage(siteId)}
function goToMissingSiteDetails(sender,args){var siteId;if(document.getElementById("sitelistdiv")){var siteList=document.getElementById("sitelistdiv");var o_childrn=siteList.childNodes;for(var i=0;i<o_childrn.length;i++)if(o_childrn[i].className=="sites slct"||o_childrn[i].className=="sitesunavail slct"){siteId=o_childrn[i].id.replace("div","");break}}gotoSiteDetailsPage(siteId)}
function gotoSiteDetailsPage(siteId){showProgressBar("contentProgressBar","Retrieving campsite details ...",null,"contentArea");var url="/campsiteDetails.do?siteId="+siteId+"&contractCode="+document.getElementById("contractCode").value+"&parkId="+document.getElementById("slMapParkId").value;window.location=url}function goToCgMap(sender,args){showProgressBar("contentProgressBar","Retrieving campground map ...",null,"contentArea");window.location=urlToCgMap}
function enlargeThisPhoto(sender,args){var siteId=getSiteIdFromName(previousSelectedSiteIcon[0]);this.photoLoader=plugin.createObject("Downloader");this.photoLoader.addEventListener("completed","gotPhoto");this.photoLoader.open("Get","/getXamlFragment.do?slAction=getPhotoPath&siteId="+siteId);this.photoLoader.send()}
function gotPhoto(sender,args){var photoSrc=sender.responseText;if(photoSrc&&photoSrc!=""){var photoCanvas=plugin.content.findName("photoCanvas");var photo=photoCanvas.findName("largePhoto");photo.Source=photoSrc;photoCanvas.Visibility="Visible"}}function hidePhoto(sender,args){var photoCanvas=plugin.content.findName("photoCanvas");photoCanvas.Visibility="Collapsed";showBubble=true;travelAnimCompleted()}
function selectSiteFromMap(sender,args){if(document.getElementById("viewmap")){var siteId=getSiteIdFromName(sender.Name);if(document.getElementById("rb"+siteId)){rb=document.getElementById("rb"+siteId);rb.onclick.apply(rb)}else{unselectSiteRB();var pos1=sender.Name.indexOf("_");var pos2=sender.Name.indexOf("_",pos1+1);if(pos2>0){var sceneHostCanvas=plugin.content.findName("sceneHostCanvas");var childrenSites=new Array;findChildrenFor(sceneHostCanvas,sender.Name.substring(0,pos2),childrenSites);changeSelectedSiteOnMap(siteId,
childrenSites)}else changeSelectedSiteOnMap(siteId)}}}function unselectSiteRB(){if(document.getElementById("sitelistdiv")){var siteList=document.getElementById("sitelistdiv");var o_childrn=siteList.childNodes;for(var i=0;i<o_childrn.length;i++)if(o_childrn[i].className=="sites slct"||o_childrn[i].className=="sitesunavail slct"){o_childrn[i].className=o_childrn[i].className.replace(" slct","");break}}}
function getSiteIdFromName(canvasName){var startPos=canvasName.indexOf("_");var endPos=canvasName.indexOf("_",startPos+1);if(endPos<0)endPos=canvasName.length;var siteId=canvasName.substring(startPos+1,endPos);return siteId}
function findChildrenFor(parentCanvas,parentSite,childrenSites){var childCanvas;var i=0;for(var index=0;index<parentCanvas.children.count;index++){childCanvas=parentCanvas.children.getItem(index);if(childCanvas.toString()!="Canvas")continue;if(childCanvas.children)findChildrenFor(childCanvas,parentSite,childrenSites);if(childCanvas.Name.indexOf(parentSite)>=0)childrenSites[i++]=childCanvas.Name.substring(childCanvas.Name.indexOf("_",childCanvas.Name.indexOf("_")+1)+1,childCanvas.Name.length)}}
function allMatchingCampsites(){if(!Silverlight.available)return;closeBubble();if(document.getElementById("sitelistdiv")){minX=1E3;maxX=0;minY=1E3;maxY=0;var siteList=document.getElementById("sitelistdiv");var o_childrn=siteList.childNodes;var rb="";if(o_childrn.length>0){for(var i=0;i<o_childrn.length;i++)if(o_childrn[i].nodeType!=3&&o_childrn[i].id){rb=document.getElementById(o_childrn[i].id.replace("div","rb"));var onClick=rb.onclick.toString();var poz0=onClick.indexOf("changeSelectedSite(")+19;
var params=onClick.substring(poz0,onClick.indexOf(")",poz0));var poz1=params.indexOf(",");if(poz1<0)poz1=params.length;var siteId=trim(params.substring(0,poz1));var childrenSites=trim(params.substring(poz1+1,params.length));if(childrenSites.length>0){var s=childrenSites.substring(childrenSites.indexOf("[")+1,childrenSites.indexOf("]"));var childSites=s.split(",");for(var j=0;j<childSites.length;j++){var canvasName="S_"+siteId+"_"+trim(childSites[j]);checkSiteCanvas(canvasName)}}else{var canvasName=
"S_"+siteId;checkSiteCanvas(canvasName)}}zoomToSites(minX,maxX,minY,maxY)}else fullCampgroundView()}}
function checkSiteCanvas(canvasName){siteSelectedCanvas=plugin.content.findName(canvasName);if(siteSelectedCanvas!=null){minX=siteSelectedCanvas.getValue("Canvas.Left")<minX?siteSelectedCanvas.getValue("Canvas.Left"):minX;maxX=siteSelectedCanvas.getValue("Canvas.Left")>maxX?siteSelectedCanvas.getValue("Canvas.Left"):maxX;minY=siteSelectedCanvas.getValue("Canvas.Top")<minY?siteSelectedCanvas.getValue("Canvas.Top"):minY;maxY=siteSelectedCanvas.getValue("Canvas.Top")>maxY?siteSelectedCanvas.getValue("Canvas.Top"):
maxY}}
function createHighlighter(site){var xamlString="<Rectangle Name='siteHighlighter_"+site+"' Canvas.Top='-14.5' Canvas.Left='-14.5' Height='29' Width='29' StrokeThickness='5' Stroke='#FFFDFF00' StrokeLineJoin='Round'>";xamlString+="<Rectangle.Triggers>";xamlString+="<EventTrigger RoutedEvent='Ellipse.Loaded'>";xamlString+="<BeginStoryboard>";xamlString+="<Storyboard>";xamlString+="<DoubleAnimation Storyboard.TargetName='siteHighlighter_"+site+"' Storyboard.TargetProperty='Opacity' From='1.0' To='0.1' Duration='0:0:1' AutoReverse='True' RepeatBehavior='Forever' />";xamlString+=
"</Storyboard>";xamlString+="</BeginStoryboard>";xamlString+="</EventTrigger>";xamlString+="</Rectangle.Triggers>";xamlString+="</Rectangle>";return plugin.content.createFromXAML(xamlString)}function downloadKeySiteAttr(siteId){this.sitesLoader=plugin.createObject("Downloader");this.sitesLoader.addEventListener("completed","keySiteAttrDownloadCompleted");this.sitesLoader.open("Get","/getKeySiteAttrs.do?slAction=getKeySiteAttr&siteId="+siteId);this.sitesLoader.send()}
function keySiteAttrDownloadCompleted(sender,args){var xmlDoc=getDownloadedXMLContent(sender,args);if(xmlDoc==null)return;keySiteAttrsXML=xmlDoc.getElementsByTagName("keysiteattrs")[0];if(keySiteAttrsXML)if(plugin)delayUpdateBubble()}
function delayUpdateBubble(){var bubbleCanvas=plugin.content.findName("MapBubble");var siteBubble=bubbleCanvas.findName("CampsiteBubble");if(siteBubble==null){window.setTimeout("delayUpdateBubble()",1E3);return}if(keySiteAttrsXML.getAttribute("acc"))siteBubble.findName("adaIcon").Visibility="Visible";if(keySiteAttrsXML.getAttribute("loop"))siteBubble.findName("loopv").Text=keySiteAttrsXML.getAttribute("loop");if(keySiteAttrsXML.getAttribute("type"))siteBubble.findName("typev").Text=keySiteAttrsXML.getAttribute("type");
siteBubble.findName("siteAreaTypeText").Visibility="Visible";for(var i=0;i<maxKeySiteAttrs;i++){if(keySiteAttrsXML.getAttribute("attrn"+i))siteBubble.findName("attrn"+i).Text=keySiteAttrsXML.getAttribute("attrn"+i)+":";if(keySiteAttrsXML.getAttribute("attrv"+i))siteBubble.findName("attrv"+i).Text=keySiteAttrsXML.getAttribute("attrv"+i)}siteBubble.findName("siteAttributes").Visibility="Visible";if(keySiteAttrsXML.getAttribute("photo")){var photo=siteBubble.findName("sitePhoto");photo.Source=keySiteAttrsXML.getAttribute("photo");
photo.Visibility="Visible"}}
function createBubble(siteSelectedCanvas,siteId,nss){if(!siteSelectedCanvas)return;if(document.getElementById("viewmap")){var siteIcon="S";var siteNameText="Nonspecific";if(document.getElementById("rb"+siteId))siteNameText=document.getElementById("rb"+siteId).nextSibling.firstChild.nodeValue;else if(!nss)siteNameText=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replace(siteIcon,"name")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"avail")))var siteAvailText=
siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"avail")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"rate")))var dailyRateText=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"rate")).Text;var xamlString="<Canvas Name='CampsiteBubble' MouseEnter='mouseOverBubble' MouseLeave='mouseLeaveBubble' >";if(keySiteAttrs){xamlString+="<Path Name='bubbleBox' Width='256' Height='190.5' Canvas.Left='0' Canvas.Top='0' Stretch='Fill' StrokeThickness='1' StrokeLineJoin='Round' Stroke='#FF000000' Fill='#FFFFFFFF' ";
if(nss)xamlString+="Data='F1 M100.984,175.64348 C99.327,175.64348 97.984,174.30048 97.984,172.64448 L97.984,-1.5051735 C97.984,-3.1617735 99.327,-4.5046735 100.984,-4.5046735 L349.943,-4.5046735 C351.6,-4.5046735 352.943,-3.1617735 352.943,-1.5051735 L352.943,172.64448 C352.943,174.30048 351.6,175.64348 349.943,175.64348 z'/>";else xamlString+="Data='F1 M223.964,184.97 L240.461,151.975 100.984,151.975 C99.327,151.975 97.984,150.632 97.984,148.976 L97.984,-1.5051735 C97.984,-3.1617735 99.327,-4.5046735 100.984,-4.5046735 L349.943,-4.5046735 C351.6,-4.5046735 352.943,-3.1617735 352.943,-1.5051735 L352.943,148.976 C352.943,150.632 351.6,151.975 349.943,151.975 L274.426,151.975 223.964,184.97 z'/>";
xamlString+="<Path Name='adaIcon' Visibility='Collapsed' Fill='#FF000000' Stretch='Fill' StrokeThickness='20' Canvas.Left='5' Canvas.Top='5' Width='20' Height='20' Data='M24.390219,31.081009 L24.524217,39.657024 C24.524216,39.657024 24.266688,39.767993 23.81575,39.997002 22.012,40.913024 17.113714,43.717624 13.224606,48.863043 11.280052,51.435751 9.5877953,54.593658 8.6607933,58.393303 8.1972962,60.293121 7.9251099,62.353378 7.9083595,64.581131 7.7743568,82.403191 21.710157,93.267033 36.852109,93.391117 53.199961,93.52515 60.971735,78.918839 60.971735,78.918839 L66.733984,84.681103 C66.733984,84.681103 66.547646,84.94281 66.18725,85.400826 64.745703,87.232827 60.519457,92.205457 54.295755,96.131222 51.18391,98.094114 47.572715,99.795262 43.560578,100.71128 41.554509,101.16927 39.448202,101.431 37.25396,101.431 19.699975,101.431 -0.25249592,87.495112 0.0024166107,64.044868 0.069418065,57.880918 1.6271554,52.738727 3.926075,48.492626 8.5239171,40.000426 16.086476,35.09266 20.617313,32.764399 22.882724,31.600266 24.390219,31.081001&#xd;&#xa;24.390219,31.081009 z M39.688962,21.728001 L39.95698,38.612032 62.066998,38.745966 61.933002,46.651958 40.224957,46.518053 40.224957,61.525875 64.61286,61.65987 84.579004,83.234009 94.629,83.10001 94.495005,91.140003 81.228998,91.005878 61.129005,69.565918 32.318997,69.431904 31.916999,21.861999 z M35.721991,0 C37.109604,0 38.431537,0.28122086 39.633904,0.78977776 42.038636,1.8068946 43.965097,3.7333552 44.982211,6.1380863 45.49077,7.3404532 45.77199,8.6623862 45.77199,10.05 45.77199,11.437615 45.490769,12.759548 44.982211,13.961915 43.965097,16.366644 42.038636,18.293106 39.633904,19.310222 38.431537,19.81878 37.109604,20.100001 35.721991,20.100001 34.334374,20.100001 33.012442,19.818779 31.810077,19.310222 29.405346,18.293106 27.478885,16.366644&#xd;&#xa;26.461769,13.961915 25.953212,12.759548 25.67199,11.437615 25.67199,10.05 25.67199,8.662386 25.953211,7.340453 26.461769,6.1380863 27.478885,3.7333549 29.405346,1.8068944 31.810077,0.78977776 33.012442,0.28122152 34.334374,0 35.721991,0 z' RenderTransformOrigin='0.668642704392969,0.556378256145737'></Path>";
xamlString+="<TextBlock Name='siteNameText' Width='200.963' Height='22.9963' Canvas.Left='30' Canvas.Top='5' FontSize='16' FontWeight='Bold' Text='"+siteNameText+"' />";xamlString+="<TextBlock Name='siteAreaTypeText' Visibility='Collapsed' Width='250' Height='20' Canvas.Left='5' Canvas.Top='30' FontSize='10' Cursor='Arrow' FontWeight='Normal' FontFamily='Lucida Sans Unicode' >";xamlString+="<Run Foreground='#FF808080' Text='Loop:'/>";xamlString+="<Run Name='loopv' Text=''/><LineBreak/>";xamlString+=
"<Run Foreground='#FF808080' Text='Type:'/>";xamlString+="<Run Name='typev' Text=''/><LineBreak/>";xamlString+="</TextBlock>";xamlString+="<TextBlock Name='siteAttributes' Visibility='Collapsed' Width='144' Height='107' Canvas.Left='5' Canvas.Top='60' FontSize='10' Cursor='Arrow' FontWeight='Normal' FontFamily='Lucida Sans Unicode' >";for(var i=0;i<6;i++){xamlString+="<Run Name='attrn"+i+"' Foreground='#FF808080' Text=''/>";xamlString+="<Run Name='attrv"+i+"' Text=''/>";xamlString+="<LineBreak/>"}xamlString+=
"</TextBlock>";xamlString+="<Image Name='sitePhoto' Visibility='Collapsed' Cursor='Hand' MouseLeftButtonUp='enlargeThisPhoto' Width='101' Height='60' Canvas.Left='150' Canvas.Top='30' Source=''/>";if(siteAvailText)xamlString+="<TextBlock Name='siteAvailText' Width='101' Height='13' Canvas.Left='154' Canvas.Top='94' FontSize='11' Cursor='Hand' FontWeight='Bold' Text='"+siteAvailText+"'/>";xamlString+="<TextBlock Width='144' Height='18' Canvas.Left='154' Canvas.Top='112' Text='See Details' Foreground='Blue' FontFamily='Verdana' FontSize='16' TextDecorations='Underline' Cursor='Hand' MouseLeftButtonUp='goToSiteDetails' />";
if(dailyRateText)xamlString+="<TextBlock Name='dailyRateText' Width='144' Height='12' Canvas.Left='154' Canvas.Top='136' Text='"+dailyRateText+"' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='10' />";if(nss)xamlString+="<TextBlock Name='nssSiteCount' Width='241' Height='21' Canvas.Left='5' Canvas.Top='170' FontSize='10' TextWrapping='wrap'><Run Foreground='#FFFFA500' Text='+ '/><Run Text='Sites in this group are assigned upon arrival'/></TextBlock>"}else{var siteAreaText=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replace(siteIcon,
"area")).Text;if(!siteAreaText)siteAreaText="";siteAreaText=getXMLEncoded(siteAreaText);var siteTypeText=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"type")).Text;siteTypeText=getXMLEncoded(siteTypeText);if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"photo")))var sitePhotoSrc=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"photo")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am1")))var icon1=
siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am1")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am2")))var icon2=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am2")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am3")))var icon3=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am3")).Text;if(siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,
"am4")))var icon4=siteSelectedCanvas.findName(siteSelectedCanvas.Name.replaceAll(siteIcon,"am4")).Text;xamlString+="<Path Name='bubbleBox' Width='256' Height='163' Canvas.Left='0' Canvas.Top='0' Stretch='Fill' StrokeThickness='1' StrokeLineJoin='Round' Stroke='Black' Fill='#BFFFFFFF' ";if(nss)xamlString+="Data='F1 M240.461,151.975 L100.984,151.975 C99.327,151.975 97.984,150.632 97.984,148.976 L97.984,25.9958 C97.984,24.3392 99.327,22.9963 100.984,22.9963 L349.943,22.9963 C351.6,22.9963 352.943,24.3392 352.943,25.9958 L352.943,148.976 C352.943,150.632 351.6,151.975 349.943,151.975 L274.426,151.975 z'/>";
else xamlString+="Data='F1 M 223.964,184.97L 240.461,151.975L 100.984,151.975C 99.327,151.975 97.984,150.632 97.984,148.976L 97.984,25.9958C 97.984,24.3392 99.327,22.9963 100.984,22.9963L 349.943,22.9963C 351.6,22.9963 352.943,24.3392 352.943,25.9958L 352.943,148.976C 352.943,150.632 351.6,151.975 349.943,151.975L 274.426,151.975L 223.964,184.97 Z '/>";xamlString+="<TextBlock Name='siteNameText' Width='228' Height='23' Canvas.Left='5' Canvas.Top='5' Foreground='Black' TextWrapping='Wrap' Text='"+
siteNameText+"' FontFamily='Verdana' FontSize='16' />";xamlString+="<TextBlock Name='siteAreaTypeText' Width='144' Height='52' Canvas.Left='5' Canvas.Top='25' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='10'>";xamlString+="Area: "+siteAreaText;xamlString+="<LineBreak/>";xamlString+="Type: "+siteTypeText;xamlString+="</TextBlock>";if(siteAvailText)xamlString+="<TextBlock Name='siteAvailText' Width='144' Height='12' Canvas.Left='5' Canvas.Top='82' Text='"+siteAvailText+"' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='10' />";
xamlString+="<TextBlock Width='144' Height='14' Canvas.Left='5' Canvas.Top='96' Text='See Details' Foreground='Blue' FontFamily='Verdana' FontSize='12' TextDecorations='Underline' Cursor='Hand' MouseLeftButtonUp='goToSiteDetails' />";if(dailyRateText)xamlString+="<TextBlock Name='dailyRateText' Width='144' Height='12' Canvas.Left='5' Canvas.Top='114' Text='"+dailyRateText+"' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='10' />";if(nss)xamlString+="<TextBlock Width='235' Height='12' Canvas.Left='5' Canvas.Top='130' FontFamily='Verdana' FontSize='10'><Run Text='+' Foreground='Orange' /><Run Text='Sites in this group are assigned upon arrival'/></TextBlock>";
if(sitePhotoSrc)xamlString+="<Image Name='sitePhoto' Cursor='Hand' MouseLeftButtonUp='enlargeThisPhoto' Width='101' Height='60' Canvas.Left='150' Canvas.Top='30' Source='"+sitePhotoSrc+"'/>";if(icon1)xamlString+="<Image Name='icon1' Width='23' Height='23' Canvas.Left='153' Canvas.Top='102' Source='"+icon1+"'/>";if(icon1)xamlString+="<Image Name='icon2' Width='23' Height='23' Canvas.Left='178' Canvas.Top='102' Source='"+icon2+"'/>";if(icon1)xamlString+="<Image Name='icon3' Width='23' Height='23' Canvas.Left='203' Canvas.Top='102' Source='"+
icon3+"'/>";if(icon1)xamlString+="<Image Name='icon4' Width='23' Height='23' Canvas.Left='228' Canvas.Top='102' Source='"+icon4+"'/>"}xamlString+="<Rectangle Name='closeBox' Canvas.Left='235' Canvas.Top='5' Width='17' Height='17' RadiusX='2.5' RadiusY='2.5' Stretch='Fill' StrokeThickness='0.999837' StrokeLineJoin='Round' Stroke='#FF230FD2' />";xamlString+="<Path Name='closeCross' Width='10' Height='10' Canvas.Left='238.5' Canvas.Top='8.55' Stretch='Fill' Fill='#FF301CD9' Data='F1 M 340.944,34.5802L 337.41,31.0452L 335.996,32.4592L 339.53,35.9941L 335.996,39.5291L 337.41,40.9431L 340.944,37.4081L 344.479,40.9431L 345.893,39.5291L 342.358,35.9941L 345.893,32.4592L 344.479,31.0452L 340.944,34.5802 Z '/>";
xamlString+="</Canvas>";var newBubble=plugin.content.createFromXAML(xamlString);var closeBubble=newBubble.findName("closeBox");new button(newBubble,closeBubble,"#FFF8F8F8","#FFF0F0F0",clickXonBubble);var txtElem=newBubble.findName("siteAreaTypeText");txtElem["Canvas.Top"]=newBubble.findName("siteNameText").ActualHeight+5;return newBubble}}
function missingSiteOnMapBubble(siteId,nss){if(document.getElementById("viewmap")){var xamlString="";var siteNameText="Nonspecific";if(document.getElementById("rb"+siteId))siteNameText=document.getElementById("rb"+siteId).nextSibling.firstChild.nodeValue;if(keySiteAttrs){xamlString+="<Canvas Name='CampsiteBubble' MouseEnter='mouseOverBubble' MouseLeave='mouseLeaveBubble' >";xamlString+="<Path Name='bubbleBox' Width='256' Height='218' Canvas.Left='0' Canvas.Top='0' Stretch='Fill' StrokeThickness='1' StrokeLineJoin='Round' Stroke='#FF000000' Fill='#FFFFFFFF' ";
if(nss)xamlString+="Data='F1 M100.984,175.64348 C99.327,175.64348 97.984,174.30048 97.984,172.64448 L97.984,-1.5051735 C97.984,-3.1617735 99.327,-4.5046735 100.984,-4.5046735 L349.943,-4.5046735 C351.6,-4.5046735 352.943,-3.1617735 352.943,-1.5051735 L352.943,172.64448 C352.943,174.30048 351.6,175.64348 349.943,175.64348 z'/>";else xamlString+="Data='F1 M223.964,184.97 L240.461,151.975 100.984,151.975 C99.327,151.975 97.984,150.632 97.984,148.976 L97.984,-1.5051735 C97.984,-3.1617735 99.327,-4.5046735 100.984,-4.5046735 L349.943,-4.5046735 C351.6,-4.5046735 352.943,-3.1617735 352.943,-1.5051735 L352.943,148.976 C352.943,150.632 351.6,151.975 349.943,151.975 L274.426,151.975 223.964,184.97 z'/>";
xamlString+="<Path Name='adaIcon' Visibility='Collapsed' Fill='#FF000000' Stretch='Fill' StrokeThickness='20' Canvas.Left='5' Canvas.Top='5' Width='20' Height='20' Data='M24.390219,31.081009 L24.524217,39.657024 C24.524216,39.657024 24.266688,39.767993 23.81575,39.997002 22.012,40.913024 17.113714,43.717624 13.224606,48.863043 11.280052,51.435751 9.5877953,54.593658 8.6607933,58.393303 8.1972962,60.293121 7.9251099,62.353378 7.9083595,64.581131 7.7743568,82.403191 21.710157,93.267033 36.852109,93.391117 53.199961,93.52515 60.971735,78.918839 60.971735,78.918839 L66.733984,84.681103 C66.733984,84.681103 66.547646,84.94281 66.18725,85.400826 64.745703,87.232827 60.519457,92.205457 54.295755,96.131222 51.18391,98.094114 47.572715,99.795262 43.560578,100.71128 41.554509,101.16927 39.448202,101.431 37.25396,101.431 19.699975,101.431 -0.25249592,87.495112 0.0024166107,64.044868 0.069418065,57.880918 1.6271554,52.738727 3.926075,48.492626 8.5239171,40.000426 16.086476,35.09266 20.617313,32.764399 22.882724,31.600266 24.390219,31.081001&#xd;&#xa;24.390219,31.081009 z M39.688962,21.728001 L39.95698,38.612032 62.066998,38.745966 61.933002,46.651958 40.224957,46.518053 40.224957,61.525875 64.61286,61.65987 84.579004,83.234009 94.629,83.10001 94.495005,91.140003 81.228998,91.005878 61.129005,69.565918 32.318997,69.431904 31.916999,21.861999 z M35.721991,0 C37.109604,0 38.431537,0.28122086 39.633904,0.78977776 42.038636,1.8068946 43.965097,3.7333552 44.982211,6.1380863 45.49077,7.3404532 45.77199,8.6623862 45.77199,10.05 45.77199,11.437615 45.490769,12.759548 44.982211,13.961915 43.965097,16.366644 42.038636,18.293106 39.633904,19.310222 38.431537,19.81878 37.109604,20.100001 35.721991,20.100001 34.334374,20.100001 33.012442,19.818779 31.810077,19.310222 29.405346,18.293106 27.478885,16.366644&#xd;&#xa;26.461769,13.961915 25.953212,12.759548 25.67199,11.437615 25.67199,10.05 25.67199,8.662386 25.953211,7.340453 26.461769,6.1380863 27.478885,3.7333549 29.405346,1.8068944 31.810077,0.78977776 33.012442,0.28122152 34.334374,0 35.721991,0 z' RenderTransformOrigin='0.668642704392969,0.556378256145737'></Path>";
xamlString+="<TextBlock Name='siteNameText' Width='200.963' Height='22.9963' Canvas.Left='30' Canvas.Top='5' FontSize='16' FontWeight='Bold' Text='"+siteNameText+"' />";xamlString+="<TextBlock Name='siteAreaTypeText' Visibility='Collapsed' Width='250' Height='20' Canvas.Left='5' Canvas.Top='30' FontSize='10' Cursor='Arrow' FontWeight='Normal' FontFamily='Lucida Sans Unicode' >";xamlString+="<Run Foreground='#FF808080' Text='Loop:'/>";xamlString+="<Run Name='loopv' Text=''/><LineBreak/>";xamlString+=
"<Run Foreground='#FF808080' Text='Type:'/>";xamlString+="<Run Name='typev' Text=''/><LineBreak/>";xamlString+="</TextBlock>";xamlString+="<TextBlock Name='siteAttributes' Visibility='Collapsed' Width='144' Height='107' Canvas.Left='5' Canvas.Top='60' FontSize='10' Cursor='Arrow' FontWeight='Normal' FontFamily='Lucida Sans Unicode' >";for(var i=0;i<6;i++){xamlString+="<Run Name='attrn"+i+"' Foreground='#FF808080' Text=''/>";xamlString+="<Run Name='attrv"+i+"' Text=''/>";xamlString+="<LineBreak/>"}xamlString+=
"</TextBlock>";xamlString+="<Image Name='sitePhoto' Visibility='Collapsed' Cursor='Hand' MouseLeftButtonUp='enlargeThisPhoto' Width='101' Height='60' Canvas.Left='150' Canvas.Top='30' Source=''/>";xamlString+="<TextBlock Width='144' Height='18' Canvas.Left='154' Canvas.Top='112' Text='See Details' Foreground='Blue' FontFamily='Verdana' FontSize='16' TextDecorations='Underline' Cursor='Hand' MouseLeftButtonUp='goToMissingSiteDetails' />";xamlString+="<TextBlock Name='oops' Width='241' Height='83' Canvas.Left='5' Canvas.Top='150' FontSize='10' TextWrapping='wrap'>"+
"<Run FontSize='13' Foreground='#FFFF0000' Text='Oops... '/>"+"<Run Text='Our apologies. This map is missing location data for the selected site(s).'/><LineBreak/>"+"</TextBlock>";if(nss)xamlString+="<TextBlock Name='nssSiteCount' Width='241' Height='21' Canvas.Left='5' Canvas.Top='200' FontSize='10' TextWrapping='wrap'><Run Foreground='#FFFFA500' Text='+ '/><Run Text='Sites in this group are assigned upon arrival'/></TextBlock>"}else{xamlString+="<Canvas Name='CampsiteBubble' >";xamlString+="<Path Name='bubbleBox' Width='256' Height='163' Canvas.Left='0' Canvas.Top='0' Stretch='Fill' StrokeThickness='1' StrokeLineJoin='Round' Stroke='Black' Fill='#FFFFFFFF' ";
xamlString+="Data='F1 M240.461,151.975 L100.984,151.975 C99.327,151.975 97.984,150.632 97.984,148.976 L97.984,25.9958 C97.984,24.3392 99.327,22.9963 100.984,22.9963 L349.943,22.9963 C351.6,22.9963 352.943,24.3392 352.943,25.9958 L352.943,148.976 C352.943,150.632 351.6,151.975 349.943,151.975 L274.426,151.975 z'/>";xamlString+="<TextBlock Name='siteNameText' Width='228' Height='23' Canvas.Left='5' Canvas.Top='5' Foreground='Black' TextWrapping='Wrap' Text='"+siteNameText+"' FontFamily='Verdana' FontSize='16' />";
xamlString+="<TextBlock Name='seeDetails' Width='144' Height='14' Canvas.Left='5' Canvas.Top='30' Text='See Details' Foreground='Blue' FontFamily='Verdana' FontSize='12' TextDecorations='Underline' Cursor='Hand' MouseLeftButtonUp='goToMissingSiteDetails' />";xamlString+="<TextBlock Width='228' Height='23' Canvas.Left='5' Canvas.Top='75' Foreground='Red' Text='Oops ...' TextWrapping='Wrap' FontFamily='Verdana' FontSize='16' />";xamlString+="<TextBlock Width='228' Height='40' Canvas.Left='5' Canvas.Top='100' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='10'>";
xamlString+="Our apologies. This map is missing location data for the selected site(s).";xamlString+="</TextBlock>"}xamlString+="<Rectangle Name='closeBox' Canvas.Left='235' Canvas.Top='5' Width='17' Height='17' RadiusX='2.5' RadiusY='2.5' Stretch='Fill' StrokeThickness='0.999837' StrokeLineJoin='Round' Stroke='#FF230FD2' />";xamlString+="<Path Name='closeCross' Width='10' Height='10' Canvas.Left='238.5' Canvas.Top='8.55' Stretch='Fill' Fill='#FF301CD9' Data='F1 M 340.944,34.5802L 337.41,31.0452L 335.996,32.4592L 339.53,35.9941L 335.996,39.5291L 337.41,40.9431L 340.944,37.4081L 344.479,40.9431L 345.893,39.5291L 342.358,35.9941L 345.893,32.4592L 344.479,31.0452L 340.944,34.5802 Z '/>";
xamlString+="</Canvas>";var newBubble=plugin.content.createFromXAML(xamlString);var closeBubble=newBubble.findName("closeBox");new button(newBubble,closeBubble,"#FFF8F8F8","#FFF0F0F0",clickXonBubble);return newBubble}}
function thankYouBubble(){var xamlString="<Canvas Name='CampsiteBubble'>";xamlString+="<Path Name='bubbleBox' Width='256' Height='163' Canvas.Left='0' Canvas.Top='0' Stretch='Fill' StrokeThickness='1' StrokeLineJoin='Round' Stroke='Black' Fill='#FFFFFFFF' ";xamlString+="Data='F1 M240.461,151.975 L100.984,151.975 C99.327,151.975 97.984,150.632 97.984,148.976 L97.984,25.9958 C97.984,24.3392 99.327,22.9963 100.984,22.9963 L349.943,22.9963 C351.6,22.9963 352.943,24.3392 352.943,25.9958 L352.943,148.976 C352.943,150.632 351.6,151.975 349.943,151.975 L274.426,151.975 z'/>";xamlString+=
"<TextBlock Width='228' Height='50' Canvas.Left='35' Canvas.Top='60' Foreground='Black' TextWrapping='Wrap' FontFamily='Verdana' FontSize='16' >";xamlString+="Thank you for bringing";xamlString+="<LineBreak/>";xamlString+="this to our attention!";xamlString+="</TextBlock>";xamlString+="<Rectangle Name='closeBox' Canvas.Left='235' Canvas.Top='5' Width='17' Height='17' RadiusX='2.5' RadiusY='2.5' Stretch='Fill' StrokeThickness='0.999837' StrokeLineJoin='Round' Stroke='#FF230FD2' />";xamlString+="<Path Name='closeCross' Width='10' Height='10' Canvas.Left='238.5' Canvas.Top='8.55' Stretch='Fill' Fill='#FF301CD9' Data='F1 M 340.944,34.5802L 337.41,31.0452L 335.996,32.4592L 339.53,35.9941L 335.996,39.5291L 337.41,40.9431L 340.944,37.4081L 344.479,40.9431L 345.893,39.5291L 342.358,35.9941L 345.893,32.4592L 344.479,31.0452L 340.944,34.5802 Z '/>";
xamlString+="</Canvas>";var newBubble=plugin.content.createFromXAML(xamlString);var closeBubble=newBubble.findName("closeBox");new button(newBubble,closeBubble,"#FFF8F8F8","#FFF0F0F0",clickXonBubble);return newBubble}function reportError(sender,args){closeBubble();bubble=thankYouBubble();showBubble=true;fullCampgroundView()}function mouseOverBubble(sender,args){var bbBox=sender.findName("bubbleBox");bbBox.fill="#FFFFFFFF"}
function mouseLeaveBubble(sender,args){var bbBox=sender.findName("bubbleBox");bbBox.fill="#BFFFFFFF"}function clickXonBubble(sender,args){closeBubble()}function closeBubble(){if(plugin){var bubbleCanvas=plugin.content.findName("MapBubble");var siteBubble=bubbleCanvas.findName("CampsiteBubble");try{if(siteBubble!=null)bubbleCanvas.children.remove(siteBubble)}catch(exception){alert("closeBubble: "+exception.message)}}}
function getXMLEncoded(txt){if(txt){txt=txt.replace("&","&amp;");txt=txt.replace("<","&lt;");txt=txt.replace(">","&gt;");txt=txt.replace('"',"&quot;");txt=txt.replace("'","&apos;")}return txt}function errorHandler(){}
function getZoomLevel(threshold){var zSldIdx=5/6*(3/5);if(document.getElementById("viewmap")){zSldIdx=(zoomOutSliderLimit-zoomSliderPosition)/(zoomOutSliderLimit-zoomInSliderLimit);if(threshold)if(zSldIdx<threshold){zSldIdx=threshold;zoomSliderPosition=zoomOutSliderLimit-zSldIdx*(zoomOutSliderLimit-zoomInSliderLimit);slider_SetValue(plugin.content.findName("zoom_slider"),zoomSliderPosition)}}zFactIdx=zSldIdx*zSldIdx;newScale=scaleHeight+zFactIdx*(maxScaleFactor-scaleHeight);return newScale}
function displayErrorPopup(timeOutIndic){var txt1;var txt2;var txt3;var txt4;var txt5;var pos1;if(timeOutIndic){txt1="This map is taking a long time!";txt2="Would you like to keep waiting,";txt3="or switch to the Basic Map?";txt4="I&apos;ll Keep Waiting";txt5="keepWaiting";pos1=15}else{txt1="The map failed to load!";txt2="Would you like to try again,";txt3="or switch to the Basic Map?";txt4="Try Again";txt5="tryAgain";pos1=35}var xamlString="<Canvas Name='errorPopup'>";xamlString+="\t<Rectangle Width='330' Height='181' Fill='#FFE2E2E2' Stroke='#FF000000' RadiusX='5' RadiusY='5' StrokeThickness='2'/>";
xamlString+="\t<Canvas Name='"+txt5+"' Canvas.Left='15' Canvas.Top='108' Cursor='Hand'>";xamlString+="\t<Rectangle Name='"+txt5+"Rect' Width='125' Height='46' Stroke='#FF4A56D2' StrokeThickness='1' RadiusX='5' RadiusY='5'>";xamlString+="\t<Rectangle.Fill>";xamlString+="\t<LinearGradientBrush EndPoint='0.5,1' StartPoint='0.5,0'>";xamlString+="\t<GradientStop Color='#FFBDBBBB' Offset='0.857'/>";xamlString+="\t<GradientStop Color='#FFECECEC' Offset='0.103'/>";xamlString+="\t<GradientStop Color='#FFC8C8C8' Offset='0'/>";
xamlString+="\t<GradientStop Color='#FFD7D7D7' Offset='0.5'/>";xamlString+="\t<GradientStop Color='#FFBDB6B6' Offset='0.531'/>";xamlString+="\t<GradientStop Color='#FFCCCCCC' Offset='1'/>";xamlString+="\t</LinearGradientBrush>";xamlString+="\t</Rectangle.Fill>";xamlString+="\t</Rectangle>";xamlString+="\t<TextBlock Width='110' Height='20' Canvas.Left='"+pos1+"' Canvas.Top='16' Text='"+txt4+"' TextWrapping='Wrap' FontSize='12' FontFamily='Arial' FontWeight='Bold'/>";xamlString+="\t</Canvas>";xamlString+=
"\t<Canvas Name='switchToBM' Canvas.Left='155' Canvas.Top='108' Cursor='Hand'>";xamlString+="\t<Rectangle Name='switchToBMRect' Width='156' Height='46' Stroke='#FF4A56D2' StrokeThickness='1' RadiusX='5' RadiusY='5' >";xamlString+="\t<Rectangle.Fill>";xamlString+="\t<LinearGradientBrush EndPoint='0.5,1' StartPoint='0.5,0'>";xamlString+="\t<GradientStop Color='#FFBDBBBB' Offset='0.857'/>";xamlString+="\t<GradientStop Color='#FFECECEC' Offset='0.103'/>";xamlString+="\t<GradientStop Color='#FFC8C8C8' Offset='0'/>";
xamlString+="\t<GradientStop Color='#FFD7D7D7' Offset='0.5'/>";xamlString+="\t<GradientStop Color='#FFBDB6B6' Offset='0.531'/>";xamlString+="\t<GradientStop Color='#FFCCCCCC' Offset='1'/>";xamlString+="\t</LinearGradientBrush>";xamlString+="\t</Rectangle.Fill>";xamlString+="\t</Rectangle>";xamlString+="\t<TextBlock Width='137' Height='20' Canvas.Left='20' Canvas.Top='16' Text='Switch to Basic Map' TextWrapping='Wrap' FontSize='12' FontFamily='Arial' FontWeight='Bold'/>";xamlString+="\t</Canvas>";
xamlString+="\t<TextBlock Width='296' Height='94' Canvas.Left='24' Canvas.Top='25' TextWrapping='Wrap' FontFamily='Arial' FontSize='14'>";xamlString+="\t<Run FontWeight='Bold' Text='"+txt1+"'/>";xamlString+="\t<LineBreak/>";xamlString+="\t<Run Text='"+txt2+"'/>";xamlString+="\t<LineBreak/>";xamlString+="\t<Run Text='"+txt3+"'/>";xamlString+="\t</TextBlock>";xamlString+="</Canvas>";var newPopup=plugin.content.createFromXAML(xamlString);var tryAgain=newPopup.findName(txt5);var tryAgainRect=newPopup.findName(txt5+
"Rect");if(timeOutIndic)new button(tryAgain,tryAgainRect,"#FFF8F8F8","#FFF0F0F0",clickKeepWaiting);else new button(tryAgain,tryAgainRect,"#FFF8F8F8","#FFF0F0F0",clickTryAgain);var switchToBM=newPopup.findName("switchToBM");var switchToBMRect=newPopup.findName("switchToBMRect");new button(switchToBM,switchToBMRect,"#FFF8F8F8","#FFF0F0F0",clickSwitchToBM);var bubbleCanvas=plugin.content.findName("MapBubble");bubbleCanvas.children.insert(0,newPopup)}
function clickKeepWaiting(sender,eventArgs){removeErrorPopup();if(timedOut)window.setTimeout("checkDownloadTime()",loadTime)}function removeErrorPopup(){if(plugin){var bubbleCanvas=plugin.content.findName("MapBubble");var errorPopup=bubbleCanvas.findName("errorPopup");try{if(errorPopup!=null)bubbleCanvas.children.remove(errorPopup)}catch(exception){}}}
function clickTryAgain(sender,eventArgs){var pageUrl=document.URL;pageUrl=pageUrl.replaceAll("&mapSwitch=Y","");pageUrl=pageUrl.replaceAll("&reload=Y","");pageUrl+="&reload=Y";window.location=pageUrl}function clickSwitchToBM(sender,eventArgs){if(document.getElementById("switchMap")){var switchLink=document.getElementById("switchMap");window.location=switchLink.href}}
function checkDownloadTime(){if(timedOut)if(document.getElementById("viewmap"))displayErrorPopup("timedOut");else mapDownloadFailed()};function delegate(target,callback){var func=function(){callback.apply(target,arguments)};return func}String.prototype.replaceAll=function(strTarget,strSubString){var strText=this;var intIndexOfMatch=strText.indexOf(strTarget);while(intIndexOfMatch!=-1){strText=strText.replace(strTarget,strSubString);intIndexOfMatch=strText.indexOf(strTarget)}return strText};
function WheelHelper(){this.delegate=delegate(this,this.handleMouseWheel);if(window.addEventListener)window.addEventListener("DOMMouseScroll",this.delegate,false);window.onmousewheel=document.onmousewheel=this.delegate}WheelHelper.prototype.handleMouseEnter=function(event){this.shouldScroll=true};WheelHelper.prototype.handleMouseLeave=function(event){this.shouldScroll=false};WheelHelper.prototype.wheelScrolled=null;WheelHelper.prototype.delegate=null;
WheelHelper.prototype.handleMouseWheel=function(event){var delta=0;if(!event)event=window.event;if(event.wheelDelta){delta=event.wheelDelta/120;if(window.opera)delta=-delta}else if(event.detail)delta=-event.detail/3;if(delta&&this.wheelScrolled)this.wheelScrolled(delta);if(event.preventDefault)event.preventDefault();event.returnValue=false};
WheelHelper.prototype.detach=function(){if(this.delegate!=null){if(window.removeEventListener)window.removeEventListener("DOMMouseScroll",this.delegate,false);window.onmousewheel=document.onmousewheel=null;this.delegate=null}};function button(target,backgroundElement,hoverFill,mouseDownFill,clickHandler){this.target=target;this.backgroundElement=backgroundElement;this.hoverFill=hoverFill;this.mouseDownFill=mouseDownFill;this.clickHandler=clickHandler;target.addEventListener("mouseEnter",delegate(this,this.handleMouseEnter));target.addEventListener("mouseLeave",delegate(this,this.handleMouseLeave));target.addEventListener("mouseLeftButtonUp",delegate(this,this.handleMouseUp));target.addEventListener("mouseLeftButtonDown",
delegate(this,this.handleMouseDown))}button.prototype.handleMouseEnter=function(sender,eventArgs){this.oldFill=this.backgroundElement.fill;this.backgroundElement.fill=this.hoverFill};button.prototype.handleMouseLeave=function(sender,eventArgs){this.backgroundElement.fill=this.oldFill};button.prototype.handleMouseUp=function(sender,eventArgs){this.backgroundElement.fill=this.hoverFill;if(this.clickHandler)this.clickHandler(sender,eventArgs)};
button.prototype.handleMouseDown=function(sender,eventArgs){this.backgroundElement.fill=this.mouseDownFill};var fadeTip;var _tooltipBackground;var _tooltipText;
function doTooltip(sender,args){sender.findName("closeTooltip").stop();_tooltipBackground=sender.findName("tooltipBackground");_tooltipText=sender.findName("tooltipText");_timer=sender.findName("timer");_host=sender.getHost();_tooltipBackground.Opacity=1;_tooltipText.Opacity=1;var textToDisplay="";var ttbt=sender.findName(sender.Name+"ToolTip");if(ttbt)textToDisplay=ttbt.Text;else if(document.getElementById("viewmap")){var siteId=getSiteIdFromName(sender.Name);var siteIcon=sender.Name.substring(0,
sender.Name.indexOf("_"));textToDisplay="Nonspecific";if(document.getElementById("rb"+siteId))textToDisplay=document.getElementById("rb"+siteId).nextSibling.firstChild.nodeValue;else textToDisplay=sender.findName(sender.Name.replace(siteIcon,"name")).Text;var siteTypeText=sender.findName(sender.Name.replaceAll(siteIcon,"type")).Text;if(siteTypeText)textToDisplay+=", "+siteTypeText;if(sender.findName(sender.Name.replaceAll(siteIcon,"avail"))){var siteAvailText=sender.findName(sender.Name.replaceAll(siteIcon,
"avail")).Text;if(siteAvailText)textToDisplay+=", "+siteAvailText}}if(textToDisplay!=""){_tooltipText.text=textToDisplay;var textWidth=_tooltipText.ActualWidth+6;var textHeight=_tooltipText.ActualHeight;xPosition=args.getPosition(null).x;yPosition=args.getPosition(null).y;if(xPosition>_host.content.actualWidth/2){xPosition-=textWidth;if(xPosition<0)xPosition=0}else if(xPosition+textWidth>_host.content.actualWidth)xPosition=_host.content.actualWidth-textWidth;if(yPosition>_host.content.actualHeight-
(textHeight+27))yPosition=_host.content.actualHeight-(textHeight+27);_tooltipBackground["Canvas.Left"]=xPosition-3;_tooltipBackground["Canvas.Top"]=yPosition+25;_tooltipText["Canvas.Left"]=xPosition;_tooltipText["Canvas.Top"]=yPosition+27;_tooltipBackground.width=textWidth;_tooltipBackground.Visibility="Visible";_tooltipText.Visibility="Visible";_timer.begin();fadeTip=_timer.addEventListener("completed",fadeTooltip)}}
function fadeTooltip(sender,args){try{sender.findName("closeTooltip").begin();_timer.removeEventListener("completed",fadeTip)}catch(e){}}function closeTooltip(sender,args){_tooltipBackground.Visibility="Collapsed";_tooltipText.Visibility="Collapsed"}
function insertTips(sender){_root=sender;var plugin=_root.getHost();var timerFragment='<Rectangle Visibility="Collapsed" Name="timerRectangle" Width="1" Height="1" Fill="#FFFFFFff" Canvas.Left="0" Canvas.Top="0"/>';var addTimer=plugin.content.createFromXaml(timerFragment);_root.children.add(addTimer);var tooltipBackgroundFragment='<Rectangle IsHitTestVisible="False" Name="tooltipBackground" Width="450" Height="18" Fill="#FFFFFFE1" Stroke="#FF000000" Canvas.Left="8" Canvas.Top="7" Visibility="Collapsed"/>';
var addtooltipBackground=plugin.content.createFromXaml(tooltipBackgroundFragment);_root.children.add(addtooltipBackground);var tooltipTextFragment='<TextBlock IsHitTestVisible="False" Name="tooltipText" Width="450" Height="22" Canvas.Left="17" Canvas.Top="8" FontFamily="Verdana" FontSize="12" Text="TextBlock" TextWrapping="NoWrap" Visibility="Collapsed"/>';var addtooltipText=plugin.content.createFromXaml(tooltipTextFragment);_root.children.add(addtooltipText)};
