$OW_regNamespace("OW8.Components");OW8.Components.GuestGrade=function(j){var a=false,n,m="components/guest-grade-popup/guest-grade-popup.htm";function g(w,q,u,s){OW8.Global.Components.PopUpManager.removeAllPopUps();var r=w.getCoordinates(),t={x:r.left+parseInt(u)+r.width,y:r.top+parseInt(s)-(r.height/2)},v=c(q),p=f(v,t,"bottom");if(v.getCoordinates().top<0){v=c(q);p=f(v,t,"all")}p.show()}function f(p,r,q){return OW8.Global.Components.PopUpManager.addPopUp({closeButton:true,modal:false,position:r,center:q,dimensions:{width:400},content:p,showProgress:true})}function b(){var p=null;if(!n){OW8.Logger.warn("invalid template. class for grade explanation is missing");return false}p=n.getElement(".grades");p.getElement(".gradesHeader").set("text",j.Texts.header);p.getElement(".gradeInfo.header").set("text",j.Texts.gradeH);p.getElement(".gradeInfo.text").set("text",j.Texts.gradeT);p.getElement(".expect .gradeText").set("text",j.Texts.expectT);p.getElement(".atmo .gradeText").set("text",j.Texts.atmoT);p.getElement(".clean .gradeText").set("text",j.Texts.cleanT);p.getElement(".room .gradeText").set("text",j.Texts.roomT);p.getElement(".staff .gradeText").set("text",j.Texts.staffT);e(p.getElement(".gp-1"),"01");e(p.getElement(".gp-2"),"02");e(p.getElement(".gp-3"),"03");e(p.getElement(".gp-4"),"04");e(p.getElement(".gp-5"),"05");a=true}function e(p,q){if(!$defined(p)){OW8.Logger.warn("invalid template. class for grade explanation is missing");return}var r=p.getElement("img");if(!$defined(r)){OW8.Logger.warn("Invalid template. image is missing in container for grade explanation.");return}var s=j.Images["grade"+q];r.set("src",OW.Urls.ensureImageUrl(s));r.set("alt",j.Texts["grade"+q]);r.set("title",j.Texts["grade"+q]);p.getElement(".header").set("text",j.Texts["grade"+q]);p.getElement(".text").set("text",j.Texts["grade"+q+"txt"])}function c(r){if(!$defined(n)){OW8.Logger.warn("No valid template found at: "+m);return null}if(!a){b()}var w=n.clone(),q=r,p=w.getElement(".grades");if(!$defined(q)||!$defined(p)){OW8.Logger.warn("Invalid template, .grades is missing.");return null}var t=p.getElement(".hotel");if($defined(t)){t.set("html",q.hotel)}else{OW8.Logger.warn('template is invalid. Missing "hotel" class')}h(p.getElement(".expect"),q.expectations);h(p.getElement(".atmo"),q.atmosphere);h(p.getElement(".clean"),q.cleaning);h(p.getElement(".room"),q.room);h(p.getElement(".staff"),q.staff);var v="",y="";if(q.ratedSeason.length>1){var u=q.ratedSeason.charAt(0);y=q.ratedSeason.substring(1);if(u=="S"){v=j.Texts.seasonS}else{v=j.Texts.seasonW}}else{OW8.Logger.warn('Wrong format for "ratedSeason"')}var s={raters:q.numberOfRaters,year:y};v=v.substitute(s);p.getElement(".seasonText").set("text",v);return w}function h(p,q){if(!$defined(p)){OW8.Logger.warn("container element is undefined for grade:"+q);return}p.getElement(".gradeValue").set("text",q);k(p.getElement(".gradeFill"),q)}function k(r,s){if(!$defined(r)){OW8.Logger.warn("Undefined element for grade:"+s);return}var p=s.replace(",","");if(p.length==2){var q=p.charAt(1).toInt();if(q<3){q=0}else{if(q<5){q=3}else{if(q<7){q=5}else{if(q<=9){q=7}}}}p=p.charAt(0)+q}r.set("class","rating rating-"+p)}function i(r,p,t,s){if(!n){var q=new Request.HTML({url:OW.Urls.getSharedUrl(m),onSuccess:function(w,v,u,y){n=new Element("div",{html:u});g(r,JSON.decode(p),t,s)}}).get();return false}return true}function d(q,p,s,r){if(i(q,p,s,r)){g(q,JSON.decode(p),s,r)}}function o(p){$(p).addEvent("click",function(r){r.stop();var q=$(r.target),s=q.getNext("input[type=hidden]");if(!s||!s.value){OW8.Logger.warn("No config for item specified");return}d(q,JSON.decode(s.value),0,0)})}return{openDetailsLinkClicked:d,init:o}};$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.ResortListFilterer=function(){function c(i){i.getElements("div.extra").each(function(j){j.setStyle("display","none")})}function e(i){i.getElements("div.extra").each(function(j){j.setStyle("display","block")})}function b(j){var i=j.parentNode.parentNode;var k=i.getElement("div.extra");if(k.getStyle("display")=="none"){e(i);var m=$("main").getElement("input[type=hidden].hideResortText").get("value");j.getElement("a").set("text",m)}else{c(i);var m=$("main").getElement("input[type=hidden].showResortText").get("value");j.getElement("a").set("text",m)}}function a(i){var j=i.getElement("div.extra");if(j!=null){return true}else{return false}}function h(i){i.addEvent("click",function(j){b(i);j.stop()})}function g(i){var j=i.getElement("div.btn");if(a(i)){c(i);h(j)}else{j.hide()}}function d(){var i=$$("div.resort-group");i.each(function(j){g(j)})}function f(){d()}return{initialize:f}}();$OW_regNamespace("OW8.Components");$OW_regNamespace("OW8.Components.HotelResultList");OW8.Components.HotelResultList.HotelList=new Class({initialize:function(b){var a=this;this.el=b;this.hotels=[]},getAllHotels:function(){var a=this;if(!this.hotels.length){this.el.getChildren("div").each(function(b,c){a.hotels.push(new OW8.Components.HotelResultList.Hotel(b,c))})}return this.hotels},sortByName:function(){var a=this;this.getAllHotels().sort(function(c,d){if(c.getName()<d.getName()){return -1}if(c.getName()>d.getName()){return 1}return 0});this.hotels.each(function(b){a.el.grab(b.el)})},sortByRating:function(c){var b=this;var a=c?"bottom":"top";this.getAllHotels().sort(function(d,e){return d.getRating()-e.getRating()});this.hotels.each(function(d){b.el.grab(d.el,a)})},sortByGuestRating:function(){var a=this;this.getAllHotels().sort(function(c,d){return c.getGuestRating()-d.getGuestRating()});this.hotels.each(function(b){a.el.grab(b.el,"top")})},sortByPrice:function(c){var b=this;var a=c?"bottom":"top";this.getAllHotels().sort(function(d,e){aPrice=d.getPrice();bPrice=e.getPrice();if(isNaN(aPrice)){aPrice=c?999999:0}if(isNaN(bPrice)){bPrice=c?999999:0}return aPrice-bPrice});this.hotels.each(function(d){b.el.grab(d.el,a)})},sortByPrilo:function(c){var b=this;var a=c?"bottom":"top";this.getAllHotels().sort(function(d,e){return d.getPrilo()-e.getPrilo()});this.hotels.each(function(d){b.el.grab(d.el,a)})}});OW8.Components.HotelResultList.Hotel=new Class({initialize:function(b,c){var a=this;this.el=b;a.prilo=c},getName:function(){if(!this._name){this._name=this.el.getElement("h3").get("text");if(this._name===""){this._name=this.el.getElement("h3 input").get("value")}}return this._name},getRating:function(){if(!this._rating){this._rating=parseFloat(this.el.getElement(".rating strong").get("text").replace(",","."))}return this._rating},getGuestRating:function(){if(!this._guestRating){this._guestRating=parseFloat(this.el.getElement(".guest-rating strong").get("text").replace(",","."))}if(isNaN(this._guestRating)){return 0}return this._guestRating},getPrice:function(){if(!this._price){this._price=parseInt(this.el.getElement(".hotel-price a").get("text").replace(/[^0-9]/g,""))}return this._price},getPrilo:function(){var a=this.el.getElement("input.yieldOrder");if(!this._prilo&&a){this._prilo=parseInt(a.get("value"))}if(isNaN(this._prilo)){this._prilo=this.prilo}return this._prilo}});OW8.Components.HotelResultList.Sort=function(){var k;function m(n){k=new OW8.Components.HotelResultList.HotelList($(n))}function f(n,o){if(n!==null){n.onchange=null;n.addEvent("change",function(q){q.stop();q.cancel=true;if(o.length>0){var p=n.selectedIndex;o[0].innerHTML=n.options[p].text}g(n.value);return false})}}function g(n,o){switch(n){case"priceDesc":k.sortByPrice(false);break;case"priceAsc":k.sortByPrice(true);break;case"ratingDesc":k.sortByRating(false);break;case"ratingAsc":k.sortByRating(true);break;case"name":k.sortByName(true);break;case"prilo":k.sortByPrilo(true);break;case"guestratingDesc":k.sortByGuestRating(true);break;default:}OW8.Mod.Independent.StatisticsLogger.LogSort(n)}function j(o,n){o=$(o);n=$(n);dropdownHeaderElement=$$(".sortOrder");m(o);f(n,dropdownHeaderElement)}function h(){e.hide()}function c(){var n=e.getElement("a.x");if(!$defined(n)){return}n.addEvent("click",function(o){o.stop();h()})}function b(){var n=$("popups");if(n!==null){n.getElements("div.popup").each(function(o){o.dispose()});n.getElements("img").each(function(o){o.dispose()})}}function i(n,q,p,o,r){n=$(n);n.addEvents({click:function(s){d(s,q,p,o,r)}})}OW.Element.structuralClass="structural";function d(r,t,p,u,n){r.stop();b();var s,q;q=$(r.target).getCoordinates();s={x:q.left-200+q.width,y:q.top+200-(q.height/2)};e.removeClass(OW.Element.structuralClass);var o=OW8.Global.Components.PopUpManager.addPopUp({closeButton:true,modal:false,position:s,center:"left",dimensions:{width:640},content:e,showProgress:true});o.show();OW8.Mod.Geographical.Map.initialize(t,p,u,n)}var e;function a(q,n,r,p,o,s){i(n,r,p,o,s);e=$(q);c()}return{init:j,initShowMap:a}}();OW8.Components.HotelResultList.Events=(function(){var b=OW8.Components.Category.CreatePopup;var h,d,g;function c(j,n,m){var k=$(j.containers.containerId);if(!k){return}var i=new OW8.Components.HotelResultList.HotelList(k);var o=n?new OW8.Components.GuestGrade(n):null;h=$(j.containers.mapContainerId);i.el.addEvent("click",Event.delegate({"a.show-on-map":function(r){r.stop();var q=$(r.target),p=q.getNext("input.itemconfig");if(!p||!p.value){OW8.Logger.log("No config for item specified");return}e(r,j.containers.mapCanvas,JSON.decode(p.value),m)},"img.pointer":function(s){var q=$(s.target),p=q.get("class");if(p!=null){var r=p.split(" ")[0].split("_")[1];if(!isNaN(r)){MTNE.Web.OneWeb.Modules.GeographicalApp.Services.Geographical.CategoryService.GetCategoryById(r,function(t){b.create(t,s)},function(t){OW8.Logger.log(t)})}}},"strong.guest-rating-pointer":function(q){q.stop();if(!o){OW8.Logger.warn("Guest rating has not been correctly instantiated.");return}var p=$(q.target),r=p.getNext("input[type=hidden]");if(!r||!r.value){OW8.Logger.warn("No config for item specified");return}o.openDetailsLinkClicked(p,r.value,0,200)}}))}function f(i){d=i}function a(i){g=i}function e(n,o,p,k){var i,m;OW8.Global.Components.PopUpManager.removeAllPopUps();m=$(n.target).getCoordinates();i={x:m.left-450+m.width,y:m.top+150-(m.height/2)};h.removeClass(OW.Element.structuralClass);var j=OW8.Global.Components.PopUpManager.addPopUp({closeButton:true,modal:false,position:i,center:"left",dimensions:{width:640},content:h,showProgress:true});j.show();OW8.Mod.Geographical.Map.initialize(o,d,g,p,k)}return{init:c,setStartConfig:a,setMarkerColorConfig:f}})();$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.CurrencyConverterdropdowncheck=function(){function a(c,f,g,d){var h=$(c);var e=$(f);var g=$(g);if(h.selectedIndex==0&&e.selectedIndex==0){e.selectedIndex=1}else{if(e.selectedIndex>0){h.selectedIndex=0}}b(g,d,h,e);h.addEvent("change",function(){if(this.selectedIndex==0&&e.selectedIndex==0){e.selectedIndex=1}else{if(e.selectedIndex>0&&h.selectedIndex>0){e.selectedIndex=0}else{e.selectedIndex=0}}b(g,d,this,e)});e.addEvent("change",function(){if(this.selectedIndex==0&&h.selectedIndex==0){h.selectedIndex=1}else{if(h.selectedIndex>0&&e.selectedIndex>0){h.selectedIndex=0}else{h.selectedIndex=0}}b(g,d,h,this)});g.addEvent("change",function(){b(g,d,h,e)});g.addEvent("keyup",function(){b(g,d,h,e)})}function b(c,k,g,f){var m=g;var d=f;var h=$(c).value;var i=$(k);if(h>0){if(m.selectedIndex==0){kop=1;x=d.options[d.selectedIndex].value}else{kop=0;x=m.options[m.selectedIndex].value}var e=x;var j=e.indexOf(",");while(j!=-1){e=e.replace(",",".");j=e.indexOf(",")}l=e.split(":");multi=parseFloat(l[0]);buy=parseFloat(l[1]);sell=parseFloat(l[2]);if(kop==1){sum=h*multi/sell;kurs=buy}else{sum=(10*h*buy/multi)/10;kurs=sell}rsum=new String(sum);jx=rsum.split(".");if(jx.length>1){if(jx[1].length>2){jx[1]=jx[1].substr(0,2)}sum=jx.join(".")}else{sum=jx[0]}i.value=h+" "+m.options[m.selectedIndex].text+" = "+sum+" "+d.options[d.selectedIndex].text}else{if(h==""){alert(strDefaultError)}}}return{initialize:a}}();$OW_regNamespace("OW8.Mod.Geographical");OW8.Mod.Geographical.CompactImageFlippingList=function(){var j=OW.ObjectHelper,a=OW.Element,k="210",t="118";var m=null,n=null,q=null,f=null,w=0,r=0,o=false;function v(D,G){D=$(D);if(!D){return}var A=u(D);if(!j.isArray(A)||A.length==0){return}d(G,A.length);var K=G.maximizeText,C=G.minimizeText,H=G.imageWidth,I=G.imageHeight,E=A.length,y;w=G.minNoOfItems;r=G.maxNoOfItems;q=D;n=e();m=c(n,H,I);D.parentNode.insertBefore(n,D);if(w>0&&E>w){var z=s(K,C);D.parentNode.insertBefore(z,D.getNext())}D.addEvent("mouseover",function(M){var L=M.target;while(L&&L.tagName!=="LI"){if(L==D){return}L=L.parentNode}h(L,true)});D.addEvent("click",function(L){i()});for(y=0;y<E;y++){var B=A[y],z=B.getElement("a"),F=z?z.getElement("img"):null,J=F?F.src:null;if(J){h(B,false);break}}for(y=0;y<w;y++){a.show(A[y])}}function d(y,z){y=y||{};y.minNoOfItems=Math.min(y.minNoOfItems||z,z);y.maxNoOfItems=Math.min(y.maxNoOfItems||z,z);y.maximizeText=y.maximizeText||"";y.minimizeText=y.minimizeText||"";y.imageWidth=p(y.imageWidth,k);y.imageHeight=p(y.imageHeight,t);if(y.imageWidth>k){y.imageWidth=k;y.imageHeight=t}return y}function p(y,z){return j.isNumber(y)?y:z}function u(y){return(y||q).getElements("li")}function e(){var y=new Element("div",{id:"imageContainer","class":"imageContainer"});return y}function c(y,z,B){var A=new Element("img",{src:OW.Urls.getBlankImageUrl(),alt:""});A.width=z;A.height=B;A.style.cursor="pointer";A.addEvent("click",function(C){i()});y.appendChild(A);return A}function i(){if(f!==null){linkHref=f.href;if(linkHref){location.href=linkHref}}}function h(z,A){var B=z.getElement("a"),y=B?B.getElement("img"):null,C=y?y.src:null;if(m.src!==C){m.fade("hide");if(C){m.src=OW.Urls.ensureImageUrl(C);m.fade(A?"in":"show")}}f=B}function g(z,y){z.addEvent("click",function(A){location.href=y})}function s(A,y){var z=new Element("a",{href:"#","class":"dec show-more",html:A,events:{click:function(C){C.stop();this.blur();var B=u();b(B);if(o){this.set("html",y)}else{this.set("html",A)}}}});return z}function b(B){var y=!o,z=y?a.show:a.hide,A;for(A=w;A<r;A++){z(B[A])}o=y}return{init:v}}();$OW_regNamespace("OW8.Mod.Geographical");$OW_regNamespace("OW8.Mod.Geographical.HotelInfo.Map");OW8.Mod.Geographical.HotelInfo.Map=function(){var a;var e;var c;OW.Element.structuralClass="structural";function f(i,k,j){a=$(i.containers.mapContainerId);var h=$(i.containers.containerId);h.addEvent("click",function(m){m.stop();g(m,i.containers.mapCanvas,k,j)})}function g(m,n,o,j){var h,k;OW8.Global.Components.PopUpManager.removeAllPopUps();k=$(m.target).getCoordinates();h={x:k.left-500+k.width,y:k.top+100-(k.height/2)};a.removeClass(OW.Element.structuralClass);var i=OW8.Global.Components.PopUpManager.addPopUp({closeButton:true,modal:false,position:h,center:"left",dimensions:{width:640},content:a,showProgress:true});i.show();OW8.Mod.Geographical.Map.initialize(n,e,c,o,j)}function b(h){e=h}function d(h){c=h}return{init:f,setStartConfig:d,setMarkerColorConfig:b}}();