var console;
if(console==undefined){console=new function(){this.log=function(){}
}
}window.noGarbageClean=Browser.ie&&Browser.version<8;
var MultiSliderFilter=new Class({Extends:Slider,options:{onChange:function(){},onComplete:function(){if(!this.disabled){var newLimitPos=this.toPosition([this.step[0],this.step[1]]);
this.drag1.options.limit.x=[this.options.offset,newLimitPos[1]];
this.drag2.options.limit.x=[newLimitPos[0],this.max-this.options.offset];
this.filterContainer.sendFilter("&searchFilter.name="+this.options.name+"&minValue="+this.getMin()+"&maxValue="+this.getMax())
}},onTick:function(pos){this.knob1.setStyle(this.p,pos[0]);
this.knob2.setStyle(this.p,pos[1])
},init:function(container){this.input=container.getElement("input");
container.getElement(".slider").removeClass("hide")
},mode:"horizontal",steps:100,offset:0,valueOffset:0,snap:false,scaleSize:1,name:""},initialize:function(container,filterContainer,options){this.setOptions(options);
this.options.steps=this.options.steps||1;
this.filterContainer=filterContainer;
this.container=container;
if(this.container){this.container.removeClass("hide")
}this.options.init(container);
var knobs=container.getElements("div div");
this.hasNotDragged=true;
this.knob1=knobs[0];
this.knob2=knobs[1];
this.previousChange=[-1,-1];
this.previousEnd=[-1,-1];
this.step=[-1,-1];
this.z="x";
this.p="left";
if(this.options.input){this.options.input.setStyle("border","none")
}knobs.setStyles({left:0,position:"relative"});
this.setKnobs()
},update:function(options){this.setOptions(options);
if(typeof this.options.initialPosition[0]!="undefined"&&typeof this.options.initialPosition[1]!="undefined"){this.setKnobs()
}},setKnobs:function(){mod={x:"left",y:false};
offset="offsetWidth";
var sliderbase=this.container.getElement("div.slider");
this.getPos=sliderbase["get"+this.p.capitalize()].bind(this.sliderbase);
this.max=sliderbase[offset]-this.knob1[offset]+(this.options.offset*2);
var lim1={};
lim1[this.z]=[-this.options.offset,this.max-this.options.offset];
var lim2={};
lim2[this.z]=[-this.options.offset,this.max-this.options.offset];
if(!this.drag1){this.drag1=new Drag(this.knob1,{limit:lim1,modifiers:mod,snap:0,onStart:function(){this.draggedKnob(0)
}.bind(this),onDrag:function(){this.draggedKnob(0)
}.bind(this),onComplete:function(){this.draggedKnob(0);
this.end(0)
}.bind(this)})
}else{this.drag1.options.limit=lim1
}if(!this.drag2){this.drag2=new Drag(this.knob2,{limit:lim2,modifiers:mod,snap:0,onStart:function(){this.draggedKnob(1)
}.bind(this),onDrag:function(){this.draggedKnob(1)
}.bind(this),onComplete:function(){this.draggedKnob(1);
this.end(1)
}.bind(this)})
}else{this.drag1.options.limit=lim2
}if(this.options.initialPosition[0]===0&&this.options.initialPosition[1]===0){this.waiting=true;
this.options.initialPosition[1]=1
}else{this.waiting=false
}if(this.options.initialize){this.options.initialize.call(this)
}this.set(this.options.initialPosition);
this.previousChange=this.options.initialPosition
},set:function(step){this.step=[step[0].limit(this.options.valueOffset,this.options.steps+this.options.valueOffset),step[1].limit(this.options.valueOffset,this.options.steps+this.options.valueOffset)];
this.checkStep(1);
var pos=this.toPosition(this.step);
this.knob1.setStyle(this.p,pos[0]);
this.knob2.setStyle(this.p,pos[1]);
this.drag1.value.now.x=-this.options.offset;
this.drag2.value.now.x=this.max-this.options.offset;
var newLimitPos=this.toPosition([this.step[0],this.step[1]]);
this.drag1.options.limit.x=[this.options.offset,newLimitPos[1]];
this.drag2.options.limit.x=[newLimitPos[0],this.max-this.options.offset];
this.fireEvent("onChange",{min:this.step[0],max:this.step[1]});
this.options.hasChanged=false;
return this
},draggedKnob:function(i){i==0?knob=this.drag1:knob=this.drag2;
this.step[i]=this.toStep(knob.value.now[this.z]);
this.checkStep(i)
},checkStep:function(i){if(this.previousChange[i]!=this.step[i]){this.previousChange[i]=this.step[i];
this.fireEvent("onChange",{min:this.step[0],max:this.step[1]})
}},end:function(knobNumber){if(this.options.snap){var pos=this.toPosition(this.step);
this.knob1.setStyle(this.p,pos[0]);
this.knob2.setStyle(this.p,pos[1]);
this.drag1.value.now.x=pos[0];
this.drag2.value.now.x=pos[1]
}for(var i=0,l=this.step.length;
i<l;
i++){if(this.previousEnd[i]!=this.step[i]){this.previousEnd[i]=this.step[i];
if(!this.hasNotDragged){if(this.requestTimeout){clearTimeout(this.requestTimeout)
}this.fireEvent("onComplete",this.step)
}else{this.hasNotDragged=false;
this.requestTimeout=setTimeout(function(){this.fireEvent("onComplete",this.step)
}.bind(this),10)
}}}if(knobNumber==0){this.knob1.setStyle("zIndex",10);
this.knob2.setStyle("zIndex",9)
}else{this.knob1.setStyle("zIndex",9);
this.knob2.setStyle("zIndex",10)
}this.options.hasChanged=true
},disable:function(){this.drag1.options.savedLimit=this.drag1.options.limit.x;
this.drag2.options.savedLimit=this.drag2.options.limit.x;
this.drag1.options.limit.x=[this.drag1.value.now.x-0.01,this.drag1.value.now.x+0.01];
this.drag2.options.limit.x=[this.drag2.value.now.x+0.01,this.drag2.value.now.x-0.01];
this.disabled=true
},enable:function(){this.drag1.options.limit.x=this.drag1.options.savedLimit;
this.drag2.options.limit.x=this.drag2.options.savedLimit;
this.disabled=false
},restore:function(){this.set(this.options.restorePosition)
},toStep:function(position){return Math.round((position+this.options.offset)/this.max*this.options.steps)+this.options.valueOffset
},toPosition:function(step){return[this.max*(step[0]-this.options.valueOffset)/this.options.steps,this.max*(step[1]-this.options.valueOffset)/this.options.steps]
},getMax:function(){return this.step[0]>this.step[1]?this.step[0]:this.step[1]
},getMin:function(){return this.step[0]<this.step[1]?this.step[0]:this.step[1]
}});
var CheckboxFilter=new Class({initialize:function(checkbox,filterContainer){this.filterContainer=filterContainer;
this.checkbox=checkbox;
this.initialState=checkbox.checked;
this.parent=checkbox.getParent();
checkbox.addEvent("click",function(){var name="searchFilter."+(this.checkbox.id.match(/spa/)?"spa":this.checkbox.id);
var state=this.checkbox.checked;
if(this.checkbox.id.match(/spa/)){$$("#spaHotelType, #spaHotelConfiguration").each(function(checkbox){checkbox.checked=state
})
}this.filterContainer.sendFilter("&name="+name+"&value="+this.checkbox.value+"&checked="+state+"&"+name+"="+(state?"on":"off"))
}.bind(this))
},set:function(){this.checkbox.value=true
},restore:function(){this.checkbox.checked=this.initialState
},disable:function(){this.checkbox.setProperty("disabled","disabled")
},enable:function(){this.checkbox.removeProperty("disabled")
}});
var Filter=new Class({Implements:[Options,Events],options:{url:""},initialize:function(options){this.setFilterOptions(options);
if(map){map.filter=this
}this.filter=[];
if(options.isVeMapSearch){this.multiSliders=[];
$("price").setStyle("display","none")
}else{this.multiSliders=["price"]
}if($("stars")){this.multiSliders.push("stars")
}if($("totalRating")){this.multiSliders.push("totalRating")
}this.multiSliders.each(function(item){this.filter.push(new MultiSliderFilter($(item),this,this.sliderSettings[item]))
},this);
$$("#filter .check input").each(function(item){this.filter.push(new CheckboxFilter(item,this))
},this);
$$("div.teaser .restore").addEvent("click",function(event){if(event){event.stop()
}this.filter.each(function(item){item.restore()
},this);
this.sendFilter("&restore=true")
}.bind(this)).removeClass("hide");
$("jsFree").addClass("hide");
$$(".sliderBox label").setStyle("width","auto");
if($("showGallery")){this.isGallery=$("showGallery").hasClass("act");
$("showList").addEvent("click",function(){this.isGallery=false
}.bind(this));
$("showGallery").addEvent("click",function(){this.isGallery=true
}.bind(this))
}},setFilterOptions:function(options){this.options.url=this.options.url||options.url;
this.options.isVeMapSearch=options.isVeMapSearch;
this.sliderSettings.price.steps=options.maxPriceAbsolute-options.minPriceAbsolute;
this.sliderSettings.price.valueOffset=options.minPriceAbsolute;
this.sliderSettings.price.currency=options.currency;
this.sliderSettings.price.restorePosition=[options.minPriceAbsolute,options.maxPriceAbsolute];
this.sliderSettings.price.initialPosition=[options.minPrice,options.maxPrice];
this.sliderSettings.stars.initialPosition=[options.minNumberOfStars,options.maxNumberOfStars];
this.sliderSettings.totalRating.initialPosition=[options.minEvaluationResult,options.maxEvaluationResult]
},toggleGallery:function(isGallery){this.isGallery=isGallery
},updateFilter:function(options){this.setFilterOptions(options);
this.multiSliders.each(function(item,i){this.filter[i].update(this.sliderSettings[item])
},this);
window.filterObserver=false;
window.currencyFilterObserver=this
},sliderSettings:{price:{onChange:function(){if(!this.waiting){var min=this.getMin();
var max=this.getMax();
var text="";
min==max?text=max+" "+this.options.currency:text=min+" - "+max+" "+this.options.currency;
this.options.input.value=text
}},snap:false,name:"price"},stars:{onChange:function(){var min=this.getMin();
var max=this.getMax();
if(min==max){$$("#starsMax").addClass("hide");
$$("#min").addClass("hide")
}else{$$("#starsMax").removeClass("hide");
$$("#min").removeClass("hide")
}if(min==0){$("starsMin").addClass("notRated");
$("starsMin").setStyle("width",9)
}else{$("starsMin").removeClass("notRated");
$("starsMin").setStyle("width",min*9)
}$("starsMax").setStyle("width",max*9)
},init:function(container){container.getElements(".hide").removeClass("hide");
container.getElement("input").addClass("hide")
},steps:5,valueOffset:0,snap:true,name:"stars",restorePosition:[0,5]},totalRating:{onChange:function(){this.options.input.value=this.getMin()+" - "+this.getMax()+" / 10"
},steps:10,valueOffset:0,snap:false,name:"totalRating",restorePosition:[0,10]}},sendFilter:function(values){var hotellistFrame=window.hotellist||parent.hotellist;
if(hotellistFrame){hotellistFrame.location.href=this.options.url+values+"&hotelListIframeTarget="+map.state
}if(map){map.renderPushpins()
}this.fireEvent("sendFilter")
},disableFilter:function(){this.filter.each(function(item){item.disable()
})
},enableFilter:function(){this.filter.each(function(item){item.enable()
})
}});
var Map=new Class({Implements:Options,options:{deeplink:"",minimizeText:"",maximizeText:"",generateContent:"",topLeftLat:0,topLeftLong:0,bottomRightLat:0,bottomRightLon:0,centerLat:0,centerLon:0,zoom:0,centerZoom:false,mapStyle:"",controlLanguage:"en",routingPopupUrl:""},initialize:function(options){this.setOptions(options);
this.searchForm=$("searchForm");
this.isInit=false;
this.isShown=false;
this.filter=false;
this.view=null;
this.isFreefly=false;
this.iconSize=50;
this.zoomChange=true;
this.mapContainer=$("map");
this.mapOverlay=$("mapOverlay").setStyle("opacity",0.4);
if($("openMap")){var loadList;
this.toggleButton=$("openMap").removeClass("hide");
this.toggleButtonText=this.toggleButton.getElement(".mapButtonTitle");
if(this.options.deeplink=="map"){this.open();
$("tablehead").removeClass("hasMap")
}if(this.options.deeplink=="gallery"){loadList=true;
$("tablehead").setStyle("display","none")
}else{loadList=false;
$("tablehead").setStyle("display","")
}this.state=($("loh_frame").src.match(/hotelListIframeTarget=.*/)[0].replace("hotelListIframeTarget=",""));
this.toggleButton.addEvent("click",function(event){if(this.toggleButton.hasClass("act")){this.toggleButton.removeClass("act");
this.close();
$("tablehead").removeClass("hasMap")
}else{this.toggleButton.addClass("act");
this.open();
$("tablehead").addClass("hasMap")
}var target=event.target;
if(target.hasClass("mapButtonTitle")){target=target.getParent()
}$("tablehead").setStyle("display","");
if(!loadList){event.preventDefault()
}loadList=false;
this.trackState(!target.hasClass("act")?"list":"map");
this.filter.toggleGallery(target.id==="showGallery")
}.bind(this))
}if(!$("openMap")||$("openMap").hasClass("act")){this.open()
}$("toggleLegend").addEvent("click",function(){$("legend").toggleClass("hide");
this.getElement("strong").toggleClass("open")
})
},open:function(){if(this.filter){this.filter.toggleGallery(false)
}if(!this.isShown){if(this.toggleButtonText){this.toggleButtonText.set("text",this.options.minimizeText)
}this.mapContainer.removeClass("hide");
$("mapFooter").removeClass("hide");
this.isShown=true;
if(!this.isInit){this.initIframe()
}}var openList=$("openList");
if(openList){$("openList").removeClass("act")
}$$("#openMap, #openMap a").addClass("act");
$("mapExpanded").value=true
},close:function(){if(this.isShown){var searchForm=$("searchForm");
if(this.toggleButtonText){this.toggleButtonText.set("text",this.options.maximizeText)
}this.mapContainer.addClass("hide");
$("mapFooter").addClass("hide");
this.isShown=false
}$("mapExpanded").value=false
},initIframe:function(){var iframe=new Element("iframe",{src:this.options.iframeUrl,name:"iframeMap",id:"mapIframe",scrolling:"no",frameborder:0,framespacing:0});
iframe.inject($("map"),"inside");
iframe.addEvent("load",function(){var f=function(){var dashbord=new Dashboard((window.iframeMap||parent.iframeMap||window.frames.iframeMap||parent.frames.iframeMap),map.veMap)
};
f.delay(window.opera?100:0)
})
},init:function(mapWrapper){this.isInit=true;
this.mapCoordinate={};
var iframe=(window.iframeMap||parent.iframeMap||window.frames.iframeMap||parent.frames.iframeMap);
this.veMap=new VEMap(mapWrapper);
this.veMap.LoadMap();
iframe.document.getElementsByTagName("body")[0].unload=function(){iframe.map.veMap.Dispose()
};
map.mapCoordinate.topLeftLat=map.options.topLeftLat;
map.mapCoordinate.topLeftLon=map.options.topLeftLon;
map.mapCoordinate.bottomRightLat=map.options.bottomRightLat;
map.mapCoordinate.bottomRightLon=map.options.bottomRightLon;
map.mapCoordinate.centerLat=map.options.centerLat;
map.mapCoordinate.centerLon=map.options.centerLon;
map.mapCoordinate.zoom=map.options.zoom;
map.mapCoordinate.centerZoom=map.options.centerZoom;
if(map.mapCoordinate.centerZoom&&map.mapCoordinate.centerLat&&map.mapCoordinate.centerLon){this.veMap.SetCenterAndZoom(iframe.getVELatLong(map.mapCoordinate.centerLat,map.mapCoordinate.centerLon),map.mapCoordinate.zoom)
}else{this.veMap.SetMapView([iframe.getVELatLong(this.options.topLeftLat,this.options.topLeftLon),iframe.getVELatLong(this.options.bottomRightLat,this.options.bottomRightLon)])
}this.veMap.AttachEvent("onendzoom",this.storeMapBoundsHandler);
this.veMap.AttachEvent("onendpan",this.storeMapBoundsHandler);
this.veMap.AttachEvent("onchangemapstyle",this.storeChangeMapStyleHandler);
this.veMap.SetMapStyle((window.iframeMap||parent.iframeMap).getVEMapStyleShaded());
this.storeMapBoundsHandler();
this.routing=new Routing((window.iframeMap||parent.iframeMap),this.veMap,this.options.routingPopupUrl,this.options.routingOptions);
this.routing.init();
if(this.toggleSearch){this.toggleSearch.initAvailibiltyButton()
}map.renderPushpins()
},disable:function(){this.mapOverlay.removeClass("hide")
},enable:function(){this.mapOverlay.addClass("hide")
},trackState:function(state){console.log("trackState",state);
if(state!="gallery"&&this.state!=state&&this.state!="gallery"){HotelListViewTracker.trackViewSwitching(state,function(json){s_trackPage(json.vars,true)
})
}this.state=state;
window.fireEvent("mapChange",this.state)
},storeMapBoundsHandler:function(){var hotellistFrame=window.hotellist||parent.hotellist;
if(map.mapCoordinate){if(hotellistFrame){if(hotellistFrame.toggleMapsearch!=null){hotellistFrame.toggleMapsearch(true)
}}var view=map.veMap.GetMapView();
if(!map.filter.options.isVeMapSearch){map.checkDestinationIsInView(view)
}map.mapCoordinate.topLeftLat=view.TopLeftLatLong.Latitude;
map.mapCoordinate.topLeftLon=view.TopLeftLatLong.Longitude;
map.mapCoordinate.bottomRightLat=view.BottomRightLatLong.Latitude;
map.mapCoordinate.bottomRightLon=view.BottomRightLatLong.Longitude;
map.mapCoordinate.centerLat=map.veMap.GetCenter().Latitude;
map.mapCoordinate.centerLon=map.veMap.GetCenter().Longitude;
map.mapCoordinate.zoom=map.veMap.GetZoomLevel();
DynamicMap.storeMapCoordinate(map.mapCoordinate,function(data){});
map.renderPushpins()
}},checkDestinationIsInView:function(view){var summarySpan=$("summary").getElement("span"),searchForm=$("searchForm"),destiny=$("destiny");
if(!this.orginalDestination){this.orginalDestination=summarySpan.innerHTML
}if(this.options.topLeftLat<view.BottomRightLatLong.Latitude||this.options.topLeftLon>view.BottomRightLatLong.Longitude||this.options.bottomRightLat>view.TopLeftLatLong.Latitude||this.options.bottomRightLon<view.TopLeftLatLong.Longitude){summarySpan.innerHTML=SEEMAP
}else{summarySpan.innerHTML=this.orginalDestination;
searchForm.store("searchDestinationMap",false)
}searchForm.store("searchDestinationMap",summarySpan.innerHTML==SEEMAP?SEEMAP:false);
if(destiny.value==""&&summarySpan.innerHTML==SEEMAP){destiny.value=SEEMAP;
destiny.setStyle("color","#808080")
}},storeChangeMapStyleHandler:function(){if(map.mapCoordinate){map.mapCoordinate.style="s";
map.mapCoordinate.zoom=map.veMap.GetZoomLevel();
map.mapCoordinate.center=map.veMap.GetCenter();
DynamicMap.storeMapCoordinate(map.mapCoordinate,function(data){})
}},openPushPinHandler:function(selectedShape){if(selectedShape!=null){if(selectedShape.hotel_keylist!=null){map.veMap.ShowInfoBox(selectedShape);
selectedShape.SetDescription("<div id='"+selectedShape.hotel_keylist+"_div'"+(selectedShape.Title?"":"style='min-height: 23px'")+">"+map.options.generateContent+"</div>");
if(this.timeOut){clearTimeout(this.timeOut)
}this.timeOut=setTimeout(function(){DynamicMap.getPushpinHtml(selectedShape.hotel_keylist,function(data){var el=(window.iframeMap||parent.iframeMap).document.getElementById(selectedShape.hotel_keylist+"_div");
if(el){el.innerHTML=data
}})
},0)
}else{map.veMap.ShowInfoBox(selectedShape)
}}},renderPushpins:function(){if(map.veMap&&map.veMap.GetMapStyle()!=(window.iframeMap||parent.iframeMap).getVEMapStyle("Birdseye")&&map.veMap.GetMapStyle()!=(window.iframeMap||parent.iframeMap).getVEMapStyle("BirdseyeHybrid")){if(map.isFreefly){map.checkForHotels()
}else{map.getHotelsJS()
}}},checkForHotels:function(){if(!map.isBusy){var searchForm=$("searchForm");
map.filter.disableFilter();
DynamicMap.getPointListJS(map.mapCoordinate.topLeftLat,map.mapCoordinate.topLeftLon,map.mapCoordinate.bottomRightLat,map.mapCoordinate.bottomRightLon,map.veMap.GetZoomLevel(),function(jsResult){if(jsResult.count<parseInt(map.options.availabilityCheckCount)){map.toggleSearch.availibiltyButton.removeClass("btnDisabled");
$("mapFooter").getElement("p").set("text",CHECKPOSSIBLE)
}else{if(searchForm.getParent().hasClass("availabilityForm")){searchForm.getParent().removeClass("show");
searchForm.removeClass("jsShowBtn")
}map.toggleSearch.availibiltyButton.addClass("btnDisabled");
$("mapFooter").getElement("p").set("text",CHECKNOTPOSSIBLE);
$("checkAvailability").getElement("strong").addClass("open")
}map.veMap.reduceToThisLayerIndex(1);
hrsMapsEval(jsResult.result)
});
map.filter.enableFilter()
}},getHotelsJS:function(){map.filter.disableFilter();
var offset=map.getOffSetValues(map.iconSize);
if(!map.mapCoordinate){return
}DynamicMap.getHotelListJS(map.mapCoordinate.topLeftLat,map.mapCoordinate.topLeftLon,map.mapCoordinate.bottomRightLat,map.mapCoordinate.bottomRightLon,offset[0],offset[1],map.veMap.GetZoomLevel(),function(jsResult){var searchForm=$("searchForm");
map.veMap.reduceToThisLayerIndex(1);
hrsMapsEval(jsResult.result);
if(jsResult.fullcount<map.options.availabilityCheckCount&&jsResult.unavailablecount>0){map.toggleSearch.availibiltyButton.removeClass("btnDisabled");
$("mapFooter").getElement("p").set("text",CHECKPOSSIBLE)
}else{searchForm.getParent().removeClass("show");
searchForm.getParent().removeClass("availabilityForm");
searchForm.removeClass("jsShowBtn");
map.toggleSearch.availibiltyButton.addClass("btnDisabled");
$("mapFooter").getElement("p").set("text",CHECKNOTPOSSIBLE);
$("checkAvailability").getElement("strong").addClass("open");
if($("jsToggleSearch")){$("jsToggleSearch").removeClass("open")
}}if(map.zoomChange){map.filter.enableFilter();
map.zoomChange=false
}});
map.filter.enableFilter()
},getOffSetValues:function(offset){if(map.veMap){offset=offset||50;
var center=map.veMap.GetCenter();
var pixel=map.veMap.LatLongToPixel(center);
pixel.x+=offset;
pixel.y+=offset;
var new_val=map.veMap.PixelToLatLong(pixel);
return[Math.abs(center.Latitude-new_val.y),Math.abs(center.Longitude-new_val.x)]
}},clearHotelList:function(){map.isFreefly=true;
map.checkForHotels();
map.mwsLayer.enableCheckBoxes(false);
map.mwsLayer.resetIsOnMap();
map.mwsLayer.reinitMWSLayer()
},showSelected:function(inputs){console.log("showSelected inputs, this.state: ",inputs,this.state);
if(this.state=="list"){$("openMap").addClass("act");
$("tablehead").addClass("hasMap")
}var hotelKeys=[];
var numbersInList=[];
var isZoomIn;
Array.from(inputs).each(function(item){hotelKeys.push(item.hotelKey!=null?item.hotelKey:item.getProperty("value"));
var tmp=item.indexInList!=null?item.indexInList:item.getPrevious().get("text").replace(".","");
numbersInList.push(tmp);
isZoomIn=item.zoomIn!=null?item.zoomIn:false
});
scrollTo(0,100);
map.open();
this.trackState("map");
function tryToGetVEShapeLayer(){if(map.veMap){map.veMap.DeleteAllShapes();
map.selectedPushPinLayer=map.veMap;
if(isZoomIn!=null){isZoomIn=false
}else{isZoomIn=true
}if(isZoomIn){zoomLevel=map.veMap.GetZoomLevel();
if(zoomLevel<=15){map.veMap.SetZoomLevel(zoomLevel+2);
isZoomIn=false
}}if(hotelKeys&&numbersInList&&hotelKeys.length>0&&numbersInList.length>0){DynamicMap.createGoogleDetailPushpins(hotelKeys,numbersInList,function(jsResult){map.veMap.AddShapeLayer(1);
hrsMapsEval(jsResult+";"+jsResult)
});
map.renderPushpins();
map.veMap.AddShapeLayer(1);
map.veMap.hrsMap.hideInfoBox()
}}else{setTimeout(tryToGetVEShapeLayer,100)
}}tryToGetVEShapeLayer()
},tryToGetVEShapeLayer:function(){}});
var map=false;
var ToggleSearch=new Class({initialize:function(isVeMapSearch){this.searchForm=$("searchForm");
if(!isVeMapSearch){var isFocus="0",searchFormParent=this.searchForm.getParent(),toggleSearch=$("jsToggleSearch")
}map.toggleSearch=this
},initAvailibiltyButton:function(){this.availibiltyButton=$("checkAvailability");
this.availibiltyButton.addEvent("click",function(){if(!this.availibiltyButton.hasClass("btnDisabled")){$("searchSource").value=9;
this.searchForm.submit()
}}.bind(this))
}});
window.removeOverlay=function(){var numberOfHotels=$("summary").getElement("em");
var em=$("summary").getElement("em").removeClass("hide");
if(window.counterReady&&$("iframeOverlay")){$("iframeOverlay").dispose();
$("overlay").dispose();
$("loader").dispose();
$("tablehead").removeClass("notVisible");
window.location.replace(window.location.href+"#initialLoaded");
window.removeOverlay=function(){};
if($("confiList")){$("confiList").setStyle("display","block")
}var t=new Toggler(".jsToggle",".jsToggler");
if(window.LoadTimerObject){LoadTimerObject.fireEvent("end")
}}else{window.hotellistReady=true
}};
window.setIframeHeight=function(height){$("loh_frame").setStyle("height",height);
if(window.floatingFooter){window.floatingFooter.scrollY=$(window).getScrollSize().y
}};
window.initFloatingFooter=function(){window.floatingFooter=new FloatingFooter({win:$(window),iFrame:$("loh_frame"),footer:$("tablefoot")});
return window.floatingFooter
};
window.initTableFooter=function(){if($("tablefoot")){var buttons=$("tablefoot").getElements("input");
buttons.each(function(button){button.addEvent("click",function(event){if(this.name!="mapDisplaySubmit"){event.stop();
var form=hotellist.document.getElementById("hotelBookingForm");
if(form){var targetHiddenField=hotellist.document.getElementById("targetButton");
targetHiddenField.name=this.name;
targetHiddenField.value=this.value;
form.submit()
}else{setTimeout(function(){initTableFooter()
},100)
}}})
}.bind(this))
}};
var LoadTimer=new Class({Implements:[Events,Options],options:{start:function(){},end:function(){},showCounter:function(){}},initialize:function(time,url,options){this.setOptions(options);
this.addEvent("start",this.options.start);
this.addEvent("end",this.options.end);
this.addEvent("showCounter",this.options.showCounter);
var em=$("summary").getElement("em");
if(em){em.addClass("hide")
}if(!window.location.hash.contains("initialLoaded")&&$("counter")){var spans=$("counter").getElements("span");
this.fireEvent("start");
this.periodical=this.step.periodical(time/500,this,[new Date().getTime(),time,spans])
}else{if($("iframeOverlay")){$("iframeOverlay").dispose();
$("overlay").dispose();
$("loader").dispose();
$("tablehead").removeClass("notVisible");
if($("confiList")){$("confiList").setStyle("display","block")
}var t=new Toggler(".jsToggle",".jsToggler");
this.fireEvent("end")
}else{if($("confiList")){$("confiList").setStyle("display","block")
}var t=new Toggler(".jsToggle",".jsToggler")
}}},step:function(startTime,endTime,spans){var cnt=Math.floor((new Date().getTime()-startTime)*100/endTime);
if(cnt>100){clearInterval(this.periodical);
window.counterReady=true;
if(window.hotellistReady){window.removeOverlay()
}}}});
var Maplayer=new Class({Extends:ContextSensitiveHelp,options:{directions:["bottom","top"],firstDirection:"bottom",moveToFit:true},initialize:function(elements,options){this.parent(elements,options);
this.toolTip.addClass("angularly");
this.close=this.toolTip.getElement(".close");
var mapContainer=new Element("div",{id:"mapBox"}).inject(this.mapWrap,"inside"),map=new Element("div",{id:"veMap",styles:{width:198,height:198}}).inject(mapContainer,"inside");
new Element("span",{id:"minus"}).addEvent("click",this.zoom.bind(this,-1)).inject(mapContainer,"before");
new Element("span",{id:"plus"}).addEvent("click",this.zoom.bind(this,1)).inject(mapContainer,"before");
this.wrapper.dispose().inject(mapContainer,"inside");
if(Browser.ie6){this.close.addEvent("mouseenter",function(){this.setStyle("text-decoration","underline")
});
this.close.addEvent("mouseout",function(){this.setStyle("text-decoration","none")
})
}this.close.addEvent("click",function(){s_trackLink(this.close.id,true)
}.bind(this))
},start:function(el){var cnt=el.getParent().id.replace(/i_/,"");
s_trackLink("map_"+cnt,true);
this.close.id="map_close_"+cnt;
this.parent(el);
var coord=window.coords[el.id.replace(/map_/,"")];
this.veMap?this.addShape(coord):this.createMap(coord);
this.zoomLevel=12
},addShape:function(coord){this.veMap.setCoord(coord)
},zoom:function(direction){this.zoomLevel+=direction;
this.veMap.zoom(this.zoomLevel.limit(1,19))
},createMap:function(coord){var iframe=new Element("iframe",{src:this.options.veMapSrc+"#["+coord[0]+","+coord[1]+"]",id:"galleryMapIframe",scrolling:"no",frameborder:0,framespacing:0}).inject($("veMap"));
this.veMap=iframe.contentWindow
}});
var SliderEx=new Class({Extends:Slider});
Fx.Value=new Class({Extends:Fx,compute:function(from,to,delta){this.value=Fx.compute(from,to,delta);
this.fireEvent("motion",this.value);
return this.value
},get:function(){return this.value||0
}});
var IEMousover=new Class({initialize:function(els){els.each(function(item){item.addEvent("mouseenter",function(){item.addClass("me")
});
item.addEvent("mouseleave",function(){item.removeClass("me")
})
})
}});
var ListBuilder=new Class({initialize:function(data,typ,container,options){if(data.length&&!container.getChildren().length){container.innerHTML=this.build(data,container.id,typ).join("");
var select=new PseudoSelect(container.getFirst(),Object.append(options,{oneEntry:true}));
if(options.isActive){select.input.getParent().addClass("active")
}selectObserver.addSelect(select)
}else{container.getPrevious().addClass("inactive")
}},build:function(data,id,typ){var html=["<"+typ+">"],last=data.length-1;
data.each(function(item,cnt){html.push(this["build"+typ.capitalize()](item,cnt===last?' class="last"':""))
},this);
html.push("</"+typ+">");
return html
},buildUl:function(item,last){return"<li"+last+'><input type="checkbox" id="'+(item.actionID||"")+'" '+(item.matched?'checked="checked"':"")+'/><a href="'+item.link+'" target="hotellist">'+item.label+"</a></li>"
},buildDl:function(item,last){var isRegionDescription=!item.distanceType&&!item.desc,id=item.actionID||"",html="<dt"+(isRegionDescription?' id="regionDescription"':last)+"><label for="+id+'><input type="checkbox" id="'+id+'" '+(item.matched?'checked="checked"':"")+"/>";
if(item.link){html+=('<a href="'+item.link+'" class="'+(item.distanceType||"")+'" target="hotellist">'+item.label+"</a>")
}else{html+='<span class="'+item.distanceType+'">'+item.label+"</span>"
}html+=("</label></dt>");
if(item.list||item.desc){html+='<dd class="'+(item.list?"list":"")+'">';
if(item.type){if(item.type=="exclusiveprice"){item.type="exclusivePrice"
}if(item.type=="exclusivepriceen"){item.type="exclusivePriceEn"
}html+=('<span class="icon '+item.type+'"></span>')
}else{if(item.iconText){html+=('<span class="discount">'+item.iconText+'</span><div class="clearFix"></div>')
}}if(item.list){html+=("<ul>");
last=item.list.length-1;
item.list.each(function(li,cnt){html+=(this.buildUl(li,cnt===last?' class="last"':""))
},this);
html+=("</ul>")
}if(item.desc){html+=(item.desc)
}html+="</dd>"
}return html
}});
var SelectObserver=new Class({Implements:Events,pseudoSelects:{},initialize:function(selects){if(selects){selects.each(function(select){this.addSelect(select)
},this)
}this.changeFromIframe=true;
window.selectObserver=this
},addSelect:function(pseudoSelect){if(pseudoSelect&&pseudoSelect.list){var buttons=$$("#isSortedByPrice, #isSortedByName");
buttons.each(function(button){if(button.hasClass("active")){this.activeButton=button
}});
var list=pseudoSelect.list.getParent().getParent();
if(list.hasClass("active")){this.activeButton=pseudoSelect.input.getParent();
this.activeElement=list.getElements(".initial")
}this.pseudoSelects[pseudoSelect.container.id]=pseudoSelect;
pseudoSelect.addEvent("onSelected",this.changeActivePseudoSelects.bind(this,pseudoSelect))
}},changeActivePseudoSelects:function(pseudoSelect){this.changeFromIframe=false;
this.deactivatePseudoSelectOrButton(pseudoSelect);
this.activatePseudoSelect(pseudoSelect);
this.fireEvent("onSelectedElement")
},changePseudoSelectsItemFromIframe:function(pseudoSelectName,selectedElementId){if(this.changeFromIframe){var pseudoSelect=this.pseudoSelects[pseudoSelectName],selectedListElement=selectedElementId?this.getPseudoSelectsItem(selectedElementId):null;
if(pseudoSelect&&selectedListElement){pseudoSelect.setSelected(null,selectedListElement)
}else{this.deactivatePseudoSelectOrButton(pseudoSelect);
this.activateButton(pseudoSelectName)
}}this.changeFromIframe=true
},getPseudoSelectsItem:function(selectedElementId){var parent=$(selectedElementId).getParent();
return parent.get("tag")=="li"?parent:parent.getParent()
},activatePseudoSelect:function(pseudoSelect){this.activeButton=pseudoSelect.input.getParent().addClass("active");
if(pseudoSelect.selectedListElement){this.activeElement=pseudoSelect.selectedListElement.addClass("initial")
}if(pseudoSelect.options.selectOnDesscription&&this.activeElement.getParent().getParent().getPrevious()){this.activeElement=$$([this.activeElement,this.activeElement.getParent().getParent().getPrevious().addClass("initial")])
}this.pseudoSelect=pseudoSelect
},activateButton:function(name){var newActivButton=$(name);
if(newActivButton){this.activeButton=newActivButton.addClass("active");
this.activeElement=null;
this.pseudoSelect=null
}},deactivatePseudoSelectOrButton:function(pseudoSelect){if(this.activeElement){this.activeElement.removeClass("initial")
}if(this.activeButton){this.activeButton.removeClass("active")
}if(this.pseudoSelect&&this.pseudoSelect!=pseudoSelect){this.pseudoSelect.selectedListElement=null;
this.pseudoSelect=null
}}});
var SemLightBox=new Class({Extends:LightBox,initialize:function(options){this.parent(options);
this.form=$("searchForm");
this.formParent=this.form.getParent();
this.toHide=$$(".hideforSEM");
console.log(this.toHide)
},getContent:function(url){this.parent(url);
this.formTarget=this.content.getElement(".searchFormWrapper");
this.form.inject(this.content.getElement(".searchFormWrapper"),"inside");
this.toHide.addClass("hide")
},closeLightBox:function(event){this.form.inject(this.formParent,"inside");
this.parent(event);
this.toHide.removeClass("hide")
}});
function csh(element){window.contextHelp=window.contextHelp||new ContextSensitiveHelp([],{openEvent:"mouseenter",closeButton:false,container:($("hotellistWrap")?($("hotellistWrap").hasClass("notepad")?null:$("hotellistWrap")):null),maxWidth:300,minWidth:0,firstDirection:"right",directions:["right","bottom","top","left","right"],maxHeight:150,widthOffset:25});
element=$(element);
var tooltipText=element.retrieve("tooltipText");
if(!tooltipText){var dl=element.getNext();
if(!dl||dl.get("tag")!="dl"){dl=element.getParent().getNext()
}element.store("tooltipText",'<dl class="checkList">'+dl.innerHTML+"</dl>");
element.onmouseover=null;
window.contextHelp.build(element);
window.contextHelp.start(element);
window.contextHelp.position(element)
}}function tt(el,title){var event=window.event||arguments.callee.caller.arguments[0];
if(window.TT){el=$(el);
el.title=title||(el.getElement("span.tt")||el).get("text");
if(!el.getParent("#tablehead")){el.onmouseover=null
}else{if(el.retrieve("tip:title")&&el.retrieve("tip:title")!=el.title){el.store("tip:title",el.title);
el.title=""
}}if(!el.retrieve("tip:title")){window.TT.attach([el]);
window.TT.elementEnter({page:{x:event.clientX,y:event.clientY}},el)
}}}var FloatingFooter=new Class({Implements:[Events,Options],options:{win:window,footer:"",useRelativeParent:true},initialize:function(options){this.setOptions(options);
this.isTouch=Browser.Features.iOSTouch||Browser.Features.Touch;
this.debugPositionFixed=(Browser.ie6||this.isTouch);
if(this.debugPositionFixed){this.prepareIEFooter()
}this.options.win.addEvents({scroll:this.updatePos.bind(this),resize:this.resizeDelayed.bind(this),mapChange:this.manageMapChange.bind(this)});
this.iFrame=this.options.win.document.getElement("#loh_frame");
if(this.iFrame){this.iFrame.addEvent("resize",this.resize.bind(this))
}this.footerHeight=this.options.footer.getSize().y;
this.updateTimeout=false;
this.resizeTimeout=false;
this.isFooterPosFixed=true;
this.fPosY=0;
this.threshold=0;
this.relParentTop=(this.options.useRelativeParent)?this.options.footer.getParent().getCoordinates().top:0;
this.offsetY=(Browser.ie8)?15:0;
this.scrollY=this.options.win.getScrollSize().y;
if(this.isTouch){window.addEvent("load",function(){setTimeout(function(){this.update()
}.bind(this),1)
}.bind(this))
}},resizeDelayed:function(){if(this.resizeTimeout){clearTimeout(this.resizeTimeout)
}this.resizeTimeout=setTimeout(function(){this.resize()
}.bind(this),(Browser.ie6||Browser.ie7||Browser.ie8)?100:1)
},resize:function(){if(this.iFrame){this.setIFrame()
}this.setViewPort();
this.update(true)
},updatePos:function(){if(this.updateTimeout){clearTimeout(this.updateTimeout)
}this.updateTimeout=setTimeout(function(){this.update()
}.bind(this),(Browser.ie6||Browser.ie7||Browser.ie8)?100:1)
},update:function(afterResize){var winY=this.options.win.getScroll().y;
this.setThreshold();
if(winY>=this.threshold){if(this.isFooterPosFixed){this.options.footer.setStyle("position","static");
this.isFooterPosFixed=false;
this.scrollY=this.options.win.getScrollSize().y;
this.resize()
}}else{var ff=this;
fixIframePosition=function(){var cssText="position:fixed;";
if(Browser.ie7){cssText+="left:"+ff.iFrame.getPosition().x+"px"
}ff.options.footer.style.cssText=cssText
};
if(!this.isFooterPosFixed){if(this.debugPositionFixed){this.options.footer.setStyle("position","absolute")
}else{fixIframePosition()
}this.isFooterPosFixed=true;
this.scrollY=this.options.win.getScrollSize().y;
this.resize()
}if(Browser.ie7&&afterResize&&this.isFooterPosFixed){fixIframePosition()
}if(Browser.ie6||Browser.ie7||Browser.ie8){var temp=new Element("span");
temp.inject(this.options.footer);
temp.destroy()
}if(this.isFooterPosFixed&&this.debugPositionFixed){this.fPosY=winY+this.viewPortHeight-this.relParentTop-this.footerHeight+(this.isTouch?11:0);
this.positionIEFooter()
}}},prepareIEFooter:function(){this.options.footer.addClass("ieFoot");
this.options.footer.setStyle("position","absolute")
},positionIEFooter:function(){this.options.footer.setStyle("top",this.fPosY)
},setViewPort:function(){this.viewPortHeight=this.options.win.getSize().y
},setIFrame:function(){var coords=this.iFrame.getCoordinates();
this.iBottom=coords.bottom;
this.iTop=coords.top
},setThreshold:function(){if(this.iFrame&&!Browser.ie6){this.threshold=this.iBottom+this.footerHeight-this.viewPortHeight
}else{this.threshold=this.scrollY-this.footerHeight-this.viewPortHeight
}},manageMapChange:function(e){this.scrollY=this.options.win.getScrollSize().y;
if(e=="list"){}if(e=="map"){}this.resize()
},show:function(){this.options.footer.removeClass("hide")
},hide:function(){this.options.footer.addClass("hide")
}});
function printForm(form){var hotellistForm=form||hotellist.document.getElementById("hotelBookingForm");
if(!hotellistForm){return false
}var printWindow=window.open("","print","width=785, height=648, left=50, top=0, scrollbars=yes, resizable=yes");
printWindow.focus();
hotellistForm.target="print";
if(form){var targetHiddenField=document.getElementById("targetButton");
if(targetHiddenField){targetHiddenField.name=this.name;
targetHiddenField.value=this.value
}form.submit()
}}function setHotelistFormTarget(form){var hotellistForm=form||hotellist.document.getElementById("hotelBookingForm");
if(!hotellistForm){return false
}hotellistForm.target="_parent";
if(form){map=parent.map
}}function initShowInMapButton(){var showInMapButton=$("mapDisplaySubmit");
if(showInMapButton&&(parent.mapBrowser||window.mapBrowser)){showInMapButton.addEvent("click",function(event){event.stop();
checked=window.checked||hotellist.checked;
parent.map.showSelected(checked)
});
var showHotelsOnMap=true;
if(!showHotelsOnMap&&!parent.showHotelsOnMap){showInMapButton.addClass("hide")
}}};
