function Compass(){}
Compass.Panning=false;Compass.MaxScrollSpeed=15;Compass.Initialize=function()
{map.AttachEvent('onchangeview',Compass.OnMapChangeView);map.AttachEvent('onchangemapstyle',Compass.OnMapChangeStyle);}
Compass.MouseDown=function(args)
{var atlasCompassElement=document.getElementById('AtlasCompass');if(atlasCompassElement.setCapture)
{atlasCompassElement.setCapture();}
Compass.Panning=true;Compass.Pan(args);}
Compass.MouseMove=function(args)
{if(Compass.Panning)
{Compass.Pan(args);}}
Compass.MouseUp=function(args)
{var atlasCompassElement=document.getElementById('AtlasCompass');if(atlasCompassElement.releaseCapture)
{atlasCompassElement.releaseCapture();}
Compass.Panning=false;map.EndContinuousPan();}
Compass.OnMapChangeView=function(e)
{Compass.SetOrientation();}
Compass.OnMapChangeStyle=function(e)
{Compass.SetOrientation();}
Compass.Pan=function(e)
{if(!e)
{e=window.event;}
var atlasCompassElement=document.getElementById('AtlasCompass');var atlasCompassElementPosition=document.getElementPosition(atlasCompassElement);var mouseLocation=document.getEventLocation(e);var dx=mouseLocation.X-atlasCompassElementPosition.X-(atlasCompassElement.offsetWidth/2);var dy=mouseLocation.Y-atlasCompassElementPosition.Y-(atlasCompassElement.offsetHeight/2);dx=Math.min(Math.max(dx,-Compass.MaxScrollSpeed),Compass.MaxScrollSpeed);dy=Math.min(Math.max(dy,-Compass.MaxScrollSpeed),Compass.MaxScrollSpeed);map.StartContinuousPan(dx,dy);}
Compass.SetOrientation=function()
{var atlasCompassElement=document.getElementById('AtlasCompass');var imageUrl='url(/Start/Toolbox/Images/CompassNorth.gif)';if(map.GetMapStyle()==VEMapStyle.Birdseye||map.GetMapStyle()==VEMapStyle.BirdseyeHybrid)
{imageUrl=FreshLogicStudios.Scripts.String.Format('url(/Start/Toolbox/Images/Compass{0}.gif)',map.GetBirdseyeScene().GetOrientation());}
if(atlasCompassElement.style.backgroundImage!=imageUrl)
{atlasCompassElement.style.backgroundImage=imageUrl;}}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',Compass.Initialize));Toolbox.Panel=null;function Toolbox(){}
Toolbox.Initialize=function()
{MainMenu.Events.Add(new FreshLogicStudios.Scripts.Event('MenuResized',Toolbox.OnMenuResized));Toolbox.Panel=new Panel('Toolbox');Toolbox.Panel.SetIcon('/Start/Toolbox/Images/Toolbox.png');Toolbox.Panel.SetTitle('Toolbox');var headerHtml='';headerHtml+='<ul id="MapStyle">';headerHtml+='<li><a href="javascript:map.SetMapStyle(VEMapStyle.Shaded);" id="MapStyleRoad">Road</a></li>';headerHtml+='<li id="Satellite"><a href="javascript:map.SetMapStyle(VEMapStyle.Hybrid);" id="MapStyleAerial">Satellite</a> <img class="Caret" onclick="Toolbox.ToggleSatelliteCaretMenu();" src="/Start/Toolbox/Images/Caret.png" /><div class="CaretMenu" id="SatelliteCaretMenu"><a href="javascript:map.SetMapStyle(VEMapStyle.Aerial); Toolbox.HideCaretMenus();">Hide Labels</a><br /><a href="javascript:map.SetMapStyle(VEMapStyle.Hybrid); Toolbox.HideCaretMenus();">Show Labels</a></div></li>';headerHtml+='<li id="Birdseye"><a href="javascript:map.SetMapStyle(VEMapStyle.BirdseyeHybrid);" id="MapStyleBirdsEye">Bird\'s Eye</a> <img class="Caret" onclick="Toolbox.ToggleBirdseyeCaretMenu();" src="/Start/Toolbox/Images/Caret.png" /><div class="CaretMenu" id="BirdseyeCaretMenu"><a href="javascript:map.SetMapStyle(VEMapStyle.Birdseye); Toolbox.HideCaretMenus();">Hide Labels</a><br /><a href="javascript:map.SetMapStyle(VEMapStyle.BirdseyeHybrid); Toolbox.HideCaretMenus();">Show Labels</a></div></li>';headerHtml+='</ul>';headerHtml+='<div id="ViewOptions">';headerHtml+='<div id="AtlasCompass" class="Compass" onmousedown="Compass.MouseDown(event);" onmousemove="Compass.MouseMove(event);" onmouseup="Compass.MouseUp(event);"></div>';headerHtml+='<ul id="ZoomOptions">';headerHtml+='<li><a id="ZoomIn" href="javascript:map.ZoomIn();">Zoom In</a></li>';headerHtml+='<li><a id="ZoomOut" href="javascript:map.ZoomOut();">Zoom Out</a></li>';headerHtml+='<li id="Rotate"><a href="javascript:map.RotateClockwise();">Rotate</a></li>';headerHtml+='</ul>';headerHtml+='</div>';Toolbox.Panel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(235,100));Toolbox.Panel.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point(GetWindowWidth()-Toolbox.Panel.GetCurrentSize().Width,MainMenu.GetHeight()+20));Toolbox.Panel.SetHeaderHeight(77);Toolbox.Panel.SetHeader(headerHtml);map.AttachEvent('onchangeview',Toolbox.OnMapChangeView);map.AttachEvent('onchangemapstyle',Toolbox.OnMapChangeStyle);Toolbox.SetSelectedMapStyle(map.GetMapStyle());window.setTimeout('Toolbox.Panel.Show();',500);}
Toolbox.OnMapChangeView=function(e)
{Toolbox.SetSelectedMapStyle(map.GetMapStyle());}
Toolbox.OnMapChangeStyle=function(e)
{Toolbox.SetSelectedMapStyle(map.GetMapStyle());}
Toolbox.OnMenuResized=function()
{if(Toolbox.Panel)
{Toolbox.Panel.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point(GetWindowWidth()-Toolbox.Panel.GetCurrentSize().Width,MainMenu.GetHeight()+20));}}
Toolbox.OnWindowResized=function()
{if(Toolbox.Panel)
{Toolbox.Panel.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point(GetWindowWidth()-Toolbox.Panel.GetCurrentSize().Width,MainMenu.GetHeight()+20));}}
Toolbox.SetSelectedMapStyle=function(style)
{document.getElementById('MapStyleRoad').className='';document.getElementById('MapStyleAerial').className='';document.getElementById('MapStyleBirdsEye').className='';Toolbox.HideCaretMenus();document.getElementById('Rotate').style.display='none';document.getElementById('ZoomOptions').style.top='5px';document.getElementById('Birdseye').style.display=map.IsBirdseyeAvailable()?'block':'none';switch(style)
{case VEMapStyle.Road:{document.getElementById('MapStyleRoad').className='Selected';break;}
case VEMapStyle.Shaded:{document.getElementById('MapStyleRoad').className='Selected';break;}
case VEMapStyle.Aerial:{document.getElementById('MapStyleAerial').className='Selected';break;}
case VEMapStyle.Hybrid:{document.getElementById('MapStyleAerial').className='Selected';break;}
case VEMapStyle.Birdseye:{document.getElementById('MapStyleBirdsEye').className='Selected';document.getElementById('Rotate').style.display='block';document.getElementById('ZoomOptions').style.top='-2px';break;}
case VEMapStyle.BirdseyeHybrid:{document.getElementById('MapStyleBirdsEye').className='Selected';document.getElementById('Rotate').style.display='block';document.getElementById('ZoomOptions').style.top='-2px';break;}}
if(map.IsBirdseyeAvailable()&&map.GetMapStyle()!=VEMapStyle.Birdseye&&map.GetMapStyle()!=VEMapStyle.BirdseyeHybrid)
{Toolbox.Panel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(235,145));Toolbox.Panel.SetBody('<div id="BirdseyeMessage"><a href="javascript:map.SetMapStyle(VEMapStyle.BirdseyeHybrid);">See this location in bird\'s eye view</a></div>');}
else
{Toolbox.Panel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(235,120));Toolbox.Panel.SetBody('');}}
Toolbox.ShowSatelliteCaretMenu=function()
{Toolbox.HideCaretMenus();document.getElementById('Satellite').style.backgroundColor='#000000';document.getElementById('Satellite').style.borderColor='#484848';document.getElementById('SatelliteCaretMenu').style.display='block';}
Toolbox.HideSatelliteCaretMenu=function()
{document.getElementById('SatelliteCaretMenu').style.display='none';document.getElementById('Satellite').style.backgroundColor='transparent';document.getElementById('Satellite').style.borderColor='transparent';}
Toolbox.ToggleSatelliteCaretMenu=function()
{if(document.getElementById('SatelliteCaretMenu').style.display=='none')
{Toolbox.ShowSatelliteCaretMenu();}
else
{Toolbox.HideSatelliteCaretMenu();}}
Toolbox.ShowBirdseyeCaretMenu=function()
{Toolbox.HideCaretMenus();document.getElementById('Birdseye').style.backgroundColor='#000000';document.getElementById('Birdseye').style.borderColor='#484848';document.getElementById('BirdseyeCaretMenu').style.display='block';}
Toolbox.HideBirdseyeCaretMenu=function()
{document.getElementById('BirdseyeCaretMenu').style.display='none';document.getElementById('Birdseye').style.backgroundColor='transparent';document.getElementById('Birdseye').style.borderColor='transparent';}
Toolbox.ToggleBirdseyeCaretMenu=function()
{if(document.getElementById('BirdseyeCaretMenu').style.display=='none')
{Toolbox.ShowBirdseyeCaretMenu();}
else
{Toolbox.HideBirdseyeCaretMenu();}}
Toolbox.HideCaretMenus=function()
{Toolbox.HideSatelliteCaretMenu();Toolbox.HideBirdseyeCaretMenu();}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',Toolbox.Initialize));AddEvent(window,'resize',Toolbox.OnWindowResized);RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Search=function(what,where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var veFindResultsCache=new FreshLogicStudios.Scripts.Collections.ArrayList();var resultsPerPage=20;var self=this;this.Index=1;this.What=what||'';function ctor()
{self.Panel.SetIcon('/Start/Search/Search.png');self.Panel.SetTitle('Search');self.RenderPanelHeader();}
function OnGetSearchSuggestionComplete(results)
{if(results==self.What||results=='')
{self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('No results found.  Try <a href="javascript:map.ZoomOut(); Plugins[\'{0}\'].Refresh();">zooming out</a>.',self.GetId()));}
else
{self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('No results found.  Did you mean, <a href="javascript:Plugins[\'{0}\'].What = \'{1}\'; Plugins[\'{0}\'].Refresh();">{1}</a>?',self.GetId(),results));}}
function OnSearchComplete(veShapeLayer,veFindResults,vePlaces,hasMore)
{self.Panel.SetTitle(self.What);if(veFindResults==null)
{var view=map.GetMapView();DecodeLatLong(view.TopLeftLatLong);DecodeLatLong(view.BottomRightLatLong);WebService.GetSearchSuggestion(self.What,view.TopLeftLatLong.Latitude,view.TopLeftLatLong.Longitude,view.BottomRightLatLong.Latitude,view.BottomRightLatLong.Longitude,OnGetSearchSuggestionComplete);return;}
for(var i=0;i<veFindResults.length;i++)
{var number=(i+1)+((self.Index-1)*resultsPerPage);var title=veFindResults[i].Name;var position=veFindResults[i].LatLong.Clone();DecodeLatLong(position);var details=FreshLogicStudios.Scripts.String.Format('{0}<br />{1}',veFindResults[i].Description,veFindResults[i].Phone);var item=new FreshLogicStudios.Atlas.Item(title,details,details,position,self.Color,number);self.Items.Add(item);if(veFindResultsCache.GetCount()<number)
{veFindResultsCache.Add(veFindResults[i]);}}
var panelBodyHeader='<div class="PanelBodyHeader">';panelBodyHeader+='<div class="Summary">';panelBodyHeader+=(self.Items.GetCount()>0)?FreshLogicStudios.Scripts.String.Format('Results {0} - {1}',(self.Index-1)*resultsPerPage+1,(self.Index-1)*resultsPerPage+veFindResults.length):'';panelBodyHeader+='</div>';panelBodyHeader+='<div class="Commands">';panelBodyHeader+=(self.Index==1)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index--; Plugins[\''+self.GetId()+'\'].Refresh();">Previous</a>';panelBodyHeader+=((self.Index!=1)&&(veFindResults.length>=resultsPerPage))?' | ':'';panelBodyHeader+=(veFindResults.length<resultsPerPage)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index++; Plugins[\''+self.GetId()+'\'].Refresh();">Next</a>';panelBodyHeader+='</div>';panelBodyHeader+='</div>';self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}{1}',panelBodyHeader,FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
this.RenderPanelHeader=function()
{var html='<div class="SearchForm">';html+=FreshLogicStudios.Scripts.String.Format('<form name="SearchForm{0}" action="about:blank" method="get" target="hiddenframe" onsubmit="Plugins[\'{0}\'].What = this.What.value; Plugins[\'{0}\'].Where = this.Where.value; Plugins[\'{0}\'].BeginSearch(); return false;">',self.GetId());html+='<label>What: Business name or category</label>';html+=FreshLogicStudios.Scripts.String.Format('<input name="What" type="text" value="{0}" /><br />',self.What);html+='<label>Where: Address, city or landmark</label>';html+=FreshLogicStudios.Scripts.String.Format('<input id="Where_{0}" name="Where" type="text" value="{1}" onfocus="if(this.value == FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\']){this.value=\'\';} else{this.select();}" onblur="if(this.value==\'\'){this.value=FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\'];}" /><br />',self.GetId(),FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']);html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>';html+='</div>';self.Panel.SetHeader(html);self.Panel.SetHeaderHeight(100);}
this.Refresh=function()
{self.Panel.SetBody('Loading...');FreshLogicStudios.Atlas.Items.Clear(self.Items);self.Index=parseInt(self.Index);if(self.What=='')
{self.Items.Add(new FreshLogicStudios.Atlas.Item('',self.Where.Name,self.Where.Name,self.Where.LatLong,self.Color,''));self.EndSearch();}
else
{if(veFindResultsCache.GetCount()>=self.Index*resultsPerPage)
{var tempArrayList=veFindResultsCache.GetRange((self.Index-1)*resultsPerPage,Math.min(resultsPerPage,veFindResultsCache.GetCount()-((self.Index-1)*resultsPerPage)));OnSearchComplete(null,tempArrayList.ToArray(),null,false)}
else
{var searchTerm=(self.What=='*')?'pinpoint_highres':self.What;var searchLocation=(self.Where.Name==FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])?null:self.Where.Name;map.Find(searchTerm,searchLocation,VEFindType.Businesses,null,self.Index,resultsPerPage,false,false,false,false,OnSearchComplete);}}}
this.Search=function()
{self.Index=1;veFindResultsCache.Clear();if(self.Where.Name!=FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])
{map.Find(null,self.Where.Name,null,null,null,null,false,false,false,true,self.Refresh);}
else
{self.Refresh();}}
ctor();}
FreshLogicStudios.Atlas.Features.Search.ParseQueryString=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();if(params['ss'])
{var terms=params['ss'].split('~');var where=params['where1']||FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'];for(var i=0;i<terms.length;i++)
{var search=new FreshLogicStudios.Atlas.Features.Search(terms[i],where);if(i==0)
{search.BeginSearch();}}}
else if(params['where1'])
{new FreshLogicStudios.Atlas.Features.Search(null,params['where1']).BeginSearch();}}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',FreshLogicStudios.Atlas.Features.Search.ParseQueryString));function Help(){}
Help.Open=function()
{open('http://www.freshlogicstudios.com/Products/Atlas/Help.aspx','','');}
function Email(){}
Email.Send=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var subject='Atlas - powered by Fresh Logic Studios';var body='Atlas - powered by Fresh Logic Studios\n\n';body+=FreshLogicStudios.Scripts.String.Format('{0}://{1}/{2}',uri.GetScheme(),uri.GetAuthority(),Email.GetQueryString());var emailUri='mailto:?subject='+subject+'&body='+IOSec.EncodeUrl(body);document.location.href=emailUri;}
Email.GetQueryString=function()
{var queryString='?';queryString+=FreshLogicStudios.Scripts.String.Format('cp={0}~{1}&style={2}&lvl={3}',map.GetCenter().Latitude,map.GetCenter().Longitude,map.GetMapStyle(),map.GetZoomLevel());return queryString;}
function Directions(){}
Directions.StartPosition=undefined;Directions.EndPosition=undefined;Directions.Route=null;Directions.Pushpins=new Array();Directions.Panel=null;Directions.Clear=function()
{Directions.ClearRoute();Directions.StartPosition=undefined;Directions.EndPosition=undefined;document.getElementById('DirectionsStart').value='';document.getElementById('DirectionsEnd').value='';Directions.Route=null;}
Directions.ClearPushpins=function()
{map.RemovePushpins(Directions.Pushpins);Directions.Panel.SetBody('');}
Directions.ClearRoute=function()
{Directions.ClearPushpins();map.DeleteRoute();}
Directions.Email=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var start=(Directions.Route.StartLocation.Address==''?'Start':Directions.Route.StartLocation.Address);var end=(Directions.Route.EndLocation.Address==''?'End':Directions.Route.EndLocation.Address);var subject=FreshLogicStudios.Scripts.String.Format('Directions from {0} to {1}',start,end);var body=FreshLogicStudios.Scripts.String.Format('Atlas - powered by Fresh Logic Studios\n\n{0}://{1}/{2}',uri.GetScheme(),uri.GetAuthority(),Directions.GetQueryString());var emailUri=FreshLogicStudios.Scripts.String.Format('mailto:?subject={0}&body={1}',subject,body);document.location.href=encodeURI(emailUri);}
Directions.FindStartLocationCallback=function(veShapeLayer,veFindResults,vePlaces,hasMore)
{Directions.OnFindLocationComplete(vePlaces,'DirectionsStart');}
Directions.FindEndLocationCallback=function(veShapeLayer,veFindResults,vePlaces,hasMore)
{Directions.OnFindLocationComplete(vePlaces,'DirectionsEnd');}
Directions.GetDirections=function()
{if(map.GetMapStyle()==VEMapStyle.Birdseye)
{map.SetMapStyle(VEMapStyle.Hybrid);}
var directionsStartValue=document.getElementById('DirectionsStart').value;var directionsEndValue=document.getElementById('DirectionsEnd').value;Directions.SetStart(directionsStartValue,(directionsStartValue=='Start'?Directions.StartPosition:null));Directions.SetEnd(directionsEndValue,(directionsEndValue=='End'?Directions.EndPosition:null));Directions.GetDirectionsWorker();}
Directions.GetDirectionsWorker=function()
{if(Directions.StartPosition==undefined)
{if(document.getElementById('DirectionsStart').value!='')
{Directions.Panel.SetBody('Loading...');map.Find(null,document.getElementById('DirectionsStart').value,null,null,null,null,false,false,false,false,Directions.FindStartLocationCallback);}
else
{map.ShowMessage('Please specify a start location');}}
else if(Directions.EndPosition==undefined)
{if(document.getElementById('DirectionsEnd').value!='')
{Directions.Panel.SetBody('Loading...');map.Find(null,document.getElementById('DirectionsEnd').value,null,null,null,null,false,false,false,false,Directions.FindEndLocationCallback);}
else
{map.ShowMessage('Please specify an end location');}}
else
{var veRouteOptions=new VERouteOptions();veRouteOptions.RouteCallback=Directions.OnGetRouteComplete;veRouteOptions.RouteColor=new VEColor(153,204,0,0.7);veRouteOptions.ShowDisambiguation=false;veRouteOptions.ShowErrorMessages=false;veRouteOptions.UseMWS=true;Directions.Panel.SetBody('Loading...');map.GetRoute(Directions.StartPosition,Directions.EndPosition,null,null,Directions.OnGetRouteComplete);}}
Directions.GetQueryString=function()
{var queryString='?rtp=';if(Directions.Route.StartLocation.Address==''||Directions.Route.StartLocation.Address=='Start')
{queryString+='pos.'+Directions.Route.StartLocation.LatLong.Latitude+'_'+Directions.Route.StartLocation.LatLong.Longitude+'_Start';}
else
{queryString+='adr.'+encodeURIComponent(Directions.Route.StartLocation.Address);}
queryString+='~';if(Directions.Route.EndLocation.Address==''||Directions.Route.EndLocation.Address=='End')
{queryString+='pos.'+Directions.Route.EndLocation.LatLong.Latitude+'_'+Directions.Route.EndLocation.LatLong.Longitude+'_End';}
else
{queryString+='adr.'+encodeURIComponent(Directions.Route.EndLocation.Address);}
return queryString;}
Directions.Initialize=function()
{Directions.ContextMenus=new ContextMenuCollection();InitializeSidebarPanel();InitializeQueryString();function InitializeQueryString()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();if(params['rtp'])
{Directions.ShowPanel();var waypoints=params['rtp'].split('~');if(waypoints[0])
{if(waypoints[0].search('\\badr.')==0)
{Directions.SetStart(waypoints[0].replace('adr.',''));}
else if(waypoints[0].search('\\bpos.')==0)
{var startPosition=waypoints[0].replace('pos.','').split('_');Directions.SetStart('Start',new VELatLong(startPosition[0],startPosition[1]));}}
if(waypoints[1])
{if(waypoints[1].search('\\badr.')==0)
{Directions.SetEnd(waypoints[1].replace('adr.',''));}
else if(waypoints[1].search('\\bpos.')==0)
{var endPosition=waypoints[1].replace('pos.','').split('_');Directions.SetEnd('End',new VELatLong(endPosition[0],endPosition[1]));}
Directions.GetDirectionsWorker();}}}
function InitializeSidebarPanel()
{var html='<div id="DirectionsForm"><form name="DirectionsForm" action="about:blank" method="get" target="hiddenframe" onsubmit="Directions.GetDirections(); return false;">';html+='<label>From</label>';html+='<input id="DirectionsStart" type="text" name="DirectionsStart" onchanged="Directions.OnStartChanged();" /><br />';html+='<label>To</label>';html+='<input id="DirectionsEnd" type="text" name="DirectionsEnd" onchanged="Directions.OnEndChanged();" /><br />';html+='<button class="Button" type="submit" name="submit" value="Get Directions">Get Directions</button>';html+='</form></div>';Directions.Panel=new Panel('_Directions');Directions.Panel.SetIcon('/Start/Directions/Images/Directions.png');Directions.Panel.SetTitle('Directions');Directions.Panel.SetHeader(html);Directions.Panel.SetHeaderHeight(100);Directions.Panel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(250,'auto'));Directions.Panel.Minimize(false);Directions.Panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',Directions.OnPanelClosed));}}
Directions.OnEndChanged=function()
{Directions.SetEnd(document.getElementById('DirectionsEnd').value,undefined);Directions.Panel.SetBody('');}
Directions.OnFindLocationComplete=function(results,addressId)
{if(results.length==1)
{if(addressId=='DirectionsStart')
{Directions.SetStart(null,new VELatLong(results[0].LatLong.Latitude,results[0].LatLong.Longitude));}
else
{Directions.SetEnd(null,new VELatLong(results[0].LatLong.Latitude,results[0].LatLong.Longitude));}
Directions.GetDirectionsWorker();}
else if(results.length>1)
{var panelBodyHtml='<div class="PanelBodyHeader">';panelBodyHtml+='<div class="Summary">';panelBodyHtml+='Did you mean?';panelBodyHtml+='</div>';panelBodyHtml+='</div>';panelBodyHtml+='<ol class="AmbiguousPlaces">';for(var i=0;i<results.length;i++)
{panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<li><a href="javascript:Directions.UpdateAddressFromAmbiguousPanel(\'{0}\', \'{1}\', new VELatLong({2}, {3}));">{4}</a></li>',addressId,results[i].Name.replace(/\'/g,'\\\''),results[i].LatLong.Latitude,results[i].LatLong.Longitude,results[i].Name);}
panelBodyHtml+='</ol>';Directions.Panel.SetBody(panelBodyHtml);}}
Directions.OnGetRouteComplete=function(args)
{Directions.Route=args;Directions.Route.StartLocation.Address=(document.getElementById('DirectionsStart').value=='Start'||document.getElementById('DirectionsStart').value=='')?'':document.getElementById('DirectionsStart').value;Directions.Route.EndLocation.Address=(document.getElementById('DirectionsEnd').value=='Start'||document.getElementById('DirectionsEnd').value=='')?'':document.getElementById('DirectionsEnd').value;Directions.ClearPushpins();map.m_vedirectionsmanager.RemoveRoutePins();for(var i=0;i<Directions.Route.Itinerary.Segments.length;i++)
{Directions.Route.Itinerary.Segments[i].Step=i+1;}
var panelBodyHtml='<div class="PanelBodyHeader">';panelBodyHtml+='<div class="Summary">';panelBodyHtml+='Total distance:<span id="DirectionsTotalDistance">'+Directions.Route.Itinerary.Distance+' '+Directions.Route.Itinerary.DistanceUnit+'</span><br />';panelBodyHtml+='Estimated time:<span id="DirectionsEstimatedTime">'+Directions.Route.Itinerary.Time.toLowerCase()+'</span>';panelBodyHtml+='</div>';panelBodyHtml+='<div class="Commands"><a href="javascript:Directions.Clear();">Clear</a> | <a href="javascript:Directions.Email();">Email</a> | <a href="javascript:Directions.Print();">Print</a> | <a href="javascript:Directions.Reverse();">Reverse</a></div>';panelBodyHtml+='</div>';panelBodyHtml+='<ul id="DirectionsInstructions">';for(var i=0;i<Directions.Route.Itinerary.Segments.length;i++)
{var routeSegment=Directions.Route.Itinerary.Segments[i];var pushpinId=FreshLogicStudios.Scripts.Guid.NewGuid();var pushpinImage=FreshLogicStudios.Scripts.String.Format('/Pushpin/Image.ashx?Color={0}&Text={1}','Blue',routeSegment.Step);var title='';var details='';if(routeSegment.Step==1)
{routeSegment.Instruction='Depart from '+(Directions.Route.StartLocation.Address==''?'Start':Directions.Route.StartLocation.Address);pushpinImage='/Start/Directions/Images/Start.png';title='Start';details='<div>'+routeSegment.Instruction+'</div>';}
else if(routeSegment.Step==Directions.Route.Itinerary.Segments.length)
{routeSegment.Instruction='Arrive at '+(Directions.Route.EndLocation.Address==''?'End':Directions.Route.EndLocation.Address);pushpinImage='/Start/Directions/Images/End.png';title='End';details='<div>'+routeSegment.Instruction+'</div>';}
else
{var distance=routeSegment.Distance?'<div class="InstructionDistance">'+routeSegment.Distance+'<br /><span class="InstructionUnit">'+Directions.Route.Itinerary.DistanceUnit+'</span></div>':'';title='Step '+routeSegment.Step+' of '+Directions.Route.Itinerary.Segments.length;details='<div class="Instruction">'+routeSegment.Instruction+'</div>'+distance;}
panelBodyHtml+='<li class="PanelItem">';panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<a href="javascript:Pushpin.ShowContextMenu(\'{1}\'); Pushpin.Center(\'{1}\');"><img class="PanelPushpin" src="{0}" /></a>',pushpinImage,pushpinId);panelBodyHtml+='<div class="PanelItemDetail">';panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<a class="DetailTitle" href="javascript:Pushpin.ShowContextMenu(\'{0}\'); Pushpin.Center(\'{0}\');">{1}</a>',pushpinId,title);panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<div class="DetailContent">{0}</div>',details);panelBodyHtml+='</div>';panelBodyHtml+='</li>';var pushpin=new VEPushpin(pushpinId,new VELatLong(routeSegment.LatLong.Latitude,routeSegment.LatLong.Longitude),pushpinImage,title,details,'AtlasPushpin');map.AddAtlasPushpin(pushpin);Directions.Pushpins.push(pushpin);}
panelBodyHtml+='</ul>';Directions.Panel.SetBody(panelBodyHtml);}
Directions.OnPanelClosed=function()
{Directions.Clear();}
Directions.OnStartChanged=function()
{Directions.SetStart(document.getElementById('DirectionsStart').value,undefined);Directions.Panel.SetBody('');}
Directions.Print=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var printUri=FreshLogicStudios.Scripts.String.Format('{0}://{1}/Start/Directions/Print.aspx{2}',uri.GetScheme(),uri.GetAuthority(),Directions.GetQueryString());open(printUri,'','');}
Directions.Reverse=function()
{Directions.ClearRoute();var temp=(document.getElementById('DirectionsStart').value=='Start')?'End':document.getElementById('DirectionsStart').value;document.getElementById('DirectionsStart').value=(document.getElementById('DirectionsEnd').value=='End')?'Start':document.getElementById('DirectionsEnd').value;document.getElementById('DirectionsEnd').value=temp;var tempPosition=Directions.StartPosition;Directions.StartPosition=Directions.EndPosition;Directions.EndPosition=tempPosition;if(Directions.Route)
{Directions.GetDirections();}}
Directions.SetEnd=function(address,position)
{Directions.ClearRoute();if(address)
{document.getElementById('DirectionsEnd').value=address;}
if(position)
{Directions.EndPosition=position.Clone();var pushpin=new VEPushpin(FreshLogicStudios.Scripts.Guid.NewGuid(),Directions.EndPosition,'/Start/Directions/Images/End.png','End','Arrive at End','');map.AddAtlasPushpin(pushpin);Directions.Pushpins.push(pushpin);}
else
{Directions.EndPosition=undefined;}
if(Directions.StartPosition!=undefined)
{var pushpin=new VEPushpin(FreshLogicStudios.Scripts.Guid.NewGuid(),Directions.StartPosition,'/Start/Directions/Images/Start.png','Start','Depart from Start','');map.AddAtlasPushpin(pushpin);Directions.Pushpins.push(pushpin);}}
Directions.SetStart=function(address,position)
{Directions.ClearRoute();if(address)
{document.getElementById('DirectionsStart').value=address;}
if(position)
{Directions.StartPosition=position.Clone();var pushpin=new VEPushpin(FreshLogicStudios.Scripts.Guid.NewGuid(),Directions.StartPosition,'/Start/Directions/Images/Start.png','Start','Depart from Start','');map.AddAtlasPushpin(pushpin);Directions.Pushpins.push(pushpin);}
else
{Directions.StartPosition=undefined;}
if(Directions.EndPosition!=undefined)
{var pushpin=new VEPushpin(FreshLogicStudios.Scripts.Guid.NewGuid(),Directions.EndPosition,'/Start/Directions/Images/End.png','End','Arrive at End','');map.AddAtlasPushpin(pushpin);Directions.Pushpins.push(pushpin);}}
Directions.ShowPanel=function()
{if(Sidebar.Contains('_Directions'))
{Directions.Panel.Maximize(true);}
else
{Sidebar.Add(Directions.Panel);}}
Directions.UpdateAddressFromAmbiguousPanel=function(addressId,address,position)
{if(addressId=='DirectionsStart')
{Directions.SetStart(address,position);}
else
{Directions.SetEnd(address,position);}
Directions.GetDirectionsWorker();}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',Directions.Initialize));function Details(){}
Details.Address=null;Details.Items=new FreshLogicStudios.Scripts.Collections.ArrayList();Details.Position=undefined;Details.Panel=null;Details.Clear=function()
{FreshLogicStudios.Atlas.Items.Clear(Details.Items);Details.Panel.SetBody('');Details.Address=null;}
Details.Initialize=function()
{var html='<div>';html+='<form name="DetailsForm" action="about:blank" method="get" target="hiddenframe" onsubmit="Details.Search(this.Where.value); return false;">';html+='<label>Where: Address, city or landmark</label>';html+='<input type="text" name="Where" value="'+FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']+'" onfocus="if(this.value == FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\']){this.value=\'\';} else{this.select();}" onblur="if(this.value==\'\'){this.value=FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\'];}" /><br />';html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>'
html+='</div>';Details.Panel=new Panel('_Details');Details.Panel.SetIcon('/Start/Details/Details.png');Details.Panel.SetTitle('Details');Details.Panel.SetHeader(html);Details.Panel.SetHeaderHeight(60);Details.Panel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(250,'auto'));Details.Panel.Minimize(false);Details.Panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',Details.Clear));}
Details.OnGetAmbiguousPlacesComplete=function(results)
{if(results.length==1)
{Details.Address=results[0].Address;Details.Search(new VELatLong(results[0].Position.Latitude,results[0].Position.Longitude));}
else
{var panelBodyHtml='<div class="PanelBodyHeader">';panelBodyHtml+='<div class="Summary">'
panelBodyHtml+='Did you mean?'
panelBodyHtml+='</div>';panelBodyHtml+='</div>';panelBodyHtml+='<ul>';for(var i=0;i<results.length;i++)
{panelBodyHtml+='<li><a href="#" onclick="document.DetailsForm.Where.value = \''+results[i].Address.replace(/\'/g,'\\\'')+'\'; Details.Search(new VELatLong('+results[i].Position.Latitude+','+results[i].Position.Longitude+')); return false;">'+results[i].Address+'</a></li>';}
panelBodyHtml+='</ul>';Details.Panel.SetBody(panelBodyHtml);}}
Details.OnReverseGeocodeComplete=function(results)
{document.DetailsForm.Where.value=results;var details=FreshLogicStudios.Scripts.String.Format('<br />Latitude: {0}<br />Longitude: {1}',Details.Position.Latitude,Details.Position.Longitude);var item=new FreshLogicStudios.Atlas.Item(results,details,details,Details.Position,Pushpin.GetNextColor(),1);Details.Items.Add(item);item.ShowPushpin();item.ShowContextMenu();item.Center();Details.Panel.SetBody(FreshLogicStudios.Atlas.Items.GetSidebarHtml(Details.Items));}
Details.Populate=function(where)
{var address=Details.Address;Details.Clear();Details.Position=where;if(Details.Position!=undefined)
{Details.Panel.SetBody('Loading...');if(!address)
{WebService.ReverseGeocode(Details.Position.Latitude,Details.Position.Longitude,Details.OnReverseGeocodeComplete);}
else
{Details.OnReverseGeocodeComplete(address);}}}
Details.Search=function(where)
{if(typeof(where)=='string')
{document.DetailsForm.Where.value=where;if(where==FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])
{Details.Populate(map.GetCenter());}
else
{WebService.GetAmbiguousPlaces(where,Details.OnGetAmbiguousPlacesComplete);}}
else
{Details.Populate(where);}}
Details.ShowPanel=function()
{if(Sidebar.Contains('_Details'))
{Details.Panel.Maximize(true);}
else
{if(Details.Panel==null)
{Details.Initialize();}
Sidebar.Add(Details.Panel);}}
function Gps(){}
Gps.Panel=null;Gps.Color=null;Gps.GpsDeviceIdToFollow=null;Gps.CenterOnDeviceToFollow=function()
{if(Gps.GpsDeviceIdToFollow)
{var myGpsDevice=GpsDeviceCollection.GpsDevices[GpsDeviceCollection.IndexOf(Gps.GpsDeviceIdToFollow)];map.SetAnimationEnabled(false);map.SetCenter(myGpsDevice.GetPosition());map.SetAnimationEnabled(true);}}
Gps.Clear=function()
{for(var i=0;i<GpsDeviceCollection.GpsDevices.length;i++)
{if(GpsDeviceCollection.GpsDevices[i].IsContextMenuVisible())
{AtlasContextMenu.Hide();}
GpsDeviceCollection.GpsDevices[i].RemovePushpin();}}
Gps.Initialize=function()
{Gps.Color=Pushpin.GetNextColor();var header='<a href="/MyAccount/GpsDevices/">Manage GPS Devices</a>';var footer='<div><a href="http://www.freshlogicstudios.com/Products/Atlas/Mobile.aspx" target="_blank">Atlas Mobile</a></div>';footer+='Atlas Mobile enables real-time GPS tracking of your mobile device from this site.  Now available as free download.<br />';footer+='<a href="http://www.freshlogicstudios.com/Products/Atlas/Mobile.aspx" target="_blank">read more</a>';Gps.Panel=new Panel('_Gps');Gps.Panel.SetIcon('/Services/Gps/Gps.png');Gps.Panel.SetTitle('GPS');Gps.Panel.SetHeader(header);Gps.Panel.SetHeaderHeight(15);Gps.Panel.SetFooter(footer);Gps.Panel.SetFooterHeight(72);Gps.Panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',Gps.Clear));}
Gps.OnWebRequestComplete=function(response)
{if(Sidebar.Contains('_Gps'))
{if(response.get_statusCode()==200)
{var gpsDevices=response.get_xml().getElementsByTagName("GpsDevice");var positions=new Array();var gpsDeviceCollection=new Array();for(var i=0;i<gpsDevices.length;i++)
{var id=gpsDevices[i].getAttribute('Id');var name=gpsDevices[i].getAttribute('Name');var owner=gpsDevices[i].getAttribute('Owner');var gpsDeviceNotes='';try
{gpsDeviceNotes=gpsDevices[i].getElementsByTagName('Notes')[0].firstChild.data;}
catch(e){}
var location=gpsDevices[i].getElementsByTagName('Location')[0];var latitude=location.getAttribute('Latitude');var longitude=location.getAttribute('Longitude');var altitude=location.getAttribute('Altitude');var heading=location.getAttribute('Heading');var speed=location.getAttribute('Speed');var modified=location.getAttribute('Modified');var locationNotes='';try
{locationNotes=location.getElementsByTagName('Notes')[0].firstChild.data;}
catch(e){}
var myPosition=new VELatLong(latitude,longitude);positions.push(myPosition);var myGpsDevice=GpsDeviceCollection.Contains(id)?GpsDeviceCollection.GpsDevices[GpsDeviceCollection.IndexOf(id)]:new GpsDevice(id);myGpsDevice.SetName(name);myGpsDevice.SetOwner(owner);myGpsDevice.SetPosition(myPosition);myGpsDevice.SetAltitude(altitude);myGpsDevice.SetHeading(heading);myGpsDevice.SetSpeed(speed);myGpsDevice.SetModified(modified);myGpsDevice.SetIndex(i+1);myGpsDevice.SetNotes(gpsDeviceNotes+locationNotes);gpsDeviceCollection.push(myGpsDevice);}
GpsDeviceCollection.Synchronize(gpsDeviceCollection);Gps.CenterOnDeviceToFollow();if(Gps.Panel.GetBody()=='Loading...')
{if(positions.length==1)
{map.SetAnimationEnabled(false);map.SetCenter(new VELatLong(positions[0].Latitude,positions[0].Longitude));map.SetAnimationEnabled(true);}
else if(positions.length>1)
{map.SetMapView(positions);}}
Gps.Panel.SetBody(GpsDeviceCollection.GetSidebarPanelHtml());}
else
{Gps.Panel.SetBody('');map.ShowMessage(FreshLogicStudios.Scripts.String.Format('An error occured while loading data.  {0}: {1}',response.get_statusCode(),response.get_statusText()));}
window.setTimeout(Gps.Populate,1000);}
else
{GpsDeviceCollection.Synchronize(new Array());}}
Gps.Populate=function()
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url('/Services/Gps/Gps.ashx');webRequest.add_completed(Gps.OnWebRequestComplete);webRequest.invoke();}
Gps.ShowPanel=function()
{if(Sidebar.Contains('_Gps'))
{Gps.Panel.Maximize(true);}
else
{if(Gps.Panel==null)
{Gps.Initialize();}
Sidebar.Add(Gps.Panel);Gps.Panel.SetBody('Loading...');window.setTimeout(Gps.Populate,1000);}}
function GpsDevice(_id,_name,_owner,_position,_altitude,_heading,_speed,_modified,_notes)
{var altitude=_altitude;var heading=_heading;var id=_id;var index=0;var modified=_modified;var name=_name;var notes=_notes;var owner=_owner;var position=_position;var self=this;var speed=_speed;var notesVisible=false;function GetContextMenuHtml()
{return FreshLogicStudios.Scripts.String.Format('<table><tr><td class="GpsDeviceDetailsLabel">Altitude:</td><td>{0} feet</td></tr><tr><td class="GpsDeviceDetailsLabel">Heading:</td><td>{1} degrees</td></tr><tr><td class="GpsDeviceDetailsLabel">Speed:</td><td>{2} mph</td></tr><tr><td class="GpsDeviceDetailsLabel">Updated:</td><td>{3}<br />{4} {5}</td></tr></table>',altitude,heading,speed,modified.split(' ')[0],modified.split(' ')[1],modified.split(' ')[2]);}
function GetDetailsHtml()
{var notesHtml=GetNotesHtml();var sideBarPanelHtml=FreshLogicStudios.Scripts.String.Format('<div class="Logo"><img src="https://account.freshlogicstudios.com/Image.ashx?Email={0}" /></div>',owner);sideBarPanelHtml='<div class="GpsDeviceOptions">';if(notesHtml!='')
{sideBarPanelHtml+=FreshLogicStudios.Scripts.String.Format('<a href="javascript:GpsDeviceCollection.GpsDevices[GpsDeviceCollection.IndexOf(\'{0}\')].ToggleNotes();" id="{0}_ToggleNotesLink">{1}</a> | ',id,notesVisible?'hide notes':'notes');}
if(id!=Gps.GpsDeviceIdToFollow)
{sideBarPanelHtml+='<a href="#" onclick="this.innerHTML = \'stop following\'; Gps.GpsDeviceIdToFollow = \''+id+'\'; return false;">start following</a>';}
else
{sideBarPanelHtml+='<a href="#" onclick="this.innerHTML = \'start following\'; Gps.GpsDeviceIdToFollow = null; return false;">stop following</a>';}
sideBarPanelHtml+='</div>';return sideBarPanelHtml+'<table id="'+(id+'_Location')+'" style="display:'+(notesVisible?'none':'block')+';"><tr><td class="GpsDeviceDetailsLabel">Altitude:</td><td>'+altitude+' feet</td></tr><tr><td class="GpsDeviceDetailsLabel">Heading:</td><td>'+heading+' degrees</td></tr><tr><td class="GpsDeviceDetailsLabel">Speed:</td><td>'+speed+' mph</td></tr><tr><td class="GpsDeviceDetailsLabel">Updated:</td><td>'+modified.split(' ')[0]+'<br />'+modified.split(' ')[1]+' '+modified.split(' ')[2]+'</td></tr></table>'+notesHtml;}
function GetNotesHtml()
{if(notes&&notes!='')
{return'<div id="'+(id+'_Notes')+'" style="display:'+(notesVisible?'block':'none')+';">'+notes+'</div>';}
return'';}
this.AddPushpin=function()
{var pushpinImage=FreshLogicStudios.Scripts.String.Format('/Pushpin/Image.ashx?Color={0}&Text={1}',Gps.Color,index);var pushpin=new VEPushpin(id,new VELatLong(position.Latitude,position.Longitude),pushpinImage,name,GetContextMenuHtml(),'AtlasPushpin');var isContextMenuVisible=this.IsContextMenuVisible();this.RemovePushpin();map.AddAtlasPushpin(pushpin);if(isContextMenuVisible)
{Pushpin.ShowContextMenu(pushpin.ID);}}
this.GetAltitude=function()
{return altitude;}
this.GetHeading=function()
{return heading;}
this.GetId=function()
{return id;}
this.GetIndex=function()
{return index;}
this.GetName=function()
{return name;}
this.GetNotes=function()
{return notes;}
this.GetOwner=function()
{return owner;}
this.GetPosition=function()
{return position;}
this.GetSidebarPanelHtml=function()
{var pushpinImage=FreshLogicStudios.Scripts.String.Format('/Pushpin/Image.ashx?Color={0}&Text={1}',Gps.Color,index);var panelBodyHtml='<li class="PanelItem">';panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<a href="javascript:Pushpin.ShowContextMenu(\'{1}\'); Pushpin.Center(\'{1}\');"><img class="PanelPushpin" src="{0}" /></a>',pushpinImage,id);panelBodyHtml+='<div class="PanelItemDetail">';panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<a class="DetailTitle" href="javascript:Pushpin.ShowContextMenu(\'{0}\'); Pushpin.Center(\'{0}\');">{1}</a>',id,name);panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<div class="DetailContent">{0}</div>',GetDetailsHtml());panelBodyHtml+='</div>';panelBodyHtml+='</li>';return panelBodyHtml;}
this.GetSpeed=function()
{return speed;}
this.GetModified=function()
{return modified;}
this.IsContextMenuVisible=function()
{return(CurrentPushpin!=null&&CurrentPushpin.ID==id&&AtlasContextMenu.IsVisible());}
this.RemovePushpin=function()
{try
{map.DeletePushpin(id);}
catch(e)
{}}
this.SetAltitude=function(_altitude)
{altitude=_altitude;}
this.SetHeading=function(_heading)
{heading=_heading;}
this.SetIndex=function(_index)
{index=_index;}
this.SetModified=function(_modified)
{modified=_modified;}
this.SetName=function(_name)
{name=_name;}
this.SetNotes=function(_notes)
{notes=_notes;}
this.SetOwner=function(_owner)
{owner=_owner;}
this.SetPosition=function(_position)
{position=_position;}
this.SetSpeed=function(_speed)
{speed=_speed;}
this.ToggleNotes=function()
{if(!notesVisible)
{document.getElementById(id+'_ToggleNotesLink').innerHTML='hide notes';document.getElementById(id+'_Location').style.display='none';document.getElementById(id+'_Notes').style.display='block';}
else
{document.getElementById(id+'_ToggleNotesLink').innerHTML='notes';document.getElementById(id+'_Notes').style.display='none';document.getElementById(id+'_Location').style.display='block';}
notesVisible=!notesVisible;}
this.UpdatePushpin=function()
{self.AddPushpin();}}
function GpsDeviceCollection(){}
GpsDeviceCollection.GpsDevices=new Array();GpsDeviceCollection.GpsDeviceIdToFollow=null;GpsDeviceCollection.Add=function(gpsDevice)
{GpsDeviceCollection.GpsDevices.push(gpsDevice);}
GpsDeviceCollection.Contains=function(id)
{for(var i=0;i<GpsDeviceCollection.GpsDevices.length;i++)
{if(GpsDeviceCollection.GpsDevices[i].GetId()==id)
{return true;}}
return false;}
GpsDeviceCollection.IndexOf=function(id)
{for(var i=0;i<GpsDeviceCollection.GpsDevices.length;i++)
{if(GpsDeviceCollection.GpsDevices[i].GetId()==id)
{return i;}}
return-1;}
GpsDeviceCollection.Remove=function(gpsDevice)
{for(var i=GpsDeviceCollection.GpsDevices.length-1;i>=0;i--)
{if(GpsDeviceCollection.GpsDevices[i].GetId()==gpsDevice.GetId())
{GpsDeviceCollection.GpsDevices.splice(i,1);}}}
GpsDeviceCollection.Synchronize=function(gpsDevices)
{for(var i=0;i<gpsDevices.length;i++)
{if(GpsDeviceCollection.Contains(gpsDevices[i].GetId()))
{GpsDeviceCollection.GpsDevices[GpsDeviceCollection.IndexOf(gpsDevices[i].GetId())]=gpsDevices[i];}
else
{GpsDeviceCollection.Add(gpsDevices[i]);}
gpsDevices[i].UpdatePushpin();}
for(var i=0;i<GpsDeviceCollection.GpsDevices.length;i++)
{var exists=false;for(var j=0;j<gpsDevices.length;j++)
{if(GpsDeviceCollection.GpsDevices[i].GetId()==gpsDevices[j].GetId())
{exists=true;break;}}
if(!exists)
{GpsDeviceCollection.GpsDevices[i].RemovePushpin();GpsDeviceCollection.Remove(GpsDeviceCollection.GpsDevices[i]);}}}
GpsDeviceCollection.GetSidebarPanelHtml=function()
{if(GpsDeviceCollection.GpsDevices.length==0)
{return"You currently have no GPS devices added to your account or your GPS devices haven't reported any locations yet.";}
var sidebarPanelHtml='<ul>';for(var i=0;i<GpsDeviceCollection.GpsDevices.length;i++)
{sidebarPanelHtml+=GpsDeviceCollection.GpsDevices[i].GetSidebarPanelHtml();}
sidebarPanelHtml+='</ul>';return sidebarPanelHtml;}
RegisterNamespace('FreshLogicStudios.Atlas.Services');FreshLogicStudios.Atlas.Services.Friends=function()
{FreshLogicStudios.Atlas.Plugin.call(this);var self=this;function ctor()
{self.Panel.SetIcon('/Services/Friends/Friends.png');self.Panel.SetTitle('Friends');self.RenderPanelHeader();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var items=response.get_xml().getElementsByTagName('item');var points=new Array();for(var i=0;i<items.length;i++)
{var description=(items[i].getElementsByTagName('description')[0].firstChild)?items[i].getElementsByTagName('description')[0].firstChild.data:'';var title=(items[i].getElementsByTagName('title')[0].firstChild)?items[i].getElementsByTagName('title')[0].firstChild.data:'';var latitude=null;var longitude=null;if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('georss:point').length>0)
{try
{var point=items[i].getElementsByTagName('georss:point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('point').length>0)
{try
{var point=items[i].getElementsByTagName('point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{continue;}
var position=new VELatLong(parseFloat(latitude),parseFloat(longitude));var item=new FreshLogicStudios.Atlas.Item(title,description,description,position,self.Color,self.Items.GetCount()+1);self.Items.Add(item);points.push(position);}
self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}',FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
else
{self.EndSearch();}}
this.RenderPanelHeader=function()
{self.Panel.SetHeader('');self.Panel.SetHeaderHeight(1);}
this.Search=function()
{self.Clear();self.Panel.SetBody('Loading...');var webRequest=new Sys.Net.WebRequest();webRequest.set_url('/Services/Friends/Friends.ashx');webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
ctor();}
var map=null;var Sidebar=null;var AtlasContextMenu=null;var CurrentPushpin=null;var MainMenu=null;var Plugins=[];function DecodeLatLong(veLatLong)
{if(veLatLong._reserved&&(!veLatLong.Latitude||!veLatLong.Longitude))
{var tempLatLong=new _xz1().Decode(veLatLong._reserved);veLatLong.Latitude=tempLatLong[0];veLatLong.Longitude=tempLatLong[1];tempLatLong=null;}}
function Main()
{try
{Lat49.initAds('4','http://atlas.freshlogicstudios.com/iepngfix.htc');}
catch(e)
{}
Sidebar=new PanelCollection();FreshLogicStudios.Scripts.Configuration.Settings.Load();InitializeQueryString();InitializeMenu();document.getElementById('Map').style.height=GetWindowHeight()-1+'px';document.getElementById('Map').style.width=GetWindowWidth()-1+'px';map=new VEMap('Map');map.onLoadMap=map_Loaded;map.GetCenter=function()
{return new VELatLong(this.vemapcontrol.GetCenterLatitude(),this.vemapcontrol.GetCenterLongitude());}
map.PixelToLatLong=function(vePixel)
{var tempLatLong=this.vemapcontrol.PixelToLatLong(vePixel);var encodedLatLong=new VELatLongFactory(new VELatLongFactoryAlwaysEncodeSpec()).CreateVELatLong(tempLatLong.latitude,tempLatLong.longitude);var latLong=new VELatLong(tempLatLong.latitude,tempLatLong.longitude);latLong._reserved=encodedLatLong._reserved;return latLong;}
try
{map.LoadMap(new VELatLong(FreshLogicStudios.Scripts.Configuration.Settings['Latitude'],FreshLogicStudios.Scripts.Configuration.Settings['Longitude']),FreshLogicStudios.Scripts.Configuration.Settings['MapZoomLevel'],FreshLogicStudios.Scripts.Configuration.Settings['MapStyle'],false);}
catch(e)
{map.LoadMap();}
AtlasContextMenu=new ContextMenu('AtlasContextMenu','Options',null,'',new VELatLong(0.0,0.0));map.AttachEvent('onchangemapstyle',map_OnChangeMapStyle);map.AttachEvent('onchangeview',map_OnChangeView);map.AttachEvent('onclick',map_OnClick);}
function InitializeQueryString()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();if(params['cp'])
{FreshLogicStudios.Scripts.Configuration.Settings['Latitude']=params['cp'].split('~')[0];FreshLogicStudios.Scripts.Configuration.Settings['Longitude']=params['cp'].split('~')[1];}
FreshLogicStudios.Scripts.Configuration.Settings['MapStyle']=params['style']||FreshLogicStudios.Scripts.Configuration.Settings['MapStyle'];FreshLogicStudios.Scripts.Configuration.Settings['MapZoomLevel']=params['lvl']||FreshLogicStudios.Scripts.Configuration.Settings['MapZoomLevel'];}
function InitializeMenu()
{MainMenu=new Menu();var menuElements=document.getElementById('Menu').getElementsByTagName('div');for(var i=0;i<menuElements.length;i++)
{if(menuElements[i].className=='MenuItem')
{MainMenu.Add(new MenuItem(menuElements[i].id));}}
MainMenu.Events.Add(new FreshLogicStudios.Scripts.Event('MenuResized',OnMenuResized));}
function Resize()
{if(map)
{map.Resize(GetWindowWidth(),GetWindowHeight());}
Sidebar.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(250,GetWindowHeight()-MainMenu.GetHeight()-40));Sidebar.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point(20,MainMenu.GetHeight()+20));}
function map_OnChangeMapStyle(e)
{if(map.GetMapStyle()==VEMapStyle.Road)
{map.SetMapStyle(VEMapStyle.Shaded);}}
function map_OnChangeView(e)
{FreshLogicStudios.Scripts.Configuration.Settings['Latitude']=map.GetCenter().Latitude;FreshLogicStudios.Scripts.Configuration.Settings['Longitude']=map.GetCenter().Longitude;FreshLogicStudios.Scripts.Configuration.Settings['MapStyle']=map.GetMapStyle();FreshLogicStudios.Scripts.Configuration.Settings['MapZoomLevel']=map.GetZoomLevel();UpdateAdvertisements();}
function map_OnClick(e)
{if(e.rightMouseButton||e.ctrlKey)
{map_OnRightClick(e);}
if(CurrentPushpin==null&&window.event.button!=''&&window.event.button!=2)
{AtlasContextMenu.Hide();}}
function map_OnRightClick(e)
{var position=e.latLong||map.PixelToLatLong(new VEPixel(e.mapX,e.mapY));AtlasContextMenu.SetTitle('Options');AtlasContextMenu.SetBody('');AtlasContextMenu.SetLocation(position);AtlasContextMenu.SetSize(Panel.DefaultSize);AtlasContextMenu.Show();CurrentPushpin=null;}
function map_Loaded(e)
{map.onLoadMap=null;map.HideDashboard();UpdateAdvertisements();Events.Fire('MapLoaded');}
function OnMenuResized()
{Sidebar.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(250,GetWindowHeight()-MainMenu.GetHeight()-40));Sidebar.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point(20,MainMenu.GetHeight()+20));}
function UpdateAdvertisements()
{try
{Lat49.updateAdByLatLon('Advertisements',map.GetCenter().Latitude,map.GetCenter().Longitude,Lat49.Tile.convertLiveZoom(map.GetZoomLevel()));}
catch(e)
{}}
AddEvent(window,'load',Main);AddEvent(window,'load',FreshLogicStudios.Scripts.Drawing.Image.FixBackgroundImages);AddEvent(window,'unload',FreshLogicStudios.Scripts.Configuration.Settings.Save);AddEvent(window,'resize',Resize);var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}
else if(dataProp)
return data[i].identity;}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();document.getElementPosition=function(element)
{var x=0;var y=0;var topOffset=0;var leftOffset=0;if(BrowserDetect.browser=='Safari')
{do
{y+=element.offsetTop||0;x+=element.offsetLeft||0;if(element.offsetParent&&element.offsetParent==document.body)
{if(document.getElementStyle(element,'position')=='absolute')
{break;}}
element=element.offsetParent;}
while(element);return new FreshLogicStudios.Scripts.Drawing.Point(x,y);}
else
{if(element.offsetParent)
{x=element.offsetLeft;y=element.offsetTop;while(element=element.offsetParent)
{x+=element.offsetLeft;y+=element.offsetTop;}}
return new FreshLogicStudios.Scripts.Drawing.Point(x-leftOffset,y);}}
document.getElementsByClassName=function(className)
{var children=document.getElementsByTagName('*')||document.all;var elements=new Array();for(var i=0;i<children.length;i++)
{var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++)
{if(classNames[j]==className)
{elements.push(child);break;}}}
return elements;}
document.getElementStyle=function(element,property)
{var value='';if(document.defaultView&&document.defaultView.getComputedStyle)
{value=document.defaultView.getComputedStyle(element,'').getPropertyValue(property);}
else if(element.currentStyle)
{property=property.replace(/-(w)/g,function(strMatch,p1){return p1.toUpperCase();});value=element.currentStyle[property];}
return value;}
document.getEventLocation=function(e)
{var x=0;var y=0;try
{if(e.pageX||e.pageY)
{x=e.pageX;y=e.pageY;}
else if(e.clientX||e.clientY)
{x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}}
catch(e)
{return null;}
return new FreshLogicStudios.Scripts.Drawing.Point(x,y);}
document.getXmlDocumentFromString=function(xml)
{var document=null;if(window.ActiveXObject)
{document=new ActiveXObject("Microsoft.XMLDOM");document.async="false";document.loadXML(xml);}
else
{var parser=new DOMParser();document=parser.parseFromString(xml,"text/xml");}
if(document)
{return document.documentElement;}
else
{return null;}}
document.getScrollOffsets=function()
{var scrollX=0;var scrollY=0;if(document.body&&document.body.pageXOffset)
{scrollX=Math.max(scrollX,document.body.pageXOffset);}
if(document.documentElement&&document.documentElement.scrollLeft)
{scrollX=Math.max(scrollX,document.documentElement.scrollLeft);}
if(document.body&&document.body.pageXOffset)
{scrollX=Math.max(scrollX,document.body.pageXOffset);}
if(document.body&&document.body.pageYOffset)
{scrollY=Math.max(scrollY,document.body.pageYOffset);}
if(document.documentElement&&document.documentElement.scrollTop)
{scrollY=Math.max(scrollY,document.documentElement.scrollTop);}
if(document.body&&document.body.scrollTop)
{scrollY=Math.max(scrollY,document.body.scrollTop);}
return new FreshLogicStudios.Scripts.Drawing.Size(scrollX,scrollY);}
document.SelectRange=function(element,startingIndex,length)
{if(element.createTextRange)
{var textRange=element.createTextRange();textRange.moveStart("character",startingIndex);textRange.moveEnd("character",length-element.value.length);textRange.select();}
else if(element.setSelectionRange)
{element.setSelectionRange(startingIndex,length);}
element.focus();}
RegisterNamespace("FreshLogicStudios.Atlas");FreshLogicStudios.Atlas.Item=function(title,sidebarDetails,contextMenuDetails,position,color,number)
{var id=FreshLogicStudios.Scripts.Guid.NewGuid();var pushpin=null;var self=this;this.Color=color||'Red';this.ContextMenuDetails=contextMenuDetails||'';this.Number=number||1;this.Position=position||null;this.SidebarDetails=sidebarDetails||'';this.Title=title||'';function GetPushpinImage()
{return FreshLogicStudios.Scripts.String.Format('/Pushpin/Image.ashx?Color={0}&Text={1}',color,number);}
this.Center=function()
{Pushpin.Center(id);}
this.GetPushpin=function()
{if(pushpin==null&&self.Position!=null)
{pushpin=new VEPushpin(id,self.Position,GetPushpinImage(),self.Title,self.ContextMenuDetails,'AtlasPushpin');}
return pushpin;}
this.GetSidebarHtml=function()
{var panelHtml='<li class="PanelItem">';panelHtml+=FreshLogicStudios.Scripts.String.Format('<a href="javascript:Pushpin.ShowContextMenu(\'{1}\'); Pushpin.Center(\'{1}\');"><img class="PanelPushpin" src="{0}" /></a>',GetPushpinImage(),id);panelHtml+='<div class="PanelItemDetail">';panelHtml+=FreshLogicStudios.Scripts.String.Format('<a class="DetailTitle" href="javascript:Pushpin.ShowContextMenu(\'{0}\'); Pushpin.Center(\'{0}\');">{1}</a>',id,self.Title);panelHtml+=FreshLogicStudios.Scripts.String.Format('<div class="DetailContent">{0}</div>',self.SidebarDetails);panelHtml+='</div>';panelHtml+='</li>';return panelHtml;}
this.HidePushpin=function()
{if(pushpin)
{map.RemoveAtlasPushpin(pushpin);}
pushpin=null;}
this.ShowContextMenu=function()
{Pushpin.ShowContextMenu(id);}
this.ShowPushpin=function()
{map.AddAtlasPushpin(self.GetPushpin());}}
RegisterNamespace('FreshLogicStudios.Atlas.Items');FreshLogicStudios.Atlas.Items.Clear=function(items)
{for(var i=0;i<items.GetCount();i++)
{items.GetItem(i).HidePushpin();}
items.Clear();}
FreshLogicStudios.Atlas.Items.GetSidebarHtml=function(items)
{var sidebarHtml='No results found.';if(items.GetCount()>0)
{sidebarHtml='<ul>';for(var i=0;i<items.GetCount();i++)
{sidebarHtml+=items.GetItem(i).GetSidebarHtml();}
sidebarHtml+='</ul>';}
return sidebarHtml;}
FreshLogicStudios.Atlas.Items.ZoomToFit=function(items)
{if(items.GetCount()>0)
{var positions=new Array();for(var i=0;i<items.GetCount();i++)
{positions.push(items.GetItem(i).Position);}
map.SetMapView(positions);}}
RegisterNamespace("FreshLogicStudios.Atlas");FreshLogicStudios.Atlas.Plugin=function(where)
{var id=FreshLogicStudios.Scripts.Guid.NewGuid();var self=this;this.Color=Pushpin.GetNextColor();this.Items=new FreshLogicStudios.Scripts.Collections.ArrayList();this.Panel=null;this.Places=null;this.Where=where||FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'];function ctor()
{Plugins[id]=self;self.Panel=new Panel(id);self.Panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',self.Close));self.Panel.SetFooterHeight(70);self.Panel.SetFooter('<div class="Advertisement AdvertiseHere"><h1><a href="http://lat49.com/index.php?pubid=4" target="_blank">Advertise On Atlas</a></h1><p>We\'ve partnered with Lat49 to bring geographically relevant advertising to users of Atlas.</p><a href="http://lat49.com/index.php?pubid=4" target="_blank">read more...</a></div>');Sidebar.Add(self.Panel);self.RenderPanelHeader();}
function FindPlaceCallback(veShapeLayer,veFindResults,vePlaces,hasMore)
{self.Places=vePlaces;if(self.Places==null)
{self.Panel.SetBody('No results found.');return;}
else if(self.Places.length==1)
{DecodeLatLong(self.Places[0].LatLong);self.Where=self.Places[0];self.Search();}
else if(self.Places.length>1)
{var panelBodyHtml='<div class="PanelBodyHeader"><div class="Summary">Did you mean?</div></div>';panelBodyHtml+='<ol class="AmbiguousPlaces">';for(var i=0;i<self.Places.length;i++)
{DecodeLatLong(self.Places[i].LatLong);panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<li><a href="javascript:Plugins[\'{0}\'].Panel.SetBody(\'Loading...\'); Plugins[\'{0}\'].Where = Plugins[\'{0}\'].Places[{1}]; Plugins[\'{0}\'].Search();">{2}</a></li>',id,i,self.Places[i].Name);}
panelBodyHtml+='</ol>';self.Panel.SetBody(panelBodyHtml);}}
this.BeginSearch=function()
{self.Clear();self.Panel.SetBody('Loading...');if(FreshLogicStudios.Scripts.String.IsNullOrEmpty(self.Where)||self.Where==FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])
{self.Where=new VEPlace(FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'],map.GetCenter());DecodeLatLong(self.Where.LatLong);self.Search();}
else
{map.Find(null,self.Where,null,null,null,null,false,false,false,false,FindPlaceCallback);return;}}
this.Clear=function()
{self.HidePushpins();self.Items.Clear();}
this.Close=function()
{self.Clear();self.Panel.Hide();Sidebar.Remove(self.Panel);}
this.EndSearch=function()
{var whereInputElement=document.getElementById(FreshLogicStudios.Scripts.String.Format('Where_{0}',self.GetId()));if(whereInputElement!=null)
{whereInputElement.value=self.Where.Name;}
self.Panel.SetBody(FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items));self.ShowPushpins();self.ZoomToFit();}
this.GetId=function()
{return id;}
this.HidePushpins=function()
{for(var i=0;i<self.Items.GetCount();i++)
{self.Items.GetItem(i).HidePushpin();}}
this.RenderPanelHeader=function()
{var html='<div>';html+=FreshLogicStudios.Scripts.String.Format('<form action="about:blank" method="get" target="hiddenframe" onsubmit="Plugins[\'{0}\'].Where = this.Where.value; Plugins[\'{0}\'].BeginSearch(); return false;">',id);html+='<label>Where: Address, city or landmark</label>';html+=FreshLogicStudios.Scripts.String.Format('<input id="Where_{0}" name="Where" type="text" value="{1}" onfocus="if(this.value == FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\']){this.value=\'\';} else{this.select();}" onblur="if(this.value==\'\'){this.value=FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\'];}" /><br />',self.GetId(),FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']);html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>'
html+='</div>';self.Panel.SetHeader(html);self.Panel.SetHeaderHeight(60);}
this.Search=function(){}
this.ShowPushpins=function()
{for(var i=0;i<self.Items.GetCount();i++)
{self.Items.GetItem(i).ShowPushpin();}}
this.ZoomToFit=function()
{if(self.Items.GetCount()>0)
{var positions=new Array();for(var i=0;i<self.Items.GetCount();i++)
{positions.push(self.Items.GetItem(i).Position);}
map.SetMapView(positions);}}
ctor();}
FreshLogicStudios.Scripts.Configuration.Settings.LoadDefaults=function()
{FreshLogicStudios.Scripts.Configuration.Settings.Defaults['BirdsEyeOrientation']=VEOrientation.North;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['Latitude']=39.50;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['Longitude']=-98.35;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['MapStyle']=VEMapStyle.Shaded;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['MapZoomLevel']=4;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['RegionZoomLevel']=6;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['CityZoomLevel']=11;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['StreetZoomLevel']=16;FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']='Use current view';}
VEMap.prototype.AddAtlasPushpin=function(pushpin)
{this.AddPushpin(pushpin);document.getElementById(pushpin.ID).onclick=Pushpin.OnClick;}
VEMap.prototype.RemoveAtlasPushpin=function(pushpin)
{if(CurrentPushpin==pushpin)
{AtlasContextMenu.Hide();}
document.getElementById(pushpin.ID).onclick=null;this.DeletePushpin(pushpin.ID);}
VEMap.prototype.RemovePushpins=function(pushpins)
{for(var i=pushpins.length-1;i>=0;i--)
{var pushpin=pushpins.pop();this.RemoveAtlasPushpin(pushpin);}}
VEMap.prototype.RestoreDefaults=function()
{this.SetMapStyle(FreshLogicStudios.Scripts.Configuration.Settings.Defaults['MapStyle']);this.SetCenterAndZoom(new VELatLong(FreshLogicStudios.Scripts.Configuration.Settings.Defaults['Latitude'],FreshLogicStudios.Scripts.Configuration.Settings.Defaults['Longitude']),FreshLogicStudios.Scripts.Configuration.Settings.Defaults['MapZoomLevel']);}
VEMap.prototype.RotateClockwise=function()
{if(this.GetMapStyle()==VEMapStyle.Birdseye||this.GetMapStyle()==VEMapStyle.BirdseyeHybrid)
{switch(this.GetBirdseyeScene().GetOrientation())
{case VEOrientation.North:this.SetBirdseyeOrientation(VEOrientation.East);break;case VEOrientation.South:this.SetBirdseyeOrientation(VEOrientation.West);break;case VEOrientation.East:this.SetBirdseyeOrientation(VEOrientation.South);break;default:this.SetBirdseyeOrientation(VEOrientation.North);break;}}}
VEMap.prototype.RotateCounterClockwise=function()
{if(this.GetMapStyle()==VEMapStyle.Birdseye||this.GetMapStyle()==VEMapStyle.BirdseyeHybrid)
{var orientation=this.GetBirdseyeScene().GetOrientation();switch(orientation)
{case VEOrientation.North:this.SetBirdseyeOrientation(VEOrientation.West);break;case VEOrientation.South:this.SetBirdseyeOrientation(VEOrientation.East);break;case VEOrientation.East:this.SetBirdseyeOrientation(VEOrientation.North);break;default:this.SetBirdseyeOrientation(VEOrientation.South);break;}}}
VEMap.prototype.ShowMessage=function(message)
{var myPanel=new Panel('Message');myPanel.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(300,0));myPanel.SetLocation(new FreshLogicStudios.Scripts.Drawing.Point((GetWindowWidth()/2)-(myPanel.GetSize().Width/2),GetWindowHeight()/2));myPanel.SetTitle('Message');myPanel.SetIcon('/Images/Message.png');myPanel.SetBody(message);myPanel.Show();window.setTimeout(function(){myPanel.Close();},5000);}
Pushpin.Colors=new Array('Red','LightGreen','LightBlue','Orange','Purple','Yellow','Gray','Black');function Pushpin(){}
Pushpin.Center=function(id)
{map.SetAnimationEnabled(false);map.SetCenter(Pushpin.FromId(id).LatLong);map.SetAnimationEnabled(true);}
Pushpin.FromId=function(id)
{for(var i=0;i<map.pushpins.length;i++)
{if(map.pushpins[i].ID==id)
{return map.pushpins[i];}}
return null;}
Pushpin.GetNextColor=function()
{var color=Pushpin.Colors.shift();Pushpin.Colors.push(color);return color;}
Pushpin.OnClick=function(e)
{var id=null;var pushpin=null;if(e!=null)
{id=e.currentTarget.id;}
else
{id=window.event.srcElement.id;}
pushpin=Pushpin.FromId(id.split('_')[0]);if(pushpin!=null)
{Pushpin.ShowContextMenu(pushpin.ID);}}
Pushpin.ShowContextMenu=function(pushpinId)
{var pushpin=Pushpin.FromId(pushpinId);if(pushpin!=null)
{AtlasContextMenu.SetSize(Panel.DefaultSize);AtlasContextMenu.SetLocation(pushpin.LatLong);AtlasContextMenu.SetTitle(pushpin.Title);AtlasContextMenu.SetBody(pushpin.Details);AtlasContextMenu.Show(true);CurrentPushpin=pushpin;}}
VEPushpin.ShowDetailOnMouseOver=false;Panel.DefaultSize=new FreshLogicStudios.Scripts.Drawing.Size(240,'auto');Panel.MinimumSize=new FreshLogicStudios.Scripts.Drawing.Size(44,49);function Panel(_id)
{var self=this;var icon='';var id=_id;var location=null;var minimized=false;var size=Panel.DefaultSize.Clone();var animationTimer=null;var animationStartTime=null;var minimizing=false;var maximizing=false;var currentOpacity=0;var contentHeaderSize=null;var contentFooterSize=null;var element=null;var body=null;var bodyLeft=null;var bodyRight=null;var bodyCenter=null;var header=null;var footer=null;var headerLeft=null;var headerRight=null;var headerCenter=null;var footerLeft=null;var footerRight=null;var footerCenter=null;var eventLayer=null;var titleBar=null;var iconElement=null;var titleElement=null;var closeButton=null;var minMaxButton=null;var contentHeader=null;var contentBody=null;var contentFooter=null;this.Events=new FreshLogicStudios.Scripts.EventCollection();function GetAutoHeight()
{var currentBodyDisplay=body.style.display;var currentBodyHeight=body.style.height;var currentContentBodyDisplay=contentBody.style.display;var currentContentHeaderDisplay=contentHeader.style.display;var currentContentFooterDisplay=contentFooter.style.display;var currentContentBodyHeight=contentBody.style.height;body.style.display='block';contentBody.style.display='block';contentHeader.style.display='block';contentFooter.style.display='block';body.style.height='auto';contentBody.style.height='auto';var contentBodyHeight=Math.max(contentBody.offsetHeight,contentBody.scrollHeight);if(contentBody.innerHTML=='')
{contentBodyHeight=0;}
body.style.display=currentBodyDisplay;contentBody.style.display=currentContentBodyDisplay;contentHeader.style.display=currentContentHeaderDisplay;contentFooter.style.display=currentContentFooterDisplay;body.style.height=currentBodyHeight;contentBody.style.height=currentContentBodyHeight;return Panel.MinimumSize.Height+(contentHeaderSize.Height>0?contentHeaderSize.Height+15:5)+(contentBodyHeight>0?contentBodyHeight+10:0)+(contentFooterSize.Height>0?contentFooterSize.Height+5:0);}
function Initialize()
{element=document.createElement('div');body=document.createElement('div');bodyLeft=document.createElement('div');bodyRight=document.createElement('div');bodyCenter=document.createElement('div');header=document.createElement('div');footer=document.createElement('div');headerLeft=document.createElement('div');headerRight=document.createElement('div');headerCenter=document.createElement('div');footerLeft=document.createElement('div');footerRight=document.createElement('div');footerCenter=document.createElement('div');eventLayer=document.createElement('div');titleBar=document.createElement('div');iconElement=document.createElement('div');titleElement=document.createElement('div');closeButton=document.createElement('a');minMaxButton=document.createElement('img');contentHeader=document.createElement('div');contentBody=document.createElement('div');contentFooter=document.createElement('div');element.id=id;element.oncontextmenu=function(){return false;};element.className='Panel';header.className='Header';headerLeft.className='Left';headerRight.className='Right';headerCenter.className='Center';body.className='Body';bodyLeft.className='Left';bodyRight.className='Right';bodyCenter.className='Center';footer.className='Footer';footerLeft.className='Left';footerRight.className='Right';footerCenter.className='Center';eventLayer.className='EventLayer';contentHeader.className='ContentHeader';contentBody.className='ContentBody';contentFooter.className='ContentFooter';header.appendChild(headerLeft);header.appendChild(headerRight);header.appendChild(headerCenter);body.appendChild(bodyLeft);body.appendChild(bodyRight);body.appendChild(bodyCenter);footer.appendChild(footerLeft);footer.appendChild(footerRight);footer.appendChild(footerCenter);bodyCenter.appendChild(contentHeader);bodyCenter.appendChild(contentBody);bodyCenter.appendChild(contentFooter);element.appendChild(eventLayer);element.appendChild(header);element.appendChild(body);element.appendChild(footer);titleBar.className='TitleBar';iconElement.className='Icon';titleElement.className='Title';closeButton.className='CloseButton';minMaxButton.className='MinMaxButton';closeButton.innerHTML='x';closeButton.href='#';closeButton.title='Close';closeButton.onclick=function(){self.Close();return false;};minMaxButton.src='/Panel/Images/Minimize.gif';minMaxButton.alt='Minimize';minMaxButton.onclick=function(){self.Minimize(true);return false;};titleBar.appendChild(iconElement);titleBar.appendChild(titleElement);titleBar.appendChild(closeButton);titleBar.appendChild(minMaxButton);header.appendChild(titleBar);var panels=document.getElementById('Panels');if(!panels)
{panels=document.createElement('div');panels.id='Panels';document.body.appendChild(panels);}
panels.appendChild(element);contentHeaderSize=new FreshLogicStudios.Scripts.Drawing.Size(size.Width-Panel.MinimumSize.Width,0);contentFooterSize=new FreshLogicStudios.Scripts.Drawing.Size(size.Width-Panel.MinimumSize.Width,0);self.SetLocation(location);self.SetSize(size);}
function SetHeight(height)
{var contentHeight=height-Panel.MinimumSize.Height;var bodyHeight=contentHeight-10;var headerHeight=(contentHeaderSize.Height>0)?contentHeaderSize.Height+10:0;var footerHeight=(contentFooterSize.Height>0)?contentFooterSize.Height+5:0;if(height<Panel.MinimumSize.Height)
{height=Panel.MinimumSize.Height;}
if(headerHeight+footerHeight>contentHeight)
{contentFooter.style.display='none';if(headerHeight>contentHeight)
{contentHeader.style.display='none';}
else
{if(contentHeaderSize.Height>0)
{contentHeader.style.display='block';bodyHeight-=headerHeight;}
else
{contentHeader.style.display='none';}}}
else
{if(contentHeaderSize.Height>0)
{contentHeader.style.display='block';bodyHeight-=headerHeight;}
else
{contentHeader.style.display='none';}
if(contentFooterSize.Height>0)
{contentFooter.style.display='block';bodyHeight-=footerHeight;}
else
{contentFooter.style.display='none';}}
bodyHeight=Math.max(0,bodyHeight);contentBody.style.display=(bodyHeight>0)?'block':'none';contentHeader.style.height=contentHeaderSize.Height+'px';contentFooter.style.height=contentFooterSize.Height+'px';contentBody.style.height=bodyHeight+'px';var footerPosition=10;if(contentHeader.style.display=='block')
{contentHeader.style.top='10px';contentBody.style.top=(10+contentHeaderSize.Height+10)+'px';footerPosition+=contentHeaderSize.Height;footerPosition+=10;}
else
{contentBody.style.top='10px';}
if(contentBody.style.display=='block')
{footerPosition+=bodyHeight;footerPosition+=10;}
contentFooter.style.top=footerPosition+'px';element.style.height=height+'px';eventLayer.style.height=height+'px';var myHeight='2px';if(contentHeight>2)
{myHeight=contentHeight+'px';}
body.style.height=myHeight;bodyLeft.style.height=myHeight;bodyRight.style.height=myHeight;bodyCenter.style.height=myHeight;}
function SetWidth(width)
{width+=18;if(width<Panel.MinimumSize.Width)
{width=Panel.MinimumSize.Width;}
contentHeaderSize.Width=width-Panel.MinimumSize.Width;contentFooterSize.Width=width-Panel.MinimumSize.Width;element.style.width=width+'px';header.style.width=width+'px';headerCenter.style.width=width-Panel.MinimumSize.Width+'px';footer.style.width=width+'px';footerCenter.style.width=width-Panel.MinimumSize.Width+'px';body.style.width=width+'px';bodyCenter.style.width=width-Panel.MinimumSize.Width+'px';contentHeader.style.width=width-Panel.MinimumSize.Width+'px';contentBody.style.width=width-Panel.MinimumSize.Width+'px';contentFooter.style.width=width-Panel.MinimumSize.Width+'px';eventLayer.style.width=width+'px';titleBar.style.width=width-30+'px';titleElement.style.width=(width-30)-25-((icon==''||icon==null)?0:37);}
function SlideDown(targetHeight)
{if(maximizing)
{var initialSpeed=200;var acceleration=400;var timeEllapsed=((new Date()).getTime()-animationStartTime)/1000;var totalDistanceTraveled=(initialSpeed*timeEllapsed)+(.5*acceleration*(Math.pow(timeEllapsed,2)));var newHeight=self.GetCurrentSize().Height+totalDistanceTraveled;newHeight=newHeight-(newHeight%1);if(newHeight>=targetHeight)
{maximizing=false;minimizing=false;SetHeight(targetHeight);contentBody.style.overflow='auto';self.Events.Fire('Maximized',self);}
else
{SetHeight(newHeight);window.setTimeout(function(){SlideDown(targetHeight);},20);}}}
function SlideUp(targetHeight)
{if(minimizing)
{var initialSpeed=200;var acceleration=400;var timeEllapsed=((new Date()).getTime()-animationStartTime)/1000;var totalDistanceTraveled=(initialSpeed*timeEllapsed)+(.5*acceleration*(Math.pow(timeEllapsed,2)));var newHeight=self.GetCurrentSize().Height-totalDistanceTraveled;newHeight=newHeight-(newHeight%1);if(newHeight<=targetHeight)
{maximizing=false;minimizing=false;SetHeight(targetHeight);contentBody.style.overflow='auto';self.Events.Fire('Minimized',self);}
else
{SetHeight(newHeight);window.setTimeout(function(){SlideUp(targetHeight);},20);}}}
this.Close=function()
{self.Hide();self.Events.Fire('Closed',self);}
this.GetBody=function()
{return contentBody.innerHTML;}
this.GetCurrentSize=function()
{return new FreshLogicStudios.Scripts.Drawing.Size(parseInt(element.style.width.substring(0,element.style.width.indexOf('px'))),parseInt(element.style.height.substring(0,element.style.height.indexOf('px'))));}
this.GetElement=function()
{return element;}
this.GetFooter=function()
{return contentFooter.innerHTML;}
this.GetHeader=function()
{return contentHeader.innerHTML;}
this.GetIcon=function()
{return icon;}
this.GetId=function()
{return id;}
this.GetLocation=function()
{return location;}
this.GetSize=function()
{return size;}
this.GetTitle=function()
{return titleElement.innerHTML;}
this.Hide=function()
{element.style.visibility='hidden';}
this.IsHeightDynamic=function()
{return(size.Height=='auto');}
this.IsVisible=function()
{return(element.style.visibility=='visible');}
this.IsMinimized=function()
{return minimized;}
this.Maximize=function(animate)
{if(minimized)
{animationTimer=window.clearTimeout(animationTimer);maximizing=true;minimizing=false;minimized=false;self.Events.Fire('Maximizing',self);minMaxButton.onclick=function(){self.Minimize(true);return false;};minMaxButton.src='/Panel/Images/Minimize.gif';minMaxButton.alt='Minimize';if(animate)
{var targetHeight=size.Height;if(targetHeight=='auto')
{targetHeight=GetAutoHeight();}
animationStartTime=(new Date()).getTime();contentBody.style.overflow='hidden';window.setTimeout(function(){SlideDown(targetHeight);},10);}
else
{var targetHeight=size.Height;if(targetHeight=='auto')
{targetHeight=GetAutoHeight();}
maximizing=false;SetHeight(targetHeight);self.Events.Fire('Maximized',self);}}}
this.Minimize=function(animate)
{if(!minimized)
{self.Events.Fire('Minimizing',self);minMaxButton.onclick=function(){self.Maximize(true);return false;};minMaxButton.src='/Panel/Images/Maximize.gif';minMaxButton.alt='Maximize';animationTimer=window.clearTimeout(animationTimer);maximizing=false;minimizing=true;minimized=true;if(animate)
{animationStartTime=(new Date()).getTime();contentBody.style.overflow='hidden';window.setTimeout(function(){SlideUp(Panel.MinimumSize.Height);},10);}
else
{minimizing=false;SetHeight(Panel.MinimumSize.Height);self.Events.Fire('Minimized',self);}}}
this.SetBody=function(html)
{contentBody.innerHTML=html||'';if(size.Height=='auto')
{self.SetSize(size);}}
this.SetFooter=function(html)
{contentFooter.innerHTML=html||'';if(size.Height=='auto')
{self.SetSize(size);}}
this.SetFooterHeight=function(height)
{contentFooterSize.Height=height||'auto';self.SetSize(size);}
this.SetHeader=function(html)
{contentHeader.innerHTML=html||'';if(size.Height=='auto')
{self.SetSize(size);}}
this.SetHeaderHeight=function(height)
{contentHeaderSize.Height=height||'auto';self.SetSize(size);}
this.SetIcon=function(imageUrl)
{icon=imageUrl;FreshLogicStudios.Scripts.Html.HtmlElement.SetBackgroundImage(iconElement,(imageUrl||''));titleElement.style.left=(icon==null||icon=='')?'5px':'37px';}
this.SetLocation=function(_location)
{location=_location||new FreshLogicStudios.Scripts.Drawing.Point(0,0);element.style.top=location.Y-3+'px';element.style.left=location.X-8+'px';}
this.SetSize=function(_size)
{size=_size.Clone()||Panel.DefaultSize;size.Width=size.Width||Panel.DefaultSize.Width;size.Height=size.Height||Panel.DefaultSize.Height;size.Width=size.Width>Panel.MinimumSize.Width?size.Width:Panel.MinimumSize.Width;if(size.Height!='auto')
{size.Height=size.Height>Panel.MinimumSize.Height?size.Height:Panel.MinimumSize.Height;size.Height+=16;}
if(!minimized&&!maximizing&&!minimizing)
{var targetHeight=size.Height;if(targetHeight=='auto')
{targetHeight=GetAutoHeight();}
SetHeight(targetHeight);SetWidth(size.Width);}}
this.SetTitle=function(title)
{titleElement.innerHTML=title||'';}
this.Show=function(animate)
{animate=(animate==null?true:animate);if(!self.IsVisible())
{self.Minimize(false);element.style.visibility='visible';self.Maximize(animate);}
else
{element.style.visibility='visible';}}
Initialize();}
PanelCollection.PanelSpacing=10;PanelCollection.PanelDropShadowHeight=14;function PanelCollection()
{var self=this;var location=new FreshLogicStudios.Scripts.Drawing.Point(0,0);var size=Panel.DefaultSize.Clone();this.Panels=new Array();function GetMaximizedPanelSize()
{var count=self.Panels.length;return new FreshLogicStudios.Scripts.Drawing.Size(size.Width,size.Height-(Panel.MinimumSize.Height*(count-1)+(count-1)*PanelCollection.PanelSpacing-(count-1)*PanelCollection.PanelDropShadowHeight));}
function OnPanelClosed(args)
{self.Remove(args);PerformLayout();}
function OnPanelMaximized(args)
{PerformLayout();}
function OnPanelMaximizing(args)
{for(var i=0;i<self.Panels.length;i++)
{if(self.Panels[i]!=args)
{self.Panels[i].Minimize(false);}}
PerformLayout();}
function OnPanelMinimized(args)
{PerformLayout();}
function PerformLayout()
{var currentLocation=location.Clone();var maximizedSize=GetMaximizedPanelSize();for(var i=0;i<self.Panels.length;i++)
{self.Panels[i].SetLocation(currentLocation.Clone());self.Panels[i].SetSize(maximizedSize.Clone());var panelHeight=(self.Panels[i].IsMinimized()?self.Panels[i].GetCurrentSize().Height-PanelCollection.PanelDropShadowHeight:maximizedSize.Height);currentLocation.Offset(0,panelHeight+PanelCollection.PanelSpacing);}}
this.Add=function(panel)
{this.Panels.push(panel);panel.Hide();panel.SetSize(GetMaximizedPanelSize());panel.Events.Add(new FreshLogicStudios.Scripts.Event('Minimized',function(args){OnPanelMinimized(args);}));panel.Events.Add(new FreshLogicStudios.Scripts.Event('Maximizing',function(args){OnPanelMaximizing(args);}));panel.Events.Add(new FreshLogicStudios.Scripts.Event('Maximized',function(args){OnPanelMaximized(args);}));panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',function(args){OnPanelClosed(args);}));this.MinimizeAll();panel.Show();panel.Maximize(true);}
this.Contains=function(id)
{for(var i=0;i<this.Panels.length;i++)
{if(this.Panels[i].GetId()==id)
{return true;}}
return false;}
this.MinimizeAll=function()
{for(var i=0;i<this.Panels.length;i++)
{this.Panels[i].Minimize(false);}}
this.Remove=function(panel)
{for(var i=this.Panels.length-1;i>=0;i--)
{if(this.Panels[i].GetId()==panel.GetId())
{this.Panels.splice(i,1);}}}
this.SetLocation=function(_location)
{location=_location;PerformLayout();}
this.SetSize=function(_size)
{size=_size;PerformLayout();}}
function Menu()
{var self=this;var location=new FreshLogicStudios.Scripts.Drawing.Point(0,0);this.Menus=new Array();this.Events=new FreshLogicStudios.Scripts.EventCollection();function OnMenuMaximizing(args)
{for(var i=0;i<self.Menus.length;i++)
{if(self.Menus[i]!=args)
{self.Menus[i].Minimize(false);}}}
function OnMenuMinimized(args)
{for(var i=0;i<self.Menus.length;i++)
{if(self.Menus[i]!=args.GetId()&&(self.Menus[i].IsMinimizing()||self.Menus[i].IsMaximizing()))
{return;}}
self.Events.Fire('MenuResized');}
function OnMenuMaximized(args)
{for(var i=0;i<self.Menus.length;i++)
{if(self.Menus[i]!=args.GetId()&&(self.Menus[i].IsMinimizing()||self.Menus[i].IsMaximizing()))
{return;}}
self.Events.Fire('MenuResized');}
this.Add=function(menu)
{var offset=0;for(var i=0;i<this.Menus.length;i++)
{offset+=this.Menus[i].GetTabWidth();}
this.Menus.push(menu);menu.SetTabOffset(offset);menu.Minimize();menu.Events.Add(new FreshLogicStudios.Scripts.Event('Minimized',function(args){OnMenuMinimized(args);}));menu.Events.Add(new FreshLogicStudios.Scripts.Event('Maximizing',function(args){OnMenuMaximizing(args);}));menu.Events.Add(new FreshLogicStudios.Scripts.Event('Maximized',function(args){OnMenuMaximized(args);}));self.MinimizeAll();menu.Maximize();}
this.GetHeight=function()
{var height=0;for(var i=0;i<this.Menus.length;i++)
{var menuHeight=this.Menus[i].GetCurrentSize().Height;if(menuHeight>height)
{height=menuHeight;}}
return height;}
this.MinimizeAll=function()
{for(var i=0;i<this.Menus.length;i++)
{this.Menus[i].Minimize();}}
this.Remove=function(menu)
{for(var i=this.Menus.length-1;i>=0;i--)
{if(this.Menus[i].GetId()==menu.GetId())
{this.Menus.splice(i,1);}}}}
function MenuItem(_id)
{var self=this;var icon='';var id=_id;var location=null;var minimized=false;var animationTimer=null;var animationStartTime=null;var minimizing=false;var maximizing=false;var currentOpacity=0;var fadingIn=false;var fadingOut=false;var contentHeaderSize=null;var contentFooterSize=null;var element=null;var content=null;var tab=null;var tabLeft=null;var tabCenter=null;var tabRight=null;var tabLabel=null;this.Events=new FreshLogicStudios.Scripts.EventCollection();function GetTopPosition()
{return parseInt(element.style.top.substring(0,element.style.top.indexOf('px')))}
function Initialize()
{element=document.getElementById(id);var contentHtml=element.innerHTML;var logoHtml='<a class="Logo" href="http://www.freshlogicstudios.com"><img alt="Fresh Logic Studios" src="/Menu/Images/Logo.gif" /></a>';content=document.createElement('div');tab=document.createElement('div');tabLeft=document.createElement('div');tabCenter=document.createElement('div');tabRight=document.createElement('div');tabLabel=document.createElement('a');content.className='Content';tab.className='Tab';tabLeft.className='Left';tabCenter.className='Center';tabRight.className='Right';content.style.height=element.offsetHeight+'px';tabLabel.innerHTML=element.title;tabLabel.href='#';tabLabel.onclick=function(){return false;};tabCenter.appendChild(tabLabel);tab.appendChild(tabLeft);tab.appendChild(tabCenter);tab.appendChild(tabRight);element.innerHTML='';element.oncontextmenu=function(){return false;};element.appendChild(content);element.appendChild(tab);content.innerHTML=logoHtml+contentHtml;element.style.top=(-1*content.offsetHeight)+'px';element.style.visibility='visible';}
function SlideDown()
{if(maximizing)
{var initialSpeed=100;var acceleration=400;var timeEllapsed=((new Date()).getTime()-animationStartTime)/1000;var totalDistanceTraveled=(initialSpeed*timeEllapsed)+(.5*acceleration*(Math.pow(timeEllapsed,2)));var newTop=GetTopPosition()+totalDistanceTraveled;newTop=newTop-(newTop%1);if(newTop>=0)
{maximizing=false;minimizing=false;element.style.top='0px';self.Events.Fire('Maximized',self);}
else
{element.style.top=newTop+'px'
window.setTimeout(function(){SlideDown();},20);}}}
function SlideUp()
{if(minimizing)
{var initialSpeed=100;var acceleration=400;var timeEllapsed=((new Date()).getTime()-animationStartTime)/1000;var totalDistanceTraveled=(initialSpeed*timeEllapsed)+(.5*acceleration*(Math.pow(timeEllapsed,2)));var newTop=GetTopPosition()-totalDistanceTraveled;newTop=newTop-(newTop%1);if(newTop<=(-1*self.GetSize().Height))
{maximizing=false;minimizing=false;element.style.top=(-1*self.GetSize().Height)+'px';self.Events.Fire('Minimized',self);}
else
{element.style.top=newTop+'px';window.setTimeout(function(){SlideUp();},20);}}}
this.GetElement=function()
{return element;}
this.GetId=function()
{return id;}
this.GetSize=function()
{return new FreshLogicStudios.Scripts.Drawing.Size(content.offsetWidth,content.offsetHeight);}
this.GetCurrentSize=function()
{var elementHeight=content.offsetHeight+tab.offsetHeight;var elementTop=parseInt(element.style.top.substring(0,element.style.top.indexOf('px')));return new FreshLogicStudios.Scripts.Drawing.Size(parseInt(element.style.width.substring(0,element.style.width.indexOf('px'))),elementHeight+elementTop);}
this.GetTabWidth=function()
{return tab.offsetWidth;}
this.IsMinimized=function()
{return minimized;}
this.IsMinimizing=function()
{return minimizing;}
this.IsMaximizing=function()
{return maximizing;}
this.Maximize=function()
{if(minimized)
{animationTimer=window.clearTimeout(animationTimer);maximizing=true;minimizing=false;minimized=false;self.Events.Fire('Maximizing',self);element.style.zIndex='10000';tab.onclick=function(){self.Minimize(true);return false;};tab.title='Minimize';tabLabel.style.backgroundImage='url(\'/Menu/Images/Tab/Minimize.gif\')';animationStartTime=(new Date()).getTime();window.setTimeout(function(){SlideDown();},10);}}
this.Minimize=function()
{if(!minimized)
{self.Events.Fire('Minimizing',self);element.style.zIndex='11000';tab.onclick=function(){self.Maximize(true);return false;};tab.title='Maximize';tabLabel.style.backgroundImage='url(\'/Menu/Images/Tab/Maximize.gif\')';animationTimer=window.clearTimeout(animationTimer);maximizing=false;minimizing=true;minimized=true;animationStartTime=(new Date()).getTime();window.setTimeout(function(){SlideUp();},10);}}
this.SetTabOffset=function(offset)
{tab.style.right=offset+'px';}
Initialize();}
RegisterNamespace('FreshLogicStudios.Atlas.GeoRss');FreshLogicStudios.Atlas.GeoRss.Channel=function()
{var self=this;this.Description='';this.Items=new FreshLogicStudios.Scripts.Collections.ArrayList();this.Link='http://www.freshlogicstudios.com/Products/Atlas/GeoRss.aspx';this.TimeToLive=null;this.Title='';this.ContainsItem=function(item)
{for(var i=0;i<self.Items.GetCount();i++)
{if(self.Items.GetItem(i).Equals(item))
{return true;}}
return false;}
this.GetUniqueItems=function(items)
{var uniqueItems=new Array();for(var i=0;i<items.length;i++)
{if(!self.ContainsItem(items[i]))
{uniqueItems.push(items[i]);}}
return uniqueItems;}}
FreshLogicStudios.Atlas.GeoRss.Channel.FromDom=function(domElement)
{var rssChannel=new FreshLogicStudios.Atlas.GeoRss.Channel();try
{rssChannel.Description=domElement.getElementsByTagName('description').length>0?domElement.getElementsByTagName('description')[0].firstChild.data:'';}
catch(e){}
try
{rssChannel.Link=domElement.getElementsByTagName('link').length>0?domElement.getElementsByTagName('link')[0].firstChild.data:'';}
catch(e){}
try
{rssChannel.TimeToLive=domElement.getElementsByTagName('ttl').length>0?domElement.getElementsByTagName('ttl')[0].firstChild.data:null;}
catch(e){}
try
{rssChannel.Title=domElement.getElementsByTagName('title').length>0?domElement.getElementsByTagName('title')[0].firstChild.data:'';}
catch(e){}
var items=domElement.getElementsByTagName('item');for(var i=0;i<items.length;i++)
{rssChannel.Items.Add(FreshLogicStudios.Atlas.GeoRss.Item.FromDom(items[i]));}
return rssChannel;}
function GeoRss()
{var color=Pushpin.GetNextColor();var counter=1;var id=FreshLogicStudios.Scripts.Guid.NewGuid();var items=new FreshLogicStudios.Scripts.Collections.ArrayList();var layer=new VEShapeLayer();var maxItemsToDisplay=100;var self=this;var timeout=null;this.Channel=new FreshLogicStudios.Atlas.GeoRss.Channel();this.Panel=new Panel(FreshLogicStudios.Scripts.Guid.NewGuid());this.UpdateInterval=null;this.Uri='';function Initialize()
{self.Panel=new Panel('GeoRssPanel'+id);self.Panel.SetBody('Loading...');self.Panel.SetIcon('/GeoRss/GeoRss.png');self.Panel.SetTitle('GeoRSS');self.Panel.Events.Add(new FreshLogicStudios.Scripts.Event('Closed',function(args){self.Clear();}));Sidebar.Add(self.Panel);map.AddShapeLayer(layer);}
function OnWebRequestComplete(response)
{if(!self.Panel.IsVisible())
{return;}
if(response.get_statusCode()==200)
{var channel=FreshLogicStudios.Atlas.GeoRss.Channel.FromDom(response.get_xml());self.Channel.Link=channel.Link;self.Channel.Description=channel.Description;self.Channel.Title=channel.Title;if(self.UpdateInterval==null&&channel.TimeToLive!=null)
{self.UpdateInterval=channel.TimeToLive*60*1000;}
var uniqueRssItems=self.Channel.GetUniqueItems(channel.Items.ToArray());self.Channel.Items.AddRange(uniqueRssItems);var panelBodyHtml='<div class="PanelBodyHeader">';panelBodyHtml+='<div class="Summary">';panelBodyHtml+=FreshLogicStudios.Scripts.String.Format('<a href="{0}" target="_blank">{1}</a><br />{2}',self.Channel.Link,self.Channel.Title,self.Channel.Description);panelBodyHtml+='</div>';panelBodyHtml+='</div>';panelBodyHtml+='<ul>';for(var i=uniqueRssItems.length-1;i>=0;i--)
{var rssItem=uniqueRssItems[i];if(rssItem.Shape&&rssItem.Shape.GetType()==VEShapeType.Pushpin)
{var description=rssItem.Description;if(rssItem.Link)
{description+=FreshLogicStudios.Scripts.String.Format("<div><a href=\"{0}\" target=\"_blank\">more...</a></div>",rssItem.Link);}
var item=new FreshLogicStudios.Atlas.Item(rssItem.Title,description,description,rssItem.Shape.GetPoints()[0],color,counter++);items.Add(item);item.ShowPushpin();}
if(rssItem.Shape&&(rssItem.Shape.GetType()==VEShapeType.Polyline||rssItem.Shape.GetType()==VEShapeType.Polygon))
{rssItem.Shape.HideIcon();layer.AddShape(rssItem.Shape);var description=rssItem.Description;if(rssItem.Link)
{description+=FreshLogicStudios.Scripts.String.Format("<div><a href=\"{0}\" target=\"_blank\">more...</a></div>",rssItem.Link);}
var item=new FreshLogicStudios.Atlas.Item(rssItem.Title,description,description,rssItem.Shape.GetIconAnchor(),color,counter++);items.Add(item);item.ShowPushpin();}
if(items.GetCount()>maxItemsToDisplay)
{items.GetItem(0).HidePushpin();items.RemoveAt(0);}
if(counter>=1000)
{counter=1;}}
if(uniqueRssItems.length>0)
{try
{var itemToShow=items.GetItem(items.GetCount()-1);itemToShow.Center();itemToShow.ShowContextMenu();}
catch(e)
{}}
if(self.UpdateInterval)
{for(var i=items.GetCount()-1;i>=0;i--)
{panelBodyHtml+=items.GetItem(i).GetSidebarHtml();}}
else
{for(var i=0;i<items.GetCount();i++)
{panelBodyHtml+=items.GetItem(i).GetSidebarHtml();}}
panelBodyHtml+='</ul>';self.Panel.SetBody(panelBodyHtml);}
else
{map.ShowMessage(FreshLogicStudios.Scripts.String.Format('An error occured while loading data.  {0}: {1}',response.get_statusCode(),response.get_statusText()));}
if(!timeout)
{FreshLogicStudios.Atlas.Items.ZoomToFit(items);}
if(self.UpdateInterval)
{timeout=window.setTimeout(self.Update,self.UpdateInterval);}}
this.Clear=function()
{if(timeout)
{window.clearTimeout(timeout);}
map.DeleteShapeLayer(layer);FreshLogicStudios.Atlas.Items.Clear(items);self.Panel.Hide();Sidebar.Remove(self.Panel);}
this.GetId=function()
{return id;}
this.Update=function()
{var webRequest=new Sys.Net.WebRequest();var uri=FreshLogicStudios.Scripts.String.Format('/Proxy.ashx?uri={0}',encodeURIComponent(self.Uri));webRequest.set_url(uri);webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
Initialize();}
GeoRss.Initialize=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();var geoRssUri=null;var updateInterval=null;if(params['georss'])
{geoRssUri=params['georss'];}
if(params['rss'])
{geoRssUri=FreshLogicStudios.Scripts.String.Format('http://ws.geonames.org/rssToGeoRSS?feedUrl={0}',encodeURIComponent(params['rss']));}
if(params['GeoRssUri'])
{geoRssUri=params['GeoRssUri'];}
if(params['RssUri'])
{geoRssUri=FreshLogicStudios.Scripts.String.Format('http://ws.geonames.org/rssToGeoRSS?feedUrl={0}',encodeURIComponent(params['RssUri']));}
if(params['GeoRssUpdateInterval'])
{updateInterval=parseInt(params['GeoRssUpdateInterval'])*1000;}
if(geoRssUri)
{GeoRss.Populate(geoRssUri,updateInterval);}}
GeoRss.Populate=function(uri,updateInterval)
{var myGeoRss=new GeoRss();myGeoRss.UpdateInterval=updateInterval;myGeoRss.Uri=uri;myGeoRss.Update();}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',GeoRss.Initialize));RegisterNamespace('FreshLogicStudios.Atlas.GeoRss');FreshLogicStudios.Atlas.GeoRss.Item=function()
{var self=this;this.Description='';this.Link=null;this.Shape=null;this.Title='Untitled';this.Equals=function(item)
{if(self.Description!=item.Description)
{return false;}
else if(self.Title!=item.Title)
{return false;}
return true;}}
FreshLogicStudios.Atlas.GeoRss.Item.FromDom=function(domElement)
{var item=new FreshLogicStudios.Atlas.GeoRss.Item();try
{item.Description=domElement.getElementsByTagName('description').length>0?domElement.getElementsByTagName('description')[0].firstChild.data:'';}
catch(e)
{}
try
{item.Link=domElement.getElementsByTagName('link').length>0?domElement.getElementsByTagName('link')[0].firstChild.data:'';}
catch(e)
{}
try
{item.Title=domElement.getElementsByTagName('title').length>0?domElement.getElementsByTagName('title')[0].firstChild.data:'';}
catch(e)
{}
var pushpin=FreshLogicStudios.Atlas.GeoRss.Item.TryParsePushpin(domElement);if(pushpin)
{item.Shape=pushpin;return item;}
var polyline=FreshLogicStudios.Atlas.GeoRss.Item.TryParsePolyline(domElement);if(polyline)
{item.Shape=polyline;return item;}
var polygon=FreshLogicStudios.Atlas.GeoRss.Item.TryParsePolygon(domElement);if(polygon)
{item.Shape=polygon;return item;}
var box=FreshLogicStudios.Atlas.GeoRss.Item.TryParseBox(domElement);if(box)
{item.Shape=box;return item;}
return item;}
FreshLogicStudios.Atlas.GeoRss.Item.TryParseBox=function(domElement)
{var box=null;var points=new Array();if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('georss:box')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('box')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{var lowerCornerPoint=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('gml:Envelope')[0].getElementsByTagName('gml:lowerCorner')[0].firstChild.data);var upperCornerPoint=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('gml:Envelope')[0].getElementsByTagName('gml:upperCorner')[0].firstChild.data);points.push(lowerCornerPoint);points.push(upperCornerPoint);}
catch(e)
{}}
if(points.length==0)
{try
{var lowerCornerPoint=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('Envelope')[0].getElementsByTagName('lowerCorner')[0].firstChild.data);var upperCornerPoint=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('Envelope')[0].getElementsByTagName('upperCorner')[0].firstChild.data);points.push(lowerCornerPoint);points.push(upperCornerPoint);}
catch(e)
{}}
if(points.length&&points.length==2)
{try
{var boxPoints=new Array();boxPoints.push(points[0]);boxPoints.push(new VELatLong(points[0].Latitude,points[1].Longitude));boxPoints.push(points[1]);boxPoints.push(new VELatLong(points[1].Latitude,points[0].Longitude));box=new VEShape(VEShapeType.Polygon,boxPoints);}
catch(e)
{}}
return box;}
FreshLogicStudios.Atlas.GeoRss.Item.TryParsePushpin=function(domElement)
{var pushpin=null;var latitude=null;var longitude=null;if(latitude==null||longitude==null)
{try
{latitude=domElement.getElementsByTagName('geo:lat').length>0?domElement.getElementsByTagName('geo:lat')[0].firstChild.data:null;longitude=domElement.getElementsByTagName('geo:long').length>0?domElement.getElementsByTagName('geo:long')[0].firstChild.data:null;}
catch(e)
{}}
if(latitude==null||longitude==null)
{try
{latitude=domElement.getElementsByTagName('lat').length>0?domElement.getElementsByTagName('lat')[0].firstChild.data:null;longitude=domElement.getElementsByTagName('long').length>0?domElement.getElementsByTagName('long')[0].firstChild.data:null;}
catch(e)
{}}
if(latitude==null||longitude==null)
{if(domElement.getElementsByTagName('georss:point').length>0)
{try
{var point=domElement.getElementsByTagName('georss:point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(domElement.getElementsByTagName('point').length>0)
{try
{var point=domElement.getElementsByTagName('point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(domElement.getElementsByTagName('gml:pos').length>0)
{try
{var point=domElement.getElementsByTagName('gml:pos')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(domElement.getElementsByTagName('pos').length>0)
{try
{var point=domElement.getElementsByTagName('pos')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude&&longitude)
{try
{pushpin=new VEShape(VEShapeType.Pushpin,new VELatLong(parseFloat(latitude),parseFloat(longitude)));}
catch(e)
{}}
return pushpin;}
FreshLogicStudios.Atlas.GeoRss.Item.TryParsePolygon=function(domElement)
{var polygon=null;var points=new Array();if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('georss:polygon')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('polygon')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('gml:Polygon')[0].getElementsByTagName('gml:posList')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('Polygon')[0].getElementsByTagName('posList')[0].firstChild.data);}
catch(e)
{}}
if(points.length&&points.length>=3)
{try
{polygon=new VEShape(VEShapeType.Polygon,points);}
catch(e)
{}}
return polygon;}
FreshLogicStudios.Atlas.GeoRss.Item.TryParsePolyline=function(domElement)
{var polyline=null;var points=new Array();if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('georss:line')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('line')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('gml:LineString')[0].getElementsByTagName('gml:posList')[0].firstChild.data);}
catch(e)
{}}
if(points.length==0)
{try
{points=FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints(domElement.getElementsByTagName('LineString')[0].getElementsByTagName('posList')[0].firstChild.data);}
catch(e)
{}}
if(points.length&&points.length>=2)
{try
{polyline=new VEShape(VEShapeType.Polyline,points);}
catch(e)
{}}
return polyline;}
FreshLogicStudios.Atlas.GeoRss.Item.ParsePoints=function(value)
{var points=new Array();var tempPoints=value.split(' ');for(var i=0;i<tempPoints.length;i=i+2)
{points.push(new VELatLong(parseFloat(tempPoints[i]),parseFloat(tempPoints[i+1])));}
return points;}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.YouTube');FreshLogicStudios.Atlas.Feeds.YouTube.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/YouTube/YouTube.png');geoRss.Panel.SetTitle('YouTube');geoRss.Uri='http://atlas.freshlogicstudios.com/Feeds/YouTube/YouTube.ashx';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.Twitter');FreshLogicStudios.Atlas.Feeds.Twitter.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/Twitter/Twitter.png');geoRss.Panel.SetTitle('Twitter');geoRss.UpdateInterval=5000;geoRss.Uri='http://atlas.freshlogicstudios.com/GeoRss/Feeds/Twitter.ashx';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.TheWeatherChannel');FreshLogicStudios.Atlas.Feeds.TheWeatherChannel.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/TheWeatherChannel/TheWeatherChannel.png');geoRss.Panel.SetTitle('The Weather Channel');geoRss.UpdateInterval=60000;geoRss.Uri='http://atlas.freshlogicstudios.com/Feeds/TheWeatherChannel/TheWeatherChannel.ashx';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.Npr');FreshLogicStudios.Atlas.Feeds.Npr.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/Npr/Npr.png');geoRss.Panel.SetTitle('National Public Radio');geoRss.UpdateInterval=60000;geoRss.Uri='http://ws.geonames.org/rssToGeoRSS?feedUrl=http://www.npr.org/rss/rss.php?id=1001';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.Flickr');FreshLogicStudios.Atlas.Feeds.Flickr.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/Flickr/Flickr.png');geoRss.Panel.SetTitle('Flickr');geoRss.UpdateInterval=60000;geoRss.Uri='http://atlas.freshlogicstudios.com/GeoRss/Feeds/Flickr.ashx';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Feeds.AP');FreshLogicStudios.Atlas.Feeds.AP.Open=function()
{var geoRss=new GeoRss();geoRss.Panel.SetIcon('/Feeds/AP/AP.png');geoRss.Panel.SetTitle('Associated Press');geoRss.UpdateInterval=60000;geoRss.Uri='http://ws.geonames.org/rssToGeoRSS?feedUrl=http://hosted.ap.org/lineups/TOPHEADS-rss_2.0.xml?SITE=NYPLA&SECTION=HOME';geoRss.Update();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Wikipedia=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var self=this;function ctor()
{self.Panel.SetIcon('/Features/Wikipedia/Wikipedia.png');self.Panel.SetTitle('Wikipedia');}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var items=response.get_xml().getElementsByTagName('item');var points=new Array();for(var i=0;i<items.length;i++)
{var number=(i+1);var description=(items[i].getElementsByTagName('description')[0].firstChild)?items[i].getElementsByTagName('description')[0].firstChild.data:'';var title=(items[i].getElementsByTagName('title')[0].firstChild)?items[i].getElementsByTagName('title')[0].firstChild.data:'';var latitude=null;var longitude=null;if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('georss:point').length>0)
{try
{var point=items[i].getElementsByTagName('georss:point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('point').length>0)
{try
{var point=items[i].getElementsByTagName('point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
var position=new VELatLong(parseFloat(latitude),parseFloat(longitude));var item=new FreshLogicStudios.Atlas.Item(title,description,description,position,self.Color,number);self.Items.Add(item);points.push(position);}
self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}',FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
else
{self.EndSearch();}}
this.Search=function()
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/Wikipedia/Wikipedia.ashx?Latitude={0}&Longitude={1}',self.Where.LatLong.Latitude,self.Where.LatLong.Longitude));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
ctor();}
FreshLogicStudios.Atlas.Features.Wikipedia.ParseQueryString=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();if(params['Wikipedia'])
{var wikipedia=new FreshLogicStudios.Atlas.Features.Wikipedia();wikipedia.Where=params['Wikipedia']!='undefined'?params['Wikipedia']:'';if(wikipedia.Where!='')
{wikipedia.BeginSearch();}}}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',FreshLogicStudios.Atlas.Features.Wikipedia.ParseQueryString));RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.WiFi=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var self=this;function ctor()
{self.Panel.SetIcon('/Features/WiFi/WiFi.png');self.Panel.SetTitle('WiFi');self.Panel.SetFooterHeight(75);}
function SearchPostalCode(postalCode)
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/WiFi/WiFi.ashx?zip={0}',postalCode));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var hotspots=response.get_xml().getElementsByTagName('Hotspot');for(var i=0;i<hotspots.length;i++)
{if(hotspots[i].getElementsByTagName('Position').length>0)
{var title=hotspots[i].getElementsByTagName('Name')[0].firstChild.data;var ssid=hotspots[i].getElementsByTagName('SSID')[0].firstChild.data;var provider=hotspots[i].getElementsByTagName('Provider')[0].firstChild.data;var address1=hotspots[i].getElementsByTagName('Address1')[0].firstChild.data;var address2=hotspots[i].getElementsByTagName('Address2')[0].firstChild.data;var position=new VELatLong(hotspots[i].getElementsByTagName('Latitude')[0].firstChild.data,hotspots[i].getElementsByTagName('Longitude')[0].firstChild.data);var details=FreshLogicStudios.Scripts.String.Format('{0}<br />{1}<br />SSID: {2}<br />Provider: {3}',address1,address2,ssid,provider);var item=new FreshLogicStudios.Atlas.Item(title,details,details,position,self.Color,i+1);self.Items.Add(item);}}
var ads=response.get_xml().getElementsByTagName('Ad');var footerHtml='';for(var i=0;i<ads.length;i++)
{var title=ads[i].getElementsByTagName('Title')[0].firstChild.data;var description=ads[i].getElementsByTagName('Description')[0].firstChild.data;var uri=ads[i].getElementsByTagName('Uri')[0].firstChild.data;footerHtml+=FreshLogicStudios.Scripts.String.Format('<div><a href="{0}" target="_blank">{1}</a></div>',uri,title);footerHtml+=description;}
self.Panel.SetFooter(footerHtml);}
var panelBodyHeader='<div class="PanelBodyHeader"><div class="Summary">Data provided by <a href="http://www.hotspothaven.com/" target="_blank">hotspothaven.com</a></div></div>';self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}{1}',panelBodyHeader,FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
this.Search=function()
{WebService.GetPostalCode(self.Where.LatLong.Latitude,self.Where.LatLong.Longitude,function(response){SearchPostalCode(response);});}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Traffic=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var self=this;function ctor()
{self.Panel.SetIcon('/Features/Traffic/Traffic.png');self.Panel.SetTitle('Traffic');}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var traffic=response.get_xml().getElementsByTagName('Result');for(var i=0;i<traffic.length;i++)
{var title=traffic[i].getElementsByTagName('Title')[0].firstChild.data;var details=traffic[i].getElementsByTagName('Description')[0].firstChild.data.split(';')[0];var position=new VELatLong(traffic[i].getElementsByTagName('Latitude')[0].firstChild.data,traffic[i].getElementsByTagName('Longitude')[0].firstChild.data);var item=new FreshLogicStudios.Atlas.Item(title,details,details,position,self.Color,i+1);self.Items.Add(item);}}
var panelBodyHeader='<div class="PanelBodyHeader"><div class="Summary">Data provided by <a href="http://www.yahoo.com/" target="_blank">yahoo.com</a></div></div>';self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}{1}',panelBodyHeader,FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
this.Search=function()
{var webRequest=new Sys.Net.WebRequest();var uri=FreshLogicStudios.Scripts.String.Format('http://api.local.yahoo.com/MapsService/V1/trafficData?appid=freshlogicstudios&latitude={0}&longitude={1}',self.Where.LatLong.Latitude,self.Where.LatLong.Longitude);webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Proxy.ashx?uri={0}',encodeURIComponent(uri)));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Photos=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var resultsPerPage=10;var self=this;this.Index=1;this.What='';function ctor()
{self.Panel.SetIcon('/Features/Photos/Photos.png');self.Panel.SetTitle('Photos');self.RenderPanelHeader();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var photos=response.get_xml().getElementsByTagName('photo');for(var i=0;i<photos.length;i++)
{var number=(i+1)+((self.Index-1)*10);var photoId=photos[i].getAttribute('id');var uploaded=new Date(parseInt(photos[i].getAttribute('dateupload'))*1000);uploaded=new FreshLogicStudios.Scripts.DateTime(uploaded.getFullYear(),uploaded.getMonth()+1,uploaded.getDate(),uploaded.getHours(),uploaded.getMinutes(),uploaded.getSeconds(),uploaded.getMilliseconds());var owner=photos[i].getAttribute('owner');var ownerName=photos[i].getAttribute('ownername');var secret=photos[i].getAttribute('secret');var server=photos[i].getAttribute('server');var title=photos[i].getAttribute('title');title=title==''?'Untitled':title;var position=new VELatLong(photos[i].getAttribute('latitude'),photos[i].getAttribute('longitude'));var contextMenuDetails=FreshLogicStudios.Scripts.String.Format('<div class="Photo"><a href="http://www.flickr.com/photos/{0}/{1}" target="_blank" title="{2}"><img alt="{2}" onload="AtlasContextMenu.SetSize(new FreshLogicStudios.Scripts.Drawing.Size(276,\'auto\'));" src="http://static.flickr.com/{3}/{1}_{4}_m.jpg" /></a></div>',owner,photoId,title,server,secret);var sidebarDetails=FreshLogicStudios.Scripts.String.Format('<div class="DetailContent">{0}<br /><a href="http://www.flickr.com/photos/{1}" target="_blank">{2}\'s photos</a></div>',uploaded.ToString('g'),owner,ownerName);var item=new FreshLogicStudios.Atlas.Item(title,sidebarDetails,contextMenuDetails,position,self.Color,number);self.Items.Add(item);}
var panelBodyHeader='<div class="PanelBodyHeader">';panelBodyHeader+='<div class="Summary">';panelBodyHeader+=(self.Items.GetCount()>0)?FreshLogicStudios.Scripts.String.Format('Results {0} - {1}',(self.Index-1)*resultsPerPage+1,(self.Index-1)*resultsPerPage+photos.length):'';panelBodyHeader+='<br />';panelBodyHeader+='Data provided by <a href="http://www.flickr.com/" target="_blank">flickr.com</a>';panelBodyHeader+='</div>';panelBodyHeader+='<div class="Commands">';panelBodyHeader+=(self.Index==1)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index--; Plugins[\''+self.GetId()+'\'].Refresh();">Previous</a>';panelBodyHeader+=((self.Index!=1)&&(photos.length>=resultsPerPage))?' | ':'';panelBodyHeader+=(photos.length<resultsPerPage)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index++; Plugins[\''+self.GetId()+'\'].Refresh();">Next</a>';panelBodyHeader+='</div>';panelBodyHeader+='</div>';self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}{1}',panelBodyHeader,FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
else
{self.EndSearch();}}
function SearchBoundingBox(what,latitude1,longitude1,latitude2,longitude2,index)
{var webRequest=new Sys.Net.WebRequest();var uri=FreshLogicStudios.Scripts.String.Format('http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=c2e6e659a0a5b0f8abc8d81d2c46faca&tags={0}&min_upload_date=1136095200&max_upload_date={1}&bbox={2},{3},{4},{5}&extras=date_upload,owner_name,geo&per_page=10&page={6}',what,parseInt(new Date().getTime()/1000),Math.min(longitude1,longitude2),Math.min(latitude1,latitude2),Math.max(longitude1,longitude2),Math.max(latitude1,latitude2),index);webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Proxy.ashx?uri={0}',encodeURIComponent(uri)));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
this.RenderPanelHeader=function()
{var html='<div class="SearchForm">';html+=FreshLogicStudios.Scripts.String.Format('<form name="SearchForm{0}" action="about:blank" method="get" target="hiddenframe" onsubmit="Plugins[\'{0}\'].What = this.What.value; Plugins[\'{0}\'].Where = this.Where.value; Plugins[\'{0}\'].BeginSearch(); return false;">',self.GetId());html+='<label>What: Tag or keyword (optional)</label>';html+=FreshLogicStudios.Scripts.String.Format('<input name="What" type="text" value="{0}" /><br />',self.What);html+='<label>Where: Address, city or landmark</label>';html+=FreshLogicStudios.Scripts.String.Format('<input type="text" name="Where" value="{0}" onfocus="if(this.value == FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\']){this.value=\'\';} else{this.select();}" onblur="if(this.value==\'\'){this.value=FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\'];}" /><br />',FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']);html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>';html+='</div>';self.Panel.SetHeader(html);self.Panel.SetHeaderHeight(100);}
this.Refresh=function()
{self.Clear();self.Panel.SetBody('Loading...');var view=map.GetMapView();SearchBoundingBox(self.What,view.TopLeftLatLong.Latitude,view.TopLeftLatLong.Longitude,view.BottomRightLatLong.Latitude,view.BottomRightLatLong.Longitude,self.Index);}
this.Search=function()
{self.Index=1;if(self.Where.Name!=FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])
{map.Find(null,self.Where.Name,null,null,null,null,false,false,false,true,self.Refresh);}
else
{self.Refresh();}}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.People=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var resultsPerPage=20;var self=this;this.Index=1;this.Who='';function ctor()
{self.Panel.SetIcon('/Features/People/People.png');self.Panel.SetTitle('People');self.RenderPanelHeader();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var places=response.get_xml().getElementsByTagName('Place');for(var i=0;i<places.length;i++)
{var number=(i+1)+((self.Index-1)*10);var address=(places[i].getElementsByTagName('Address')[0].firstChild)?places[i].getElementsByTagName('Address')[0].firstChild.data:'';var title=(places[i].getElementsByTagName('Name')[0].firstChild)?places[i].getElementsByTagName('Name')[0].firstChild.data:'';var phone=(places[i].getElementsByTagName('Phone')[0].firstChild)?places[i].getElementsByTagName('Phone')[0].firstChild.data:'';var position=new VELatLong(places[i].getElementsByTagName('Latitude')[0].firstChild.data,places[i].getElementsByTagName('Longitude')[0].firstChild.data);var details=FreshLogicStudios.Scripts.String.Format('{0}<br />{1}',address,phone);var item=new FreshLogicStudios.Atlas.Item(title,details,details,position,self.Color,number);self.Items.Add(item);}
var panelBodyHeader='<div class="PanelBodyHeader">';panelBodyHeader+='<div class="Summary">';panelBodyHeader+=(self.Items.GetCount()>0)?FreshLogicStudios.Scripts.String.Format('Results {0} - {1}',(self.Index-1)*resultsPerPage+1,(self.Index-1)*resultsPerPage+places.length):'';panelBodyHeader+='</div>';panelBodyHeader+='<div class="Commands">';panelBodyHeader+=(self.Index==1)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index--; Plugins[\''+self.GetId()+'\'].Refresh();">Previous</a>';panelBodyHeader+=((self.Index!=1)&&(places.length>=resultsPerPage))?' | ':'';panelBodyHeader+=(places.length<resultsPerPage)?'':'<a href="javascript:Plugins[\''+self.GetId()+'\'].Index++; Plugins[\''+self.GetId()+'\'].Refresh();">Next</a>';panelBodyHeader+='</div>';panelBodyHeader+='</div>';self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}{1}',panelBodyHeader,FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
else
{self.EndSearch();}}
function SearchBoundingBox(who,latitude1,longitude1,latitude2,longitude2,index)
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/People/People.ashx?who={0}&latitude1={1}&longitude1={2}&latitude2={3}&longitude2={4}&index={5}',who,latitude1,longitude1,latitude2,longitude2,index));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
this.RenderPanelHeader=function()
{var html='<div class="SearchForm">';html+=FreshLogicStudios.Scripts.String.Format('<form name="SearchForm{0}" action="about:blank" method="get" target="hiddenframe" onsubmit="Plugins[\'{0}\'].Who = this.Who.value; Plugins[\'{0}\'].Where = this.Where.value; Plugins[\'{0}\'].BeginSearch(); return false;">',self.GetId());html+='<label>Who: Name or phone number</label>';html+=FreshLogicStudios.Scripts.String.Format('<input name="Who" type="text" value="{0}" /><br />',self.Who);html+='<label>Where: Address, city or landmark</label>';html+=FreshLogicStudios.Scripts.String.Format('<input type="text" name="Where" value="{0}" onfocus="if(this.value == FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\']){this.value=\'\';} else{this.select();}" onblur="if(this.value==\'\'){this.value=FreshLogicStudios.Scripts.Configuration.Settings.Defaults[\'DefaultWhere\'];}" /><br />',FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere']);html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>';html+='</div>';self.Panel.SetHeader(html);self.Panel.SetHeaderHeight(100);}
this.Refresh=function()
{self.Panel.SetBody('Loading...');FreshLogicStudios.Atlas.Items.Clear(self.Items);var view=map.GetMapView();SearchBoundingBox(self.Who,view.TopLeftLatLong.Latitude,view.TopLeftLatLong.Longitude,view.BottomRightLatLong.Latitude,view.BottomRightLatLong.Longitude,self.Index);}
this.Search=function()
{self.Index=1;if(self.Where.Name!=FreshLogicStudios.Scripts.Configuration.Settings.Defaults['DefaultWhere'])
{map.Find(null,self.Where.Name,null,null,null,null,false,false,false,true,self.Refresh);}
else
{self.Refresh();}}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Packages=function()
{FreshLogicStudios.Atlas.Plugin.call(this);var polyline=null;var self=this;this.What='';function ctor()
{self.Panel.SetIcon('/Features/Packages/Packages.png');self.Panel.SetTitle('Packages');self.RenderPanelHeader();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var items=response.get_xml().getElementsByTagName('item');var points=new Array();for(var i=0;i<items.length;i++)
{var number=(i+1);var description=(items[i].getElementsByTagName('description')[0].firstChild)?items[i].getElementsByTagName('description')[0].firstChild.data:'';var title=(items[i].getElementsByTagName('title')[0].firstChild)?items[i].getElementsByTagName('title')[0].firstChild.data:'';var latitude=null;var longitude=null;if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('georss:point').length>0)
{try
{var point=items[i].getElementsByTagName('georss:point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
if(latitude==null||longitude==null)
{if(items[i].getElementsByTagName('point').length>0)
{try
{var point=items[i].getElementsByTagName('point')[0].firstChild.data;latitude=point.split(' ')[0];longitude=point.split(' ')[1];}
catch(e)
{}}}
var position=new VELatLong(parseFloat(latitude),parseFloat(longitude));var item=new FreshLogicStudios.Atlas.Item(title,description,description,position,self.Color,number);self.Items.Add(item);points.push(position);}
if(points.length>=2)
{polyline=new VEShape(VEShapeType.Polyline,points);polyline.HideIcon();map.AddShape(polyline);}
self.EndSearch();self.Panel.SetBody(FreshLogicStudios.Scripts.String.Format('{0}',FreshLogicStudios.Atlas.Items.GetSidebarHtml(self.Items)));}
else
{self.EndSearch();}}
this.BeginSearch=function()
{self.Search();}
this.Clear=function()
{self.HidePushpins();self.Items.Clear();if(polyline!=null)
{map.DeleteShape(polyline);polyline=null;}}
this.RenderPanelHeader=function()
{var html='<div class="SearchForm">';html+=FreshLogicStudios.Scripts.String.Format('<form name="SearchForm{0}" action="about:blank" method="get" target="hiddenframe" onsubmit="Plugins[\'{0}\'].What = this.What.value; Plugins[\'{0}\'].BeginSearch(); return false;">',self.GetId());html+='<label>Tracking number: <span class="Carriers">DHL, FedEx, UPS or USPS</span></label>';html+=FreshLogicStudios.Scripts.String.Format('<input name="What" type="text" value="{0}" /><br />',self.What);html+='<button class="Button" type="submit" name="submit" value="Search">Search</button>';html+='</form>';html+='</div>';self.Panel.SetHeader(html);self.Panel.SetHeaderHeight(70);}
this.Search=function()
{self.Clear();self.Panel.SetBody('Loading...');var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/Packages/Packages.ashx?TrackingNumber={0}',self.What));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
ctor();}
FreshLogicStudios.Atlas.Features.Packages.ParseQueryString=function()
{var uri=new FreshLogicStudios.Scripts.Uri(window.location.href);var params=uri.GetQueryParameters();if(params['Packages'])
{var packages=new FreshLogicStudios.Atlas.Features.Packages();packages.What=params['Packages']!='undefined'?params['Packages']:'';packages.RenderPanelHeader();if(packages.What!='')
{packages.BeginSearch();}}}
Events.Add(new FreshLogicStudios.Scripts.Event('MapLoaded',FreshLogicStudios.Atlas.Features.Packages.ParseQueryString));RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Movies=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var self=this;function ctor()
{self.Panel.SetIcon('/Features/Movies/Movies.png');self.Panel.SetTitle('Movies');}
function SearchPostalCode(postalCode)
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/Movies/Movies.ashx?zip={0}',postalCode));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var theatres=response.get_xml().getElementsByTagName('Theatre');for(var i=0;i<theatres.length;i++)
{if(theatres[i].getElementsByTagName('Position').length>0)
{var title=theatres[i].getElementsByTagName('Name')[0].firstChild.data;var address1=theatres[i].getElementsByTagName('Address1')[0].firstChild.data;var address2=theatres[i].getElementsByTagName('Address2')[0].firstChild?theatres[i].getElementsByTagName('Address2')[0].firstChild.data:'';var phone=theatres[i].getElementsByTagName('Phone')[0].firstChild.data;var uri=theatres[i].getElementsByTagName('Uri')[0].firstChild.data;var position=new VELatLong(theatres[i].getElementsByTagName('Latitude')[0].firstChild.data,theatres[i].getElementsByTagName('Longitude')[0].firstChild.data);var details=FreshLogicStudios.Scripts.String.Format('<div>{0}</div><div>{1}</div><div>{2}</div>',address1,address2,phone);details+='<div style="position:relative;">';details+=FreshLogicStudios.Scripts.String.Format('<a href="{0}" style="color:#6A6967;" target="_blank" title="View theatre details">details&nbsp;&raquo;</a><br />',uri);var movies=theatres[i].getElementsByTagName('Movie');var showtimesHtml='';if(movies.length<=0)
{showtimesHtml+='<span style="color:#6A6967;">no showtimes available</span><br />';}
else
{showtimesHtml+='<a href="#" style="color:#6A6967;" title="View or hide the showtimes" onclick="FreshLogicStudios.Scripts.Html.HtmlElement.Toggle(this.parentNode.getElementsByTagName(\'ul\')[0]); FreshLogicStudios.Scripts.Html.HtmlElement.Toggle(this.parentNode.getElementsByTagName(\'img\')[0]); return false;">showtimes&nbsp;&raquo;</a><br />';showtimesHtml+='<img src="/Features/Movies/Showtimes.gif" class="ShowtimesDetailsImage" style="display:none;" alt="" />';showtimesHtml+='<ul class="MoviesByTheatreList" style="display:none;">';for(var j=0;j<movies.length;j++)
{var movieName=movies[j].getElementsByTagName('Name')[0].firstChild.data;var rating=(movies[j].getElementsByTagName("Rating")[0].firstChild)?movies[j].getElementsByTagName("Rating")[0].firstChild.data:'';var length=(movies[j].getElementsByTagName("Length")[0].firstChild)?movies[j].getElementsByTagName("Length")[0].firstChild.data:'';showtimesHtml+='<li>';showtimesHtml+=FreshLogicStudios.Scripts.String.Format('<div><a href="{0}" target="_blank">{1}</a></div>',movies[j].getElementsByTagName("Uri")[0].firstChild.data,movieName);showtimesHtml+=FreshLogicStudios.Scripts.String.Format('<div class="MovieDetails"><span class="MovieRating">{0}</span><span class="MovieLength">{1}</span></div>',rating,length);showtimesHtml+='<ul class="ShowtimesList">';var showtimes=movies[j].getElementsByTagName('Showtime');if(showtimes.length>0)
{showtimesHtml+=FreshLogicStudios.Scripts.String.Format('<li>{0}</li>',showtimes[0].firstChild.data);}
else
{showtimesHtml+='<li>no showtimes</li>';}
for(var k=1;k<showtimes.length;k++)
{showtimesHtml+=FreshLogicStudios.Scripts.String.Format('<li> - {0}</li>',showtimes[k].firstChild.data);}
showtimesHtml+='</ul>';showtimesHtml+='</li>';}
showtimesHtml+='</ul>';}
var sidebarHtml=details+showtimesHtml+'</div></div>';var contextMenuHtml=details+'</div></div>';var item=new FreshLogicStudios.Atlas.Item(title,sidebarHtml,contextMenuHtml,position,self.Color,i+1);self.Items.Add(item);}}}
self.EndSearch();}
this.Search=function()
{WebService.GetPostalCode(self.Where.LatLong.Latitude,self.Where.LatLong.Longitude,function(response){SearchPostalCode(response);});}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.GasPrices=function(where)
{FreshLogicStudios.Atlas.Plugin.call(this,where);var self=this;function ctor()
{self.Panel.SetIcon('/Features/GasPrices/GasPrices.png');self.Panel.SetTitle('Gas Prices');}
function SearchPostalCode(postalCode)
{var webRequest=new Sys.Net.WebRequest();webRequest.set_url(FreshLogicStudios.Scripts.String.Format('/Features/GasPrices/GasPrices.ashx?zip={0}',postalCode));webRequest.add_completed(OnWebRequestComplete);webRequest.invoke();}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var gasStations=response.get_xml().getElementsByTagName('GasStation');for(var i=0;i<gasStations.length;i++)
{var title=gasStations[i].getElementsByTagName("Name")[0].firstChild.data;var address1=gasStations[i].getElementsByTagName("Address1")[0].firstChild.data;var address2=gasStations[i].getElementsByTagName("Address2")[0].firstChild.data;var prices=gasStations[i].getElementsByTagName("Price");var position=new VELatLong(gasStations[i].getElementsByTagName("Latitude")[0].firstChild.data,gasStations[i].getElementsByTagName("Longitude")[0].firstChild.data);var details=FreshLogicStudios.Scripts.String.Format('<div class="Logo"><img src="http://gadgets.freshlogicstudios.com/GasPrices/Images/GasStationLogo.ashx?name={0}" /></div>',title);details+=FreshLogicStudios.Scripts.String.Format('{0}<br />{1}<br /><br />',address1,address2);for(var j=0;j<prices.length;j++)
{details+=(prices[j].getAttribute("type")+": "+prices[j].getElementsByTagName("Amount")[0].firstChild.data+(j!=(prices.length-1)?"<br />":""));}
var item=new FreshLogicStudios.Atlas.Item(title,details,details,position,self.Color,i+1);self.Items.Add(item);}}
self.EndSearch();}
this.Search=function()
{WebService.GetPostalCode(self.Where.LatLong.Latitude,self.Where.LatLong.Longitude,function(response){SearchPostalCode(response);});}
ctor();}
RegisterNamespace('FreshLogicStudios.Atlas.Features');FreshLogicStudios.Atlas.Features.Xkcd=function()
{FreshLogicStudios.Atlas.Plugin.call(this);var polygon=null;var self=this;function ctor()
{self.Panel.SetIcon('/Features/Experiments/Xkcd/Xkcd.png');self.Panel.SetTitle('XKCD Geohashing');self.RenderPanelHeader();self.Panel.SetBody('<strong>What is this?</strong><br />XKCD comic #426 contains an algorithm that generates random coordinates across the country every day. These coordinates can be used as destinations for adventures, a la Geocaching. They can also be used for local meetups.<br /><a href="http://wiki.xkcd.com/geohashing/Main_Page" target="_blank">more...</a></p>');}
function OnWebRequestComplete(response)
{if(response.get_statusCode()==200)
{var items=response.get_xml().getElementsByTagName('item');var points=new Array();for(var i=0;i<items.length;i++)
{var number=(i+1);var description=(items[i].getElementsByTagName('description')[0].firstChild)?items[i].getElementsByTagName('description')[0].firstChild.data:'';var title=(items[i].getElementsByTagName('title')[0].firstChild)?items[i].getElementsByTagName('title')[0].firstChild.data:'';var latitude=null;var longitude=null;if(latitude==null||longitude==null)
{if(items[i].getElementsByTagN