var MAX_DATA_POINTS_ON_MAP=200;var LAYER_COUNT=7;var PAGE_SIZE=100+100;var BASE_URL='https://www.paraglidingmap.com';var BREAK_OUT_OF_FRAMES=true;var ENABLE_GOOGLE_BAR=true;var SHOW_BUTTON_TERRAIN=true;var SHOW_BUTTON_MAP=true;var SHOW_BUTTON_SATELLITE=true;var SHOW_OVERVIEW_MAP_CONTROL=true;var SHOW_SCALE_CONTROL=true;var ENABLE_INLINE_ADVERTISING=true;var SHOW_HIERARCHICAL_MAP_TYPE=true;var SHOW_SATELLITE_3D_MAP_BUTTON=true;var SHOW_COMPACT_VERSION=false;var MENU_HEIGHT=30;var ENABLE_SCROLL_WHEEL_ZOOM=true;var ENABLE_FULL_DETAILS_DIALOG=false;var SHOW_WEBCAM_OVERLAY=false;var SHOW_STREETVIEW_CONTROL=true;var SHOW_ZOOM_CONTROL=true;var _map;var _dataStateIsDirty=false;function load(){var aa={center:new google.maps.LatLng(-34.397,150.644),zoom:8,mapTypeId:google.maps.MapTypeId.TERRAIN,panControl:false,zoomControl:SHOW_ZOOM_CONTROL,mapTypeControl:SHOW_HIERARCHICAL_MAP_TYPE,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_RIGHT},scaleControl:SHOW_SCALE_CONTROL,streetViewControl:SHOW_STREETVIEW_CONTROL,overviewMapControl:SHOW_OVERVIEW_MAP_CONTROL,scrollWheel:ENABLE_SCROLL_WHEEL_ZOOM};_map=new google.maps.Map(document.getElementById("map"),aa);_repaint();google.maps.event.addListenerOnce(_map,'idle',function(){_onMapLoaded();});}
function _onMapLoaded(){var ba=$j.url();_map.setMapTypeId(google.maps.MapTypeId.TERRAIN);_LoadStateFromCookie();if((ba.param('lat')!=undefined)&&(ba.param('lng')!=undefined)){_map.setCenter(new google.maps.LatLng(ba.param('lat')*1,ba.param('lng')*1));hideLegend();}
if(ba.param('zoom')!=undefined){_map.setZoom(ba.param('zoom')*1);hideLegend();}
if(ba.param('launchid')!=undefined){hideLegend();}
google.maps.event.addDomListener(_map,'dragend',_onMapMoveEndDomListener);google.maps.event.addDomListener(_map,'zoom_changed',_onMapMoveEndDomListener);UpdateMarkers(1,'load',new Date().getTime(),0);_refreshForecastDropdown();}
function _repaint(){var da=Math.max(800,$j(window).innerWidth());var ea=$j(window).innerHeight();if(SHOW_COMPACT_VERSION){da=Math.max(314,$j(window).innerWidth());ea=Math.max(314,$j(window).innerHeight());}
var fa=(($j('#top')!=null)&&(!SHOW_COMPACT_VERSION));var ga=($j('#menu')!=null);var ha=0;var ia=0;var ja=0;if((true==true)&&(!SHOW_COMPACT_VERSION)&&(!_IS_WEBSITE_PRO_USER)){}
if((_topIsVisible)&&(fa)){ha+=_topHeight;}
if(!ga){MENU_HEIGHT=0;}
var ka=0;if($j('#pony')!=null){var ad=$j('.adPlatinum');if(ad===null||typeof ad==='undefined'||ad.width()==0){ad=$j('#donatePlatinum')}
ka=ad.outerWidth()>0?ad.outerWidth()+20:10;$j('#pony').css('top',ha+MENU_HEIGHT+"px");if("left"=="left"){ja=ia;}
else{$j('#pony').attr('left',(da-ia)+"px");}}
$j('#loading').css('top',ha+MENU_HEIGHT+37+'px');$j('#loading').css('left',ja+ka+"px");$j('#hiddenLayersWarning').css('left',$j('#loading').css('left'));$j('#hiddenLayersWarning').css('top',ha+MENU_HEIGHT+67+"px");$j('#moreResultsAvailable').css('top',$j('#loading').css('top'));$j('#moreResultsAvailable').css('left',$j('#loading').css('left'));$j('#legend').css('top',ha+MENU_HEIGHT+31+"px");$j('#legend').css('left',$j('#loading').css('left'));$j('#showLegend').css('top',ha+MENU_HEIGHT+7+"px");$j('#showLegend').css('left',$j('#legend').css('left'));if(($j('#legend').position().top+$j('#legend').outerHeight())>$j(window).height()){$j('#legend').css('top',Math.max(0,$j(window).height()-$j('#legend').outerHeight()));}
$j('#map').css('left',ja+"px");$j('#map').css('top',ha+MENU_HEIGHT+"px");$j('#map').css('height',ea-(ha+MENU_HEIGHT)+"px");$j('#map').css('width',(da-ia)+"px");$j('#forecastDropdownDiv').css('top',ha+MENU_HEIGHT+7+"px");$j('#forecastDropdownDiv').css('left',$j('#showLegend').position().left+$j('#showLegend').width()+7+"px");$j('#showSearch').css('top',ha+MENU_HEIGHT+7+"px");$j('#showSearch').css('left',$j('#forecastDropdownDiv').position().left+$j('#forecastDropdownDiv').width()+7+"px");if(ga){$j('#menu').css('top',0+"px");}
if(fa){if(_topIsVisible){$j('#tabShow').css('visibility','hidden');$j('#tabHide').css('visibility','visible');$j('#top').css('height',ha+"px");$j('#top').css('visibility','visible');$j('#menu').css('top',100+"px");$j('#bubble').css('top',156+"px");}
else{$j('#tabShow').css('visibility','visible');$j('#tabHide').css('visibility','hidden');$j('#top').css('visibility','hidden');$j('#bubble').css('top',56+"px");}}}﻿var KEY_LAST_LATITUDE="LastLatitude";var KEY_LAST_LONGITUDE="LastLongitude";var KEY_LAST_ZOOM="LastZoom";var KEY_LAST_MAP_TYPE="LastMapTypev3";var KEY_FORECAST_BUBBLE="ForecastBubble";var KEY_LEGEND_DISPLAYED="LegendDisplayed";var KEY_IS_TOP_BAR_HIDDEN="IsTopBarHidden";function _LoadStateFromCookie(){var la=_GetCookie(KEY_LAST_LATITUDE);var ma=_GetCookie(KEY_LAST_LONGITUDE);var na=_GetCookie(KEY_LAST_ZOOM);var oa=_GetCookie(KEY_LAST_MAP_TYPE);var pa=_GetCookie(KEY_FORECAST_BUBBLE);var qa=_GetCookie(KEY_LEGEND_DISPLAYED);oa=null;if(la===null){la=47.04;}
if(ma===null){ma=2.14;}
if(na===null){na=3;}
if(oa===null){oa=google.maps.MapTypeId.TERRAIN;}
_map.setCenter(new google.maps.LatLng(la*1,ma*1));_map.setZoom(na*1);_map.setMapTypeId(oa);$j("#"+_LAYER_FLYABLE_SITES).prop('checked',(_GetCookieBool(_LAYER_FLYABLE_SITES,true)));$j("#"+_LAYER_INSUFFICIENT_INFO_SITES).prop('checked',(_GetCookieBool(_LAYER_INSUFFICIENT_INFO_SITES,true)));$j("#"+_LAYER_LANDINGS).prop('checked',(_GetCookieBool(_LAYER_LANDINGS,true)));$j("#"+_LAYER_NON_FLYABLE_SITES).prop('checked',(_GetCookieBool(_LAYER_NON_FLYABLE_SITES,true)));$j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked',(_GetCookieBool(_LAYER_THERMAL_HOTSPOTS,true)));$j("#"+_LAYER_SCHOOLS).prop('checked',(_GetCookieBool(_LAYER_SCHOOLS,true)));$j("#"+_LAYER_SHOPS).prop('checked',(_GetCookieBool(_LAYER_SHOPS,true)));$j("#"+_LAYER_UNKNOWN_WIND_DIRECTION_SITES).prop('checked',(_GetCookieBool(_LAYER_UNKNOWN_WIND_DIRECTION_SITES,true)));$j("#"+_LAYER_WEATHER).prop('checked',(_GetCookieBool(_LAYER_WEATHER,true)));$j('.onOff:checkbox').iphoneStyle({checkedLabel:'ON',uncheckedLabel:'OFF',onChange:function(ra,sa){_toggleLayer(ra,sa);}});$j('#legend').hide();if(qa==null){showLegend();}}
function _SaveStateToCookie(){var ta=_map.getCenter();var ua=ta.lat();var va=ta.lng();var wa=_map.getZoom();var xa=_map.getMapTypeId();_SetCookie(KEY_LAST_LATITUDE,ua,365*2);_SetCookie(KEY_LAST_LONGITUDE,va,365*2);_SetCookie(KEY_LAST_ZOOM,wa,365*2);_SetCookie(KEY_LAST_MAP_TYPE,xa,365*2);_SetCookie(KEY_LEGEND_DISPLAYED,true,365*2);_SetCookie(_LAYER_FLYABLE_SITES,$j("#"+_LAYER_FLYABLE_SITES).prop('checked'),365*2);_SetCookie(_LAYER_INSUFFICIENT_INFO_SITES,$j("#"+_LAYER_INSUFFICIENT_INFO_SITES).prop('checked'),365*2);_SetCookie(_LAYER_LANDINGS,$j("#"+_LAYER_LANDINGS).prop('checked'),365*2);_SetCookie(_LAYER_NON_FLYABLE_SITES,$j("#"+_LAYER_NON_FLYABLE_SITES).prop('checked'),365*2);_SetCookie(_LAYER_THERMAL_HOTSPOTS,$j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked'),365*2);_SetCookie(_LAYER_SCHOOLS,$j("#"+_LAYER_SCHOOLS).prop('checked'),365*2);_SetCookie(_LAYER_SHOPS,$j("#"+_LAYER_SHOPS).prop('checked'),365*2);_SetCookie(_LAYER_UNKNOWN_WIND_DIRECTION_SITES,$j("#"+_LAYER_UNKNOWN_WIND_DIRECTION_SITES).prop('checked'),365*2);_SetCookie(_LAYER_WEATHER,$j("#"+_LAYER_WEATHER).prop('checked'),365*2);}
function _SetCookie(ya,za,Aa){var Ba;if(Aa){var Ca=new Date();Ca.setTime(Ca.getTime()+(Aa*24*60*60*1000));Ba="; expires="+Ca.toGMTString();}
else{Ba="";}
document.cookie=ya+"="+za+Ba+"; path=/";}
function _GetCookie(Da){var Ea=Da+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(Ea)===0){return c.substring(Ea.length,c.length);}}
return null;}
function _GetCookieBool(Fa,Ga){var Ha=_GetCookie(Fa);return((Ha==null)||(Ha=="true"));}﻿var _offsetHours=0;$j(window).resize(function(){_repaint();});$j(document).bind('click',function(e){if(($j(e.target).closest('#legend').length==0)&&($j(e.target).closest('#showLegend').length==0)&&($j('#legend:visible').length>0)){hideLegend();}});function _onMapMoveBegin(Ia){_updateMarkersKill=true;}
function _onMapMoveEndDomListener(Ja){_onMapMoveEnd(Ja,true);}
function _onMapMoveEnd(Ka,La){pageIndex=1;_SaveStateToCookie();UpdateMarkers(1,'_onMapMoveEnd',new Date().getTime(),_offsetHours);if(La)_refreshForecastDropdown();}
function showHideLegend(){if($j('#legend').is(':hidden'))showLegend();else hideLegend();}
function showLegend(){$j('#showLegendDiv').html('Hide Layers');$j('#legend').css('visibility','visible');$j('#legend').fadeIn(250);_repaint();}
function hideLegend(){$j('#showLegendDiv').html('Layers');$j('#legend').fadeOut(250);if(_dataStateIsDirty){_clearAndRefreshMap();}
_SaveStateToCookie();}
function showSearch(){var Ma=_map.getCenter().lat().toFixed(6);var Na=_map.getCenter().lng().toFixed(6);var Oa=_map.getZoom()-1;showPopupDialog("Search","/search.aspx?Latitude="+Ma+"&Longitude="+Na+"&Zoom="+Oa,null);}
function showPopupDialog(Pa,Qa,Ra){var Sa=/(iPad|iPhone|iPod)/g.test(navigator.userAgent);var Ta=$j(window).innerHeight()-70;var Ua=(Sa&&SHOW_COMPACT_VERSION?40:70);var Va=Math.min($j(window).innerWidth()-Ua,1040);var Wa;var Xa='width: 1040px; height: '+(Ta-35)+'px;';var Ya=Qa;if(SHOW_COMPACT_VERSION){Va=Math.min(Va,560);Xa='width: '+Va+'px; height: '+(Ta-35)+'px;';Ya=Ra;}
Wa='<div class="dialog" style="'+Xa+(Sa?' overflow: scroll; -webkit-overflow-scrolling: touch; ':' overflow: hidden;')+'">'+'<iframe src="'+Ya+'" style="'+Xa+' height: '+(Ta-44)+'px; '+(Sa?'':' position: absolute; overflow-x: hidden; overflow-y: scroll;')+'border: 0;" frameborder="0">'+'</iframe>'+'</div>';var Za=($j(window).width()-Va)/2;var $a=($j(window).height()-Ta)/2;var ab=$j(Wa).dialog({autoOpen:true,title:Pa,width:Va,height:Ta,draggable:false,resizable:false,modal:true,position:[Za,$a]});$j('.ui-widget-overlay').css({'z-index':'1000'});$j('.ui-dialog').css({'z-index':'99999'});$j('.ui-widget-overlay').click(function(){$j('.dialog').dialog('close');});}
function _refreshForecastDropdown(){var bb=_map.getCenter();var cb=bb.lat();var db=bb.lng();var eb=_offsetHours;var fb='/Tools.ashx?latitude='+cb+'&longitude='+db+'&selectedValue='+eb;$j.ajax({url:fb,cache:false,success:function(gb){$j('#forecastDropdownDiv').empty();$j('#forecastDropdownDiv').append(gb);var hb=$j('#forecastDropdown').val();if(hb!=undefined)_offsetHours=hb;_repaint();}});}
function forecastSelectionChanged(){_offsetHours=$j('#forecastDropdown').val();_dataStateIsDirty=true;_clearAndRefreshMap();}﻿var _topIsVisible=true;var _topHeight=100;function hideTop(){_topIsVisible=false;_repaint();var ib=_virtualCenter(_map.getCenter(),_topHeight);_map.setCenter(ib,_map.getZoom());_SaveStateToCookie();}
function showTop(){_topIsVisible=true;_repaint();var jb=_virtualCenter(_map.getCenter(),(_topHeight)*-1);_map.setCenter(jb,_map.getZoom());_SaveStateToCookie();}
function _virtualCenter(kb,lb){return kb;}﻿var _LAYER_SITES='Sites';var _LAYER_LANDINGS='Landings';var _LAYER_THERMAL_HOTSPOTS='ThermalHotspots';var _LAYER_SCHOOLS='Schools';var _LAYER_SHOPS='Shops';var _LAYER_WEATHER='Weather';var _LAYER_FLYABLE_SITES='FlyableSites';var _LAYER_NON_FLYABLE_SITES='NonFlyableSites';var _LAYER_INSUFFICIENT_INFO_SITES='InsufficientInfoSites';var _LAYER_UNKNOWN_WIND_DIRECTION_SITES='UnknownWindDirectionSites';var _layerMarkersQueue=new Array();_layerMarkersQueue[_LAYER_SITES]=new Queue();_layerMarkersQueue[_LAYER_LANDINGS]=new Queue();_layerMarkersQueue[_LAYER_THERMAL_HOTSPOTS]=new Queue();_layerMarkersQueue[_LAYER_SCHOOLS]=new Queue();_layerMarkersQueue[_LAYER_SHOPS]=new Queue();_layerMarkersQueue[_LAYER_WEATHER]=new Queue();function _clearMap(){if(_map!=null){_clearOverlay(_layerMarkersQueue[_LAYER_SITES]);_clearOverlay(_layerMarkersQueue[_LAYER_LANDINGS]);_clearOverlay(_layerMarkersQueue[_LAYER_THERMAL_HOTSPOTS]);_clearOverlay(_layerMarkersQueue[_LAYER_SCHOOLS]);_clearOverlay(_layerMarkersQueue[_LAYER_SHOPS]);_clearOverlay(_layerMarkersQueue[_LAYER_WEATHER]);}}
function _clearOverlay(mb){for(var i=mb.length()-1;i>=0;i--){_removeMarkerFromMap(mb.queue()[i].marker);mb.removeAt(i);}}
function _clearAndRefreshMap(){if(_map!=null){_clearMap();_onMapMoveEnd(_map,false);}}
var _updateMarkersFirstRun=true;var _lastHash=0;function UpdateMarkers(nb,ob,pb,qb){var rb=document.getElementById('loading');var sb=document.getElementById('hiddenLayersWarning');var tb=document.getElementById('moreResultsAvailable');if(!((_atLeastOneSitesLayerIsVisible())||($j("#"+_LAYER_WEATHER).prop('checked'))||($j("#"+_LAYER_LANDINGS).prop('checked'))||($j("#"+_LAYER_SCHOOLS).prop('checked'))||($j("#"+_LAYER_SHOPS).prop('checked'))||($j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')))){rb.innerText="All layers are turned off!";rb.style.visibility='visible';_processXmlResponse(null);}
var ub=new Array();if($j("#"+_LAYER_FLYABLE_SITES).prop('checked')==false)ub.push("Flyable sites");if($j("#"+_LAYER_NON_FLYABLE_SITES).prop('checked')==false)ub.push("Non-flyable sites");if($j("#"+_LAYER_INSUFFICIENT_INFO_SITES).prop('checked')==false)ub.push("Insufficient info.");if($j("#"+_LAYER_WEATHER).prop('checked')==false)ub.push("Weather");if($j("#"+_LAYER_LANDINGS).prop('checked')==false)ub.push("Landings");if($j("#"+_LAYER_SCHOOLS).prop('checked')==false)ub.push("Schools");if($j("#"+_LAYER_SHOPS).prop('checked')==false)ub.push("Shops");if($j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')==false)ub.push("Thermal hotspots");if((ub.length>0)&&(window.location.href.toLowerCase().indexOf('thirdpartywidget.aspx')<0)){sb.innerText="REMINDER: Some layers are hidden. ("+ub.join(', ')+")";sb.style.visibility='visible';$j(sb).delay(7000).fadeOut(2000);}
else{sb.style.visibility='hidden';}
if(!((_dataStateIsDirty)||((_getMarkerCountInViewport(_LAYER_SITES)<MAX_DATA_POINTS_ON_MAP)&&_atLeastOneSitesLayerIsVisible())||((_getMarkerCountInViewport(_LAYER_WEATHER)<MAX_DATA_POINTS_ON_MAP)&&$j("#"+_LAYER_WEATHER).prop('checked'))||((_getMarkerCountInViewport(_LAYER_LANDINGS)<MAX_DATA_POINTS_ON_MAP)&&$j("#"+_LAYER_LANDINGS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SCHOOLS)<MAX_DATA_POINTS_ON_MAP)&&$j("#"+_LAYER_SCHOOLS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SHOPS)<MAX_DATA_POINTS_ON_MAP)&&$j("#"+_LAYER_SHOPS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_THERMAL_HOTSPOTS)<MAX_DATA_POINTS_ON_MAP)&&$j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')))){return;}
rb.style.visibility='visible';rb.innerText="Loading"+_repeat('.',nb);tb.style.visibility='hidden';var vb=_map.getBounds();if(!vb)return;_dataStateIsDirty=false;$j.ajax({url:_buildDataUrl(vb,qb,nb),cache:false,success:function(wb){var xb=wb.hash;if(xb==_lastHash){var yb=_processXmlResponse(wb);if((((_getMarkerCountInViewport(_LAYER_SITES)<MAX_DATA_POINTS_ON_MAP)&&(yb.sites.length>0)&&_atLeastOneSitesLayerIsVisible())||((_getMarkerCountInViewport(_LAYER_WEATHER)<MAX_DATA_POINTS_ON_MAP)&&(yb.stations.length>0)&&$j("#"+_LAYER_WEATHER).prop('checked'))||((_getMarkerCountInViewport(_LAYER_LANDINGS)<MAX_DATA_POINTS_ON_MAP)&&(yb.landings.length>0)&&$j("#"+_LAYER_LANDINGS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SCHOOLS)<MAX_DATA_POINTS_ON_MAP)&&(yb.schools.length>0)&&$j("#"+_LAYER_SCHOOLS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SHOPS)<MAX_DATA_POINTS_ON_MAP)&&(yb.shops.length>0)&&$j("#"+_LAYER_SHOPS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_THERMAL_HOTSPOTS)<MAX_DATA_POINTS_ON_MAP)&&(yb.hotspots.length>0)&&$j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')))){UpdateMarkers(nb+1,"UpdateMarkers",pb,qb);}
else{rb.style.visibility='hidden';if(((_getMarkerCountInViewport(_LAYER_SITES)>=MAX_DATA_POINTS_ON_MAP)&&(yb.sites.length>0)&&_atLeastOneSitesLayerIsVisible())||((_getMarkerCountInViewport(_LAYER_WEATHER)>=MAX_DATA_POINTS_ON_MAP)&&(yb.stations.length>0)&&$j("#"+_LAYER_WEATHER).prop('checked'))||((_getMarkerCountInViewport(_LAYER_LANDINGS)>=MAX_DATA_POINTS_ON_MAP)&&(yb.landings.length>0)&&$j("#"+_LAYER_LANDINGS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SCHOOLS)>=MAX_DATA_POINTS_ON_MAP)&&(yb.schools.length>0)&&$j("#"+_LAYER_SCHOOLS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_SHOPS)>=MAX_DATA_POINTS_ON_MAP)&&(yb.shops.length>0)&&$j("#"+_LAYER_SHOPS).prop('checked'))||((_getMarkerCountInViewport(_LAYER_THERMAL_HOTSPOTS)>=MAX_DATA_POINTS_ON_MAP)&&(yb.hotspots.length>0)&&$j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')))tb.style.visibility='visible';}
_updateMarkersFirstRun=false;}},error:function(e){console.log(e);}});}
function _repeat(zb,Ab){var Bb="";for(var i=0;i<Ab;i++){Bb+=zb;}
return Bb;}
function _processXmlResponse(Cb){var Db=new _ProcessedXmlResult();Db.sites=Cb.launches;Db.stations=Cb.stations;Db.landings=Cb.landings;Db.hotspots=Cb.hotspots;Db.schools=Cb.schools;Db.shops=Cb.shops;if(Db.sites==null)Db.sites=new Array();if(Db.stations==null)Db.stations=new Array();if(Db.landings==null)Db.landings=new Array();if(Db.hotspots==null)Db.hotspots=new Array();if(Db.schools==null)Db.schools=new Array();if(Db.shops==null)Db.shops=new Array();if($j("#"+_LAYER_SCHOOLS).prop('checked'))Db.schools.each(function(){_addSchoolMarker(this);});else _removeAllMarkers(_LAYER_SCHOOLS);if($j("#"+_LAYER_SHOPS).prop('checked'))Db.shops.each(function(){_addShopMarker(this);});else _removeAllMarkers(_LAYER_SHOPS);if($j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked'))$j.each(Db.hotspots,function(){_addThermalHotspotMarker(this);});else _removeAllMarkers(_LAYER_THERMAL_HOTSPOTS);if($j("#"+_LAYER_LANDINGS).prop('checked'))$j.each(Db.landings,function(){_addLandingMarker(this);});else _removeAllMarkers(_LAYER_LANDINGS);if($j("#"+_LAYER_WEATHER).prop('checked'))$j.each(Db.stations,function(){_addStationMarker(this);});else _removeAllMarkers(_LAYER_WEATHER);if(_atLeastOneSitesLayerIsVisible()){var Eb=$j.url().param('launchid');$j.each(Db.sites,function(){var Fb=false;var Gb=false;var Hb=$j.url();if((_updateMarkersFirstRun)&&(Eb!=null)&&(Eb!='')&&(Eb==this[0])){Fb=true;if((Hb.param('autoopen')==undefined)||(Hb.param('autoopen')=='')||(Hb.param('autoopen')=='true')){Gb=true;}}
_addSiteMarker(this,Gb,Fb);});}
else{_removeAllMarkers(_LAYER_SITES);}
return Db;}
function _atLeastOneSitesLayerIsVisible(){var Ib=(($j("#"+_LAYER_FLYABLE_SITES).prop('checked'))||($j("#"+_LAYER_NON_FLYABLE_SITES).prop('checked'))||($j("#"+_LAYER_INSUFFICIENT_INFO_SITES).prop('checked'))||($j("#"+_LAYER_UNKNOWN_WIND_DIRECTION_SITES).prop('checked')));return Ib;}
function _getMarkerCountInViewport(Jb){var Kb=0;for(var i=0;i<_layerMarkersQueue[Jb].length();i++){if(_isInViewport(_map,_layerMarkersQueue[Jb].queue()[i].marker))Kb++;}
return Kb;}
function _removeAllMarkers(Lb){for(var i=_layerMarkersQueue[Lb].length()-1;i>=0;i--){_removeMarker(Lb,i);}}
function _removeMarker(Mb,Nb){var Ob=_layerMarkersQueue[Mb].queue()[Nb];_removeMarkerFromMap(Ob.marker);_layerMarkersQueue[Mb].removeAt(Nb);}
function _addMarker(Pb,Qb,id,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,$b){if(Qb.containsID(id))return null;var ac=false;if(Qb.length()>=MAX_DATA_POINTS_ON_MAP){ac=true;var bc=Qb.queue();var cc;for(cc=0;cc<Qb.length();cc++){if(!_isInViewport(map,bc[cc].marker)){_removeMarker(Pb,cc);ac=false;break;}}}
if(!ac){var dc=new _keyValuePair();dc.id=id;Qb.enqueue(dc);dc.marker=addMarkerToMap(Pb,Qb.length()-1,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,$b);return dc.marker;}
return null;}
function _addSchoolMarker(ec){var fc=ec.getAttribute("name");var id=ec.getAttribute("id");var gc=parseFloat(ec.getAttribute("lat"));var hc=parseFloat(ec.getAttribute("lng"));var ic=ec.getAttribute("isShop")=="True";if(!_layerMarkersQueue[_LAYER_SCHOOLS].containsID(id)){var jc=BASE_URL+"/images/marker-school.png";var kc="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>"+fc+"</div>"+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+"LayerNameSchool"+(ic?" & LayerNameShop":"")+"<br />Click icon for more details."+"</div>";var lc=_addMarker(_LAYER_SCHOOLS,_layerMarkersQueue[_LAYER_SCHOOLS],id,kc,jc,gc,hc,20,34,10,34,true,false);if(lc){google.maps.event.addListener(lc,"click",function(){showPopupDialog('BusinessDetailsTitleSchool','/BusinessDetails.aspx?id='+id,null);});}
return true;}
return false;}
function _addShopMarker(mc){var nc=mc.getAttribute("name");var id=mc.getAttribute("id");var oc=parseFloat(mc.getAttribute("lat"));var pc=parseFloat(mc.getAttribute("lng"));var qc=mc.getAttribute("isSchool")=="True";if(!_layerMarkersQueue[_LAYER_SHOPS].containsID(id)){var rc=BASE_URL+"/images/marker-school.png";var sc="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>"+nc+"</div>"+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+(qc?"LayerNameSchool & ":"")+"LayerNameShop"+"<br />Click icon for more details."+"</div>";var tc=_addMarker(_LAYER_SHOPS,_layerMarkersQueue[_LAYER_SHOPS],id,sc,rc,oc,pc,20,34,10,34,true,false);if(tc){google.maps.event.addListener(tc,"click",function(){showPopupDialog('BusinessDetailsTitleShop','/BusinessDetails.aspx?id='+id,null);});}
return true;}
return false;}
function _addThermalHotspotMarker(uc){var id=uc[0];var vc=parseFloat(uc[1]);var wc=parseFloat(uc[2]);var xc=uc[3];var yc=uc[4];if(!_layerMarkersQueue[_LAYER_THERMAL_HOTSPOTS].containsID(id)){var zc;if(xc>=80)zc=100;else if(xc>=60)zc=80;else if(xc>=40)zc=60;else if(xc>=20)zc=40;else zc=20;var Ac=BASE_URL+"/images/marker-thermal-hotspot-"+zc+".png";var Bc=15;var Cc=Bc/2;var Dc=null;Dc="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>Thermal hotspot</div>"+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+xc+"% "+"probability within 250m."+"<br />"+"Lift starts at "+yc+"m AMSL."+"</div>";var Ec=_addMarker(_LAYER_THERMAL_HOTSPOTS,_layerMarkersQueue[_LAYER_THERMAL_HOTSPOTS],id,Dc,Ac,vc,wc,Bc,Bc,Cc,Cc,false,false);return Ec;}
return false;}
function _addLandingMarker(Fc){var id=Fc[0];var Gc=Fc[1];var Hc=Fc[2];var Ic=Fc[3];if(!_layerMarkersQueue[_LAYER_LANDINGS].containsID(id)){var Jc=BASE_URL+"/images/marker-landing.png";var Kc="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>"+Gc+"</div>"+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+"Landing"+"<br />Click icon for more details."+"</div>";var Lc=_addMarker(_LAYER_LANDINGS,_layerMarkersQueue[_LAYER_LANDINGS],id,Kc,Jc,Hc,Ic,20,34,10,34,true,false);if(Lc){google.maps.event.addListener(Lc,"click",function(){showPopupDialog(Gc,'/LaunchDetailsFullPopup.aspx?id='+id+'&offsetHours=0','/LaunchDetailsFullPopupThirdParty.aspx?id='+id+'&offsetHours=0');});}
return true;}
return false;}
var workaroundSize=true?64:128;function _addStationMarker(Mc){var id=Mc[0];var Nc=Mc[1];var Oc=Mc[2];var Pc=parseFloat(Mc[3]);var Qc=parseFloat(Mc[4]);var Rc=parseInt(Mc[5]);var Sc=parseFloat(Mc[6]);var Tc=parseFloat(Mc[7]);var Uc=parseFloat(Mc[8]);var Vc=parseFloat(Mc[9]);var Wc=parseInt(Mc[10]);if(isNaN(Wc))return false;if(!_layerMarkersQueue[_LAYER_WEATHER].containsID(Oc)){url=BASE_URL+"/Marker.ashx"+"?tu="+Sc+"&ws="+Tc+"&wsu=0"+"&ageMinutes="+Wc+"&wd="+Vc;var Xc=workaroundSize/2;var Yc="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>"+Nc+"</div>"+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+"Weather station"+"<br />Click icon for more details."+"</div>";var Zc=_addMarker(_LAYER_WEATHER,_layerMarkersQueue[_LAYER_WEATHER],id,Yc,url,Pc,Qc,workaroundSize,workaroundSize,workaroundSize / 2, workaroundSize / 2,false,false);if(Zc){google.maps.event.addListener(Zc,"click",function(){showPopupDialog("Weather station"+" "+Nc,'/StationDetailsFullPopup.aspx?id='+id,'/StationDetailsFullPopup.aspx?id='+id+'&thirdParty=true');});}
return true;}
return false;}
function _addSiteMarker($c,bd,cd){var dd=$j.url();var id=$c[0];var ed=$c[1];var fd=parseFloat($c[3]);var gd=parseFloat($c[4]);var hd=((($c[2]=="1")||((fd==dd.param('lat'))&&(gd==dd.param('lng'))))&&(dd.param('highlight')!="false"));var jd=($c[5]=="1");var kd=($c[6]=="1");var ld=$c[7];var md=($c[8]=="1");var nd=($c[9]=="1");var od=$c[10];var pd;var qd=false;pd=_layerMarkersQueue[_LAYER_SITES];if(kd||md)qd=$j("#"+_LAYER_INSUFFICIENT_INFO_SITES).prop('checked');else if(jd)qd=$j("#"+_LAYER_FLYABLE_SITES).prop('checked');else qd=$j("#"+_LAYER_NON_FLYABLE_SITES).prop('checked');if(qd||bd){var rd=false;if(!pd.containsID(id)){var sd;var td=20;var ud=34;if(kd){sd=BASE_URL+"/images/marker-question.png";rd=true;}
else if(md&&!false){sd=BASE_URL+"/images/marker-question.png";rd=true;}
else if(jd){sd=BASE_URL+"/images/marker-flyable.png";}
else{sd=BASE_URL+"/images/marker-not-flyable.png";rd=true;}
if((rd)){td=15;ud=25;}
var vd=-1;switch(od){case '5':vd=28;break;case '4':vd=40;break;case '3':vd=51;break;case '2':vd=63;break;case '1':vd=74;break;default:starRatingHtml='';}
var wd=(vd>=0)?'<div class="starRating" style="margin-left: '+vd+'px">'+_repeat('<img src="/images/star.png" />',5)+'</div><div class="clear" />':'';var xd=null;xd="<div style='font-family: arial, helvetica; font-size: 12px; font-weight: bold; color: #fff;'>"+ed+"</div>"+wd+"<div style='font-family: arial, helvetica; margin-top: 3px; font-size: 12px; font-weight: normal; color: #ccc;'>"+"Launch"+"<br />Click icon for more details."+"</div>";if(cd){_map.setCenter(new google.maps.LatLng(fd*1,gd*1));if($j.url().param('zoom')==undefined)_map.setZoom(13);}
if(bd){showPopupDialog(ed,'/LaunchDetailsFullPopup.aspx?id='+id+'&offsetHours=0','/LaunchDetailsFullPopupThirdParty.aspx?id='+id+'&offsetHours=0');}
var yd=_addMarker(_LAYER_SITES,pd,id,xd,sd,fd,gd,td,ud,td/2,ud,!hd,hd);if(yd){var zd=SHOW_COMPACT_VERSION?"site_details_compact":"site_details";var Ad=SHOW_COMPACT_VERSION?"&thirdpartywidget=true":"";google.maps.event.addListener(yd,"click",function(){showPopupDialog('Details','/LaunchDetailsFullPopup.aspx?id='+id+'&offsetHours='+_offsetHours,'/LaunchDetailsFullPopupThirdParty.aspx?id='+id+'&offsetHours='+_offsetHours);});}
return true;}}
return false;}
function _buildDataUrl(Bd,Cd,Dd){var Ed=_map.getZoom();var Fd='';var Gd='';var Hd='';var Id='';var Jd=$j.url();var Kd=Jd.param('launchid');var Ld=Jd.param('forceshowlaunchid');var Md=Jd.param('lat');var Nd=Jd.param('lng');var Od=Jd.param('optimize');if((_updateMarkersFirstRun)&&(Kd!=null)&&(Kd!='')){Fd='&forceShowLaunchID='+Kd;}
else if((Ld!=null)&&(Ld!='')){Fd='&forceShowLaunchID='+Ld;}
if((_updateMarkersFirstRun)&&(Md!=null)&&(Md!='')&&(Md!=null)&&(Md!='')){Gd='&forceLat='+Md;Hd='&forceLng='+Nd;}
if(Od=='true')Id="&optimize=true";_lastHash++;var Pd="https://www.paraglidingmap.com/WebServices/Data5.ashx?page="+Dd+Id+Fd+Gd+Hd+"&hash="+_lastHash+"&showSites="+(((_getMarkerCountInViewport(_LAYER_SITES)<MAX_DATA_POINTS_ON_MAP)&&(_atLeastOneSitesLayerIsVisible()))?"true":"false")+"&showLandings="+((Ed>=1)&&($j("#"+_LAYER_LANDINGS).prop('checked')&&(_getMarkerCountInViewport(_LAYER_LANDINGS)<MAX_DATA_POINTS_ON_MAP)&&(!SHOW_COMPACT_VERSION))?"true":"false")+"&showThermalHotspots="+((Ed>=1)&&($j("#"+_LAYER_THERMAL_HOTSPOTS).prop('checked')&&(_getMarkerCountInViewport(_LAYER_THERMAL_HOTSPOTS)<MAX_DATA_POINTS_ON_MAP))?"true":"false")+"&showSchools="+(($j("#"+_LAYER_SCHOOLS).prop('checked')&&(_getMarkerCountInViewport(_LAYER_SCHOOLS)<MAX_DATA_POINTS_ON_MAP))?"true":"false")+"&showShops="+(($j("#"+_LAYER_SHOPS).prop('checked')&&(_getMarkerCountInViewport(_LAYER_SHOPS)<MAX_DATA_POINTS_ON_MAP))?"true":"false")+"&showStations="+(($j("#"+_LAYER_WEATHER).prop('checked')&&(_getMarkerCountInViewport(_LAYER_WEATHER)<MAX_DATA_POINTS_ON_MAP)&&(!SHOW_COMPACT_VERSION))?"true":"false")+"&neLat="+Bd.getNorthEast().lat()+"&neLng="+Bd.getNorthEast().lng()+"&swLat="+Bd.getSouthWest().lat()+"&swLng="+Bd.getSouthWest().lng()+"&offsetHours="+Cd;return Pd;}
function _toggleLayer(Qd,Rd){_dataStateIsDirty=true;}
function _keyValuePair(){var Sd=null;var Td=null;var Ud=null;function id(){return Sd;}
function marker(){return Td;}
function listenerHandle(){return Ud;}}
function _ProcessedXmlResult(){var Vd=null;var Wd=null;var Xd=null;var Yd=null;var Zd=null;var $d=null;function sites(){return Vd;}
function stations(){return Wd;}
function landings(){return Xd;}
function hotspots(){return Yd;}
function schools(){return Zd;}
function shops(){return $d;}}﻿var _tooltip=null;function addMarkerToMapAsync(ae,be,ce,de,ee,fe,ge,he,ie,je,ke){setTimeout("addMarkerToMap("+"'"+ae+"', "+be+", "+"'"+ce.replace(/'/g,"\\'")+"', "+"'"+de.replace(/'/g,"\\'")+"', "+ee+", "+fe+", "+ge+", "+he+", "+ie+", "+je+", "+ke+");",1);}
function addMarkerToMap(le,me,ne,oe,pe,qe,re,se,te,ue,ve,we){var xe=new google.maps.MarkerImage(oe,new google.maps.Size(re,se),new google.maps.Point(0,0),new google.maps.Point(te,ue),new google.maps.Size(re,se));var ye=new google.maps.LatLng(pe,qe);var ze;if(!we){ze=new google.maps.Marker({position:ye,map:_map,icon:xe,optimized:false});}
else{var Ae='';if(we){obfuscatorHack=(115-re+1)/2;Ae='<img src="/images/marker-highlight.png" style="z-index: 900; position: absolute; width: 115px; height: 115px; margin: -'+(115-se)/2+'px 0 0 -'+obfuscatorHack+'px;" />';}
var Be='';if(ve)Be='<img src="/images/marker_shadow.png" style="position: absolute; width: 34px; height: 38px; margin: -'+(38-se)+'px 0 0 0px;" />';ze=new RichMarker({position:ye,map:_map,draggable:false,shadow:false,anchor:new google.maps.Size(-te,-ue),content:'<div>'+Ae+Be+'<img id="marker" src="'+oe+'" style="z-index: 999; position: absolute; cursor: pointer; width: '+re+'px; height: '+se+'px;" />'+'</div>'});}
if(ne){ze.tooltip=ne;google.maps.event.addListener(ze,"mouseover",function(){_showTooltip(ze.tooltip,ze.position);});google.maps.event.addListener(ze,"mouseout",function(){_tooltip.setMap(null);_tooltip=null;});}
_layerMarkersQueue[le].queue()[me].marker=ze;return ze;}
function _showTooltip(Ce,De){_tooltip=new InfoBubble({map:_map,content:_createTooltipContent(Ce),position:De,shadowStyle:1,padding:0,backgroundColor:'rgb(57, 57, 57)',borderRadius:4,arrowSize:10,borderWidth:1,borderColor:'#2c2c2c',disableAutoPan:true,hideCloseButton:true,arrowPosition:30,backgroundClassName:'phoney',arrowStyle:2,anchorHeight:34});_tooltip.open();}
function _createTooltipContent(Ee){return '<div class="phoneytext">'+Ee+'</div>';}
function _removeMarkerFromMap(Fe){if(Fe){Fe.setMap(null);Fe=null;}}
function _isInViewport(Ge,He){if(!He)return true;var Ie=_map.getBounds();var Je=Ie.getNorthEast().lat();var Ke=Ie.getNorthEast().lng();var Le=Ie.getSouthWest().lat();var Me=Ie.getSouthWest().lng();var Ne;if(Me<Ke){Ne=((He.position.lat()>=Le)&&(He.position.lng()>=Me)&&(He.position.lat()<=Je)&&(He.position.lng()<=Ke));}
else{Ne=((He.position.lat()>=Le)&&(He.position.lat()<=Je))&&((He.position.lng()>=Me)||(He.position.lng()<=Ke));}
return Ne;}﻿function RichMarker(Oe){var Pe=Oe||{};this.ready_=false;this.dragging_=false;if(Oe['visible']==undefined){Oe['visible']=true;}
if(Oe['shadow']==undefined){Oe['shadow']='7px -3px 5px rgba(88,88,88,0.7)';}
if(Oe['anchor']==undefined){Oe['anchor']=RichMarkerPosition['BOTTOM'];}
this.setValues(Pe);}
RichMarker.prototype=new google.maps.OverlayView();window['RichMarker']=RichMarker;RichMarker.prototype.getVisible=function(){return(this.get('visible'));};RichMarker.prototype['getVisible']=RichMarker.prototype.getVisible;RichMarker.prototype.setVisible=function(Qe){this.set('visible',Qe);};RichMarker.prototype['setVisible']=RichMarker.prototype.setVisible;RichMarker.prototype.visible_changed=function(){if(this.ready_){this.markerWrapper_.style['display']=this.getVisible()?'':'none';this.draw();}};RichMarker.prototype['visible_changed']=RichMarker.prototype.visible_changed;RichMarker.prototype.setFlat=function(Re){this.set('flat',!!Re);};RichMarker.prototype['setFlat']=RichMarker.prototype.setFlat;RichMarker.prototype.getFlat=function(){return(this.get('flat'));};RichMarker.prototype['getFlat']=RichMarker.prototype.getFlat;RichMarker.prototype.getWidth=function(){return(this.get('width'));};RichMarker.prototype['getWidth']=RichMarker.prototype.getWidth;RichMarker.prototype.getHeight=function(){return(this.get('height'));};RichMarker.prototype['getHeight']=RichMarker.prototype.getHeight;RichMarker.prototype.setShadow=function(Se){this.set('shadow',Se);this.flat_changed();};RichMarker.prototype['setShadow']=RichMarker.prototype.setShadow;RichMarker.prototype.getShadow=function(){return(this.get('shadow'));};RichMarker.prototype['getShadow']=RichMarker.prototype.getShadow;RichMarker.prototype.flat_changed=function(){if(!this.ready_){return;}
this.markerWrapper_.style['boxShadow']=this.markerWrapper_.style['webkitBoxShadow']=this.markerWrapper_.style['MozBoxShadow']=this.getFlat()?'':this.getShadow();};RichMarker.prototype['flat_changed']=RichMarker.prototype.flat_changed;RichMarker.prototype.setZIndex=function(Te){this.set('zIndex',Te);};RichMarker.prototype['setZIndex']=RichMarker.prototype.setZIndex;RichMarker.prototype.getZIndex=function(){return(this.get('zIndex'));};RichMarker.prototype['getZIndex']=RichMarker.prototype.getZIndex;RichMarker.prototype.zIndex_changed=function(){if(this.getZIndex()&&this.ready_){this.markerWrapper_.style.zIndex=this.getZIndex();}};RichMarker.prototype['zIndex_changed']=RichMarker.prototype.zIndex_changed;RichMarker.prototype.getDraggable=function(){return(this.get('draggable'));};RichMarker.prototype['getDraggable']=RichMarker.prototype.getDraggable;RichMarker.prototype.setDraggable=function(Ue){this.set('draggable',!!Ue);};RichMarker.prototype['setDraggable']=RichMarker.prototype.setDraggable;RichMarker.prototype.draggable_changed=function(){if(this.ready_){if(this.getDraggable()){this.addDragging_(this.markerWrapper_);}
else{this.removeDragListeners_();}}};RichMarker.prototype['draggable_changed']=RichMarker.prototype.draggable_changed;RichMarker.prototype.getPosition=function(){return(this.get('position'));};RichMarker.prototype['getPosition']=RichMarker.prototype.getPosition;RichMarker.prototype.setPosition=function(Ve){this.set('position',Ve);};RichMarker.prototype['setPosition']=RichMarker.prototype.setPosition;RichMarker.prototype.position_changed=function(){this.draw();};RichMarker.prototype['position_changed']=RichMarker.prototype.position_changed;RichMarker.prototype.getAnchor=function(){return(this.get('anchor'));};RichMarker.prototype['getAnchor']=RichMarker.prototype.getAnchor;RichMarker.prototype.setAnchor=function(We){this.set('anchor',We);};RichMarker.prototype['setAnchor']=RichMarker.prototype.setAnchor;RichMarker.prototype.anchor_changed=function(){this.draw();};RichMarker.prototype['anchor_changed']=RichMarker.prototype.anchor_changed;RichMarker.prototype.htmlToDocumentFragment_=function(Xe){var Ye=document.createElement('DIV');Ye.innerHTML=Xe;if(Ye.childNodes.length==1){return(Ye.removeChild(Ye.firstChild));}
else{var Ze=document.createDocumentFragment();while(Ye.firstChild){Ze.appendChild(Ye.firstChild);}
return Ze;}};RichMarker.prototype.removeChildren_=function($e){if(!$e){return;}
var af;while(af=$e.firstChild){$e.removeChild(af);}};RichMarker.prototype.setContent=function(bf){this.set('content',bf);};RichMarker.prototype['setContent']=RichMarker.prototype.setContent;RichMarker.prototype.getContent=function(){return(this.get('content'));};RichMarker.prototype['getContent']=RichMarker.prototype.getContent;RichMarker.prototype.content_changed=function(){if(!this.markerContent_){return;}
this.removeChildren_(this.markerContent_);var cf=this.getContent();if(cf){if(typeof cf=='string'){cf=cf.replace(/^\s*([\S\s]*)\b\s*$/,'$1');cf=this.htmlToDocumentFragment_(cf);}
this.markerContent_.appendChild(cf);var df=this;var ef=this.markerContent_.getElementsByTagName('IMG');for(var i=0,image;image=ef[i];i++){google.maps.event.addDomListener(image,'mousedown',function(e){if(df.getDraggable()){if(e.preventDefault){e.preventDefault();}
e.returnValue=false;}});google.maps.event.addDomListener(image,'load',function(){df.draw();});}
google.maps.event.trigger(this,'domready');}
if(this.ready_){this.draw();}};RichMarker.prototype['content_changed']=RichMarker.prototype.content_changed;RichMarker.prototype.setCursor_=function(ff){if(!this.ready_){return;}
var gf='';if(navigator.userAgent.indexOf('Gecko/')!==-1){if(ff=='dragging'){gf='-moz-grabbing';}
if(ff=='dragready'){gf='-moz-grab';}
if(ff=='draggable'){gf='pointer';}}
else{if(ff=='dragging'||ff=='dragready'){gf='move';}
if(ff=='draggable'){gf='pointer';}}
if(this.markerWrapper_.style.cursor!=gf){this.markerWrapper_.style.cursor=gf;}};RichMarker.prototype.startDrag=function(e){if(!this.getDraggable()){return;}
if(!this.dragging_){this.dragging_=true;var hf=this.getMap();this.mapDraggable_=hf.get('draggable');hf.set('draggable',false);this.mouseX_=e.clientX;this.mouseY_=e.clientY;this.setCursor_('dragready');this.markerWrapper_.style['MozUserSelect']='none';this.markerWrapper_.style['KhtmlUserSelect']='none';this.markerWrapper_.style['WebkitUserSelect']='none';this.markerWrapper_['unselectable']='on';this.markerWrapper_['onselectstart']=function(){return false;};this.addDraggingListeners_();google.maps.event.trigger(this,'dragstart');}};RichMarker.prototype.stopDrag=function(){if(!this.getDraggable()){return;}
if(this.dragging_){this.dragging_=false;this.getMap().set('draggable',this.mapDraggable_);this.mouseX_=this.mouseY_=this.mapDraggable_=null;this.markerWrapper_.style['MozUserSelect']='';this.markerWrapper_.style['KhtmlUserSelect']='';this.markerWrapper_.style['WebkitUserSelect']='';this.markerWrapper_['unselectable']='off';this.markerWrapper_['onselectstart']=function(){};this.removeDraggingListeners_();this.setCursor_('draggable');google.maps.event.trigger(this,'dragend');this.draw();}};RichMarker.prototype.drag=function(e){if(!this.getDraggable()||!this.dragging_){this.stopDrag();return;}
var dx=this.mouseX_-e.clientX;var dy=this.mouseY_-e.clientY;this.mouseX_=e.clientX;this.mouseY_=e.clientY;var jf=parseInt(this.markerWrapper_.style['left'],10)-dx;var kf=parseInt(this.markerWrapper_.style['top'],10)-dy;this.markerWrapper_.style['left']=jf+'px';this.markerWrapper_.style['top']=kf+'px';var lf=this.getOffset_();var mf=new google.maps.Point(jf-lf.width,kf-lf.height);var nf=this.getProjection();this.setPosition(nf.fromDivPixelToLatLng(mf));this.setCursor_('dragging');google.maps.event.trigger(this,'drag');};RichMarker.prototype.removeDragListeners_=function(){if(this.draggableListener_){google.maps.event.removeListener(this.draggableListener_);delete this.draggableListener_;}
this.setCursor_('');};RichMarker.prototype.addDragging_=function(of){if(!of){return;}
var pf=this;this.draggableListener_=google.maps.event.addDomListener(of,'mousedown',function(e){pf.startDrag(e);});this.setCursor_('draggable');};RichMarker.prototype.addDraggingListeners_=function(){var qf=this;if(this.markerWrapper_.setCapture){this.markerWrapper_.setCapture(true);this.draggingListeners_=[google.maps.event.addDomListener(this.markerWrapper_,'mousemove',function(e){qf.drag(e);},true),google.maps.event.addDomListener(this.markerWrapper_,'mouseup',function(){qf.stopDrag();qf.markerWrapper_.releaseCapture();},true)];}
else{this.draggingListeners_=[google.maps.event.addDomListener(window,'mousemove',function(e){qf.drag(e);},true),google.maps.event.addDomListener(window,'mouseup',function(){qf.stopDrag();},true)];}};RichMarker.prototype.removeDraggingListeners_=function(){if(this.draggingListeners_){for(var i=0,listener;listener=this.draggingListeners_[i];i++){google.maps.event.removeListener(listener);}
this.draggingListeners_.length=0;}};RichMarker.prototype.getOffset_=function(){var rf=this.getAnchor();if(typeof rf=='object'){return(rf);}
var sf=new google.maps.Size(0,0);if(!this.markerContent_){return sf;}
var tf=this.markerContent_.offsetWidth;var uf=this.markerContent_.offsetHeight;switch(rf){case RichMarkerPosition['TOP_LEFT']:break;case RichMarkerPosition['TOP']:sf.width=-tf/2;break;case RichMarkerPosition['TOP_RIGHT']:sf.width=-tf;break;case RichMarkerPosition['LEFT']:sf.height=-uf/2;break;case RichMarkerPosition['MIDDLE']:sf.width=-tf/2;sf.height=-uf/2;break;case RichMarkerPosition['RIGHT']:sf.width=-tf;sf.height=-uf/2;break;case RichMarkerPosition['BOTTOM_LEFT']:sf.height=-uf;break;case RichMarkerPosition['BOTTOM']:sf.width=-tf/2;sf.height=-uf;break;case RichMarkerPosition['BOTTOM_RIGHT']:sf.width=-tf;sf.height=-uf;break;}
return sf;};RichMarker.prototype.onAdd=function(){if(!this.markerWrapper_){this.markerWrapper_=document.createElement('DIV');this.markerWrapper_.style['position']='absolute';}
if(this.getZIndex()){this.markerWrapper_.style['zIndex']=this.getZIndex();}
this.markerWrapper_.style['display']=this.getVisible()?'':'none';if(!this.markerContent_){this.markerContent_=document.createElement('DIV');this.markerWrapper_.appendChild(this.markerContent_);var vf=this;google.maps.event.addDomListener(this.markerContent_,'click',function(e){google.maps.event.trigger(vf,'click');});google.maps.event.addDomListener(this.markerContent_,'mouseover',function(e){google.maps.event.trigger(vf,'mouseover');});google.maps.event.addDomListener(this.markerContent_,'mouseout',function(e){google.maps.event.trigger(vf,'mouseout');});}
this.ready_=true;this.content_changed();this.flat_changed();this.draggable_changed();var wf=this.getPanes();if(wf){wf.overlayMouseTarget.appendChild(this.markerWrapper_);}
google.maps.event.trigger(this,'ready');};RichMarker.prototype['onAdd']=RichMarker.prototype.onAdd;RichMarker.prototype.draw=function(){if(!this.ready_||this.dragging_){return;}
var xf=this.getProjection();if(!xf){return;}
var yf=(this.get('position'));var zf=xf.fromLatLngToDivPixel(yf);var Af=this.getOffset_();this.markerWrapper_.style['top']=(zf.y+Af.height)+'px';this.markerWrapper_.style['left']=(zf.x+Af.width)+'px';var Bf=this.markerContent_.offsetHeight;var Cf=this.markerContent_.offsetWidth;if(Cf!=this.get('width')){this.set('width',Cf);}
if(Bf!=this.get('height')){this.set('height',Bf);}};RichMarker.prototype['draw']=RichMarker.prototype.draw;RichMarker.prototype.onRemove=function(){if(this.markerWrapper_&&this.markerWrapper_.parentNode){this.markerWrapper_.parentNode.removeChild(this.markerWrapper_);}
this.removeDragListeners_();};RichMarker.prototype['onRemove']=RichMarker.prototype.onRemove;var RichMarkerPosition={'TOP_LEFT':1,'TOP':2,'TOP_RIGHT':3,'LEFT':4,'MIDDLE':5,'RIGHT':6,'BOTTOM_LEFT':7,'BOTTOM':8,'BOTTOM_RIGHT':9};window['RichMarkerPosition']=RichMarkerPosition;
