/* This file was compressed using MbCompression library. http://blog.mironabramson.com */ 
var map=null;var SelectedPinID=0;var LastPinID=0;var wp=0;var formID;var PushPinExistArray=new Array();var PushPinIDArray=new Array();var WayPointTypeArray=new Array();var WayPointValueArray=new Array();var WayPointLatLongArray=new Array();var PinPointText='(See Map)';function GetMap(pageformID){formID=pageformID;if(document.getElementById('VEMap')){map=new VEMap('VEMap');map.LoadMap();map.AttachEvent("onclick",MouseClick);CheckPostBack();}}
function LatlongLatitude(e){var mode=map.GetMapMode();if(mode==VEMapMode.Mode2D)
{var x=e.mapX;var y=e.mapY;pixel=new VEPixel(x,y);var LL=map.PixelToLatLong(pixel);var LatLongPoint=new VELatLong(LL);return LL.Latitude;}
else if(mode==VEMapMode.Mode3D)
{e.Latlong.Latitude;}}
function LatlongLongitude(e){var mode=map.GetMapMode();if(mode==VEMapMode.Mode2D)
{var x=e.mapX;var y=e.mapY;pixel=new VEPixel(x,y);var LL=map.PixelToLatLong(pixel);var LatLongPoint=new VELatLong(LL);return LL.Longitude;}
else if(mode==VEMapMode.Mode3D)
{e.Latlong.Longitude;}}
var PostBackTimerCount=0;function CheckPostBack(){if(document.getElementById('PostBackWayPointCount')){var WayPointCount=document.getElementById('PostBackWayPointCount').value;if(PostBackTimerCount<WayPointCount){if(document.getElementById('txtWayPoint'+PostBackTimerCount)){document.getElementById('txtWayPoint'+PostBackTimerCount).value=document.getElementById('PostBackWayPointValue'+PostBackTimerCount).value;var LatLongPoint=new VELatLong(document.getElementById('PostBackWayPointLatitude'+PostBackTimerCount).value,document.getElementById('PostBackWayPointLongitude'+PostBackTimerCount).value);PlotPinPoint(PostBackTimerCount,LatLongPoint,document.getElementById('PostBackWayPointValue'+PostBackTimerCount).value);ViewReadOnlyWayPoint(PostBackTimerCount);WayPointTypeArray[PostBackTimerCount]='latlong';WayPointValueArray[PostBackTimerCount]=document.getElementById('PostBackWayPointValue'+PostBackTimerCount).value;WayPointLatLongArray[PostBackTimerCount]=LatLongPoint;document.getElementById('txtWayPointType'+PostBackTimerCount).value='latlong';document.getElementById('txtWayPointLatLong'+PostBackTimerCount).value=LatLongPoint;document.getElementById('txtWayPointValue'+PostBackTimerCount).value=document.getElementById('PostBackWayPointValue'+PostBackTimerCount).value;CreateNextWayPointBlock();}
PostBackTimerCount++;setTimeout('CheckPostBack()',100);}else{map.SetMapView(WayPointLatLongArray);}}}
function MouseClick(e){if(e.eventName=='onclick'&&e.rightMouseButton){var LatLongPoint=new VELatLong(LatlongLatitude(e),LatlongLongitude(e));var LatLongDescription='(See Pin Point on Map)';var LatLongHTML='<b>(See Pin Point on Map)</b>';var isDifferent=true;if(SelectedPinID<50){if(SelectedPinID>0){isDifferent=(LatLongPoint!=document.getElementById('txtWayPointLatLong'+(SelectedPinID-1)).value);}}
if(isDifferent){PlotPinPoint(SelectedPinID,LatLongPoint,LatLongHTML);document.getElementById('txtWayPoint'+SelectedPinID).value=LatLongDescription;ViewReadOnlyWayPoint(SelectedPinID);document.getElementById('LinkWayPoint'+SelectedPinID).innerHTML=LatLongHTML;WayPointTypeArray[SelectedPinID]='latlong';WayPointValueArray[SelectedPinID]=LatLongDescription;WayPointLatLongArray[SelectedPinID]=LatLongPoint;document.getElementById('txtWayPointType'+SelectedPinID).value='latlong';document.getElementById('txtWayPointValue'+SelectedPinID).value=LatLongDescription;document.getElementById('txtWayPointLatLong'+SelectedPinID).value=LatLongPoint;CreateNextWayPointBlock();}}}
function DeleteWayPoint(PinID){var NextPinID=0;try{map.DeleteAllShapes();}catch(err){alert('Error deleting all PushPins ('+err.message+')');}
for(var i=0;i<=LastPinID;i++){PushPinExistArray[i]=false;}
for(var i=PinID;i<LastPinID;i++){NextPinID=i+1;document.getElementById('txtWayPoint'+i).value=document.getElementById('txtWayPoint'+NextPinID).value;document.getElementById('txtWayPointValue'+i).value=document.getElementById('txtWayPointValue'+NextPinID).value;document.getElementById('txtWayPointLatLong'+i).value=document.getElementById('txtWayPointLatLong'+NextPinID).value;document.getElementById('txtWayPointType'+i).value=document.getElementById('txtWayPointType'+NextPinID).value;document.getElementById('LinkWayPoint'+i).innerHTML=document.getElementById('LinkWayPoint'+NextPinID).innerHTML;WayPointTypeArray[i]=WayPointTypeArray[NextPinID];WayPointValueArray[i]=WayPointValueArray[NextPinID];WayPointLatLongArray[i]=WayPointLatLongArray[NextPinID];}
var LastWayPointBlock=document.getElementById('WayPointBlock'+LastPinID);LastWayPointBlock.innerHTML='';LastWayPointBlock.setAttribute('id','');LastWayPointBlock.style.display='none';LastWayPointBlock=null;LastPinID--;document.getElementById('txtWayPointCount').value=LastPinID;WayPointTypeArray.length=LastPinID;WayPointValueArray.length=LastPinID;WayPointLatLongArray.length=LastPinID;ShowWayPointField(LastPinID);if(LastPinID>1){document.getElementById('GetDirectionsButton').style.display='block';}else{document.getElementById('GetDirectionsButton').style.display='none';}
RefreshPinPoints();}
function MoveUpWayPoint(PinID){ShowWayPointField(LastPinID);if(PinID>0){var PreviousPinID=PinID-1;var PreviousLocationValue=document.getElementById('txtWayPoint'+PreviousPinID).value;var CurrentLocationValue=document.getElementById('txtWayPoint'+PinID).value;document.getElementById('txtWayPoint'+PreviousPinID).value=CurrentLocationValue;document.getElementById('txtWayPoint'+PinID).value=PreviousLocationValue;PreviousLocationValue=document.getElementById('txtWayPointValue'+PreviousPinID).value;CurrentLocationValue=document.getElementById('txtWayPointValue'+PinID).value;document.getElementById('txtWayPointValue'+PreviousPinID).value=CurrentLocationValue;document.getElementById('txtWayPointValue'+PinID).value=PreviousLocationValue;var PreviousLatLong=document.getElementById('txtWayPointLatLong'+PreviousPinID).value;var CurrentLatLong=document.getElementById('txtWayPointLatLong'+PinID).value;document.getElementById('txtWayPointLatLong'+PreviousPinID).value=CurrentLatLong;document.getElementById('txtWayPointLatLong'+PinID).value=PreviousLatLong;var PreviousType=document.getElementById('txtWayPointType'+PreviousPinID).value;var CurrentType=document.getElementById('txtWayPointType'+PinID).value;document.getElementById('txtWayPointType'+PreviousPinID).value=CurrentType;document.getElementById('txtWayPointType'+PinID).value=PreviousType;var PreviousLinkValue=document.getElementById('LinkWayPoint'+PreviousPinID).innerHTML;var CurrentLinkValue=document.getElementById('LinkWayPoint'+PinID).innerHTML;document.getElementById('LinkWayPoint'+PreviousPinID).innerHTML=CurrentLinkValue;document.getElementById('LinkWayPoint'+PinID).innerHTML=PreviousLinkValue;var PreviousWayPointType=WayPointTypeArray[PreviousPinID];WayPointTypeArray[PreviousPinID]=WayPointTypeArray[PinID];WayPointTypeArray[PinID]=PreviousWayPointType;var PreviousWayPointValue=WayPointValueArray[PreviousPinID];WayPointValueArray[PreviousPinID]=WayPointValueArray[PinID];WayPointValueArray[PinID]=PreviousWayPointValue;var PreviousWayPointLatLong=WayPointLatLongArray[PreviousPinID];WayPointLatLongArray[PreviousPinID]=WayPointLatLongArray[PinID];WayPointLatLongArray[PinID]=PreviousWayPointLatLong;RefreshPinPoints();}}
function MoveDownWayPoint(PinID){ShowWayPointField(LastPinID);if(PinID<LastPinID-1){var NextPinID=PinID+1;var NextLocationValue=document.getElementById('txtWayPoint'+NextPinID).value;var CurrentLocationValue=document.getElementById('txtWayPoint'+PinID).value;document.getElementById('txtWayPoint'+NextPinID).value=CurrentLocationValue;document.getElementById('txtWayPoint'+PinID).value=NextLocationValue;NextLocationValue=document.getElementById('txtWayPointValue'+NextPinID).value;CurrentLocationValue=document.getElementById('txtWayPointValue'+PinID).value;document.getElementById('txtWayPointValue'+NextPinID).value=CurrentLocationValue;document.getElementById('txtWayPointValue'+PinID).value=NextLocationValue;var NextLatLong=document.getElementById('txtWayPointLatLong'+NextPinID).value;var CurrentLatLong=document.getElementById('txtWayPointLatLong'+PinID).value;document.getElementById('txtWayPointLatLong'+NextPinID).value=CurrentLatLong;document.getElementById('txtWayPointLatLong'+PinID).value=NextLatLong;var NextType=document.getElementById('txtWayPointType'+NextPinID).value;var CurrentType=document.getElementById('txtWayPointType'+PinID).value;document.getElementById('txtWayPointType'+NextPinID).value=CurrentType;document.getElementById('txtWayPointType'+PinID).value=NextType;var NextLinkValue=document.getElementById('LinkWayPoint'+NextPinID).innerHTML;var CurrentLinkValue=document.getElementById('LinkWayPoint'+PinID).innerHTML;document.getElementById('LinkWayPoint'+NextPinID).innerHTML=CurrentLinkValue;document.getElementById('LinkWayPoint'+PinID).innerHTML=NextLinkValue;var NextWayPointType=WayPointTypeArray[NextPinID];WayPointTypeArray[NextPinID]=WayPointTypeArray[PinID];WayPointTypeArray[PinID]=NextWayPointType;var NextWayPointValue=WayPointValueArray[NextPinID];WayPointValueArray[NextPinID]=WayPointValueArray[PinID];WayPointValueArray[PinID]=NextWayPointValue;var NextWayPointLatLong=WayPointLatLongArray[NextPinID];WayPointLatLongArray[NextPinID]=WayPointLatLongArray[PinID];WayPointLatLongArray[PinID]=NextWayPointLatLong;RefreshPinPoints();}}
function RefreshPinPoints(){for(var i=0;i<LastPinID;i++){PlotPinPoint(i,WayPointLatLongArray[i],WayPointValueArray[i]);}
try{if(WayPointLatLongArray!=null&&WayPointLatLongArray.length>0){map.SetMapView(WayPointLatLongArray);}else{map.SetZoomLevel(4);}}catch(err){alert('RefreshPinPoints: '+err.message);}}
function PlotPinPoint(PinID,LatLongPoint,LocationValue){var PinLabel;if(PinID==0){PinLabel="Starting Point";}else{PinLabel="Stop #"+PinID;}
try{var pin=map.AddPushpin(LatLongPoint);pin.SetCustomIcon("<img src='/images/rides/pushpins/pushpin_"+(PinID)+".gif' />");pin.SetTitle(PinLabel);pin.SetDescription(LocationValue+'<br/>'
+'<a href="javascript: DeleteWayPoint('+PinID+')">Remove this Stop...</a><br/><br><font size=1>'+LatLongPoint+'</font>');PushPinIDArray[PinID]=pin.GetID();}catch(err){ShowWayPointField(PinID);alert('Cannot add a stopping point in this view. Please switch to Road or Aerial view.');}
PushPinExistArray[PinID]=true;}
function AddWayPointField(LocationValue){LastPinID++;document.getElementById('txtWayPointCount').value=LastPinID;var PinID=LastPinID;SelectedPinID=LastPinID;var CloneWayPointBlock=document.getElementById('WayPointBlock0').cloneNode(true);CloneWayPointBlock.setAttribute('id','WayPointBlock'+PinID);var tagElement=CloneWayPointBlock.getElementsByTagName('div');for(var i=0;i<tagElement.length;i++){switch(tagElement[i].getAttribute('id')){case'ViewWayPoint0':tagElement[i].setAttribute('id','ViewWayPoint'+PinID);tagElement[i].style.display='none';break
case'EditWayPoint0':tagElement[i].setAttribute('id','EditWayPoint'+PinID);tagElement[i].style.display='block';break}}
var tagElement=CloneWayPointBlock.getElementsByTagName('a');for(var i=0;i<tagElement.length;i++){switch(tagElement[i].getAttribute('id')){case'LinkWayPoint0':tagElement[i].setAttribute('id','LinkWayPoint'+PinID);tagElement[i].innerHTML='';tagElement[i].onclick=function(){EditWayPoint(PinID)};break}}
var tagElement=CloneWayPointBlock.getElementsByTagName('textarea');for(var i=0;i<tagElement.length;i++){switch(tagElement[i].getAttribute('id')){case'txtWayPoint0':tagElement[i].setAttribute('id','txtWayPoint'+PinID);tagElement[i].setAttribute('name','txtWayPoint'+PinID);tagElement[i].innerHTML='';break}}
var tagElement=CloneWayPointBlock.getElementsByTagName('input');for(var i=0;i<tagElement.length;i++){switch(tagElement[i].getAttribute('id')){case'SubmitWayPointButton0':tagElement[i].setAttribute('id','SubmitWayPointButton'+PinID);tagElement[i].onclick=function(){SubmitWayPoint(PinID);return false;};break
case'DeleteWayPointButton0':tagElement[i].setAttribute('id','DeleteWayPointButton'+PinID);tagElement[i].onclick=function(){DeleteWayPoint(PinID);return false;};break
case'MoveUpWayPointButton0':tagElement[i].setAttribute('id','MoveUpWayPointButton'+PinID);tagElement[i].onclick=function(){MoveUpWayPoint(PinID);return false;};break
case'MoveDownWayPointButton0':tagElement[i].setAttribute('id','MoveDownWayPointButton'+PinID);tagElement[i].onclick=function(){MoveDownWayPoint(PinID);return false;};break
case'txtWayPointType0':tagElement[i].setAttribute('id','txtWayPointType'+PinID);tagElement[i].setAttribute('name','txtWayPointType'+PinID);tagElement[i].value='';break
case'txtWayPointValue0':tagElement[i].setAttribute('id','txtWayPointValue'+PinID);tagElement[i].setAttribute('name','txtWayPointValue'+PinID);tagElement[i].value='';break
case'txtWayPointLatLong0':tagElement[i].setAttribute('id','txtWayPointLatLong'+PinID);tagElement[i].setAttribute('name','txtWayPointLatLong'+PinID);tagElement[i].value='';break}}
var spanBlock=CloneWayPointBlock.getElementsByTagName('span');spanBlock[0].innerHTML='Stopping Point #'+PinID;document.getElementById('WayPointFormFieldLocation').appendChild(CloneWayPointBlock);}
function EditWayPoint(PinID){ShowWayPointField(PinID);}
function SubmitWayPoint(PinID){if(PinID<50){var LocationValue=document.getElementById('txtWayPoint'+PinID).value.replace(/^\s*|\s*$/g,"");if(LocationValue!=''){PlotAddress(PinID,LocationValue);ViewReadOnlyWayPoint(PinID);WayPointTypeArray[PinID]='address';WayPointValueArray[PinID]=LocationValue;document.getElementById('txtWayPointType'+PinID).value='address';document.getElementById('txtWayPointValue'+PinID).value=LocationValue;CreateNextWayPointBlock();}}}
function PlotAddress(PinID,LocationValue){try{map.Find(null,LocationValue,null,null,0,20,true,true,true,true,function(layer,places,findResults,hasMore,veErrorMessage){var results="Find Results:\n";if(findResults!=null&&findResults.length!=null&&findResults.length>0){for(r=0;r<findResults.length;r++){if(findResults[r].ID!=null){results+=findResults[r].ID+": "+findResults[r].LatLong+"\n";}else if(findResults[r].Name!=null){results+=findResults[r].Name+", ";results+=findResults[r].Description+": ";results+=findResults[r].Phone+"\n";}}
if(findResults.length==1){WayPointLatLongArray[PinID]=map.GetCenter();document.getElementById('txtWayPointLatLong'+PinID).value=map.GetCenter();try{PlotPinPoint(PinID,map.GetCenter(),LocationValue);map.SetMapView(WayPointLatLongArray);}catch(err){alert(err.message)}}else{ActivateMultipleLocationSelector(PinID,findResults);}}});}catch(err){alert('PlotAddress: '+err.message);}}
function ActivateMultipleLocationSelector(PinID,findResults){try{ShowWayPointField(PinID);var LocationSelectorDivElement=document.getElementById('MultipleLocationSelectorDiv');LocationSelectorDivElement.style.top=380+'px';LocationSelectorDivElement.style.left=430+'px';LocationSelectorDivElement.style.display='block';LocationSelectorDivElement.innerHTML='<b>Do you mean...?</b><br><br>';for(var i=0;i<findResults.length;i++){LocationSelectorDivElement.innerHTML+='<a href="javascript:void(0);" onclick="SelectLocation('+PinID+',\''+findResults[i].Name+'\', \''+findResults[i].LatLong+'\');" class="lnkArC0011b">'+findResults[i].Name+' &raquo;</a><br><br>';}
LocationSelectorDivElement.innerHTML+='<a href="javascript:void(0);" onclick="document.getElementById(\'MultipleLocationSelectorDiv\').style.display=\'none\';" class="lnkArC0011b">None of the above &raquo;</a><br><br>';LocationSelectorDivElement.focus();}catch(err){alert('Multiple Locations Found: '+err.message);}}
function SelectLocation(PinID,LocationValue,LatLong){var LatLongArray=LatLong.split(',');var LatLongPoint=new VELatLong(LatLongArray[0],LatLongArray[1]);PlotPinPoint(PinID,LatLongPoint,LocationValue);document.getElementById('txtWayPoint'+PinID).innerHTML=LocationValue;ViewReadOnlyWayPoint(PinID);document.getElementById('LinkWayPoint'+PinID).innerHTML=LocationValue;WayPointTypeArray[PinID]='address';WayPointValueArray[PinID]=LocationValue;WayPointLatLongArray[PinID]=LatLongPoint;document.getElementById('txtWayPointType'+PinID).value='address';document.getElementById('txtWayPointValue'+PinID).value=LocationValue;document.getElementById('txtWayPointLatLong'+PinID).value=LatLongPoint;map.SetMapView(WayPointLatLongArray);ShowWayPointField(LastPinID);document.getElementById('MultipleLocationSelectorDiv').style.display='none';}
function ViewReadOnlyWayPoint(PinID){var LocationValue=document.getElementById('txtWayPoint'+PinID).value.replace(/^\s*|\s*$/g,"");var EditElement=document.getElementById('EditWayPoint'+PinID);EditElement.style.display='none';var LinkElement=document.getElementById('LinkWayPoint'+PinID);LinkElement.innerHTML=LocationValue;var ViewElement=document.getElementById('ViewWayPoint'+PinID);ViewElement.style.display='block';}
function ShowWayPointField(PinID){for(var i=0;i<=LastPinID;i++){var EditElement=document.getElementById('EditWayPoint'+i);if(EditElement.style.display=='block'){var LocationValueElement=document.getElementById('txtWayPoint'+i);if(WayPointValueArray[i]!=null){LocationValueElement.innerHTML=WayPointValueArray[i];}
EditElement.style.display='none';var ViewElement=document.getElementById('ViewWayPoint'+i);ViewElement.style.display='block';}}
if(WayPointTypeArray[PinID]=='latlong'){document.getElementById('txtWayPoint'+PinID).value='';}
var ViewElement=document.getElementById('ViewWayPoint'+PinID);ViewElement.style.display='none';var EditElement=document.getElementById('EditWayPoint'+PinID);EditElement.style.display='block';SelectedPinID=PinID;}
function CreateNextWayPointBlock(){var LastWayPointLocationValue=document.getElementById('txtWayPoint'+LastPinID).value;if(LastWayPointLocationValue.replace(/^\s*|\s*$/g,"")!=''){AddWayPointField();}else{ShowWayPointField(LastPinID);}
if(LastPinID>1){document.getElementById('GetDirectionsButton').style.display='block';}}
function getBrowserWidth(){var windowWidth=630;if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){windowWidth=window.innerWidth;}
if(navigator.appName.indexOf("Microsoft")!=-1){windowWidth=document.body.offsetWidth;}}
return windowWidth;}
function getBrowserHeight(){var windowHeight=460;if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){windowHeight=window.innerHeight;}
if(navigator.appName.indexOf("Microsoft")!=-1){windowHeight=document.body.offsetHeight;}}
return windowHeight;}
function DisplayLoadingBox(){var LoadingDiv=document.getElementById('LoadDiv');LoadingDiv.style.top=470+'px';LoadingDiv.style.left=530+'px';LoadingDiv.style.display='block';return true;}
