jQuery.fn.check=function(mode){return this.attr("checked",mode===!0?"checked":"")},jQuery.fn.checked=function(){return this.attr("checked")},jQuery.log=function(message){var dt=new Date;message=$.padString(dt.getHours(),2)+":"+$.padString(dt.getMinutes(),2)+":"+$.padString(dt.getSeconds(),2)+"."+$.padString(dt.getMilliseconds(),3,"0",!0)+" - "+message;try{console.log(message)}catch(ex){$("#debugLog").length==0&&$("body").append('<div id="debugLog" style="position: absolute; top: 0px; left: 0px; width: 200px; height: 100px; overflow: auto; border: solid 2px red; background-color: #FFFFFF;"></div>'),$("#debugLog").append('<div style="font-family: Courier New; border-bottom: solid 1px #666666; color: #000000;">'+message+"</div>")}},jQuery.padString=function(s,length,padWith,padRight){s=""+s,padWith=padWith?""+padWith:"0",length=length?length:0,padWith.length==0?padWith="0":padWith.length>1&&(padWith=padWith.substr(0,1));var append="";while(append.length+s.length<length)append+=padWith;return padRight?s+append:append+s},jQuery.migrolMarker=function(ms,latLng,title,relatedTo,urlAddition){var container=this,i;this.MSObject=ms,this.Map=this.MSObject.googleMap,this.Container=container,this.LatLng=latLng,this.Address=latLng.lat()+","+latLng.lng(),this.Title=title,this.RelatedTo=relatedTo,this.urlAddition=null,this.MarkersPerLevel=[],this.MarkersPerLevel[0]=new GIcon,this.MarkersPerLevel[0].iconSize=new GSize(67,74),this.MarkersPerLevel[0].iconAnchor=new GPoint(21,70),this.MarkersPerLevel[0].imageMap=[0,1,43,1,43,40,25,55,25,71,16,71,16,55,0,40],this.MarkersPerLevel[0].infoWindowAnchor=new GPoint(10,28),this.MarkersPerLevel[1]=new GIcon,this.MarkersPerLevel[1].iconSize=new GSize(40,44),this.MarkersPerLevel[1].iconAnchor=new GPoint(12,42),this.MarkersPerLevel[1].imageMap=[0,0,25,0,25,25,14,38,14,42,10,42,10,38,0,25],this.MarkersPerLevel[1].infoWindowAnchor=new GPoint(10,28),this.MarkersPerLevel[2]=new GIcon,this.MarkersPerLevel[2].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_point.png",this.MarkersPerLevel[2].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_point.png",this.MarkersPerLevel[2].iconSize=new GSize(15,15),this.MarkersPerLevel[2].iconAnchor=new GPoint(7,7),this.MarkersPerLevel[2].infoWindowAnchor=new GPoint(10,28),this.MarkersPerLevel[3]=new GIcon,this.MarkersPerLevel[3].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_point_small.png",this.MarkersPerLevel[3].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_point_small.png",this.MarkersPerLevel[3].iconSize=new GSize(11,11),this.MarkersPerLevel[3].iconAnchor=new GPoint(5,5),this.MarkersPerLevel[3].infoWindowAnchor=new GPoint(10,28);switch(urlAddition){default:case"M":this.MarkersPerLevel[0].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_M_big.png",this.MarkersPerLevel[0].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_M_big.png",this.MarkersPerLevel[1].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_M_small.png",this.MarkersPerLevel[1].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_M_small.png";break;case"S":this.MarkersPerLevel[0].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_S_big.png",this.MarkersPerLevel[0].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_S_big.png",this.MarkersPerLevel[1].image="/portaldata/1/Resources/_internal/images/kartensuche/marker_S_small.png",this.MarkersPerLevel[1].transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_S_small.png"}for(this.MouseClick=function(){var station=container.GetStation();station.MasterContainer.showInfoWindow(station)},this.GMarkers=[],i=0;i<this.MarkersPerLevel.length;i++)this.GMarkers[i]=new GMarker(latLng,{title:this.Title,icon:this.MarkersPerLevel[i],zIndexProcess:ms.importanceOrder}),this.GMarkers[i].RelatedTo=this.RelatedTo,this.GMarkers[i].importance=0,this.GMarkers[i].MarkerClick=GEvent.addListener(this.GMarkers[i],"click",this.MouseClick);this.CheckVisibility=function(bounds){var station=container.GetStation();return bounds.contains(container.LatLng)?(station.Show(),!0):(station.Hide(),!1)},this.GetStation=function(){return container.__station__||(container.__station__=container.MSObject.stations[container.RelatedTo]),container.__station__},this.Show=function(){},this.Hide=function(){},this.ChangeMarkerToLo=function(){},this.ChangeMarkerToHi=function(){},this.GetCurrentMarker=function(){var station=container.GetStation();return station.MasterContainer.googleMarkerMgr.getMarker(container.LatLng.lat(),container.LatLng.lng(),container.Map.getZoom())},this.Dispose=function(){container.__station__=null;while(container.MarkersPerLevel.length>0)container.MarkersPerLevel.pop();container.MarkersPerLevel=null;while(container.GMarkers.length>0){var marker=container.GMarkers.pop();GEvent.removeListener(marker.MarkerClick)}container.GMarkers=null,container.MSObject=null,container.Map=null,container.LatLng=null,container.Title=null,container.RelatedTo=null,container=null}},jQuery.mapSearch=function(chkShopID,cmbShopNameID,chkCarwashID,chkPortableID,chkSelfServiceBoxID,chkServiceIncludedID,chkGarageID,chkDieselID,chkEarthGasID,chkVPowerID,chkVPowerDieselID,cmbCityID,txtPostalCodeID,lnkSearchID,language,txtRadiusSearchID,lnkRadiusSearchID,routeAllowed,focusOnStationID,focusZoomLevel){var container=this,maxDistance=2e4,mapOptions;this.stations=null,this.currentRequest=null,this.processingResult=!1,this.googleMap=null,this.googleDirections=null,this.googleGeocoder=null,this.googleDirectionsCurrentStation=null,this.googleDirectionsStationQueue=[],this.googleDirectionsStationErrorQueue=[],this.googleAddressGMarker=null,this.infoWindow=null,this.googleMapsIsAvailable=!1,this.googleEventHandlers=null,this.lastSearchParameters=null,this.googleMarkerMgr=null,this.language=language,this.currentlySelectedSation=null,this.initialStation=focusOnStationID,this.initialStationZoom=focusZoomLevel,this.chkShop=$("#"+chkShopID),this.chkCarwash=$("#"+chkCarwashID),this.chkPortable=$("#"+chkPortableID),this.chkSelfServiceBox=$("#"+chkSelfServiceBoxID),this.chkServiceIncluded=$("#"+chkServiceIncludedID),this.chkGarage=$("#"+chkGarageID),this.chkDiesel=$("#"+chkDieselID),this.chkEarthGas=$("#"+chkEarthGasID),this.chkVPower=$("#"+chkVPowerID),this.chkVPowerDiesel=$("#"+chkVPowerDieselID),this.lnkSearch=$("#"+lnkSearchID),this.txtRadiusSearch=$("#"+txtRadiusSearchID),this.lnkRadiusSearch=$("#"+lnkRadiusSearchID),this.lnkRadiusSearch.attr("href","#"),this.stationLoadingResults=$("#stationLoadingResults"),this.stationResults=$("#stationResults"),this.stationNoResults=$("#stationNoResults"),this.stationNoResultsOnMap=$("#stationNoResultsOnMap"),this.radiusSearch=$("#radiusSearch"),this.radiusSearchResult=$("#radiusSearchResult"),this.notOnMapLinks=$("#radiusSearchWrapper a.notOnMap"),this.cmbShopName=$find(cmbShopNameID),this.cmbCity=$find(cmbCityID),this.txtPostalCode=$find(txtPostalCodeID),this.msAjaxIsLoaded=this.cmbCity!=null,this.msAjaxIsLoaded||Sys.Application.add_load(function(){container.msAjaxIsLoaded=!0,container.cmbShopName=$find(cmbShopNameID),container.cmbCity=$find(cmbCityID),container.txtPostalCode=$find(txtPostalCodeID),container.lastSearchParameters!=null&&container.setMsAjaxValues(container.lastSearchParameters.C,container.lastSearchParameters.P),container.setMsAjaxEventHandlers()}),this.Dispose=function(){var station,i;container.hideInfoWindow();if(container.stations!=null)while(container.stations.length>0)try{station=container.stations.pop(),station.Dispose()}catch(ex){}container.googleAddressGMarker!=null&&(container.googleMap.removeOverlay(container.googleAddressGMarker),container.googleAddressGMarker=null),container.googleMarkerMgr.clearMarkers(),container.googleMarkerMgr=null;if(container.googleMapsIsAvailable&&container.googleEventHandlers)for(i=0;i<container.googleEventHandlers.length;i++)GEvent.removeListener(container.googleEventHandlers[i]);try{$(container.chkShop).add(container.chkCarwash).add(container.chkPortable).add(container.chkSelfServiceBox).add(container.chkServiceIncluded).add(container.chkGarage).add(container.chkDiesel).add(container.chkEarthGas).add(container.chkVPower).add(container.chkVPowerDiesel).add(container.lnkSearch).add(container.lnkRadiusSearch).add(container.notOnMapLinks).add(container.stationNoResultsOnMap.find("a")).add("#radiusSearchWrapper a.changeAddress").unbind("click")}catch(ex){}try{container.txtRadiusSearch.unbind("keydown")}catch(ex){}try{container.cmbShopName.remove_selectedIndexChanged(container.cmbShopName_selectedIndexChanged),container.cmbCity.remove_selectedIndexChanged(container.cmbCity_selectedIndexChanged),container.txtPostalCode.remove_valueChanged(container.txtPostalCode_valueChanged),container.txtPostalCode.remove_keyPress(container.txtPostalCode_keyPress)}catch(ex){}GUnload()},this.setMsAjaxEventHandlers=function(){if(!container.msAjaxIsLoaded)return;container.cmbShopName.add_selectedIndexChanged(container.cmbShopName_selectedIndexChanged),container.cmbCity.add_selectedIndexChanged(container.cmbCity_selectedIndexChanged),container.txtPostalCode.add_valueChanged(container.txtPostalCode_valueChanged),container.txtPostalCode.add_keyPress(container.txtPostalCode_keyPress)},this.cmbShopName_selectedIndexChanged=function(sender){if(container.processingResult)return;sender.get_value()!==""&&container.chkShop.check(!0),container.createSearchParametersAndDoSearch()},this.cmbCity_selectedIndexChanged=function(sender){if(container.processingResult)return;sender.get_value()!==""&&container.txtPostalCode.set_value("")},this.txtPostalCode_valueChanged=function(sender){if(container.processingResult)return;(sender.get_value()+"").length>0&&(container.processingResult=!0,container.cmbCity.clearSelection(),container.cmbCity.get_items().getItem(0).select(),container.processingResult=!1)},this.txtPostalCode_keyPress=function(sender,eventArgs){if(container.processingResult)return;eventArgs.get_keyCode()==13&&(eventArgs.set_cancel(!0),eventArgs.get_domEvent().preventDefault(),eventArgs.get_domEvent().stopPropagation(),container.createSearchParametersAndDoSearch())},this.createSearchParametersAndDoSearch=function(){var searchCriteria={HS:container.chkShop.attr("checked"),SN:container.chkShop.attr("checked")&&container.msAjaxIsLoaded?container.cmbShopName.get_value():"",HC:container.chkCarwash.checked(),CW:0,HG:container.chkGarage.attr("checked"),T:0,C:container.msAjaxIsLoaded?container.cmbCity.get_value():"",P:container.msAjaxIsLoaded?container.txtPostalCode.get_value():""};container.chkPortable.checked()&&(searchCriteria.CW|=2),container.chkSelfServiceBox.checked()&&(searchCriteria.CW|=4),container.chkServiceIncluded.checked()&&(searchCriteria.CW|=1),container.chkDiesel.checked()&&(searchCriteria.T|=1),container.chkEarthGas.checked()&&(searchCriteria.T|=2),container.chkVPower.checked()&&(searchCriteria.T|=4),container.chkVPowerDiesel.checked()&&(searchCriteria.T|=8),container.findStations(searchCriteria)},this.findStations=function(searchCriteria){container.currentRequest!=null&&container.currentRequest.abort(),searchCriteria||(searchCriteria=null),container.fadeIn(container.stationLoadingResults),container.currentRequest=$.ajaxWebRequest("/addons/comon/Common/Webservices/PetrolStationSearch.asmx","FindStations",{param:searchCriteria},this.processStationResult)},this.updateMarkersTimeout=null,this.updateMarkers=function(){container.updateMarkersTimeout!=null&&(window.clearTimeout(container.updateMarkersTimeout),container.updateMarkersTimeout=null),container.updateMarkersTimeout=$(document).wait(100,container.updateMarkersMove)},this.updateMarkersMove=function(){var amountShown,currentZoomLevel,i,station;container.updateMarkersTimeout=null;var currentRadiusSearch=null,currentRadiusLatLng=null,currentBounds=container.googleMap.getBounds();container.googleAddressGMarker!=null&&(currentRadiusSearch=container.txtRadiusSearch.val(),currentRadiusLatLng=container.googleAddressGMarker.getLatLng(),currentBounds.contains(currentRadiusLatLng)?container.fadeOut(container.notOnMapLinks):container.fadeIn(container.notOnMapLinks));if(container.stations==null||container.stations.length==0)return;for(amountShown=0,currentZoomLevel=container.googleMap.getZoom(),i=0;i<container.stations.length;i++)station=container.stations[i],station.Marker.CheckVisibility(currentBounds)&&(amountShown==0&&container.fadeOut(container.stationNoResultsOnMap),amountShown++,currentRadiusSearch!=null&&(station.DistanceTo==null||station.DistanceTo!=currentRadiusSearch)&&(station.DistanceTo=currentRadiusSearch,station.Marker.LatLng.distanceFrom(currentRadiusLatLng)>maxDistance?$("#stationElement"+station.Item.ID+" div.distanceTo").text("> "+maxDistance/1e3+" km"):container.addStationToQueue(station)));amountShown==0&&container.fadeIn(container.stationNoResultsOnMap)},this.addStationToQueue=function(station){$("#stationElement"+station.Item.ID+" div.distanceTo").text("..."),container.googleDirectionsCurrentStation==null?(container.googleDirectionsCurrentStation=station,container.processCurrentDirectionsItem()):container.googleDirectionsStationQueue.push(station)},this.fadeIn=function(element,speed){speed=speed||"fast",element.stop(!0,!0).fadeIn(speed,function(){$(this).show().css("opacity","1").css("opacity","").css("zoom","")})},this.fadeOut=function(element,speed){speed=speed||"fast",element.stop(!0,!0).fadeOut(speed)},this.showInfoWindow=function(station,zoomOnItem,zoomLevel){var i,stationToHide;if(container.infoWindow.station_!=null&&container.infoWindow.station_.Item&&container.infoWindow.station_.Item.ID==station.Item.ID)return;for(container.hideInfoWindow(),i=0;i<container.stations.length;i++)stationToHide=container.stations[i],stationToHide.IsSelected&&stationToHide.HideDetails();zoomLevel=zoomLevel||12,station.ItemHtmlDetails==null&&$.ajaxWebRequest("/addons/comon/Common/Webservices/PetrolStationSearch.asmx","GetStationHTML",{stationID:station.Item.ID,language:container.language,routeAllowed:routeAllowed},function(result){station.ItemHtmlDetails=result.d,station.DetailsElement=$(station.ItemHtmlDetails.DHTML).css("display","none"),station.DetailsElement.find("div.backtotop").click(function(){$.scrollTo({top:"0px",left:"0px"},750),container.googleMap.setCenter(station.Point,12)}),station.Element.append(station.DetailsElement),station.UpdateRoutePlanner(),station.Item.ID==container.infoWindow.station_.Item.ID?(container.infoWindow.processResult(station),station.ShowDetails()):station.HideDetails(),zoomOnItem==!0&&container.googleMap.setCenter(station.Point,zoomLevel)}),container.infoWindow.setStation(station,function(removedStation){removedStation.HideDetails(),container.hideInfoWindow()}),station.ShowDetails(),container.googleMap.addOverlay(container.infoWindow)},this.hideInfoWindow=function(station){if(!container.infoWindow.isVisible())return;(!station||container.infoWindow.station_&&container.infoWindow.station_.Item&&container.infoWindow.station_.Item.ID==station.Item.ID)&&(container.infoWindow.clear(),container.infoWindow.station_!=null&&container.infoWindow.station_.HideDetails(),container.googleMap.removeOverlay(container.infoWindow))},this.hideMarker=function(station){station.Marker.Hide();if(container.infoWindow.isVisible()){var currMarker=container.infoWindow.currentMarker();currMarker&&currMarker.RelatedTo&&currMarker.RelatedTo==station.Index&&(container.infoWindow.clear(),container.googleMap.removeOverlay(container.infoWindow))}},this.setMsAjaxValues=function(shopNameValue,cityValue,postalCodeValue){if(!container.msAjaxIsLoaded)return;container.processingResult=!0;var selectedItem=container.cmbShopName.findItemByValue(shopNameValue);selectedItem||(selectedItem=container.cmbShopName.get_items().getItem(0)),container.cmbShopName.clearSelection(),selectedItem.select(),selectedItem=container.cmbCity.findItemByValue(cityValue),selectedItem||(selectedItem=container.cmbCity.get_items().getItem(0)),container.cmbCity.clearSelection(),selectedItem.select(),container.processingResult=!1,container.txtPostalCode.set_value(postalCodeValue)},this.processStationResult=function(result){var parametersUsed,resultStations,markersForManager,i,station,latLng,marker,highlightElement;container.currentRequest=null,container.hideInfoWindow();if(container.stations!=null)while(container.stations.length>0)station=container.stations.pop(),station.Dispose();container.googleMarkerMgr&&container.googleMarkerMgr.clearMarkers(),parametersUsed=result.d.P,container.chkShop.check(parametersUsed.HS),container.chkCarwash.check(parametersUsed.HC),container.chkPortable.check((parametersUsed.CW&2)!=0),container.chkSelfServiceBox.check((parametersUsed.CW&4)!=0),container.chkServiceIncluded.check((parametersUsed.CW&1)!=0),container.chkGarage.check(parametersUsed.HG),container.chkDiesel.check((parametersUsed.T&1)!=0),container.chkEarthGas.check((parametersUsed.T&2)!=0),container.chkVPower.check((parametersUsed.T&4)!=0),container.chkVPowerDiesel.check((parametersUsed.T&8)!=0),container.setMsAjaxValues(parametersUsed.SN,parametersUsed.C,parametersUsed.P),container.lastSearchParameters=parametersUsed,container.fadeOut(container.stationLoadingResults,"slow"),container.fadeOut(container.stationNoResults),container.fadeOut(container.stationNoResultsOnMap),container.stationResults.html(""),container.stations=[],resultStations=result.d.S;if(resultStations.length==0)container.fadeIn(container.stationNoResults,"slow");else{for(markersForManager=[],markersForManager[0]=[],markersForManager[1]=[],markersForManager[2]=[],markersForManager[3]=[],i=0;i<resultStations.length;i++)station=$('<div id="stationElement'+resultStations[i].ID+'" class="stationItem" style="display: none;"><div class="station"><div class="name">'+resultStations[i].N+'</div><div class="zipCode">'+resultStations[i].Z+'</div><div class="city">'+resultStations[i].C+'</div><div class="distanceTo"></div><div class="clear"></div></div></div>'),container.stationResults.append(station),latLng=new GLatLng(resultStations[i].Lt,resultStations[i].Lg),marker=new jQuery.migrolMarker(container,latLng,resultStations[i].N,i,resultStations[i].MI),markersForManager[0].push(marker.GMarkers[0]),markersForManager[1].push(marker.GMarkers[1]),markersForManager[2].push(marker.GMarkers[2]),markersForManager[3].push(marker.GMarkers[3]),station.attr("RelatedTo",i),highlightElement=station.find("div.station"),highlightElement.attr("RelatedTo",i),container.stations[i]={Item:resultStations[i],MasterContainer:container,Index:i,Marker:marker,IsVisible:!1,IsHighlighted:!1,IsFlashing:!1,Element:station,HighlightElement:highlightElement,DetailsElement:null,ItemHtmlDetails:null,LoadingDetails:null,DistanceTo:null,Point:latLng,MarkerIsLo:!0,IsSelected:!1,IsExpanded:!1,DirectionsErrorRetries:0,DirectionsInterval:0,Show:function(){if(this.IsVisible)return;this.IsVisible=!0,this.Marker.Show(),this.Element.stop(!0,!0).show()},Hide:function(){if(!this.IsVisible)return;this.IsVisible=!1,this.Marker.ChangeMarkerToLo(),container.hideMarker(this),container.hideInfoWindow(this),this.Element.stop(!0,!0).hide(),this.HideDetails()},Highlight:function(){var i,item;if(this.IsHighlighted||!this.IsVisible)return;for(this.IsHighlighted=!0,i=0;i<container.stations.length;i++){item=container.stations[i],i!==this.Index&&item.IsVisible&&item.IsHighlighted&&item.ResetHighlight();if(i===this.Index||!item.IsVisible||item.MarkerIsLo)continue;item.MarkerIsLo=!0,item.Marker.ChangeMarkerToLo()}this.MarkerIsLo=!1,this.Marker.ChangeMarkerToHi();if(this.IsSelected)return;this.animateToColor("#FFE600")},ResetHighlight:function(){if(!this.IsHighlighted)return;this.IsHighlighted=!1,this.Marker.ChangeMarkerToLo();if(this.IsSelected)return;this.animateToColor("#FFFFFF")},ShowDetails:function(){if(this.IsExpanded)return;container.currentlySelectedSation=this,this.IsSelected=!0,this.Element.addClass("selected"),this.animateToColor("#DFDFDF");if(this.DetailsElement==null){this.LoadingDetails==null&&(this.LoadingDetails=container.stationLoadingResults.clone(),this.Element.append(this.LoadingDetails),container.fadeIn(this.LoadingDetails));return}this.LoadingDetails!=null&&(this.LoadingDetails.stop(!0,!0).remove(),this.LoadingDetails=null),this.UpdateRouteText(),this.IsExpanded=!0,this.DetailsElement.slideDown("slow",function(){$(this).show()})},HideDetails:function(){if(!this.IsSelected)return;container.currentlySelectedSation!=null&&container.currentlySelectedSation.Item.ID==this.Item.ID&&(container.currentlySelectedSation=null),this.IsSelected=!1,this.Element.removeClass("selected"),this.IsHighlighted?this.Highlight():this.animateToColor("#FFFFFF"),this.LoadingDetails!=null&&(this.LoadingDetails.remove(),this.LoadingDetails=null);if(!this.IsExpanded)return;this.IsExpanded=!1;if(this.DetailsElement==null)return;this.DetailsElement.stop(!0,!0),this.DetailsElement.slideUp("slow",function(){$(this).hide()})},FlashDetails:function(){if(!this.IsSelected||this.IsFlashing)return;this.IsFlashing=!0;var currentStation=this;this.Element.stop(!0,!0).effect("pulsate",{times:2},600,function(){currentStation.IsFlashing=!1,currentStation.Element.css("opacity",1)})},animateToColor:function(color){this.Element.stop(!0,!0).show();if(this.IsVisible){var currentStation=this;this.Element.animate({backgroundColor:color},500,"linear",function(){currentStation.Element.css("backgroundColor",color)})}else this.Element.css("backgroundColor",color);this.IsFlashing&&(this.IsFlashing=!1)},MouseOver:station.mouseover(function(){container.stations[$(this).attr("RelatedTo")].Highlight()}),MouseOut:station.mouseout(function(){container.stations[$(this).attr("RelatedTo")].ResetHighlight()}),MouseClick:station.click(function(){container.showInfoWindow(container.stations[$(this).attr("RelatedTo")])}),Dispose:function(){this.Element.stop(!0,!0),this.Element.unbind("mouseover"),this.Element.unbind("mouseout"),this.Element.unbind("click"),this.DetailsElement!=null&&this.DetailsElement.find("div.backtotop").unbind(),this.Element.remove(),this.HighlightElement!=null&&this.HighlightElement.remove(),this.DetailsElement!=null&&this.DetailsElement.remove(),this.Marker.Dispose(),this.Marker=null,this.Point=null,this.Item=null,this.Element=null,this.HighlightElement=null,this.DetailsElement=null,this.ItemHtmlDetails=null},ResetDistance:function(onlyClearErrorInfo){return this.DirectionsErrorRetries=0,this.DirectionsInterval=0,onlyClearErrorInfo||(this.DistanceTo=null),this},RouteStartSpecified:!1,RouteFirst:!0,RouteCurrent:null,RouteMap:null,RouteDirections:null,UpdateRoutePlanner:function(){var self=this,routePlanner=this.Element.find("div.routeplanner"),planRoute;routePlanner.find(".input input.inputText").change(function(){self.RouteStartSpecified=$(this).val()!="",self.UpdateRouteText()}),planRoute=function(){var parent,printRoute;if(routePlanner.find(".input input.inputText").val()=="")return;parent=routePlanner.parent(),self.RouteFirst&&(self.RouteFirst=!1,parent.append($("#radiusSearchResult div.farAway").clone()).append($("#radiusSearchResult div.notFound").clone()).append('<div class="routeLoading"></div>').append('<div class="routeResults"><div class="directions"><div class="directionsContent"></div></div><div class="map"></div><div class="clear"></div></div>'),parent.find("div.farAway").hide(),parent.find("div.notFound").hide(),parent.find("div.routeLoading").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),self.RouteMap=new GMap2(parent.find("div.routeResults div.map")[0]),self.RouteDirections=new GDirections(self.RouteMap,parent.find("div.routeResults div.directionsContent")[0]),container.googleEventHandlers.push(GEvent.addListener(self.RouteDirections,"load",function(){parent.find("div.farAway").hide(),parent.find("div.notFound").hide(),parent.find("div.routeLoading").hide(),parent.find("div.routeResults").removeClass("hide"),routePlanner.find("a.print").show()})),container.googleEventHandlers.push(GEvent.addListener(self.RouteDirections,"error",function(){parent.find("div.farAway").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),parent.find("div.routeLoading").hide(),parent.find("div.notFound").show()})),printRoute=function(printLink){if(printLink.attr("isclicked")=="1")return;printLink.attr("isclicked","1").addClass("loading"),$.switchStylesheet("printroute",!0,!0);var handlerHasBeenCalled=!1,printHandler=function(){handlerHasBeenCalled=!0,GEvent.removeListener(eventHandler),window.print(),$(document).wait(20,function(){printLink.removeAttr("isclicked").removeClass("loading"),$.switchStylesheet("printroute",!0,!1),self.RouteMap.checkResize(),self.RouteMap.setCenter(self.RouteDirections.getBounds().getCenter(),self.RouteMap.getBoundsZoomLevel(self.RouteDirections.getBounds()))})},eventHandler=GEvent.addListener(self.RouteMap,"tilesloaded",printHandler);self.RouteMap.checkResize(),self.RouteMap.setCenter(self.RouteDirections.getBounds().getCenter(),self.RouteMap.getBoundsZoomLevel(self.RouteDirections.getBounds())),$(document).wait(1500,function(){handlerHasBeenCalled||printHandler()})},routePlanner.find("a.print").click(function(ev){return ev.stopPropagation(),printRoute($(this)),!1})),parent.find("div.farAway").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),parent.find("div.notFound").hide(),parent.find("div.routeLoading").show(),container.googleGeocoder.getLatLng(routePlanner.find(".input input.inputText").val(),function(point){point?container.googleGeocoder.getLocations(routePlanner.find(".input input.inputText").val(),function(result){result&&result.Status.code==200?result.Placemark[0].AddressDetails.Country.CountryNameCode.toLowerCase()!="ch"&&result.Placemark[0].AddressDetails.Country.CountryNameCode.toLowerCase()!="fl"?(parent.find("div.notFound").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),parent.find("div.routeLoading").hide(),parent.find("div.farAway").show()):self.RouteDirections.load("from: "+routePlanner.find(".input input.inputText").val()+" to: "+self.Marker.Address,{locale:container.language+"_CH"}):(parent.find("div.farAway").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),parent.find("div.routeLoading").hide(),parent.find("div.notFound").show())}):(parent.find("div.farAway").hide(),parent.find("div.routeResults").addClass("hide"),routePlanner.find("a.print").hide(),parent.find("div.routeLoading").hide(),parent.find("div.notFound").show())})},routePlanner.find(".input input.inputText").keydown(function(evt){evt.keyCode==13&&(evt.stopPropagation(),evt.preventDefault(),planRoute())}),routePlanner.find(".input .inputSubmit").click(function(ev){return ev.stopPropagation(),planRoute(),!1})},UpdateRouteText:function(){this.RouteStartSpecified||this.Element.find("div.routeplanner .input input.inputText").val(container.googleAddressGMarker==null?"":container.txtRadiusSearch.val())}},resultStations[i].ID==container.initialStation&&(container.showInfoWindow(container.stations[i],!0,container.initialStationZoom),container.initialStation=0);container.googleMarkerMgr||(container.googleMarkerMgr=new MarkerManager(container.googleMap)),container.googleMarkerMgr.addMarkers(markersForManager[3],1,8),container.googleMarkerMgr.addMarkers(markersForManager[2],9,10),container.googleMarkerMgr.addMarkers(markersForManager[1],11,13),container.googleMarkerMgr.addMarkers(markersForManager[0],14),container.googleMarkerMgr.refresh()}container.googleAddressGMarker!=null&&$("#stationResultsWrapper div.distanceTo").show(),container.updateMarkers()},this.resetMap=function(){container.googleMap.setCenter(new GLatLng(46.71726889201247,8.34411633593751),7)},this.updateRadius=function(ev){return ev&&ev.stopPropagation(),container.txtRadiusSearch.val()==""?!1:(container.googleGeocoder.getLatLng(container.txtRadiusSearch.val(),function(point){point?($("#radiusSearchResult div.enteredAddress").text(container.txtRadiusSearch.val()),container.googleGeocoder.getLocations(container.txtRadiusSearch.val(),function(result){if(result&&result.Status.code==200)if(result.Placemark[0].AddressDetails.Country.CountryNameCode.toLowerCase()!="ch"&&result.Placemark[0].AddressDetails.Country.CountryNameCode.toLowerCase()!="fl")$("#radiusSearchResult div.found").hide(),$("#radiusSearchResult div.notFound").hide(),$("#radiusSearchResult div.farAway").show(),$("#radiusSearchResult").slideDown("slow"),$("#radiusSearch").slideUp("slow");else{container.googleAddressGMarker!=null&&container.googleMap.removeOverlay(container.googleAddressGMarker);var imgMap=new GIcon(G_DEFAULT_ICON).imageMap,icon=new GIcon;icon.image="/portaldata/1/Resources/_internal/images/kartensuche/marker_lo.png",icon.transparent="/portaldata/1/Resources/_internal/images/kartensuche/marker_lo.png",icon.iconSize=new GSize(20,34),icon.iconAnchor=new GPoint(10,34),icon.shadow="/portaldata/1/Resources/_internal/images/kartensuche/marker_shadow.png",icon.shadowSize=new GSize(37,34),icon.imageMap=imgMap,container.googleAddressGMarker=new GMarker(point,{title:container.txtRadiusSearch.val(),icon:icon,zIndexProcess:container.importanceOrder,clickable:!1}),container.googleAddressGMarker.importance=5,container.googleMap.addOverlay(container.googleAddressGMarker),$("#radiusSearchResult div.notFound").hide(),$("#radiusSearchResult div.farAway").hide(),$("#radiusSearchResult div.found").show(),$("#radiusSearchResult").slideDown("slow"),$("#radiusSearch").slideUp("slow"),$("#stationResultsWrapper div.distanceTo").show(),container.googleMap.setCenter(point,12)}else $("#radiusSearchResult div.found").hide(),$("#radiusSearchResult div.farAway").hide(),$("#radiusSearchResult div.notFound").show(),$("#radiusSearchResult").slideDown("slow"),$("#radiusSearch").slideUp("slow");container.currentlySelectedSation!=null&&container.currentlySelectedSation.UpdateRouteText()})):($("#radiusSearchResult div.found").hide(),$("#radiusSearchResult div.farAway").hide(),$("#radiusSearchResult div.notFound").show(),$("#radiusSearchResult").slideDown("slow"),$("#radiusSearch").slideUp("slow"))}),!1)},this.changeAddress=function(){$("#stationResultsWrapper div.distanceTo").hide(),$("#radiusSearch").slideDown("slow"),$("#radiusSearchResult").slideUp("slow"),container.googleAddressGMarker!=null&&(container.googleMap.removeOverlay(container.googleAddressGMarker),container.googleAddressGMarker=null),container.currentlySelectedSation!=null&&container.currentlySelectedSation.UpdateRouteText()},this.googleTimeout=null,this.processCurrentDirectionsItem=function(){if(container.googleTimeout!=null)return;container.googleAddressGMarker==null&&container.clearGoogleQueue();if(container.googleDirectionsCurrentStation==null)return;container.googleDirectionsCurrentStation.DirectionsInterval<100&&(container.googleDirectionsCurrentStation.DirectionsInterval=100),container.googleTimeout=$(document).wait(container.googleDirectionsCurrentStation.DirectionsInterval,container.actualProcessCurrentDirectionsItem)},this.actualProcessCurrentDirectionsItem=function(){container.googleTimeout=null,container.googleAddressGMarker==null&&container.clearGoogleQueue();if(container.googleDirectionsCurrentStation==null)return;var ll=container.googleAddressGMarker.getLatLng();container.googleDirections.load("from: "+container.googleDirectionsCurrentStation.Marker.Address+" to: "+ll.lat()+","+ll.lng(),{locale:container.language+"_CH"})},this.clearGoogleQueue=function(){container.googleDirectionsCurrentStation.ResetDistance(),container.googleDirectionsCurrentStation=null;while(container.googleDirectionsStationErrorQueue.length>0)container.googleDirectionsStationErrorQueue.pop().ResetDistance();while(container.googleDirectionsStationQueue.length>0)container.googleDirectionsStationQueue.pop().ResetDistance()},this.importanceOrder=function(marker){return GOverlay.getZIndex(marker.getLatLng().lat())+marker.importance*1e6},this.loadedGoogleDirections=function(){container.googleAddressGMarker==null&&container.clearGoogleQueue();if(container.googleDirectionsCurrentStation==null)return;var station=container.googleDirectionsCurrentStation,distance=container.googleDirections.getDistance().meters;container.popNextDirectionStation(),station.ResetDistance(!0),distance>maxDistance?$("#stationElement"+station.Item.ID+" div.distanceTo").text("> "+maxDistance/1e3+" km"):(distance=Math.round(distance/100)/10,$("#stationElement"+station.Item.ID+" div.distanceTo").text(distance+" km"))},this.errorGoogleDirections=function(){container.googleAddressGMarker==null&&container.clearGoogleQueue();if(container.googleDirectionsCurrentStation==null)return;var errorWas=container.googleDirections.getStatus(),station=container.googleDirectionsCurrentStation;errorWas.code=="620"&&(station.DirectionsErrorRetries++,station.DirectionsErrorRetries>3?(station.ResetDistance(),$("#stationElement"+station.Item.ID+" div.distanceTo").text("N/A")):(station.DirectionsInterval+=400,container.googleDirectionsStationErrorQueue.push(station))),container.popNextDirectionStation()},this.popNextDirectionStation=function(){if(container.googleDirectionsStationQueue.length==0&&container.googleDirectionsStationErrorQueue.length>0)while(container.googleDirectionsStationErrorQueue.length>0)container.googleDirectionsStationQueue.push(container.googleDirectionsStationErrorQueue.pop());container.googleDirectionsStationQueue.length>0?(container.googleDirectionsCurrentStation=container.googleDirectionsStationQueue.pop(),container.processCurrentDirectionsItem()):container.googleDirectionsCurrentStation=null},this.centerAddress=function(){if(container.googleAddressGMarker==null)return;container.googleMap.setCenter(container.googleAddressGMarker.getLatLng())},this.googleMapsIsAvailable=GBrowserIsCompatible(),$(window).unload(function(){container.Dispose()}),this.createSearchParametersAndDoSearch(),this.googleMapsIsAvailable?(this.googleMap=new GMap2($("#petrolstationMapCanvas")[0]),this.googleDirections=new GDirections,this.googleGeocoder=new GClientGeocoder,this.googleGeocoder.setBaseCountryCode("CH"),mapOptions=this.googleMap.getDefaultUI(),mapOptions.maptypes.normal=!0,mapOptions.maptypes.satellite=!0,mapOptions.maptypes.hybrid=!0,mapOptions.maptypes.physical=!0,mapOptions.zoom.scrollwheel=!1,mapOptions.controls.maptypecontrol=!0,mapOptions.controls.menumaptypecontrol=!0,mapOptions.controls.scalecontrol=!0,this.googleMap.setUI(mapOptions),this.googleMap.setMapType(G_NORMAL_MAP),container.resetMap(),this.googleEventHandlers=[],this.googleEventHandlers.push(GEvent.addListener(this.googleMap,"move",this.updateMarkers)),this.googleEventHandlers.push(GEvent.addListener(this.googleMap,"zoomend",this.updateMarkers)),this.googleEventHandlers.push(GEvent.addListener(this.googleDirections,"load",this.loadedGoogleDirections)),this.googleEventHandlers.push(GEvent.addListener(this.googleDirections,"error",this.errorGoogleDirections)),$(this.chkShop).add(this.chkCarwash).add(this.chkPortable).add(this.chkSelfServiceBox).add(this.chkServiceIncluded).add(this.chkGarage).add(this.chkDiesel).add(this.chkEarthGas).add(this.chkVPower).add(this.chkVPowerDiesel).add(this.lnkSearch).click(function(){container.createSearchParametersAndDoSearch()}),this.setMsAjaxEventHandlers(),this.lnkRadiusSearch.click(this.updateRadius),$("#radiusSearchWrapper a.changeAddress").click(this.changeAddress),this.notOnMapLinks.click(this.centerAddress),this.txtRadiusSearch.keydown(function(evt){evt.keyCode==13&&(evt.stopPropagation(),evt.preventDefault(),container.updateRadius())}),this.infoWindow=new CustomInfowindow(20,0),this.stationNoResultsOnMap.find("a").click(function(){container.resetMap()})):$("#mapWrapper").hide()}
