function translate(a){return typeof translatedStrings!="undefined"&&typeof translatedStrings[a]!="undefined"?translatedStrings[a]:a}
function toggleSearchFormInPower(a){a==!0?(dojo.byId("power-toggle-search-form-off").style.display="",dojo.byId("power-toggle-search-form-on").style.display="none",dojo.byId("power-search-form-inner-div").style.display="",dojo.byId("power-search-form-outer-div").className="width578 bg-02 p-tb-e font-small height-only-mainbox"):(dojo.byId("power-toggle-search-form-off").style.display="none",dojo.byId("power-toggle-search-form-on").style.display="",dojo.byId("power-search-form-inner-div").style.display=
"none",dojo.byId("power-search-form-outer-div").className="width578 bg-02 font-small pb-j pt-e")}function setDateForDatePicker(a,b){dojo.byId(a).value=(b.getDate()<10?"0":"")+b.getDate()+"."+(b.getMonth()+1)+"."+b.getFullYear()}function isTownOrAirport(a){return a=="T"||a=="A"}String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")};
function formatDateFromYmd(a,b){var b=b.toLowerCase(),c=a.match(/(([0-9]{4})-([0-9]{2})-([0-9]{2}))/i);return c==null||c.length!=5?null:b.replace(/y/,c[2]).replace(/m/,c[3]).replace(/d/,c[4])}function formatDateToYmd(a,b){var b=b.toLowerCase(),c=b.replace(/[a-z]+/,""),c=c.substr(0,1),a=a.split(c),b=b.split(c);if(a.length!=b.length)return null;for(var c=[],d=0;d<a.length;d++)c[b[d]]=a[d];return c.y+"-"+c.m+"-"+c.d}
function validatePassengers(){var a=parseInt(dojo.byId("adults_count").value),b=parseInt(dojo.byId("children_count").value),c=parseInt(dojo.byId("infants_count").value);if(a+b+c>4)return message=translate("LANG_TOO_MANY_PASSENGERS"),alert(message.replace("%d",4)),!1;return a<c?(alert(translate("LANG_NUMBER_OF_BABIES_EQUAL_OR_LESS")),!1):!0}if(typeof deconcept=="undefined")var deconcept={};if(typeof deconcept.util=="undefined")deconcept.util={};
if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil={};
deconcept.SWFObject=function(a,b,c,d,e,f,g,h,j,k){if(document.getElementById){this.DETECT_KEY=k?k:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];a&&this.setAttribute("swf",a);b&&this.setAttribute("id",b);c&&this.setAttribute("width",c);d&&this.setAttribute("height",d);e&&this.setAttribute("version",new deconcept.PlayerVersion(e.toString().split(".")));this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(!window.opera&&document.all&&this.installedVer.major>7)deconcept.SWFObject.doPrepUnload=!0;f&&this.addParam("bgcolor",f);this.addParam("quality",g?g:"high");this.setAttribute("useExpressInstall",!1);this.setAttribute("doExpressInstall",!1);this.setAttribute("xiRedirectUrl",h?h:window.location);this.setAttribute("redirectUrl","");j&&this.setAttribute("redirectUrl",j)}};
deconcept.SWFObject.prototype={useExpressInstall:function(a){this.xiSWFPath=!a?"expressinstall.swf":a;this.setAttribute("useExpressInstall",!0)},setAttribute:function(a,b){this.attributes[a]=b},getAttribute:function(a){return this.attributes[a]},addParam:function(a,b){this.params[a]=b},getParams:function(){return this.params},addVariable:function(a,b){this.variables[a]=b},getVariable:function(a){return this.variables[a]},getVariables:function(){return this.variables},getVariablePairs:function(){var a=
[],b,c=this.getVariables();for(b in c)a[a.length]=b+"="+c[b];return a},getSWFHTML:function(){var a="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){this.getAttribute("doExpressInstall")&&(this.addVariable("MMplayerType","PlugIn"),this.setAttribute("swf",this.xiSWFPath));a='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" ';a+=' id="'+this.getAttribute("id")+'" name="'+
this.getAttribute("id")+'" ';var b=this.getParams(),c;for(c in b)a+=[c]+'="'+b[c]+'" ';b=this.getVariablePairs().join("&");b.length>0&&(a+='flashvars="'+b+'"');a+="/>"}else{this.getAttribute("doExpressInstall")&&(this.addVariable("MMplayerType","ActiveX"),this.setAttribute("swf",this.xiSWFPath));a='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+
'">';a+='<param name="movie" value="'+this.getAttribute("swf")+'" />';b=this.getParams();for(c in b)a+='<param name="'+c+'" value="'+b[c]+'" />';b=this.getVariablePairs().join("&");b.length>0&&(a+='<param name="flashvars" value="'+b+'" />');a+="</object>"}return a},write:function(a){if(this.getAttribute("useExpressInstall")&&this.installedVer.versionIsValid(new deconcept.PlayerVersion([6,0,65]))&&!this.installedVer.versionIsValid(this.getAttribute("version")))this.setAttribute("doExpressInstall",
!0),this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl"))),document.title=document.title.slice(0,47)+" - Flash Player Installation",this.addVariable("MMdoctitle",document.title);if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version")))return(typeof a=="string"?document.getElementById(a):a).innerHTML=this.getSWFHTML(),!0;else this.getAttribute("redirectUrl")!=""&&document.location.replace(this.getAttribute("redirectUrl"));
return!1}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){var a=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var b=navigator.plugins["Shockwave Flash"];b&&b.description&&(a=new deconcept.PlayerVersion(b.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".")))}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0)for(var b=1,c=3;b;)try{c++,b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+c),a=new deconcept.PlayerVersion([c,0,
0])}catch(d){b=null}else{try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),a=new deconcept.PlayerVersion([6,0,21]),b.AllowScriptAccess="always"}catch(f){if(a.major==6)return a}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(g){}}b!=null&&(a=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(",")))}return a};
deconcept.PlayerVersion=function(a){this.major=a[0]!=null?parseInt(a[0]):0;this.minor=a[1]!=null?parseInt(a[1]):0;this.rev=a[2]!=null?parseInt(a[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(a){return this.major<a.major?!1:this.major>a.major?!0:this.minor<a.minor?!1:this.minor>a.minor?!0:this.rev<a.rev?!1:!0};
deconcept.util={getRequestParameter:function(a){var b=document.location.search||document.location.hash;if(a==null)return b;if(b)for(var b=b.substring(1).split("&"),c=0;c<b.length;c++)if(b[c].substring(0,b[c].indexOf("="))==a)return b[c].substring(b[c].indexOf("=")+1);return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){for(var a=document.getElementsByTagName("OBJECT"),b=a.length-1;b>=0;b--){a[b].style.display="none";for(var c in a[b])typeof a[b][c]=="function"&&(a[b][c]=function(){})}};
if(deconcept.SWFObject.doPrepUnload&&!deconcept.unloadSet)deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)},window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload),deconcept.unloadSet=!0;if(!document.getElementById&&document.all)document.getElementById=function(a){return document.all[a]};
var getQueryParamValue=deconcept.util.getRequestParameter,FlashObject=deconcept.SWFObject,SWFObject=deconcept.SWFObject;function FlightNotFoundMessage(a,b,c,d){this.depName=a;this.dstName=b;this.linkWithoutDepDstFilters=c;this.linkWithoutAllFilters=d}
FlightNotFoundMessage.prototype.getMessage=function(a){return a?this._isAvailableAtLeastOneItem(a.fdep)||this._isAvailableAtLeastOneItem(a.fdst)?translate("LANG_RESULT_NO_RESULTS_FOUND_DEP_DST_AVAILABLE").replace("#dep#",this.depName).replace("#dst#",this.dstName).replace("#link#",this.linkWithoutDepDstFilters):this._isAvailableAtLeastOneItem(a.daytime)||this._isAvailableAtLeastOneItem(a.returnDaytime)||this._isAvailableAtLeastOneItem(a.airline)||a.airline.length>0?translate("LANG_RESULT_NO_RESULTS_FOUND_OPTIONS_AVAILABLE").replace("#dep#",
this.depName).replace("#dst#",this.dstName).replace("#link#",this.linkWithoutAllFilters):translate("LANG_RESULT_NO_RESULTS_FOUND_DEFAULT").replace("#dep#",this.depName).replace("#dst#",this.dstName):translate("LANG_RESULT_NO_RESULTS_FOUND_DEFAULT").replace("#dep#",this.depName).replace("#dst#",this.dstName)};FlightNotFoundMessage.prototype._isAvailableAtLeastOneItem=function(a){if(!a)return!1;for(var b=0,c=a.length;b<c;++b)if(a[b].price!=void 0&&a[b].price!="")return!0;return!1};var periodicalUpdater;
function Controller(a){this.updateUrl=a.baseUrl+"/resultupdate";this.resultUrl=a.baseUrl+"/result";this.getHandleUrl=a.baseUrl+"/gethandle";this.getDeeplinkForPopupUrl=a.baseUrl+"/getdeeplinkforpopup";this.requestId=a.requestId;this.commonImageUrl=a.commonImageUrl;this.hideMiddleAdsWhenCrossSaleExists=a.hideMiddleAdsWhenCrossSaleExists;this.resultRenderer=new ResultRenderer({resultPanelId:a.resultPanelId,deeplinkUrl:a.baseUrl+"/deeplink",commonImageUrl:a.commonImageUrl,testMode:a.testMode,country:a.country,
overlay:a.overlay,isWhitelabel:a.isWhitelabel});this.crossSalesRenderer=new CrossSaleRenderer("crossSalesPlaceHolder","swAdsMiddle",this.hideMiddleAdsWhenCrossSaleExists);this.crossSaleUrl=a.crosssaleUrl;this.testMode=a.testMode;this.tripsResult=null;this.statusPanel=a.statusPanel;this.filterRenderer=new FilterRenderer("filter_panel","horizontal_menu_daytime_filter_panel",a.baseUrl,a.testMode);this.pager=new Pager("result_pager",a.numberOfResultsToShow,a.testMode);this.searchFormBox="searchformbox";
this.handle="";this.offset=a.offset;this.urlWithParams=a.urlWithParams;this.currentOffset=0;this.numberOfResultsToShow=a.numberOfResultsToShow;this.searchForm=a.searchForm;this.resultGraphs=a.resultGraphs;this.isFilterRequest=a.isFilterRequest;this.flightNotFoundMessage=a.flightNotFoundMessage;this.extUserParams=a.extUserParams;this.flightSearchOrigin=a.flightSearchOrigin}
Controller.prototype.draw=function(a){a.flights.length>0||a.flightResultCount!=0?(this.resultRenderer.drawResults(a.flights,this.handle,a.userNamePopupEnabled),this.filterRenderer.draw(a.filters,this.commonImageUrl)):(a.filters.fdst||a.filters.fdep)&&this.filterRenderer.draw(a.filters,this.commonImageUrl)};Controller.prototype.resetContainers=function(){this.resultRenderer.clear();this.pager.clear();this.filterRenderer.clear();this.tripsResult=null};
Controller.prototype.clearResultPage=function(){dojo.byId("mainResultBox").innerHTML=""};Controller.prototype.clearMiddleAds=function(){dojo.byId("swAdsMiddlePlaceHolder").style.display="none";dojo.addClass("swAdsMiddlePlaceHolder","hiddenByXsales")};
Controller.prototype.drawCrossSale=function(a){var b=this;dojo.xhrGet({url:this.crossSaleUrl+"/handle/"+a,handleAs:"text",load:function(a){a.length!=0&&(b.hideMiddleAdsWhenCrossSaleExists&&controller.clearMiddleAds(),controller.crossSalesRenderer.drawCsAd(a),controller.crossSalesRenderer.drawCsAdEcondaTags(),swoodoo.scripts.eval("crosssale-offer"))},error:function(){}})};Controller.prototype.onUpdaterException=function(){this.statusPanel.stop();this.changeButtons(!1)};
Controller.prototype.onUpdaterSuccess=function(a){this.draw(a);if(a.searchStatus==1)this.stopSearch(!0),a.flightResultCount==0?this.resultRenderer.drawNoResults(this.flightNotFoundMessage.getMessage(a.filters)):this.drawPager(),this.onUpdaterComplete();else this.onUpdaterContinue()};Controller.prototype.onUpdaterComplete=function(){};Controller.prototype.onUpdaterContinue=function(){};Controller.prototype.onSearchStart=function(){this.resultGraphs&&(this.resultGraphs.fold(),this.resultGraphs.lockFolding())};
Controller.prototype.onSearchStop=function(){this.resultGraphs&&(this.resultGraphs.unlockFolding(),this.isFilterRequest||this.resultGraphs.unfold())};
Controller.prototype.getPeriodicalUpdater=function(a){var b="requestid="+this.requestId,c={requestid:this.requestId},a=this.updateUrl+"/"+this.handle+"/"+a;dojo.require("swoodoo.PeriodicalUpdater");return new swoodoo.PeriodicalUpdater("",a,{method:"post",parameters:b,params:c,frequency:1E3,asynchronous:!0,evalJS:!1,evalJSON:!1,decay:2,onException:function(){periodicalUpdater.stop();controller.onUpdaterException();return!1},onSuccess:function(a){var a=eval("("+a+")"),b=a.results;controller.tripsResult=
b;if(a.status!=1){periodicalUpdater.stop();if(a.redirectLink!=void 0)window.location=a.redirectLink;else controller.onUpdaterException();controller.onSearchStop()}controller.onUpdaterSuccess(b)}})};Controller.prototype.updateResults=function(a){controller.changeButtons(!0);this.onSearchStart();controller.statusPanel.start();periodicalUpdater=this.getPeriodicalUpdater(a);periodicalUpdater.start()};
Controller.prototype.stopSearch=function(a){periodicalUpdater.stop();this.onSearchStop();this.currentOffset=this.tripsResult.currentPage;a&&this.statusPanel.stop();controller.changeButtons(!1)};Controller.prototype.cancelSearch=function(){periodicalUpdater.stop();this.onSearchStop();this.statusPanel.stop();try{periodicalUpdater&&periodicalUpdater.abort()}catch(a){}controller.changeButtons(!1)};
Controller.prototype.drawPager=function(){this.pager.draw(this.tripsResult.currentPage,this.tripsResult.totalResults,this.tripsResult.moreResults)};Controller.prototype.toggleSearch=function(a){a?(dojo.byId("searchformbox-header").style.display="none",dojo.byId(this.searchFormBox).style.display=""):(dojo.byId(this.searchFormBox).style.display="none",dojo.byId("searchformbox-header").style.display="")};
Controller.prototype.getTripIds=function(a){for(var b="",c=0;c<a.length;c++)b+=a[c].alternative?this.getTripIds(a[c].alternative):a[c].tripId,c+1<a.length&&(b+=",");return b};Controller.prototype.goToResults=function(a){window.location=this.urlWithParams+"/offset/"+a};
Controller.prototype.getDeeplinkForPopup=function(){var a={url:this.getDeeplinkForPopupUrl,handleAs:"text",content:{adults:dojo.byId("adults_count").value,children:dojo.byId("children_count")?dojo.byId("children_count").value:0,babies:dojo.byId("infants_count")?dojo.byId("infants_count").value:0,popuptripId:dojo.byId("popuptripId").value,username:dojo.byId("usernameInput").value,handle:this.handle},load:function(a){a=eval("("+a+")");a.deeplink?(dojo.byId("popupLoginStatus").innerHTML='<a target="_blank" href ='+
a.deeplink+">Bitte klicken Sie hier, wir leiten Sie zu dem günstigen Anbieter weiter.</a>",dojo.byId("popupLoginform").style.display="none"):dojo.byId("popupLoginStatus").innerHTML='<div class="pt-n">'+a.message+"</div>"},error:function(){}};dojo.xhrPost(a)};
Controller.prototype.startSearch=function(){controller.changeButtons(!0);this.onSearchStart();this.resetContainers();controller.statusPanel.start();dojo.xhrPost({url:this.getHandleUrl,handleAs:"text",content:{requestid:this.requestId,ext:this.extUserParams,flightSearchOrigin:this.flightSearchOrigin},load:function(a){a=eval("("+a+")");if(a.status==1)controller.handle=a.handle,controller.updateResults(controller.offset);else{if(a.redirectLink!=void 0)window.location=a.redirectLink;controller.onSearchStop();
controller.statusPanel.stop();controller.resultRenderer.drawNoResults(controller.flightNotFoundMessage.getMessage(null));controller.changeButtons(!1)}controller.crossSaleUrl&&controller.drawCrossSale(controller.handle)},error:function(){controller.statusPanel.stop();controller.changeButtons(!1)}})};Controller.prototype.changeButtons=function(a){this.searchForm.changeSearchButton(a)};function StatusPanel(a,b){this.pandelId=a;this.xmlUrl=b;this.fillEntriesAktive=null}
StatusPanel.prototype.start=function(){dojo.byId("statusPanel2").style.display="block";this.createSearchIndicator();dojo.xhrGet({url:this.xmlUrl,handleAs:"xml",load:function(a){dojo.byId("divLoaderText").innerHTML=a.getElementsByTagName("loadertext")[0].childNodes[0].nodeValue;var b=a.getElementsByTagName("entries")[0].childNodes[0].nodeValue.split(",");dojo.byId("divEntries").innerHTML=b[0];var c=b.length,d=1;this.fillEntriesAktive=window.setInterval(function(){dojo.byId("divEntries")==null?window.clearInterval(this.fillEntriesAktive):
(dojo.byId("divEntries").innerHTML=b[d],d++,d==c&&(d=0))},1E3);dojo.byId("divCanceltext").innerHTML=a.getElementsByTagName("canceltext")[0].childNodes[0].nodeValue},error:function(){}})};StatusPanel.prototype.stop=function(){this.destroySearchIndicator();dojo.fx.wipeOut({node:"statusPanel2",duration:1E3,delay:50,onEnd:function(){dojo.byId("statusPanel2").style.display="none"}}).play()};StatusPanel.prototype.createSearchIndicator=function(){dojo.byId("searchIndicatorContainer").innerHTML='<span id="searchIndicator" style="display:none"></span>'};
StatusPanel.prototype.destroySearchIndicator=function(){dojo.byId("searchIndicatorContainer").innerHTML=""};function Pager(a,b,c){this.pagerId=a;this.testMode=c;this.numberOfResultsToShow=b}Pager.prototype.draw=function(a,b,c){if(!this.testMode)dojo.byId(this.pagerId).innerHTML=this.generatePagerHtml(a,b,c)};Pager.prototype.clear=function(){dojo.byId(this.pagerId).innerHTML=""};
Pager.prototype.generatePagerHtml=function(a,b,c){var d=b/this.numberOfResultsToShow;if(b<=this.numberOfResultsToShow)return"";for(var e=b="",f=!1,g=0;g<d;g++)e=g+1<d?'<span class="p-lr-g separator"> | </span>':"",f=g+1==a,b+=this.generateNumberElement(g,!1,f)+e;c&&(b+=this.generateNumberElement(d+1,!0));return b};
Pager.prototype.generateNumberElement=function(a,b,c){var d=a*this.numberOfResultsToShow,a=b?translate("LANG_RESULT_NEXT_LINK"):a+1;return c?'<b class="activelink"> '+a+"</b>":'<a href="javascript:controller.goToResults('+d+');">'+a+"</a>"};
var closeButtonText=translatedStrings.LANG_JS_DATEPICKER_CLOSE_BUTTON,useButtons=0,hideThisMonth=1,dayArrayShort=[translatedStrings.LANG_DATE_FORMAT_WEEKDAY_7,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_1,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_2,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_3,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_4,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_5,translatedStrings.LANG_DATE_FORMAT_WEEKDAY_6],monthArrayLong=[translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_1,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_2,
translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_3,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_4,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_5,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_6,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_7,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_8,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_9,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_10,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_11,translatedStrings.LANG_DATE_FORMAT_FULL_MONTH_12],defaultDateSeparator=
translatedStrings.LANG_JS_DATEPICKER_DATE_SEPARATOR,defaultDateFormat=translatedStrings.LANG_JS_DATEPICKER_DATE_FORMAT,defaultFirstWeekDay=1,datePickerDivID="datepicker",iFrameDivID="datepickeriframe",dateSeparator=defaultDateSeparator,dateFormat=defaultDateFormat,firstWeekDay=defaultFirstWeekDay,crlf="\r\n",TABLE="<table cols='7' class='dpTable dpTableHead'>"+crlf,xTABLE="</table>"+crlf,TR="<tr class='dpTR'>",TR_title="<tr class='dpTitleTR'>",TR_days="<tr class='dpDayTR'>",TR_todaybutton="<tr class='dpTodayButtonTR'>",
xTR="</tr>"+crlf,TD="<td class='dpTD'",TD_title="<td colspan='3' class='dpTitleTD'>",TD_old="<td class='dpTDO'",TD_old_selected="<td class='dpTDOS'",TD_buttons="<td class='dpButtonTD'>",TD_todaybutton="<td colspan='7' class='dpTodayButtonTD'>",TD_days="<td class='dpDayTD'>",TD_selected="<td class='dpDayHighlightTD'",xTD="</td>"+crlf,DIV_title="<div id='dpTitle#id#' class='dpTitleText'>",DIV_selected="<div class='dpDayHighlight'>",xDIV="</div>",calendarClickHandle=null;
function displayDatePicker(a,b,c,d,e,f,g){g?(g=splitDateString(g),g=new Date(parseInt(g[0],10),parseInt(g[1],10)-1,parseInt(g[2],10))):g=new Date;g.setHours(0,0,0,0);g=g.toString();a=document.getElementById(a);b||(b=a);dateSeparator=e?e:defaultDateSeparator;dateFormat=d?d:defaultDateFormat;firstWeekDay=f?f:defaultFirstWeekDay;d=b.offsetLeft;for(e=b.offsetTop+b.offsetHeight;b.offsetParent;)b=b.offsetParent,d+=b.offsetLeft,e+=b.offsetTop;drawDatePicker(a,c,d,e,g)}
function drawDatePicker(a,b,c,d,e){var f=getFieldDate(a.value);if(!f)f=getFieldDate(searchForm.getStoredDate(a.name)),a.value=getDateString(f);if(!document.getElementById(datePickerDivID)){var g=document.createElement("div");g.setAttribute("id",datePickerDivID);g.setAttribute("class","dpDiv");document.body.appendChild(g)}var h=document.getElementById(datePickerDivID);h.style.position="absolute";h.style.left=c+"px";h.style.top=d+"px";h.style.visibility=h.style.visibility=="visible"?"hidden":"visible";
h.style.display=h.style.display=="block"?"none":"block";h.style.zIndex=1E4;refreshDatePicker(a.name,f.getFullYear(),f.getMonth(),f.getDate(),b,e);calendarClickHandle=dojo.connect("document_body","click",function(b){searchForm.documentClickHandler(b,h,a,searchForm.datePickerImage)})}
function refreshDatePicker(a,b,c,d,e,f){var g=new Date((new Date).getTime()+SEARCH_START_DELAY_DAYS*864E5),h=getFieldDate(MAX_AVAILABLE_DATE,"ymd"),j=null,j=b<g.getFullYear()||b==g.getFullYear()&&c<g.getMonth()?new Date(g.getFullYear(),g.getMonth(),1):b>h.getFullYear()||b==h.getFullYear()&&c>=h.getMonth()?new Date(h.getFullYear(),h.getMonth()-1,1):new Date(b,c,1);dojo.byId(datePickerDivID).innerHTML=createHtmlForDatePicker(a,j,c,d,e,f);adjustiFrame()}
function createHtmlForDatePicker(a,b,c,d,e,f){var g=new Date,h=new Date(b.getFullYear(),b.getMonth()+1,b.getDate()),j='<div><img src="'+imagesPath+'dbTableBoxTop.png" width="370" height="13" alt="" /></div>';j+="<div class='dbDivBody'><table class='dpMainTable'><tbody>";j+="<tr>";j+="<td class='dpMainCell'>";j+=GenerateMonthTable(b,g.getMonth(),g.getFullYear(),a,d,c,!0,e,"1",f);j+="</td>";j+="<td width='10'>&nbsp;</td>";j+="<td class='dpMainCell'>";j+=GenerateMonthTable(h,g.getMonth(),g.getFullYear(),
a,d,c,!1,e,"2",f);j+="</td>";j+="</tr>";j+="<tr class='dpTodayButtonTR'>";j+="<td colspan='3' class='dpTodayButtonTD' style='text-align: center; padding-top:10px;'>";j+="<a class='dpTodayButton' onClick='updateDateField(\""+a+'", null, '+e+");'>"+closeButtonText+"</a>";j+="</td>";j+="</tr>";j+="</tbody></table></div>";j+="<div><img src='"+imagesPath+"dbTableBoxBottom.png' width='370' height='9' alt='' /></div>";return j}
function GenerateMonthTable(a,b,c,d,e,f,g,h,j,k){var l="<table cols='7' class='dpTable dpTableHead'><tbody>";g?(l+="<tr class='dpTitleTR'>",l+="<td class='dpButtonTD dpButtonRightTD'>"+getButtonCode(d,a,-12,"bwdYearBt",h,k)+"</td>",l+="<td class='dpButtonTD'>"+getButtonCode(d,a,-1,"bwdMonthBt",h,k)+"</td>",l+="<td colspan='3' class='dpTitleTD'>",l+="<div id='dpTitl'"+j+"' class='dpTitleText'>"+monthArrayLong[a.getMonth()]+" "+a.getFullYear()+"</div>",l+="</td>"):(l+="<tr class='dpTitleTR'>",l+="<td colspan='3' class='dpTitleTD'>",
l+="<div id='dpTitl'"+j+"' class='dpTitleText'>"+monthArrayLong[a.getMonth()]+" "+a.getFullYear()+"</div>",l+="</td>",l+="<td class='dpButtonTD'>"+getButtonCode(d,a,0,"fwdMonthBt",h,k)+"</td>",l+="<td class='dpButtonTD'>"+getButtonCode(d,a,12,"fwdYearBt",h,k)+"</td>");l+="</tr>";l+="</tbody></table>";l+='<table cols="7" cellspacing="5" class="dpTable dpTableContent"><tbody>';l+="<tr class='dpDayTR'>";for(j=firstWeekDay;j<dayArrayShort.length;j++)l+="<td class='dpDayTD'>"+dayArrayShort[j]+"</td>";
for(j=0;j<firstWeekDay;j++)l+="<td class='dpDayTD'>"+dayArrayShort[j]+"</td>";l+="</tr>";l+="<tr class='dpTR'>";for(var m=a.getDay()==0?7:a.getDay(),j=firstWeekDay;j<m;j++)l+='<td class="dpTDE">&nbsp;</td>';j=new Date;j.setDate(j.getDate()+SEARCH_START_DELAY_DAYS);var p,g=0;do{m=a.getDate();p=a.getMonth();if(a>=new Date(k)&&(a.getFullYear()>c||a.getFullYear()==c&&(a.getMonth()>b||a.getMonth()==b&&m>=j.getDate()))){var o="id='dayid_"+getDateString(a)+"' onclick=\"updateDateField('"+d+"', '"+getDateString(a)+
"', "+h+');">';l+=m==e&&p==f?"<td class='dpDayHighlightTD'"+o+m+"</td>":"<td class='dpTD' "+o+m+"</td>"}else l+="<td class='dpTDO' id='dayid_"+getDateString(a)+"'>"+m+"</td>";m=new Date(a);m.setDate(m.getDate()+1);a.getDay()+1==firstWeekDay&&m.getDate()!=1&&(l+="</tr><tr class='dpTR'>",g++);a.setDate(a.getDate()+1)}while(a.getDate()>1);m=a.getDay()==0?7:a.getDay();if(m<7&&m>1)for(j=8-m;j>0;j--)l+='<td class="dpTDE">&nbsp;</td>';l+="</tr>";for(g++;g<6;g++)l+='<tr class="dpTREmpty">',l+='<td colspan="6"></td>',
l+="</tr>";l+="</tbody></table>";return l}function getButtonCode(a,b,c,d,e,f){var g=(b.getMonth()+c)%12,b=b.getFullYear()+parseInt((b.getMonth()+c)/12);g<0&&(g+=12,b+=-1);return"<a id='"+d+"' class='dpButton' onClick='refreshDatePicker(\""+a+'", '+b+", "+g+", false,"+e+', "'+f+'");\'><img src="'+imagesPath+d+'.gif" width="14" height="13" alt="" /></a>'}
function getDateString(a,b){var b=b?b:dateFormat,c="00"+a.getDate(),d="00"+(a.getMonth()+1),c=c.substring(c.length-2),d=d.substring(d.length-2);switch(b){case "dmy":return c+dateSeparator+d+dateSeparator+a.getFullYear();case "ymd":return a.getFullYear()+dateSeparator+d+dateSeparator+c;default:return d+dateSeparator+c+dateSeparator+a.getFullYear()}}
function getFieldDate(a,b,c){var b=b?b:dateFormat,d,e,f,g,h;try{if(e=splitDateString(a)){switch(b){case "dmy":f=parseInt(e[0],10);g=parseInt(e[1],10)-1;h=parseInt(e[2],10);break;case "ymd":f=parseInt(e[2],10);g=parseInt(e[1],10)-1;h=parseInt(e[0],10);break;default:f=parseInt(e[1],10),g=parseInt(e[0],10)-1,h=parseInt(e[2],10)}d=c?new Date(h,g,f):searchForm.getDateFromParts(h,g,f)}else d=!1}catch(j){d=!1}return d}
function splitDateString(a){return a.indexOf("/")>=0?a.split("/"):a.indexOf(".")>=0?a.split("."):a.indexOf("-")>=0?a.split("-"):a.indexOf("\\")>=0?a.split("\\"):!1}
function updateDateField(a,b,c){calendarClickHandle&&dojo.disconnect(calendarClickHandle);a=document.getElementById(a);if(b&&(a.value=b,typeof a.onchange=="function"))a.onchange();document.getElementById(datePickerDivID).style.visibility="hidden";document.getElementById(datePickerDivID).style.display="none";adjustiFrame();a.focus&&a.type!="hidden"&&a.focus();b&&c&&typeof datePickerClosedTopSearch=="function"?datePickerClosedTopSearch(a):b&&!c&&typeof datePickerClosedMetaCrawler=="function"&&datePickerClosedMetaCrawler(a)}
function adjustiFrame(a,b){if(!document.getElementById(iFrameDivID)){var c=document.createElement("iFrame");c.setAttribute("id",iFrameDivID);c.setAttribute("src","javascript:false;");c.setAttribute("scrolling","no");c.setAttribute("frameborder","0");document.body.appendChild(c)}a||(a=document.getElementById(datePickerDivID));b||(b=document.getElementById(iFrameDivID));try{b.style.position="absolute",b.style.width=a.offsetWidth+"px",b.style.height=a.offsetHeight+"px",b.style.top=a.style.top,b.style.left=
a.style.left,b.style.zIndex=a.style.zIndex-1,b.style.visibility=a.style.visibility}catch(d){}}function datePickerClosedTopSearch(a){searchForm.validateSearchForm(a.name)}function SearchFormUrlManager(a,b,c,d,e){this.baseUrl=a;this.resultUrlPrefix=b;this.powerUrlPrefix=c;this.redirectToParent=d?d:!1;this.isAirSearch=e}
SearchFormUrlManager.prototype.parsePowerDataAndRedirect=function(){var a=dojo.byId("power_departure").value,b=dojo.byId("dep_hidden").value.split("|"),c=dojo.byId("power_destination").value,d=dojo.byId("dst_hidden").value.split("|"),e=dojo.byId("return").checked,f=dojo.byId("depMonth").value,g=e?dojo.byId("retMonth").value:null,h=dojo.byId("depDay").value,j=e?dojo.byId("retDay").value:null,k=h+"."+f,l=j+"."+g,m;this.isPossibleBuildFriendlyResultUrl(a,b,c,d,k,e,l)?m=this.getFriendlyResultUrlFromPowerPage(b,
d,k,e,l):this.isPossibleBuildFriendlyPowerUrl(a,b,c,d,f,h,e,g,j)&&(m=this.getFriendlyPowerUrl(b,d,f,h,e,g,j));return m?(document.location.href=m,!1):!0};
SearchFormUrlManager.prototype.parseResultDataAndRedirect=function(){var a=dojo.byId("departure").value,b=dojo.byId("dep_hidden").value.split("|"),c=dojo.byId("destination").value,d=dojo.byId("dst_hidden").value.split("|"),e=dojo.byId("return").checked,f=dojo.byId("DEPD").value,g=e?dojo.byId("RETD").value:null,h=dojo.byId("flexible_date")?dojo.byId("flexible_date").checked:!1,j=this.getDaytime(dojo.byId("daytime").value),k=e?this.getDaytime(dojo.byId("returnDaytime").value):null,l=dojo.byId("adults_count")?
dojo.byId("adults_count").value:1,m=dojo.byId("children_count")?dojo.byId("children_count").value:0,p=dojo.byId("infants_count")?dojo.byId("infants_count").value:0,o=dojo.byId("nonstop")?dojo.byId("nonstop").checked:!1,n=dojo.byId("hotel-1")&&dojo.byId("hotel-1").checked?dojo.byId("hotel-1").value:"";if(this.isPossibleBuildFriendlyResultUrl(a,b,c,d,f,e,g)){a=this.getFriendlyResultUrlFromResultPage(b,d,f,j,e,g,k,n,o,l,m,p,h);if(this.redirectToParent)try{parent.document.location.href=a}catch(q){}else this.createFormAndSubmit(a);
return!1}return!0};
SearchFormUrlManager.prototype.createFormAndSubmit=function(a){var b=document.createElement("FORM");dojo.attr(b,"method","POST");dojo.attr(b,"action",a);dojo.attr(b,"style","display:none");dojo.body().appendChild(b);if((a=dojo.byId("compareToOpenedPopupCucs"))&&a.innerHTML)for(var c=a.innerHTML.split(","),a=0;a<c.length;a++){var d="compareTo["+c[a]+"]",e=document.createElement("input");dojo.attr(e,"type","hidden");dojo.attr(e,"name",d);dojo.attr(e,"value","1");b.appendChild(e)}if((a=dojo.byId("compareToUncheckedCucs"))&&
a.innerHTML){c=a.innerHTML.split(",");for(a=0;a<c.length;a++)d=document.createElement("input"),dojo.attr(d,"type","hidden"),dojo.attr(d,"name",c[a]),dojo.attr(d,"value","1"),b.appendChild(d)}b.submit()};
SearchFormUrlManager.prototype.getFriendlyPowerUrl=function(a,b,c,d,e,f,g){a=this.baseUrl+"/"+this.powerUrlPrefix+"/"+a[1]+"-"+a[2]+"/"+b[1]+"-"+b[2];c&&(a+="/month/"+c,d&&(a+="/outbound/"+this.getYMDDateFromDMY(d+"."+c)));e&&(a+="/oneway/0",f&&(a+="/retmonth/"+f,g&&(a+="/inbound/"+this.getYMDDateFromDMY(g+"."+f))));return a};
SearchFormUrlManager.prototype.isPossibleBuildFriendlyPowerUrl=function(a,b,c,d,e,f,g,h,j){return g&&!this.isValidPowerSearchDate(h,j)?!1:b.length==5&&a==b[0]&&b[1].length>0&&b[2].length>0&&d.length==5&&c==d[0]&&d[1].length>0&&d[2].length>0&&this.isValidPowerSearchDate(e,f)};SearchFormUrlManager.prototype.getFriendlyResultUrlFromPowerPage=function(a,b,c,d,e){c=this.getYMDDateFromDMY(c);d&&(e=this.getYMDDateFromDMY(e));return this.getFriendlyResultUrl(a,b,c,"0",d,e,"0")};
SearchFormUrlManager.prototype.getFriendlyResultUrlFromResultPage=function(a,b,c,d,e,f,g,h,j,k,l,m,p){c=this.getYMDDate(c);e&&(f=this.getYMDDate(f));return this.getFriendlyResultUrl(a,b,c,d,e,f,g,h,j,k,l,m,p)};
SearchFormUrlManager.prototype.getFriendlyResultUrl=function(a,b,c,d,e,f,g,h,j,k,l,m,p){if(this.isAirSearch)c=this.baseUrl+"/"+this.resultUrlPrefix+"/"+a[1]+"-"+b[1]+"-"+a[2]+"-"+b[2]+"-"+c+"-1-1-0",e&&(c+="/"+b[1]+"-"+a[1]+"-"+b[2]+"-"+a[2]+"-"+f+"-1-1-0"),c+="/1/E/0";else{c=this.baseUrl+"/"+this.resultUrlPrefix+"/"+a[1]+"-"+a[2]+"/"+b[1]+"-"+b[2]+"/"+c+"/0";e&&(c+="/"+f+"/0");a[3]=="A"&&a[4]=="T"&&(c+="/fdep/"+a[2]);b[3]=="A"&&b[4]=="T"&&(c+="/fdst/"+b[2]);d&&d!="0"&&(c+="/daytime/"+d);g&&g!="0"&&
(c+="/returnDaytime/"+g);j&&(c+="/stops/0");if(k!=void 0&&l!=void 0&&m!=void 0&&(k!=1||l!=0||m!=0))c+="/adults/"+k+"/children/"+l+"/babies/"+m;h&&(c+="/hotel/"+h);p&&(c+="/flexible/1")}return c};SearchFormUrlManager.prototype.isPossibleBuildFriendlyResultUrl=function(a,b,c,d,e,f,g){return f&&!this.isValidDate(g)?!1:b.length==5&&(b[3]=="A"||b[3]=="T")&&a==b[0]&&b[1].length>0&&b[2].length>0&&d.length==5&&(d[3]=="A"||d[3]=="T")&&c==d[0]&&d[1].length>0&&d[2].length>0&&this.isValidDate(e)};
SearchFormUrlManager.prototype.isValidDate=function(a){var b=/^\d{4}[\.-]\d{2}[\.-]\d{2}$/;return/^\d{2}[\.-]\d{2}[\.-]\d{4}$/.exec(a)!=null||b.exec(a)!=null?!0:!1};SearchFormUrlManager.prototype.isValidPowerSearchDate=function(a,b){if(!a&&!b)return!0;else if(!a&&b)return!1;if(a){var c=/^[0-9]{2}\.[0-9]{4}$/;if(c.exec(a)==null)return!1;if(b&&(c=/^[0-9]{2}$/,c.exec(b)==null))return!1}return!0};
SearchFormUrlManager.prototype.getYMDDate=function(a){var b=translate("LANG_SEARCHFORM_DATE_FORMAT");return formatDateToYmd(a,b)};SearchFormUrlManager.prototype.getYMDDateFromDMY=function(a){a=a.split(".");return a[2]+"-"+a[1]+"-"+a[0]};SearchFormUrlManager.prototype.getDaytime=function(a){var b=parseInt(a);return b>=0&&b<=3?a:"0"};
function PriceGraphs(a,b,c,d,e,f,g,h){this.depGraphId=a;this.retGraphId=b;this.graphUrl=c;this.teaserId=d;this.teaserUrl=e;this.foldedGraphId=f;this.showPowerTeaser=g;this.showFoldLink=!1;this.retDeviation=this.depDeviation=this.retDate=this.depDate=this.dstUrlName=this.dstFull=this.dst=this.depUrlName=this.depFull=this.dep=this._params="";this._oneway=!0;this._folded=!1;this._observeIntervalForTeaser=this._observeInterval=1E3;this._depInputId=h&&h.depInputId||"departure";this._hidden_depInputId=
h&&h.hidden_depInputId||"dep_hidden";this._dstInputId=h&&h.dstInputId||"destination";this._hidden_dstInputId=h&&h.hidden_dstInputId||"dst_hidden";this._depDateInputId=h&&h.depDateInputId||"DEPD";this._retDateInputId=h&&h.retDateInputId||"RETD";this._onewayInputId=h&&h.onewayInputId||"oneway";this._returnInputId=h&&h.returnInputId||"return";this._tripTypeInputName=h&&h.tripTypeInputName||"type";this._disableAutoReloading=this._callerObj=this._activeRequestParams=this.AJAX_IN_PROGRESS=!1;this._observers=
[];this._dataLoaded=this._foldingLocked=!1}
PriceGraphs.prototype.setObservables=function(a){this._depInputId=a.depInputId?a.depInputId:this._depInputId;this._hidden_depInputId=a.hidden_depInputId?a.hidden_depInputId:this._hidden_depInputId;this._dstInputId=a.dstInputId?a.dstInputId:this._dstInputId;this._hidden_dstInputId=a.hidden_dstInputId?a.hidden_dstInputId:this._hidden_dstInputId;this._depDateInputId=a.depDateInputId?a.depDateInputId:this._depDateInputId;this._retDateInputId=a.retDateInputId?a.retDateInputId:this._retDateInputId;this._onewayInputId=
a.onewayInputId?a.onewayInputId:this._onewayInputId;this._returnInputId=a.returnInputId?a.returnInputId:this._returnInputId};PriceGraphs.prototype.setParams=function(a,b,c,d,e,f,g,h){this.setDep(a);this.setDepFull(b);this.setDepUrlName(c);this.setDst(d);this.setDepDate(e);this.setRetDate(f);this.setDepDeviation(g);this.setRetDeviation(h)};
PriceGraphs.prototype.getTeaser=function(){if(this.showPowerTeaser){this._prepareParams();var a=this;this._paramsOK()&&this.teaserId&&this.teaserUrl&&(teaserLoader=dojo.xhrGet({url:this.teaserUrl+"?"+this._params,handleAs:"json",load:function(b){b.length==2?(a.showTeaser(b[0]),eval(b[1]+"")):a.noResults()},error:function(){a.error()}}))}};
PriceGraphs.prototype.refresh=function(a,b,c){this._dataLoaded=!1;if(b)this._callerObj=b;a=a.match(this._oneway?/\/([0-9]{4}-[0-9]{2}-[0-9]{2})\//i:/\/([0-9]{4}-[0-9]{2}-[0-9]{2})\/[0-9]\/([0-9]{4}-[0-9]{2}-[0-9]{2})\//i);a.length==3&&!this._oneway?(c=="out"?this.setFormDates(a[1],c):this.setFormDates(a[2],c),this.load()):a.length==2&&this._oneway&&(this.setFormOutboundDate(a[1]),this.load())};
PriceGraphs.prototype.setOutboundDate=function(a){this.disableObservers();if(a=formatDateFromYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT)){if(dojo.byId(this._depDateInputId).value=a,this.setDepDate(dojo.byId(this._depDateInputId).value),!this._oneway){var b=formatDateToYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT),c=formatDateToYmd(dojo.byId(this._retDateInputId).value,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT);if(b>c)dojo.byId(this._retDateInputId).value=a,this.setRetDate(dojo.byId(this._retDateInputId).value),
this._dataLoaded=!1,this.load()}}else this.error();this.bindObservers()};
PriceGraphs.prototype.setFormDates=function(a,b){this.disableObservers();var c,d,e,f;b=="out"?(c=formatDateFromYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT),d=a,e=dojo.byId(this._retDateInputId).value,f=formatDateToYmd(e,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT)):(e=formatDateFromYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT),f=a,c=dojo.byId(this._depDateInputId).value,d=formatDateToYmd(c,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT));d>=f&&(b=="in"?(d=f,c=e):(f=d,e=c));dojo.byId(this._depDateInputId).value=
c;dojo.byId(this._retDateInputId).value=e;this.setDepDate(d);this.setRetDate(f);this.bindObservers()};PriceGraphs.prototype.setFormOutboundDate=function(a){this.disableObservers();dojo.byId(this._depDateInputId).value=formatDateFromYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT);this.setDepDate(a);this.bindObservers()};
PriceGraphs.prototype.setInboundDate=function(a){this.disableObservers();if(a=formatDateFromYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT)){dojo.byId(this._retDateInputId).value=a;this.setRetDate(dojo.byId(this._retDateInputId).value);var b=formatDateToYmd(dojo.byId(this._depDateInputId).value,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT),c=formatDateToYmd(a,translatedStrings.LANG_SEARCHFORM_DATE_FORMAT);if(b>c)dojo.byId(this._depDateInputId).value=a,this.setDepDate(dojo.byId(this._depDateInputId).value),
this._dataLoaded=!1,this.load()}else this.error();this.bindObservers()};PriceGraphs.prototype.load=function(a){this._prepareParams();this.retDate!=""&&!this._oneway?this.loadReturn(a):this.loadOneway()};PriceGraphs.prototype.setDep=function(a){this.dep=a};PriceGraphs.prototype.setDepFull=function(a){this.depFull=a};PriceGraphs.prototype.setDepUrlName=function(a){this.depUrlName=a};PriceGraphs.prototype.setDst=function(a){this.dst=a};PriceGraphs.prototype.setDstFull=function(a){this.dstFull=a};
PriceGraphs.prototype.setDstUrlName=function(a){this.dstUrlName=a};PriceGraphs.prototype.setDepDate=function(a){this.depDate=a};PriceGraphs.prototype.setRetDate=function(a){this._oneway=!1;this.retDate=a};PriceGraphs.prototype.setDepDeviation=function(a){this.depDeviation=a};PriceGraphs.prototype.setRetDeviation=function(a){this._oneway=!1;this.retDeviation=a};
PriceGraphs.prototype.loadReturn=function(a){var b=this;if(!this.AJAX_IN_PROGRESS&&this._paramsOK()){if(this._callerObj)this._callerObj.style.color="#DDDDDD",this._callerObj.style.cursor="wait",this._callerObj.onclick=function(){return!1};this.AJAX_IN_PROGRESS=!0;this._prepareParams();this._activeRequestParams=this._params;graphLoader=dojo.xhrGet({url:this.graphUrl+"?"+this._activeRequestParams,handleAs:"json",load:function(c){if(c.length==4){b.onResults();if(a==b.depGraphId||!a)b.showDep(c[0]),eval(c[2]);
if(a==b.retGraphId||!a)b.showRet(c[1]),eval(c[3])}else b.noResults();b.AJAX_IN_PROGRESS=!1;if(!RequestQueue.isEmpty())c=RequestQueue.pop(),b._params=c.params,b.loadReturn(c.reloadOne)},error:function(){b.error();b.AJAX_IN_PROGRESS=!1}})}else this._paramsOK()&&this._activeRequestParams!=this._params&&RequestQueue.add(this._params,a)};
PriceGraphs.prototype.loadOneway=function(){this.hideRet();var a=this;if(!this.AJAX_IN_PROGRESS&&this._paramsOK()){if(this._callerObj)this._callerObj.style.color="#DDDDDD",this._callerObj.style.cursor="wait",this._callerObj.onclick=function(){return!1};this.AJAX_IN_PROGRESS=!0;this._prepareParams();this._activeRequestParams=this._params;graphLoader=dojo.xhrGet({url:this.graphUrl+"?"+this._activeRequestParams,handleAs:"json",load:function(b){b.length==2?(a.onResults(),a.showDep(b[0]),eval(b[1])):a.noResults();
a.AJAX_IN_PROGRESS=!1;if(!RequestQueue.isEmpty())b=RequestQueue.pop(),a._params=b.params,a.loadOneway()},error:function(){a.error();a.AJAX_IN_PROGRESS=!1}})}else this._activeRequestParams!=this._params&&this._paramsOK()&&RequestQueue.add(this._params,!1)};PriceGraphs.prototype.showTeaser=function(a){if(a&&this.teaserId)dojo.byId(this.teaserId).innerHTML=a};PriceGraphs.prototype.showDep=function(a){if(a)dojo.byId(this.depGraphId).innerHTML=a,this._folded||this.unfoldDep()};
PriceGraphs.prototype.showRet=function(a){if(a)dojo.byId(this.retGraphId).innerHTML=a,this._folded||this.unfoldRet(),this._oneway=!1};PriceGraphs.prototype.hideRet=function(){this._oneway=!0;dojo.byId(this.retGraphId).style.display="none"};PriceGraphs.prototype.hide=function(){dojo.byId(this.depGraphId).style.display="none";dojo.byId(this.retGraphId).style.display="none"};
PriceGraphs.prototype.fold=function(){if(!this._foldingLocked){dojo.byId(this.depGraphId).style.display="none";dojo.byId(this.retGraphId).style.display="none";if(dojo.byId(this.foldedGraphId))dojo.byId(this.foldedGraphId).style.display=this.hasResults()?"block":"none";this._folded=!0}};
PriceGraphs.prototype.unfold=function(){if(!this._foldingLocked){if(dojo.byId(this.foldedGraphId))dojo.byId(this.foldedGraphId).style.display="none";this._folded=!1;this._dataLoaded||this.load();this.unfoldDep();this.retDate!=""&&!this._oneway&&this.unfoldRet()}};PriceGraphs.prototype.unfoldDep=function(){dojo.byId(this.depGraphId).style.visibility="visible";dojo.byId(this.depGraphId).style.display="block";dojo.byId(this.depGraphId).parentNode.style.display="block"};
PriceGraphs.prototype.unfoldRet=function(){dojo.byId(this.retGraphId).style.visibility="visible";dojo.byId(this.retGraphId).style.display="block";dojo.byId(this.retGraphId).parentNode.style.display="block"};PriceGraphs.prototype.lockFolding=function(){this._foldingLocked=!0;if(dojo.byId(this.foldedGraphId))dojo.byId(this.foldedGraphId).style.display="none"};
PriceGraphs.prototype.unlockFolding=function(){this._foldingLocked=!1;if(dojo.byId(this.foldedGraphId))dojo.byId(this.foldedGraphId).style.display=this.hasResults()?"block":"none"};PriceGraphs.prototype.show=function(a,b){this.showDep(a);this.showRet(b)};PriceGraphs.prototype.noResults=function(){this.hide()};PriceGraphs.prototype.onResults=function(){this._dataLoaded=!0};
PriceGraphs.prototype.hasResults=function(){return dojo.byId(this.depGraphId).innerHTML.length+dojo.byId(this.retGraphId).innerHTML.length>0};PriceGraphs.prototype.error=function(){this.hide()};
PriceGraphs.prototype.bindObservers=function(){var a=this,b=this._getSelectedTripType(),c=depLocation2=dojo.byId(this._depInputId).value,d=dstLocation2=dojo.byId(this._dstInputId).value,e=dojo.byId(this._depDateInputId).value,f=dojo.byId(this._retDateInputId)?dojo.byId(this._retDateInputId).value:null;this._observers[0]=window.setInterval(function(){a.refreshObservables&&a.refreshObservables();var g=a._getSelectedTripType();b!=g&&a._retChangeHndl(null,null);var g=dojo.byId(a._depInputId),h=g.value;
c!=h&&(c=h,a._depChangeHndl(g,h));h=(g=dojo.byId(a._dstInputId))?g.value:null;d!=h&&(d=h,a._dstChangeHndl(g,h));g=dojo.byId(a._depDateInputId);h=g.value;e!=h&&(e=h,a._depDateChangeHndl(g,h));h=(g=dojo.byId(a._retDateInputId))?g.value:null;f!=h&&(f=h,a._retDateChangeHndl(g,h))},this._observeInterval);this.showPowerTeaser&&this.teaserId&&this.teaserUrl&&(this._observers[1]=window.setInterval(function(){var b=dojo.byId(a._depInputId),c=b.value;depLocation2!=c&&(depLocation2=c,a._loadPowerTeaserDep(b,
c));b=dojo.byId(a._dstInputId);c=b.value;dstLocation2!=c&&(dstLocation2=c,a._loadPowerTeaserDst(b,c))},this._observeIntervalForTeaser))};PriceGraphs.prototype.disableObservers=function(){dojo.forEach(this._observers,function(a){window.clearInterval(a)})};PriceGraphs.prototype._loadPowerTeaserDep=function(a,b){this.showPowerTeaser&&(this.setDepFull(b),this.getTeaser())};PriceGraphs.prototype._loadPowerTeaserDst=function(a,b){this.showPowerTeaser&&(this.setDstFull(b),this.getTeaser())};
PriceGraphs.prototype._depChangeHndl=function(a,b){this._dataLoaded=!1;this.setDepFull(b);this._disableAutoReloading||this.load()};PriceGraphs.prototype._dstChangeHndl=function(a,b){this._dataLoaded=!1;this.setDstFull(b);this._disableAutoReloading||this.load()};PriceGraphs.prototype._depDateChangeHndl=function(a,b){this._dataLoaded=!1;this.setDepDate(b);this._disableAutoReloading||(this._datesCrossOver()&&!this._oneway?(this.setRetDate(this.depDate),this.load()):this.load(this.depGraphId))};
PriceGraphs.prototype._retDateChangeHndl=function(a,b){this._dataLoaded=!1;this.setRetDate(b);this._disableAutoReloading||(this._datesCrossOver()?(this.setDepDate(this.retDate),this.load()):this.load(this.retGraphId))};
PriceGraphs.prototype._retChangeHndl=function(){this._dataLoaded=!1;this.disableObservers();var a=this._getSelectedTripType();this.hide();a=="return"?(this._oneway=!1,this.setDepDate(dojo.byId(this._depDateInputId).value),this.setRetDate(dojo.byId(this._retDateInputId).value)):(this._oneway=!0,this.setDepDate(dojo.byId(this._depDateInputId).value));this._disableAutoReloading||this.load();this.bindObservers()};
PriceGraphs.prototype._prepareParams=function(){this._checkCodes();this._params="dep="+this.dep+"&dst="+this.dst+"&depDate="+this.depDate+"&depDeviation="+this.depDeviation+"&depFull="+encodeURIComponent(this.depFull)+"&depUrlName="+this.depUrlName+"&dstFull="+encodeURIComponent(this.dstFull)+"&dstUrlName="+this.dstUrlName;if(!this._oneway)this._params=this._params+"&retDate="+this.retDate+"&retDeviation="+this.retDeviation;this.showFoldLink&&(this._params+="&showFoldLink=1")};
PriceGraphs.prototype._paramsOK=function(){return(this.dep.trim()||this.depFull.trim())&&(this.dst.trim()||this.dstFull.trim())&&this.depDate};
PriceGraphs.prototype._checkCodes=function(){var a=dojo.byId(this._hidden_depInputId).value.split("|"),b=dojo.byId(this._hidden_dstInputId).value.split("|");a.length>2&&this.depFull==a[0]&&a[1].length>0&&a[2].length>0?(this.setDepUrlName(a[1]),this.setDep(a[2])):(this.setDep(""),this.setDepUrlName(""));b.length>2&&this.dstFull==b[0]&&b[1].length>0&&b[2].length>0?(this.setDstUrlName(b[1]),this.setDst(b[2])):(this.setDst(""),this.setDstUrlName(""))};
PriceGraphs.prototype._getSelectedTripType=function(){return dojo.byId(this._onewayInputId).checked?this._onewayInputId:this._returnInputId};PriceGraphs.prototype._datesCrossOver=function(){var a=null;dep4cmp=this.depDate.split(".")[0].length==4?this.depDate:this.depDate.split(".").reverse().join(".");this.retDate&&(a=this.retDate.split(".")[0].length==4?this.retDate:this.retDate.split(".").reverse().join("."));return dep4cmp>=a};function graphRequestQueue(){this._queue=[]}
graphRequestQueue.prototype.add=function(a,b){this._queue[0]={params:a,reloadOne:b}};graphRequestQueue.prototype.pop=function(){return this._queue.pop()};graphRequestQueue.prototype.isEmpty=function(){return this._queue.length==0};RequestQueue=new graphRequestQueue;
(function(a,b,c){b.PriceGraphsHtml5=jQuery.Class({init:function(a,b,c,g,h,j,k){this.depGraphId=a;this.retGraphId=b;this.graphUrl=c;this.teaserId=g;this.teaserUrl=h;this.foldedGraphId=j;this.showPowerTeaser=k;this.showFoldLink=!1;this.retDeviation=this.depDeviation=this.retDate=this.depDate=this.dstUrlName=this.dstFull=this.dst=this.depUrlName=this.depFull=this.dep=this._params="";this._oneway=!0;this._folded=!1;this._observeIntervalForTeaser=this._observeInterval=1E3;this._depInputId="departure";
this._hidden_depInputId="dep_hidden";this._dstInputId="destination";this._hidden_dstInputId="dst_hidden";this._depDateInputId="DEPD";this._retDateInputId="RETD";this._onewayInputId="oneway";this._returnInputId="return";this._tripTypeInputName="type";this._disableAutoReloading=this._callerObj=this._activeRequestParams=this.AJAX_IN_PROGRESS=!1;this._observers=[];this._dataLoaded=this._foldingLocked=!1;this._chartSelector="div.html5-graph";this._chartDetails="flightSearchTabs-chartDetails";this._otherChanges=
!1},setObservables:function(b){var c=this;a.each("depInputId,hidden_depInputId,dstInputId,hidden_dstInputId,depDateInputId,retDateInputId,onewayInputId,returnInputId".split(","),function(a,g){b[g]&&(c["_"+g]=b[g])})},setParams:function(a,b,c,g,h,j,k,l){this.setDep(a);this.setDepFull(b);this.setDepUrlName(c);this.setDst(g);this.setDepDate(h);this.setRetDate(j);this.setDepDeviation(k);this.setRetDeviation(l)},getTeaser:function(){if(this.showPowerTeaser){this._prepareParams();var a=this;this._paramsOK()&&
this.teaserId&&this.teaserUrl&&(teaserLoader=dojo.xhrGet({url:this.teaserUrl+"?"+this._params,handleAs:"json",load:function(b){b.length==2?(a.showTeaser(b[0]),eval(b[1]+"")):a.noResults()},error:function(){a.error()}}))}},refresh:function(b,c,f){this._dataLoaded=!1;if(c)this._callerObj=c;if(String.isString(b))b=b.match(this._oneway?/\/([0-9]{4}-[0-9]{2}-[0-9]{2})\//i:/\/([0-9]{4}-[0-9]{2}-[0-9]{2})\/[0-9]\/([0-9]{4}-[0-9]{2}-[0-9]{2})\//i),b.length==3&&!this._oneway?(this.setFormDates(b[f=="out"?
1:2],f),this.load()):b.length==2&&this._oneway&&(this.setFormOutboundDate(b[1]),this.load());else{if(this._oneway)b=b.depd,Date.isDate(b)&&(b=a.format(b,"yyyy-MM-dd")),this.setFormOutboundDate(b);else{if(Date.isDate(b.depd))b.depd=a.format(b.depd,"yyyy-MM-dd");if(Date.isDate(b.retd))b.retd=a.format(b.retd,"yyyy-MM-dd");this.setFormDates(b,f)}this.load()}},setOutboundDate:function(b){this.disableObservers();if(b=a.parseDate(b,"yyyy-MM-dd")){if(this.setDepDate(b),!this._oneway){var c=a.parseDate(a("#"+
this._retDateInputId).val());if(b>c)this.setRetDate(c),this._dataLoaded=!1,this.load()}}else this.error();this.bindObservers()},setFormDates:function(b,c){this.disableObservers();if(String.isString(b)){var f,g;c=="out"?(f=a.parseDate(b,"yyyy-MM-dd"),g=a.parseDate(a("#"+this._retDateInputId).val())):(f=a.parseDate(a("#"+this._depDateInputId).val()),g=a.parseDate(b,"yyyy-MM-dd"))}else f=a.parseDate(b.depd,"yyyy-MM-dd"),g=b.retd?a.parseDate(b.retd,"yyyy-MM-dd"):a.parseDate(a("#"+this._retDateInputId).val());
f>=g&&(c=="in"?f=g:g=f);this.setDepDate(f);this.setRetDate(g);this.bindObservers()},setFormOutboundDate:function(a){this.disableObservers();this.setDepDate(a);this.bindObservers()},setInboundDate:function(b){this.disableObservers();if(b=a.parseDate(b,"yyyy-MM-dd")){if(this.setRetDate(b),a.parseDate(a("#"+this._depDateInputId).val())>b)this.setDepDate(b),this._dataLoaded=!1,this.load()}else this.error();this.bindObservers()},load:function(b,c){var b=this._oneway||!this.retDate?!1:b,c=c||!1,f=a("#"+
this.depGraphId+" "+this._chartSelector),g=new Date(f.data("currentDate")),h=g?(new Date(g.setHours(0,0,0))).getFirstDayOfMonth():null,j=a("#"+this.retGraphId+" "+this._chartSelector),k=new Date(j.data("currentDate")),l=k?(new Date(k.setHours(0,0,0))).getFirstDayOfMonth():null,m=a.parseDate(a("#"+this._depDateInputId).val(),"d"),p=m?(new Date(m.setHours(0,0,0))).getFirstDayOfMonth():null,o=a.parseDate(a("#"+this._retDateInputId).val(),"d"),n=o?(new Date(o.setHours(0,0,0))).getFirstDayOfMonth():null,
q=a.parseDate(this.depDate,"yyyy-MM-dd"),r=q?(new Date(q.setHours(0,0,0))).getFirstDayOfMonth():null,t=a.parseDate(this.retDate,"yyyy-MM-dd"),u=t?(new Date(t.setHours(0,0,0))).getFirstDayOfMonth():null,g=m&&(this._otherChanges||!g||!h.dateEqualsTo(p)||!q||!h.dateEqualsTo(r)),k=o&&(this._otherChanges||!k||!l.dateEqualsTo(n)||!t||!l.dateEqualsTo(u));c&&(!g&&(!b||b==this.depGraphId)&&f&&f.find("#"+f.attr("id")+"-"+this.depDate).click(),!k&&(!b||b==this.retGraphId)&&j&&j.find("#"+j.attr("id")+"-"+this.retDate).click());
if(b!=this.depGraphId||g)if(b!=this.retGraphId||k){if(!b)if(g){if(!k)b=this.depGraphId}else if(k)b=this.retGraphId;else return;this._prepareParams();this.loadGraphs(b,c)}},setDep:function(a){this.dep=a},setDepFull:function(a){this.depFull=a},setDepUrlName:function(a){this.depUrlName=a},setDst:function(a){this.dst=a},setDstFull:function(a){this.dstFull=a},setDstUrlName:function(a){this.dstUrlName=a},setDepDate:function(b){Date.isDate(b)||(b=a.parseDate(b,["d","yyyy-MM-dd"]));this.depDate=a.format(b,
"yyyy-MM-dd")},setRetDate:function(b){b==null?(this._oneway=!0,this.retDate=c):(this._oneway=!1,Date.isDate(b)||(b=a.parseDate(b,["d","yyyy-MM-dd"])),this.retDate=a.format(b,"yyyy-MM-dd"))},setDepDeviation:function(a){this.depDeviation=a},setRetDeviation:function(a){this._oneway=!1;this.retDeviation=a},loadGraphs:function(b,c){var f=this;this._oneway?this.hideRet():b=b||null;c=c||!1;!this.AJAX_IN_PROGRESS&&this._paramsOK()?(this._callerObj&&a(this._callerObj).unbind("click").bind("click",function(){return!1}).css({color:"#ddd",
fill:"#ddd",cursor:"wait"}),this.AJAX_IN_PROGRESS=!0,this._prepareParams(),this._activeRequestParams=this._params,a.ajax(this.graphUrl,{dataType:"json",data:this._activeRequestParams,success:function(a){if(a.length==(f._oneway?1:2)){f.onResults();if(!b||b==f.depGraphId){var h=f.showDep(a[0]);h&&c&&h.find("#"+h.attr("id")+"-"+f.depDate).click()}if(b===null||b==f.retGraphId)(h=f.showRet(a[1]))&&c&&h.find("#"+h.attr("id")+"-"+f.retDate).click()}else f.noResults();f.AJAX_IN_PROGRESS=!1;if(!RequestQueue.isEmpty())a=
RequestQueue.pop(),f._params=a.params,f.loadGraphs(a.reloadOne)},error:function(){f.error();f.AJAX_IN_PROGRESS=!1}})):this._paramsOK()&&this._activeRequestParams!=this._params&&RequestQueue.add(this._params,b)},showTeaser:function(b){b&&this.teaserId&&a("#"+this.teaserId).html(b)},showDep:function(b){var c=null;b&&(c=a("#"+this.depGraphId),c=JSON.isJSON(b)?c.find(this._chartSelector).chart(a.parseJSON(b)):c.html(b).find(this._chartSelector),this._folded||this.unfoldDep());return c},showRet:function(b){var c=
null;b&&(c=a("#"+this.retGraphId),c=JSON.isJSON(b)?c.find(this._chartSelector).chart(a.parseJSON(b)):c.html(b).find(this._chartSelector),this._folded||this.unfoldRet());return c},hideRet:function(){this._oneway=!0;a("#"+this.retGraphId).hide()},hide:function(){a("#"+this.depGraphId+", #"+this.retGraphId+", #"+this._chartDetails).hide()},fold:function(){if(!this._foldingLocked)a("#"+this.depGraphId+", #"+this.retGraphId+", #"+this._chartDetails).hide(),a("#"+this.foldedGraphId).toggle(this.hasResults()),
this._folded=!0},unfold:function(){if(!this._foldingLocked)a("#"+this.foldedGraphId).hide(),this._folded=!1,this._dataLoaded||this.load(),this.unfoldDep(),this.retDate!=""&&!this._oneway&&this.unfoldRet()},unfoldDep:function(){a("#"+this.depGraphId).parent().andSelf().show()},unfoldRet:function(){a("#"+this.retGraphId).parent().andSelf().show()},lockFolding:function(){this._foldingLocked=!0;a("#"+this.foldedGraphId).hide()},unlockFolding:function(){this._foldingLocked=!1;a("#"+this.foldedGraphId).toggle(this.hasResults())},
show:function(a,b){this.showDep(a);this.showRet(b)},noResults:function(){this.hide()},onResults:function(){this._dataLoaded=!0},hasResults:function(){return a("#"+this.depGraphId+", #"+this.retGraphId).children().length==2-a("#"+this._onewayInputId).is(":checked")},error:function(){this.hide()},bindObservers:function(){var b=this,c=this._getSelectedTripType(),f=a("#"+this._depInputId).val(),g=f,h=a("#"+this._dstInputId).val(),j=h,k=a("#"+this._depDateInputId).val(),l=a("#"+this._retDateInputId).val();
this._observers[0]=window.setInterval(function(){b._otherChanges=!1;b.refreshObservables&&b.refreshObservables();var j=b._getSelectedTripType();if(c!=j)b._otherChanges=!0,b._retChangeHndl(null,null);var j=a("#"+b._depInputId),g=j.val();if(f!=g)b._otherChanges=!0,f=g,b._depChangeHndl(j,g);j=a("#"+b._dstInputId);g=j.val();if(h!=g)b._otherChanges=!0,h=g,b._dstChangeHndl(j,g);var g=j=!1,o=a("#"+b._depDateInputId),n=o.val();k!=n&&(k=n,j=!0);var q=a("#"+b._retDateInputId),r=q.val();l!=r&&(l=r,g=!0);j&&
g?b._bothDatesChangeHndl(o,n,q,r):j?b._depDateChangeHndl(o,n):g&&b._retDateChangeHndl(q,r)},this._observeInterval);this.showPowerTeaser&&this.teaserId&&this.teaserUrl&&(this._observers[1]=window.setInterval(function(){var c=a("#"+b._depInputId),h=c.val();g!=h&&(g=h,b._loadPowerTeaserDep(c,h));c=a("#"+b._dstInputId);h=c.val();j!=h&&(j=h,b._loadPowerTeaserDst(c,h))},this._observeIntervalForTeaser))},disableObservers:function(){a.each(this._observers,function(a,b){window.clearInterval(b)})},_loadPowerTeaserDep:function(a,
b){this.showPowerTeaser&&(this.setDepFull(b),this.getTeaser())},_loadPowerTeaserDst:function(a,b){this.showPowerTeaser&&(this.setDstFull(b),this.getTeaser())},_depChangeHndl:function(a,b){this._dataLoaded=!1;this.setDepFull(b);this._disableAutoReloading||this.load()},_dstChangeHndl:function(a,b){this._dataLoaded=!1;this.setDstFull(b);this._disableAutoReloading||this.load()},_depDateChangeHndl:function(a,b){this._dataLoaded=!1;this.setDepDate(b);this._disableAutoReloading||this.load(this.depGraphId,
!0)},_retDateChangeHndl:function(a,b){this._dataLoaded=!1;this.setRetDate(b);this._disableAutoReloading||this.load(this.retGraphId,!0)},_bothDatesChangeHndl:function(a,b,c,g){this._dataLoaded=!1;this.setDepDate(b);this.setRetDate(g);this._disableAutoReloading||this.load(null,!0)},_retChangeHndl:function(){this._dataLoaded=!1;this.disableObservers();var b=this._getSelectedTripType();this.hide();b=="return"?(this._oneway=!1,this.setDepDate(a("#"+this._depDateInputId).val()),this.setRetDate(a("#"+this._retDateInputId).val())):
(this._oneway=!0,this.setDepDate(a("#"+this._depDateInputId).val()));if(!this._disableAutoReloading){this.fold();var b=a("#"+this.depGraphId+", #"+this.retGraphId).empty(),c=a("#"+this._chartDetails);c.length&&(b.parent().height("-="+c.outerHeight()),c.remove());this.load()}this.bindObservers()},_prepareParams:function(){this._checkCodes();this._params={jq:1,dep:this.dep,dst:this.dst,depDate:this.depDate?Date.isDate(this.depDate)?this.depDate.toISODateString():this.depDate.toString():null,depDeviation:this.depDeviation,
depFull:this.depFull,depUrlName:this.depUrlName,dstFull:this.dstFull,dstUrlName:this.dstUrlName};!this._oneway&&this.retDate&&a.extend(this._params,{retDate:this.retDate?Date.isDate(this.retDate)?this.retDate.toISODateString():this.retDate.toString():null,retDeviation:this.retDeviation});this.showFoldLink&&a.extend(this._params,{showFoldLink:1});this.hasResults()&&a.extend(this._params,{dataOnly:1})},_paramsOK:function(){return(this.dep.trim()||this.depFull.trim())&&(this.dst.trim()||this.dstFull.trim())&&
this.depDate},_checkCodes:function(){var b=(a("#"+this._hidden_depInputId).val()||"").split("|"),c=(a("#"+this._hidden_dstInputId).val()||"").split("|");b.length>2&&this.depFull==b[0]&&b[1].length>0&&b[2].length>0?(this.setDepUrlName(b[1]),this.setDep(b[2])):(this.setDep(""),this.setDepUrlName(""));c.length>2&&this.dstFull==c[0]&&c[1].length>0&&c[2].length>0?(this.setDstUrlName(c[1]),this.setDst(c[2])):(this.setDst(""),this.setDstUrlName(""))},_getSelectedTripType:function(){return a("#"+this._onewayInputId).is(":checked")?
this._onewayInputId:this._returnInputId},_datesCrossOver:function(){var b=a.parseDate(this.depDate,"yyyy-MM-dd"),c=this.retDate?a.parseDate(this.retDate,"yyyy-MM-dd"):null;return b>=c}});b.GraphRequestQueue=jQuery.Class({init:function(){this._queue=[]},add:function(a,b){this._queue[0]={params:a,reloadOne:b}},pop:function(){return this._queue.pop()},isEmpty:function(){return!this._queue.length}});b.RequestQueue=new GraphRequestQueue})(jQuery,window);
var OfferSearchForm={createDestinationSelectBox:function(a,b,c,d){var e='<select name="dst" id="destination" tabindex="1">';d&&(e+='<option value="">'+translate("LANG_SEARCHFORM_ALL")+"</option>");if(b[a]!=void 0)for(var d=0,f=b[a].length;d<f;d++){var g=b[a][d];e+='<option value="'+g[0]+'"'+(c==g[0]?' selected="selected"':"")+">"+g[1]+"</option>"}e+="</select>";dojo.byId("destination_placeholder").innerHTML=e}};function FlightVerifier(a){this.verifyBaseUrl=a}
FlightVerifier.prototype.setLoaderImg=function(a){this.loaderImg=a};
FlightVerifier.prototype.verifyPrice=function(a,b,c){var d=document.getElementById("verifyLink"+a),e=document.getElementById("price"+a),f=document.getElementById("lastupdate"+a);if(d)d.style.color="#929292",d.style.cursor="progress",d.href="#",d.innerHTML='<img src="'+this.loaderImg+'" onFocus="blur()" />';a={tripid:a};c&&(a.pc=c);var g=this;dojo.xhrPost({url:this.verifyBaseUrl,content:a,handleAs:"json",load:function(a){a.status==1?(g.changeFlightAge(f,a.result.updatedBefore),g.changeLinks(d,a.result.deepLinkUrl,
a.result.searchBackUrl),g.markPriceOk(e),a.result.price!=b&&g.markPriceChanged(e,a.result.formattedPrice)):g.markError(e,d,f)},error:function(){g.markError(e,d,f)}})};FlightVerifier.prototype.changeFlightAge=function(a,b){if(a)a.innerHTML=b};
FlightVerifier.prototype.markError=function(a,b,c){if(a)a.className="offer_price_changed";if(b)b.innerHTML=translate("LANG_FLIGHTVIEW_BOOKED_OUT"),b.style.color="red",b.style.cursor="text",b.href="javascript:void(0)";if(c&&(c.innerHTML="&nbsp;",c.nextSibling))c.nextSibling.data=" "};
FlightVerifier.prototype.changeLinks=function(a,b,c){if(a){a.innerHTML=translate("LANG_FLIGHTVIEW_BOOK");a.style.color="";a.style.cursor="pointer";a.href=b;a.target="_blank";a.onclick={};var b=document.createElement("a"),d=document.createTextNode(" | ");b.setAttribute("href",c);b.innerHTML=translate("LANG_FLIGHTBACK");b.setAttribute("title",translate("LANG_FLIGHTBACK"));a.parentNode.appendChild(d);a.parentNode.appendChild(b)}};FlightVerifier.prototype.markPriceOk=function(a){if(a)a.className="offer_price_ok"};
FlightVerifier.prototype.markPriceChanged=function(a,b){a.innerHTML="<div>"+b+"</div>"};function EcondaTagsRenderer(){}EcondaTagsRenderer.render=function(a,b){EcondaTagsRenderer.reset();EcondaTagsRenderer.targetNode=dojo.byId(a);dojo.query("*",EcondaTagsRenderer.targetNode).forEach(function(a){dojo.destroy(a)});EcondaTagsRenderer.renderAnchorTags(a,b);dojo.create("script",{type:"text/javascript",src:"/js/common/emos2.js"},EcondaTagsRenderer.targetNode)};
EcondaTagsRenderer.renderAnchorTags=function(a,b){EcondaTagsRenderer.targetNode=dojo.byId(a);dojo.forEach(b,function(a){var b="";if(a.rev)b=a.rev;dojo.create("a",{name:"emos_name",title:a.title,rel:encodeURIComponent(a.rel),rev:b},EcondaTagsRenderer.targetNode)})};
EcondaTagsRenderer.reset=function(){dojo.query('a[name="emos_name"]').forEach(function(a){dojo.destroy(a)});dojo.query('script[src*="emos2.js"]').forEach(function(a){dojo.destroy(a)});if(window.emosCustomPageArray)window.emosCustomPageArray=null;if(window.emosCustomMultiArray&&window.emosMultiArrayID)window.emosCustomMultiArray=null,window.emosMultiArrayID=null};EcondaTagsRenderer.setCareaTag=function(a){var b=dojo.query('a[name="emos_name"][title="carea"]');dojo.attr(b[0],"rel",a)};
EcondaTracker=function(){};EcondaTracker.trackEvent=function(a,b){b=b?b:1;if(window.emosPropertiesEvent){if(!a.content){var c=dojo.query('a[name="emos_name"][title="content"]');if(c[0]&&c[0].rel)a.content=decodeURIComponent(c[0].rel),a.pageId=a.content}setTimeout(function(){EcondaTagsRenderer.reset();window.emosPropertiesEvent(a)},1E3)}else b<5&&setTimeout(function(){EcondaTracker.trackEvent(a,b+1)},2E3)};
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){for(var b="",c,d,e,f,g,h,j=0,a=Base64._utf8_encode(a);j<a.length;)c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=a.charCodeAt(j++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,h=e&63,isNaN(d)?g=h=64:isNaN(e)&&(h=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(c)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return b},decode:function(a){for(var b="",c,d,e,f,g,h=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<
a.length;)c=this._keyStr.indexOf(a.charAt(h++)),d=this._keyStr.indexOf(a.charAt(h++)),f=this._keyStr.indexOf(a.charAt(h++)),g=this._keyStr.indexOf(a.charAt(h++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b+=String.fromCharCode(c),f!=64&&(b+=String.fromCharCode(d)),g!=64&&(b+=String.fromCharCode(e));return b=Base64._utf8_decode(b)},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);d<128?b+=String.fromCharCode(d):(d>127&&d<2048?b+=String.fromCharCode(d>>
6|192):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128)),b+=String.fromCharCode(d&63|128))}return b},_utf8_decode:function(a){for(var b="",c=0,d=c1=c2=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|c2&63),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63),c+=3);return b}};
function GoogleAdsLinkGenerator(a,b,c,d,e){this.baseUrl=a;this.origin=b;this.query=c;this.affiliate=d;this.placement=e}
GoogleAdsLinkGenerator.prototype.getLink=function(a,b,c,d,e){return this.baseUrl+"?origin="+this.origin+"&url="+encodeURIComponent(a.url)+"&terms="+encodeURIComponent(this.query)+"&prv=SWOODOOGOOGLE&cr="+this.safe64("0|"+c+"|"+d)+"&adtype="+encodeURIComponent(a.type)+"&displayRail="+b+"&railsize="+e+"&lid="+encodeURIComponent(this.generateUniqueId(a))+"&istest=false&a="+encodeURIComponent(this.affiliate)+"&atag="+encodeURIComponent(this.placement)};
GoogleAdsLinkGenerator.prototype.generateUniqueId=function(a){return this.safe64(Math.random()+" "+(new Date).getTime()+a.url).substring(0,32)};GoogleAdsLinkGenerator.prototype.safe64=function(a){return encodeURIComponent(Base64.encode(a).replace("+","_").replace("/","$"))};dojo.provide("swoodoo.PeriodicalUpdater");dojo.require("dojox.timing");
dojo.declare("swoodoo.PeriodicalUpdater",[dojox.timing.Timer],{constructor:function(a,b,c){this.deferred=null;this.ajaxIsRunning=!1;this.url=b;this.container=a;if(typeof c.frequency=="undefined")c.frequency=1E3;if(typeof c.decay=="undefined")c.decay=1;this.currentFrequency=this.frequency=c.frequency;this.decay=c.decay;this.params=c.params;this.lastResponse="";this.resetFrequency();this.onSuccess=function(b){a.innerHTML=b};if(typeof c.onSuccess!="undefined")this.onSuccess=c.onSuccess;if(typeof c.onStart!=
"undefined")this.onStart=c.onStart;if(typeof c.onStop!="undefined")this.onStop=c.onStop;this.onException=function(){};if(typeof c.onException!="undefined")this.onException=c.onException;this.cycleAjax(this)},resetFrequency:function(){this.currentFrequency=this.frequency;this.setInterval(this.currentFrequency)},evaluateFrequency:function(){this.currentFrequency*=this.decay;this.setInterval(this.currentFrequency)},cycleAjax:function(a){this.ajaxIsRunning=!0;this.deferred=dojo.xhrPost({url:a.url,content:a.params,
load:function(b){a.ajaxIsRunning=!1;a.lastResponse==b?a.evaluateFrequency():(a.onSuccess(b),a.resetFrequency(),a.lastResponse=b)},error:function(b){a.ajaxIsRunning=!1;(!b.dojoType||b.dojoType!="cancel")&&console.error(b);a.onException(data);return!1}})},abort:function(){this.deferred&&this.deferred.cancel&&this.ajaxIsRunning&&this.deferred.cancel()},onTick:function(){this.ajaxIsRunning||this.cycleAjax(this)}});
dojo.isIE&&dojo.mixin(dojo,{__toDom:dojo._toDom,_toDom:function(a,b){a.match(/^(\s*<(script|style)\b)/i)&&(a='<input type="hidden" class="--ms-hidden"/>'+a);return dojo.__toDom(a,b)}});dojo.provide("swoodoo.mixin");dojo.provide("swoodoo.mixinRecursive");
dojo.mixin(swoodoo,{mixin:dojo.mixin,_mixinTobj:{},_mixinRecursive:function(a,b){for(var c in b){var d=b[c],e=typeof d;a[c]===void 0||a[c]===null?a[c]=e!="array"&&(e!="object"||d.nodeType)?d:dojo.clone(d):a[c]!=d&&(typeof a[c]!=e||e!="array"&&(e!="object"||d.nodeType)?a[c]=d:swoodoo._mixinRecursive(a[c],d))}if(dojo.isIE&&b&&(d=b.toString,typeof d=="function"&&d!=a.toString&&d!="\nfunction toString() {\n    [native code]\n}\n"))a.toString=b.toString;return a},mixinRecursive:function(a,b){a||(a={});
for(var c=1,d=arguments.length;c<d;c++)swoodoo._mixinRecursive(a,arguments[c]);return a}});dojo.provide("swoodoo.ie");dojo.mixin(swoodoo.ie,{isReady:function(a){return!dojo.isIE||(a||document).readyState=="complete"},onReady:function(a,b){b=b||document;b.attachEvent("onreadystatechange",function(){b.readyState=="complete"&&a()})}});dojo.provide("swoodoo.scripts");
dojo.mixin(swoodoo.scripts,{eval:function(a){dojo.query("script",a).forEach(function(a){try{var c=a.innerHTML;c&&dojo.eval(c)}catch(d){console&&console.log&&console.log(d)}})}});dojo.require("dojo.date");dojo.require("dojo.date.locale");dojo.provide("swoodoo.date");dojo.mixin(swoodoo.date,dojo.date);
dojo.mixin(swoodoo.date,{sub:function(a,b,c){return swoodoo.date.add(a,b,-c)},subtract:function(a,b,c){return swoodoo.date.add(a,b,-c)},getWeek:function(a){var b=new Date(a.getFullYear(),0,1);return Math.ceil(((a-b)/864E5+b.getDay()+1)/7)},getISOWeek:function(a){var a=new Date(a.getFullYear(),a.getMonth(),a.getDate()-(a.getDay()+6)%7+3),b=new Date(a.getFullYear(),0,4);return Math.round((a-b)/6048E5)+1}});dojo.provide("swoodoo.RegExp");
RegExp.escape=function(a){return a.replace(RegExp("[.*+?|()\\[\\]{}\\\\]","g"),"\\$&")};dojo.provide("swoodoo.Location");
dojo.mixin(swoodoo.Location,{defaultValue:"home",getHash:function(){return window.location.hash},setHash:function(a){window.location.hash=a;return window.location.hash},_init:function(a){return decodeURIComponent(a||swoodoo.Location.getHash()).replace(RegExp("#"+swoodoo.Location.defaultValue+"$"),"#")},_done:function(a){return a.replace(/\|$/,"").replace("#|","#").replace("||","|").replace(/#$/,"#"+swoodoo.Location.defaultValue)},getParam:function(a,b){var b=swoodoo.Location._init(b),c;return(c=b.match(RegExp("(#|\\/|\\|)"+
a+"(\\/|\\|)([^\\|]+)($|\\/|\\|)")))?c[3]:null},issetParam:function(a,b){b=swoodoo.Location._init(b);return b.match(RegExp("(#|\\/|\\|)"+a+"($|\\/|\\|)"))!==null},setParam:function(a,b,c){c=swoodoo.Location._init(c);if(dojo.isObject(a)){if(dojo.isArray(a))return dojo.forEach(a,function(a){c=swoodoo.Location.removeParam(a,c)}),swoodoo.Location._done(c);for(var d in a)c=swoodoo.Location.setParam(d,a[d],c);return swoodoo.Location._done(c)}if(b==void 0)return swoodoo.Location.removeParam(a,c);b=""+b;
swoodoo.Location.getParam(a,c)!=b&&(c=swoodoo.Location.removeParam(a,c),b.length>0&&(c.indexOf("#")==-1&&(c+="#"),c+="|"+a+"|"+b));return swoodoo.Location._done(c)},removeParam:function(a,b){b=swoodoo.Location._init(b);return dojo.isArray(a)?(dojo.forEach(a,function(a){b=swoodoo.Location.removeParam(a,b)}),swoodoo.Location._done(b)):swoodoo.Location._done(b.replace(RegExp("(#|\\|)"+a+"\\|[^\\|]+($||)"),"$1"))}});dojo.provide("swoodoo.ComboBoxReadStore");dojo.require("dojox.data.QueryReadStore");
dojo.declare("swoodoo.ComboBoxReadStore",dojox.data.QueryReadStore,{fetch:function(a){a.serverQuery={q:a.query.name,lastSelectedValue:this._getLastSelectedValue()};return this.inherited(arguments)},_xhrFetchHandler:function(a,b,c){a=this._filterResponse(a);if(a.label)this._labelAttr=a.label;var d=a.numRows||-1;this._items=[];dojo.forEach(a.items,function(a){this._items.push({i:a,r:this})},this);a=a.identifier;this._itemsByIdentity={};if(a){this._identifier=a;var e;for(e=0;e<this._items.length;++e){var f=
this._items[e].i,g=f[a];this._itemsByIdentity[g]||(this._itemsByIdentity[g]=f)}}else{this._identifier=Number;for(e=0;e<this._items.length;++e)this._items[e].n=e}d=this._numRows=d===-1?this._items.length:d;c(this._items,b,d);this._numRows=d},_getLastSelectedValue:function(){return dojo.byId(this.hiddenValueId)?dojo.byId(this.hiddenValueId).value:""}});dojo.provide("swoodoo.widgets.FormErrorMessage");dojo.require("dijit._Templated");
dojo.declare("swoodoo.widgets.FormErrorMessage",[dijit._Widget,dijit._Templated],{errorMessageLine1:"",errorMessageLine2:"",errorMessageLine3:"",buttonCaption:"",formNode:null,constructor:function(a){try{this.translations=translatedStrings}catch(b){}if(a.messages[0])this.errorMessageLine1=a.messages[0];if(a.messages[1])this.errorMessageLine2=a.messages[1];if(a.messages[2])this.errorMessageLine3=a.messages[2];dojo.mixin(this,a);if(!this.buttonCaption)this.buttonCaption=this.translations.LANG_DIALOG_CLOSE},
postCreate:function(){this.inherited(arguments);this._display()},getChildren:function(){return dojo.isIE?[]:this.inherited(arguments)},_display:function(){dojo.isIE&&dojo.style(this.formNode,"position","relative");this.containerNode=this.containerNode||dojo.query("div",dojo.body())[0];this.placeAt(this.containerNode,"last");var a=dojo.byId("searchform-error-layer-blanket"),b=dojo.byId("searchform-error-layer-iframe"),c=dojo.byId("searchform-error-layer-message"),d=dojo.contentBox(this.formNode),e=
dojo.marginBox(this.formNode),f=this._calcOffset(this.formNode),g=dojo.contentBox(c);dojo.style(a,"width",d.w+10+"px");dojo.style(a,"height",d.h+10+"px");dojo.style(a,"left",e.l-5+"px");dojo.style(a,"top",f.t-5+"px");dojo.isIE<=6?(dojo.style(b,"width",d.w+10+"px"),dojo.style(b,"height",d.h+10+"px"),dojo.style(b,"left",e.l-5+"px"),dojo.style(b,"top",f.t-5+"px")):dojo.style(b,"display","none");a=Math.round((d.w-g.w)/2);d=Math.round((d.h-g.h)/2);dojo.style(c,"left",e.l+a+"px");dojo.style(c,"top",f.t+
d+"px");c=dojo.byId("searchform-error-layer-btn-a");dojo.connect(c,"onclick",this,function(){this.destroy(!1)})},templatePath:dojo.moduleUrl("swoodoo.widgets","templates/FormErrorMessage.html"),baseClass:"formErrorMessage",_calcOffset:function(a){var b={l:a.offsetLeft,t:a.offsetTop};a.offsetParent&&(a=this._calcOffset(a.offsetParent),b.l+=a.l,b.t+=a.t);return b}});swoodoo.widgets.FormErrorMessage.display=function(a){new swoodoo.widgets.FormErrorMessage(a)};dojo.require("dojox.fx._core");dojo.require("dojox.fx.scroll");
dojo.mixin(dojox.fx,{smoothScroll:function(a){if(!a.target)a.target=dojo.coords(a.node,!0);var b=typeof a.win.nodeName==="undefined",c=new dojo._Animation(dojo.mixin({beforeBegin:function(){this.curve&&delete this.curve;var d=b?dojo._docScroll():{x:a.win.scrollLeft,y:a.win.scrollTop};c.curve=new dojox.fx._Line([d.x,d.y],[a.target.x,a.target.y])},onAnimate:b?function(b){a.win.scrollTo(b[0],b[1])}:function(b){a.win.scrollLeft=b[0];a.win.scrollTop=b[1]}},a));return c}});dojo.require("dijit.dijit");dojo.require("dijit.DialogUnderlay");
dojo.require("dijit.Dialog");dojo.extend(dijit.DialogUnderlay,{_layout:dijit.DialogUnderlay.prototype.layout,layout:function(){this._layout(arguments);var a=this.node.style,b=this.domNode.style;b.display="none";b.width=a.width;b.height=a.height;b.display="block"}});dojo.provide("swoodoo.widgets.Dialog");
dojo.declare("swoodoo.widgets.Dialog",[dijit.Dialog],{draggable:!1,_fixSizes:!1,templateString:'<div class="modal-box dijitDialog modbox" tabindex="-1" waiRole="dialog" waiState="labelledby-${id}_title"><div class="bg bg_n"></div><div class="bg bg_ne"></div><div class="bg bg_e"></div><div class="bg bg_se"></div><div class="bg bg_s"></div><div class="bg bg_sw"></div><div class="bg bg_w"></div><div class="bg bg_nw"></div><div dojoAttachPoint="titleBar" class="dijitDialogTitleBar"><span id="FOCUS" dojoAttachPoint="closeButtonNode" class="modalDialogCloseIcon" dojoAttachEvent="onclick: onCancel, onmouseenter: _onCloseEnter, onmouseleave: _onCloseLeave" title="${buttonCancel}"></span></div><div dojoAttachPoint="containerNode" class="dijitDialogPaneContent" id="dijitDialogPaneContent"></div></div>',loadingMessage:'<div class="dijitContentPaneLoading"><div class="hotel-dialog-image"><img src="'+
imagesPath+'activationIndicator.gif" style="margin-bottom:4px"/><br/>'+translate("LANG_HOTEL_DETAILS_LOADING")+"&hellip;</div></div>",errorMessage:'<div class="dijitContentPaneError">${errorState}</div>',_reloadPosition:function(){this._relativePosition=null;this._position()},_getFocusItems:function(){this._firstFocusItem=dojo.byId("FOCUS");this._lastFocusItem=dojo.byId("FOCUS")},_position:function(){if(!dojo.hasClass(dojo.body(),"dojoMove")){var a=this._relativePosition;if(!a){var b=this.domNode,
c=dijit.getViewport(),d=dojo.marginBox(b),a=0,a=c.h<=d.h+40?25:(c.h-d.h)/2;this._relativePosition=a={l:(c.w-d.w)/2,t:a};d=Math.max(Math.floor(c.l+a.l),28);c=Math.max(Math.floor(c.t+a.t),28);dojo.style(b,{left:d+"px",top:c+"px"})}}},_size:function(){},_onKey:function(){},postCreate:function(){this.inherited(arguments);if(dojo.isIE<7){var a=this.domNode,b=dojo.style(a,"width"),c=dojo.style(a,"height");dojo.query(".dijitContentPaneLoading",a).style({width:b+"px","margin-top":Math.floor(c/2)+"px"});dojo.query(".dijitDialogPaneContent",
a).style({width:b+"px",height:c+"px"})}}});dojo.declare("swoodoo.widgets.slidersMouseDragTracker",[],{constructor:function(){},setMouseDragOrigin:function(a){this._mouseDragOrigin=a},getMouseDragOrigin:function(){return this._mouseDragOrigin},_mouseDragOrigin:null});var MouseDragTracker=eval("new swoodoo.widgets.slidersMouseDragTracker()");dojo.provide("swoodoo.widgets.slidingFilter");dojo.require("dijit.form.HorizontalSlider");
dojo.declare("swoodoo.widgets.slidingFilter",dijit.form.HorizontalSlider,{constructor:function(a){if(!a.width)a.width="165px";a.style="width: "+a.width+"; height: 15px";dojo.mixin(this,a)},applyFilterCallback:function(){},onChange:function(){this._setTitle()},postCreate:function(){this._titleNode=this._createTitleNode();this.hideLegendNode||this._createLegendNode();dojo.connect(this,"_onBarClick",this,function(){MouseDragTracker.setMouseDragOrigin(this)});dojo.connect(this.sliderHandle,"onmousedown",
this,function(){this._oldValue=this.value;MouseDragTracker.setMouseDragOrigin(this);dojo.query(".dijitSliderMoveableH",this.id).forEach(function(a){dojo.removeClass(a,"dijitSliderActive");dojo.addClass(a,"dijitSliderFocused")})});dojo.connect(document,"onmouseup",this,function(){var a=MouseDragTracker.getMouseDragOrigin();this==a&&(dojo.query(".dijitSliderMoveableH",this.id).forEach(function(a){dojo.removeClass(a,"dijitSliderFocused");dojo[this.value==this.maximum?"removeClass":"addClass"](a,"dijitSliderActive")},
this),MouseDragTracker.setMouseDragOrigin(null),a._applyFilter())});this.domNode.firstChild.firstChild.nextSibling.nextSibling.firstChild.nextSibling.style.width="4px";this.domNode.firstChild.firstChild.nextSibling.nextSibling.firstChild.nextSibling.nextSibling.style.width=this.width;this._setTitle();this.inherited(arguments);dojo.query(".dijitSliderMoveableH",this.domNode).forEach(function(a){this.value!=this.maximum&&dojo.addClass(a,"dijitSliderActive")},this)},showButtons:!1,_titleNode:null,_getFilterUrl:function(){return parseInt(this.value)<
this.maximum?this.filterUrl+parseInt(this.value):this.filterUrl.replace(/\/dist\//,"")},_setTitle:function(){if(this._titleNode)this._titleNode.innerHTML=parseInt(this.value)<this.maximum?this.titlePattern.replace(/%/,parseInt(this.value)):this.inactiveTitle},_createTitleNode:function(){if(dojo.isIE){var a=dojo.create("tr",{"class":"hotel-price-filter-title",innerHTML:'<td colspan="5"></td>'},this.domNode.firstChild,"first");return a.firstChild}else return a=dojo.create("tr",{"class":"hotel-price-filter-title"},
this.domNode.firstChild,"first"),dojo.create("td",{colspan:"5"},a)},_createLegendNode:function(){if(dojo.isIE)var a=dojo.create("tr",{"class":"hotel-price-filter-labels",innerHTML:'<td colspan="5" ></td>'},this.domNode.firstChild);else a=dojo.create("tr",{"class":"hotel-price-filter-labels"},this.domNode.firstChild),dojo.create("td",{colspan:"5"},a);this.name=="distanceFilter"?(dojo.create("div",{"class":"start-distance"},a.firstChild),dojo.create("div",{"class":"end-distance"},a.firstChild)):(dojo.create("div",
{"class":"start",innerHTML:this.minimum+" "+this.measurementUnit},a.firstChild),dojo.create("div",{"class":"end",innerHTML:this.maximum+" "+this.measurementUnit},a.firstChild))},_mouseWheeled:function(){},_applyFilter:function(){if(this._oldValue!=parseInt(this.value)){var a=this,b=a._getFilterUrl();setTimeout(function(){a.applyFilterCallback(a._getFilterUrl())},500);a.onApplyFilter(b,parseInt(this.value))}},onApplyFilter:function(){},_valueChanged:!1,_oldValue:0});dojo.provide("swoodoo.widgets.Selectbox");
dojo.require("dijit._Widget");
dojo.declare("swoodoo.widgets.Selectbox",dijit._Widget,{constructor:function(a){a||(a={});if(!a.title)a.title="";if(!a.titleElementId)a.titleElementId="side-filter-title";if(!a.titleElementClass)a.titleElementClass="side-filter-title";if(!a.selectElementClass)a.selectElementClass="side-filter-selectbox";if(!a.selectElementId)a.selectElementId="side-filter-selectbox";if(!a.selectElementOptions)a.selectElementOptions=[];if(!a.applyFilterCallback)a.applyFilterCallback=function(){};dojo.mixin(this.params,
a)},postCreate:function(){if(this.params.selectElementOptions.length!=0)this._titleNode=this._createTitleNode(),this._selectNode=this._createSelectNode(),dojo.connect(this._selectNode,"onchange",this,this.onChangeHNDL)},_createTitleNode:function(){return!this.params.title?void 0:dojo.create("div",{"class":this.params.titleElementClass,id:this.params.titleElementId,innerHTML:this.params.title},this.domNode,"first")},_createSelectNode:function(){var a=this.params.selectElementOptions,b=a.length;if(b!=
0){for(var c=dojo.create("select",{"class":this.params.selectElementClass,id:this.params.selectElementId,innerHTML:""},this.domNode),d=0;d<b;d++)a[d].selected==!0?dojo.create("option",{selected:"",value:a[d].value,innerHTML:a[d].name+"\n"},c):dojo.create("option",{value:a[d].value,innerHTML:a[d].name+"\n"},c);return c}},onChangeHNDL:function(){var a=this._selectNode.value,b=this._selectNode[this._selectNode.selectedIndex].text;this.applyFilterCallback(a);this.onApplyFilter(a,b)},onApplyFilter:function(){}});
dojo.provide("swoodoo.widgets.hotelPriceFilter");dojo.require("swoodoo.widgets.slidingFilter");
dojo.declare("swoodoo.widgets.hotelPriceFilter",eval("swoodoo.widgets.slidingFilter"),{constructor:function(a){a.value=parseInt(a.filterData.selectedMaxPrice)?parseInt(a.filterData.selectedMaxPrice):parseInt(a.filterData.maxPrice);a.maximum=parseInt(a.filterData.maxPrice);a.minimum=parseInt(a.filterData.minPrice);a.hideLegendNode=typeof a.hideLegendNode=="undefined"?!1:a.hideLegendNode;if(isNaN(a.minimum)&&isNaN(a.maximum))return this.destroy(),!1;a.discreteValues=parseInt(a.filterData.maxPrice)-
parseInt(a.filterData.minPrice);a.filterUrl=a.filterData.url;a.measurementUnit=a.currencySign;a.intermediateChanges=!0;if(!a.titlePattern)a.titlePattern="%"},_getFilterUrl:function(){return parseInt(this.value)<this.maximum?this.filterUrl+this.minimum+this.filterPartSeparator+parseInt(this.value)+this.filterPartSeparator+this.maximum:this.filterUrl.replace(/\/price\//,"")}});dojo.provide("swoodoo.widgets.hotelDistanceFilter");dojo.require("swoodoo.widgets.slidingFilter");
dojo.declare("swoodoo.widgets.hotelDistanceFilter",swoodoo.widgets.slidingFilter,{constructor:function(a){a.value=parseInt(a.filterData.selected)?parseInt(a.filterData.selected):parseInt(a.filterData.max);a.maximum=parseInt(a.filterData.max);a.minimum=parseInt(a.filterData.min);a.discreteValues=parseInt(a.filterData.max)-parseInt(a.filterData.min)+1;a.filterUrl=a.filterData.url;a.intermediateChanges=!0;if(!a.titlePattern)a.titlePattern="%"},_getFilterUrl:function(){return parseInt(this.value)<this.maximum?
this.filterUrl+parseInt(this.value):this.filterUrl.replace(/\/dist\//,"")}});dojo.provide("swoodoo.widgets.hotelCategoryFilter");dojo.require("dijit._Widget");
dojo.declare("swoodoo.widgets.hotelCategoryFilter",dijit._Widget,{templateString:'<div id="hotel-hategoryfilter"></div>',categoryImgs:[],constructor:function(a){a||(a={});if(!a.filterData)a.filterData=[];a.maxCategory=a.filterData.length;if(!a.minCategory)a.minCategory=0;if(!a.imgFilePath)a.imgFilePath=imagesPath;if(!a.imgFile)a.imgFile="Flt_HotelCategory_Active.png";if(!a.imgFileInactive)a.imgFileInactive="Flt_HotelCategory_InActive.png";if(!a.titlePattern)a.titlePattern="%";if(!a.inactiveTitle)a.inactiveTitle=
"";if(!a.applyFilterCallback)a.applyFilterCallback=function(){};if(!a.titleElementId)a.titleElementId="hotel-category-filter-title";dojo.mixin(this,a)},postCreate:function(){for(var a=this.imgFile,b=0;b<this.maxCategory;b++)this.filterData[b].selected?(a=this.imgFile,this.minCategory=b+1):a=this.imgFileInactive,a=dojo.create("img",{id:"hotel-category-img-"+b,src:this.imgFilePath+a,title:b+1,style:"cursor: pointer"}),this.categoryImgs[b]=a,this.domNode.appendChild(a),dojo.connect(a,"onmouseover",this,
this.onMouseOverHNDL),dojo.connect(a,"onclick",this,this.onClickHNDL);dojo.connect(this.domNode,"onmouseout",this,this.onMouseOutHNDL);this.title=this.getTitle(this.minCategory);dojo.create("div",{"class":"hotel-category-filter-title",id:this.titleElementId,innerHTML:this.title},this.domNode,"first")},onClickHNDL:function(a){this.showMinCategory(a.target.title);this.minCategory=a.target.title;this.applyFilterCallback(this.filterData[a.target.title-1].url);this.onApplyFilter(this.filterData[a.target.title-
1].url,a.target.title)},onApplyFilter:function(){},onMouseOverHNDL:function(a){this.updateTitle(a.target.title);this.showMinCategory(a.target.title)},onMouseOutHNDL:function(){this.updateTitle(this.minCategory);this.showMinCategory(this.minCategory)},updateTitle:function(a){dojo.byId(this.titleElementId).innerHTML=this.getTitle(a)},getTitle:function(a){return a=="0"?this.inactiveTitle:(new String(this.titlePattern)).replace(/\%/g,a)},showMinCategory:function(a){for(var b="",c=0;c<this.maxCategory;c++)b=
a<=c?this.imgFileInactive:this.imgFile,this.categoryImgs[c].src=this.imgFilePath+b}});dojo.provide("swoodoo.widgets.LoadingLocker");
dojo.declare("swoodoo.widgets.LoadingLocker",dijit._Widget,{targetId:null,alsoBlank:[],templateString:"<div></div>",blanketId:null,blanketColor:"white",blanketOpacity:50,loaderImage:imagesPath+"activationIndicator.gif",loaderText:translatedStrings.LANG_HOTEL_LOADER_TEXT,loaderTextStyle:"color: #9c9c9c; font-size:11px; font-weight: bold",cancelLinkText:"abbrechen",loaderBlockHeight:60,loaderBlockId:"loaderBlock",constructor:function(a){dojo.mixin(this,a);this._targetNode=dojo.byId(this.targetId);this._blankNodes=
[this._targetNode];dojo.forEach(this.alsoBlank,function(a){this._blankNodes.push(dojo.byId(a))},this)},start:function(){try{if(!this._targetNode)return!1;this._filterBlanket=[];this._loaderBlock=dojo.isIE?this._IEcreateLoaderBlock(this._targetNode):this._createLoaderBlock(this._targetNode);this._drawBlankets();this._cancelLinkHandler=dojo.connect(dojo.byId(this._cancelLinkId),"onclick",this,this._cancelCallback);var a=dojo.fx.wipeIn({node:this._loaderBlock.id,duration:500}),b=dojo.fadeIn({node:this._loaderBlock.id,
duration:500});dojo.fx.chain([a,b]).play()}catch(c){}},stop:function(){var a=this;try{var b=dojo.fx.wipeOut({node:this._loaderBlock.id,duration:500}),c=dojo.fadeOut({node:this._loaderBlock.id,duration:500,onEnd:function(){dojo.destroy(dojo.byId(a.loaderBlockId))}});dojo.fx.chain([c,b]).play();this._destroy()}catch(d){}},setCancelCallback:function(a){this._cancelCallback=a},redrawBlankets:function(){dojo.forEach(this._filterBlanket,function(a){dojo.destroy(a)});this._drawBlankets()},_drawBlankets:function(){dojo.isIE?
dojo.forEach(this._blankNodes,function(a){this._filterBlanket.push(this._IEcreateBlanket(a))},this):dojo.forEach(this._blankNodes,function(a){this._filterBlanket.push(this._createBlanket(a))},this)},_createBlanket:function(a){var b=dojo.create("div",{id:a.id+"-filterBlanket"},a),c=parseInt(a.offsetTop),d=a.offsetLeft,e=parseInt(a.offsetHeight)+(a.id==this.targetId?parseInt(this.loaderBlockHeight):0),a=parseInt(a.offsetWidth);dojo.style(b,{margin:"0px 0px 0px 0px",opacity:this.blanketOpacity/100,backgroundColor:this.blanketColor,
position:"absolute",top:c+"px",left:d+"px",width:a+"px",height:e+"px",overflow:"hidden",zIndex:"100"});return b},_createLoaderBlock:function(a){return dojo.create("div",{id:this.loaderBlockId,style:this.loaderTextStyle+";z-index: 1000; opacity: 0; position:relative; display: none; text-align: center; height: "+this.loaderBlockHeight+"px;",innerHTML:'<img src="'+this.loaderImage+'" style="text-align:center; display:block; padding-top: 17px; margin: 0px auto 0px auto" />'+this.loaderText+'<br />            <a href="javascript:void(0)" id="'+
this._cancelLinkId+'">'+this.cancelLinkText+"</a>"},a,"first")},_IEcreateBlanket:function(a){var b=a.id!="filter_panel"?0:12,c=a==this._targetNode?0:-this.loaderBlockHeight,c=this._IEgetTargetOffsetTop(a)+c,d=a.offsetParent.offsetLeft,b=parseInt(String(a.offsetWidth).replace("px",""))+b,b=dojo.create("div",{innerHTML:'<div id="'+a.id+'-filterBlanket"                               style="margin: 0px 0px 0px 0px;                                     filter:progid:DXImageTransform.Microsoft.Alpha(Opacity='+
this.blanketOpacity+");                                     background-color: "+this.blanketColor+";                                     position:absolute;                                     top: "+c+"px;                                     left:"+d+";                                     width: "+b+"px;                                     height:"+a.offsetHeight+';                                     overflow: hidden;                                     z-index: 100"></div>'});a.appendChild(b.firstChild);
return dojo.byId(a.id+"-filterBlanket")},_IEcreateLoaderBlock:function(a){var b='<div style="text-align: center;                                            height: '+this.loaderBlockHeight+"px;                                            width: "+(parseInt(String(a.offsetWidth).replace("px",""))-10)+"px; "+this.loaderTextStyle+'">                                    <img src="'+this.loaderImage+'" style="text-align:center; position:relative; display:block; padding-top: 17px; margin: 0px auto 0px auto" />'+
this.loaderText+'<br /><a href="javascript:void(0)" id="'+this._cancelLinkId+'">'+this.cancelLinkText+"</a></div>";return dojo.create("div",{id:this.loaderBlockId,style:"z-index: 0; filter:progid:DXImageTransform.Microsoft.Alpha(0); position:relative; display: block",innerHTML:b},a,"first")},_IEgetTargetOffsetTop:function(a){this._offsetTop=0;this._calcOffsetTop(a);return this._offsetTop},_calcOffsetTop:function(a){a.offsetTop&&(this._offsetTop+=a.offsetTop);a.offsetParent&&this._calcOffsetTop(a.offsetParent)},
_destroy:function(){try{dojo.forEach(this._filterBlanket,function(a){dojo.destroy(a)}),dojo.disconnect(this._cancelLinkHandler),this.destroy()}catch(a){}},_offsetTop:0,_filterBlanket:[],_loaderBlock:null,_targetNode:null,_blankNodes:[],_cancelCallback:function(){},_cancelLinkId:"loaderCancelLink",_cancelLinkHandler:null});dojo.provide("swoodoo.hotelFilteringLoader");dojo.require("swoodoo.widgets.LoadingLocker");dojo.declare("swoodoo.hotelFilteringLoader",[swoodoo.widgets.LoadingLocker],{});dojo.provide("swoodoo.PriceMatrixLoader");
dojo.require("swoodoo.widgets.LoadingLocker");
dojo.declare("swoodoo.PriceMatrixLoader",[swoodoo.widgets.LoadingLocker],{targetId:null,alsoBlank:[],templateString:"<div></div>",blanketId:null,blanketColor:"white",loaderImage:imagesPath+"activationIndicator-flight.gif",loaderText:translatedStrings.LANG_POWERSEARCH_GRAPH_LOADERTEXT,loaderTextStyle:"color: #9c9c9c; font-size:11px; font-weight: bold",cancelLinkText:"",loaderBlockHeight:"199",_createBlanket:function(a){var b=dojo.create("div",{id:a.id+"-filterBlanket"},a),c=a.offsetLeft,d=parseInt(String(a.offsetHeight).replace("px",
""))+parseInt(this.loaderBlockHeight),a=parseInt(String(a.offsetWidth).replace("px",""))-0;dojo.style(b,{margin:"0px 0px 0px 0px",backgroundColor:this.blanketColor,position:"absolute",top:"0px",left:c+"px",width:a+"px",height:d+"px",overflow:"hidden",zIndex:"100"});return b}});dojo.provide("swoodoo.PriceMatrix");dojo.require("dojo.fx.easing");dojo.require("swoodoo.PriceMatrixLoader");var priceMatrixLoader;
dojo.declare("swoodoo.PriceMatrix",null,{params:{isOneWay:!1,depDate:null,depDateFrom:null,depDateTill:null,retDate:null,retDateFrom:null,retDateTill:null},labels:{fadeIn:translatedStrings.LANG_FADE_IN,fadeOut:translatedStrings.LANG_FADE_OUT,today:translatedStrings.LANG_TODAY},loaded:!1,loading:!1,drawed:!1,navigationEventsAttached:!1,celWidth:65,celHeight:21,navigationStepper:3,ajaxUrl:"",getMatrixUrlTemplateCallback:null,getRefreshUrlTemplateCallback:null,urlDatesPartRx:/(\d{4}-\d{2}-\d{2})\/\d{1}(?:\/(\d{4}-\d{2}-\d{2}))?/,
constructor:function(a,b){this.id=a;dojo.mixin(this.params,b);this.node=dojo.byId(a);this.hasUsedNavigation=!1;this.colDatesNode=dojo.query(".col-dates",this.node)[0];this.colDatesDataNode=dojo.query(".data",this.colDatesNode)[0];this.rowDatesNode=dojo.query(".row-dates",this.node)[0];this.rowDatesDataNode=dojo.query(".data",this.rowDatesNode)[0];this.pricesNode=dojo.query(".prices",this.node)[0];this.pricesDataNode=dojo.query(".data",this.pricesNode)[0];this.navLeftNode=dojo.byId("price-matrix-nav-left");
this.navRightNode=dojo.byId("price-matrix-nav-right");this.navUpNode=dojo.byId("price-matrix-nav-up");this.navDownNode=dojo.byId("price-matrix-nav-down");this.navTextTopNode=dojo.byId("price-matrix-nav-text-top");this.navTextLeftNode=dojo.byId("price-matrix-nav-text-left");this.maxAvailableDate=this._parseDate(MAX_AVAILABLE_DATE);this.minAvailableDate=this._parseDate(this._formatDate(new Date));this.ie6=dojo.isIE<7;this.ajaxUrl=this._createMatrixUrlTemplate();this._setMinMaxDates();priceMatrixLoader=
new swoodoo.PriceMatrixLoader({targetId:"pricematrix"})},refreshAjaxUrl:function(){this.ajaxUrl=this._createMatrixUrlTemplate()},_setMinMaxDates:function(){this.params.isOneWay?(this.colMinDate=this._parseDate(this.params.depDateFrom),this.colMaxDate=this._parseDate(this.params.depDateTill)):(this.colMinDate=this._parseDate(this.params.retDateFrom),this.colMaxDate=this._parseDate(this.params.retDateTill),this.rowMinDate=this._parseDate(this.params.depDateFrom),this.rowMaxDate=this._parseDate(this.params.depDateTill))},
_createRefreshUrlTemplate:function(){return this.getRefreshUrlTemplateCallback?this.getRefreshUrlTemplateCallback():this._createMatrixUrlTemplate()},_createMatrixUrlTemplate:function(){if(this.getMatrixUrlTemplateCallback)return this.getMatrixUrlTemplateCallback();var a=window.location.href;return a.match(/\d{4}-\d{2}-\d{2}/)?this.params.isOneWay?a.replace(/\d{4}-\d{2}-\d{2}/,"<DEPD>")+(a.match(/\/flexible\/1/)?"":"/flexible/1"):a.replace(/\d{4}-\d{2}-\d{2}/,"<DEPD>").replace(/\d{4}-\d{2}-\d{2}/,
"<RETD>")+(a.match(/\/flexible\/1/)?"":"/flexible/1"):(a=a.match(/^http:\/\/[\w._-]+\.swoodoo\.[^\/]+\/[a-z]+\/([^\/]+\/|.*)/i)[0],a.charAt(a.length-1)!="/"&&(a+="/"),this.params.isOneWay?a+this.params.defaultDep+"/"+this.params.defaultDst+"/<DEPD>/0"+(this.params.filterDep?"/fdep/"+this.params.filterDep:"")+(this.params.filterDst?"/fdst/"+this.params.filterDst:"")+(this.params.defaultDepDaytime?"/daytime/"+this.params.defaultDepDaytime:"")+this.params.defaultPassingers+"/flexible/1":a+this.params.defaultDep+
"/"+this.params.defaultDst+"/<DEPD>/0/<RETD>/0"+(this.params.filterDep?"/fdep/"+this.params.filterDep:"")+(this.params.filterDst?"/fdst/"+this.params.filterDst:"")+(this.params.defaultDepDaytime?"/daytime/"+this.params.defaultDepDaytime:"")+(this.params.defaultRetDaytime?"/returnDaytime/"+this.params.defaultRetDaytime:"")+this.params.defaultPassingers+"/flexible/1")},_day:864E5,_parseDate:function(a){var b=Object.prototype.toString;if(b.call(a)=="[object Number]")return new Date(a);if(b.call(a)==
"[object Date]")return a;b.call(a)=="[object Object]"&&(a=a.toUTCString?a.toUTCString():a.toString());if(b.call(a)=="[object String]"){b=new Date(a);return isNaN(b.valueOf())?(a=a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/),new Date(a[1],a[2]-1,a[3])):b}return null},_formatWeekday:function(a){a=this._parseDate(a).getDay()||7;return translatedStrings["LANG_DATE_FORMAT_WEEKDAY_"+a]},_formatDate:function(a,b){var b=b||"Y-m-d",a=this._parseDate(a),c=a.getMonth()+1;c<10&&(c="0"+c);var d=a.getDate();
d<10&&(d="0"+d);return b.replace("Y",a.getFullYear()).replace("y",a.getYear()).replace("m",c).replace("d",d).replace("@",this._formatWeekday(a))},_nextDate:function(a){return this._formatDate(new Date(this._parseDate(a).valueOf()+this._day))},_prevDate:function(a){return this._formatDate(new Date(this._parseDate(a).valueOf()-this._day))},_setCurrent:function(a,b){b&&dojo.addClass(a,"curColor");dojo.addClass(a,"cur");if(!a.innerHTML)a.innerHTML="---"},_unsetCurrent:function(a){dojo.removeClass(a,"cur");
if(a.innerHTML=="---")a.innerHTML="",dojo.addClass(a,"search")},_setCurCol:function(a){dojo.addClass(a,"cur");a.innerHTML="<small>"+translatedStrings[this.params.isOneWay?"LANG_FLIGHTTO":"LANG_FLIGHTBACK"]+"<br/></small>"+a.innerHTML+""},_unsetCurCol:function(a){dojo.removeClass(a,"cur");a.innerHTML=a.innerHTML.replace(/<small[^>]*>.*?<\/small>\s*(.*)/i,"$1")},_setCurRow:function(a){dojo.addClass(a,"cur");a.innerHTML="<small>"+translatedStrings.LANG_FLIGHTTO+"</small> "+a.innerHTML},_unsetCurRow:function(a){dojo.removeClass(a,
"cur");a.innerHTML=a.innerHTML.replace(/<small[^>]*>.*?<\/small>\s*(.*)/i,"$1")},_getUrl:function(a,b){var c=this._createRefreshUrlTemplate(),d=this.urlDatesPartRx.exec(window.location.pathname);d&&(a||(a=d[1]),b||typeof d[2]!="undefined"&&(b=d[2]));return c.replace("<DEPD>",a).replace("<RETD>",b)},addColDate:function(a,b){var c,d,e;this.params.isOneWay?(c=this.params.depDate,d=this.params.today):(c=this.params.retDate,d=this.params.depDate);var f=this._formatDate(a);c=f==c;var g=this.id+"-col-"+
f;if(!dojo.byId(g)){var h='style="left: '+b*this.celWidth+'px"';e=f==this.params.today?"<strong>"+this.labels.today+"</strong>":this._formatWeekday(a)+", <strong>"+this._formatDate(a,this.params.dateFormat)+".</strong>";c?d='<div id="'+g+'" class="col curdiv" '+h+' col="'+f+'">'+e+"</div>":(f>=d?(d='<a id="'+g+'" class="col new" '+h+' col="'+f+'"',d+=this.params.isOneWay?' href="'+this._getUrl(f,null)+'"':' href="'+this._getUrl(null,f)+'"'):d='<a id="'+g+'" class="col new inactive" '+h+' col="'+f+
'"',d+=">"+e+"</a>");f=dojo.place(d,this.colDatesDataNode,"last");c&&this._setCurCol(f);return f}},addRowDate:function(a,b){var c=this._formatDate(a),d,e,f=c==this.params.depDate;d=this.id+"-row-"+c;if(!dojo.byId(d)){var g='style="top: '+b*this.celHeight+'px"';e=c==this.params.today?"<strong>"+this.labels.today+"</strong>":this._formatWeekday(a)+", <strong>"+this._formatDate(a,this.params.dateFormat)+".</strong>";f?d='<div id="'+d+'" class="row curdiv" '+g+' row="'+c+'">'+e+"</div>":(c<=this.params.retDate?
(d='<a id="'+d+'" class="row new" '+g+' row="'+c+'"',d+=' href="'+this._getUrl(c,null)+'"'):d='<a id="'+d+'" class="row new inactive" '+g+' row="'+c+'"',d+=">"+e+"</a>");c=dojo.place(d,this.rowDatesDataNode,"last");f&&this._setCurRow(c)}},addCell:function(a,b,c,d){var a=this._formatDate(a),e,f,g;b?(e=this._formatDate(b),f=this.params.retDate,g=this.params.depDate):f=this.params.depDate;g=a==f&&(!b||e==g);f=this.id+"-price-"+a+(b?"-"+e:"");if(!dojo.byId(f)){c='style="top: '+c*this.celHeight+"px; left: "+
d*this.celWidth+'px"';d=b?' row="'+e+'"':"";if(b&&a<e)c='<div class="empty" id="'+f+'" '+c+">---</div>";else if(g)c='<div id="'+f+'" class="price search curdiv" '+c+' col="'+a+'"'+d+"></div>";else{c='<a id="'+f+'" class="price search new" '+c+' col="'+a+'"'+d;if(!b||e<=a)c+=this.params.isOneWay?' href="'+this._getUrl(a,null)+'"':' href="'+this._getUrl(e,a)+'"';c+="></a>"}b=dojo.place(c,this.pricesDataNode,"last");g&&this._setCurrent(b)}},fixDateObject:function(a){(new Date(a)).getHours()=="23"&&a.setHours(a.getHours()+
1);return a},fixDate:function(a){(new Date(a)).getHours()=="23"&&(a+=this._day/2);return a},draw:function(){if(!this.drawed){if(this.params.isOneWay)for(var a=this.colMinDate.valueOf(),b=this.colMaxDate.valueOf()+this._day/2,c=0,d=a;d<=b;d+=this._day,c++)d=this.fixDate(d),this.addColDate(d,c),this.addCell(d,null,0,c);else{a=this.colMinDate.valueOf();b=this.colMaxDate.valueOf()+this._day/2;c=0;for(d=a;d<=b;d+=this._day,c++)d=this.fixDate(d),this.addColDate(d,c);for(var d=this.rowMinDate.valueOf(),
e=this.rowMaxDate.valueOf()+this._day/2,c=0,f=d;f<=e;f+=this._day,c++){f=this.fixDate(f);this.addRowDate(f,c);for(var g=0,d=a;d<=b;d+=this._day,g++)d=this.fixDate(d),this.addCell(d,f,c,g)}}this.prepareNavigation();this._addEvents();this.loadData();this.drawed=!0}},_enableNavigation:function(a){a&&typeof a!="undefined"&&dojo.removeClass(a,"inactive")},_disableNavigation:function(a){a&&typeof a!="undefined"&&dojo.addClass(a,"inactive")},prepareNavigation:function(){this.colMinDate<=this.minAvailableDate||
!this.params.isOneway&&this.colMinDate<=this.rowMinDate?this._disableNavigation(this.navLeftNode):this._enableNavigation(this.navLeftNode);this.colMaxDate>=this.maxAvailableDate?this._disableNavigation(this.navRightNode):this._enableNavigation(this.navRightNode);!this.params.isOneway&&this.rowMinDate<=this.minAvailableDate?this._disableNavigation(this.navUpNode):this._enableNavigation(this.navUpNode);!this.params.isOneway&&(this.rowMaxDate>=this.maxAvailableDate||this.colMaxDate<=this.rowMaxDate)?
this._disableNavigation(this.navDownNode):this._enableNavigation(this.navDownNode)},_disableAllNavigation:function(){this._disableNavigation(this.navLeftNode);this._disableNavigation(this.navRightNode);this._disableNavigation(this.navUpNode);this._disableNavigation(this.navDownNode)},_activate:function(a){var b=dojo.attr(dojo.query(".col.cur",this.node)[0],"col"),c=null,d=0;if(this.params.isOneWay)(e=dojo.attr(a,"col"))||(e=b),b=dojo.byId(this.id+"-price-"+e),g=dojo.byId(this.id+"-col-"+e),this._unsetCurrent(dojo.query(".price.cur",
this.node)[0]),this._unsetCurCol(dojo.query(".col.cur",this.node)[0]),this._setCurrent(b,!0),this._setCurCol(g);else{var c=dojo.attr(dojo.query(".row.cur",this.node)[0],"row"),e=dojo.attr(a,"col");e||(e=b);if(!this.params.isOneWay){var f=dojo.attr(a,"row");f||(f=c)}var b=dojo.byId(this.id+"-price-"+e+"-"+f),g=dojo.byId(this.id+"-col-"+e),h=dojo.byId(this.id+"-row-"+f);this._unsetCurrent(dojo.query(".price.cur",this.node)[0]);this._unsetCurCol(dojo.query(".col.cur",this.node)[0]);this._unsetCurRow(dojo.query(".row.cur",
this.node)[0]);this._setCurrent(b,!0);this._setCurCol(g);this._setCurRow(h)}e=this._getOffsets(e,this.colMaxDate,this.colMinDate);c&&(d=this._getOffsets(f,this.rowMaxDate,this.rowMinDate));this._addRowsAndColsAfterDateSelect(e,d);this._slide(d,e);this.onActivate(a,d!=0||e!=0)},_addRowsAndColsAfterDateSelect:function(a,b){var c=this.colMinDate.valueOf(),d=this.colMaxDate.valueOf()+this._day/2;if(this.params.isOneWay)var e=this.id+"-price-"+this._formatDate(this.colMaxDate),f=this.id+"-price-"+this._formatDate(this.colMinDate),
e=parseInt(dojo.byId(e).style.left)/this.celWidth+1,f=parseInt(dojo.byId(f).style.left)/this.celWidth-1;else var g=this.rowMinDate.valueOf(),h=this.rowMaxDate.valueOf()+this._day/2,j=this.id+"-price-"+this._formatDate(this.colMaxDate)+"-"+this._formatDate(this.rowMaxDate),k=this.id+"-price-"+this._formatDate(this.colMinDate)+"-"+this._formatDate(this.rowMinDate),e=parseInt(dojo.byId(j).style.left)/this.celWidth+1,f=parseInt(dojo.byId(k).style.left)/this.celWidth-1,j=parseInt(dojo.byId(j).style.top)/
this.celHeight+1,k=parseInt(dojo.byId(k).style.top)/this.celHeight-1;if(a<0)for(var l=this.colMaxDate.valueOf(),m=0,p=Math.abs(a);m<p;m++)if(l+=this._day,l=this.fixDate(l),this.addColDate(l,e+m),this.params.isOneWay)l=this.fixDate(l),this.addCell(l,null,0,m+e);else for(var o=1,n=g;n<=h;n+=this._day,o++)n=this.fixDate(n),this.addCell(l,n,o+k,m+e);else if(a>0){l=this.colMinDate.valueOf();for(m=0;m<a;m++)if(l-=this._day,this.addColDate(l,-m+f),this.params.isOneWay)l=this.fixDate(l),this.addCell(l,null,
0,-m+f);else{o=1;for(n=g;n<=h;n+=this._day,o++)n=this.fixDate(n),this.addCell(l,n,o+k,-m+f)}}if(b<0){g=this.rowMaxDate.valueOf();m=0;for(p=Math.abs(b);m<=p;m++){g+=this._day;this.addRowDate(g,j+m);o=-a+1;for(h=c;h<=d;h+=this._day,o++)h=this.fixDate(h),this.addCell(h,g,m+j,o+f)}}else if(b>0){g=this.rowMinDate.valueOf();for(m=0;m<b;m++){g-=this._day;this.addRowDate(g,-m+k);o=-a+1;for(h=c;h<=d;h+=this._day,o++)h=this.fixDate(h),this.addCell(h,g,-m+k,o+f)}}},_getOffsets:function(a,b,c){var d=this.maxAvailableDate.valueOf(),
e=this.minAvailableDate.valueOf(),b=b.valueOf(),c=c.valueOf(),a=this._parseDate(a).valueOf(),f=(b+c)/2,g=(a-f)/this._day;g>0?a+(b-f)>d&&(g=0):a-(f-c)<e&&(g=0);return-g},_slide:function(a,b){if(b){var c=b*this._day;this.colMinDate=new Date(this.colMinDate.valueOf()-c);this.colMaxDate=new Date(this.colMaxDate.valueOf()-c);this.colMinDate=this.fixDateObject(this.colMinDate);this.colMaxDate=this.fixDateObject(this.colMaxDate);this._slideAnimation(this.colDatesDataNode,0,b*this.celWidth)}if(a)c=a*this._day,
this.rowMinDate=new Date(this.rowMinDate.valueOf()-c),this.rowMaxDate=new Date(this.rowMaxDate.valueOf()-c),this.rowMaxDate=this.fixDateObject(this.rowMaxDate),this.rowMinDate=this.fixDateObject(this.rowMinDate),this._slideAnimation(this.rowDatesDataNode,a*this.celHeight,0);(b||a)&&this._slideAnimation(this.pricesDataNode,a*this.celHeight,b*this.celWidth)},_slideAnimation:function(a,b,c){a={node:a,top:(dojo.coords(a).t+b).toString(),left:(dojo.coords(a).l+c).toString(),duration:600,easing:dojo.fx.easing.expoInOut,
unit:"px"};this.slideAnim=dojo.fx.slideTo(a);this.slideAnim.play()},_navigateMatrix:function(a){var b=0,c=0;this.hasUsedNavigation=!0;if(this._isPossibleExecuteAction(a)){switch(a){case "moveLeft":c=this.navigationStepper;this.colMinDate.valueOf()-this.navigationStepper*this._day<this.minAvailableDate.valueOf()&&(c=(this.colMinDate.valueOf()-this.minAvailableDate.valueOf())/this._day);break;case "moveRight":c=this.navigationStepper*-1;this.colMaxDate.valueOf()+this.navigationStepper*this._day>this.maxAvailableDate.valueOf()&&
(c=(this.maxAvailableDate.valueOf()-this.colMaxDate.valueOf())/this._day*-1);break;case "moveUp":b=this.navigationStepper;this.rowMinDate.valueOf()-this.navigationStepper*this._day<this.minAvailableDate.valueOf()&&(b=(this.rowMinDate.valueOf()-this.minAvailableDate.valueOf())/this._day);break;case "moveDown":b=this.navigationStepper*-1,this.rowMaxDate.valueOf()+this.navigationStepper*this._day>this.maxAvailableDate.valueOf()&&(b=(this.maxAvailableDate.valueOf()-this.rowMaxDate.valueOf())/this._day*
-1)}this._addRowsAndColsAfterDateSelect(c,b);this._slide(b,c);var d=this;dojo.connect(this.slideAnim,"onEnd",function(){d._addNavigationEvents();d.prepareNavigation()});this._reloadMatrix();this._createAtagEvent()}},_isPossibleExecuteAction:function(a){if(!("moveLeft, moveRight, moveUp, moveDown".indexOf(a)<0)){switch(a){case "moveLeft":if(this.colMinDate.valueOf()<=this.minAvailableDate.valueOf())return!1;if(!this.params.isOneway&&this.colMinDate<=this.rowMinDate)return!1;break;case "moveRight":if(this.colMaxDate.valueOf()>=
this.maxAvailableDate.valueOf())return!1;break;case "moveUp":if(this.rowMinDate.valueOf()<=this.minAvailableDate.valueOf())return!1;break;case "moveDown":if(this.rowMaxDate.valueOf()>=this.maxAvailableDate.valueOf())return!1;if(!this.params.isOneway&&this.colMaxDate<=this.rowMaxDate)return!1}return!0}},_reloadMatrix:function(){this.loaded=!1;this.loadData()},onActivate:function(a,b){fullRedirectUrl=dojo.attr(a,"href");this.slideAnim&&b?dojo.connect(this.slideAnim,"onEnd",function(){priceMatrixLoader.start();
setTimeout("document.location.href = '"+fullRedirectUrl+"'",1E3)}):(priceMatrixLoader.start(),setTimeout("document.location.href = '"+fullRedirectUrl+"'",1E3))},errorMatrix:function(){var a=dojo.byId("pricematrix");a.innerHTML='<div class="disabledTitle">'+translatedStrings.LANG_SEARCHFORM_ERROR_LAYER_FIRST_LINE+"</div>";a.innerHTML+='<div class="disabledText">'+translatedStrings.LANG_FUNCTIONALITY_DISABLED+"</div>";dojo.style(a,"visibility","visible")},disableErrorMatrix:function(){this.ie6&&dojo.style(dojo.byId("pricematrix"),
"visibility","hidden")},reload:function(){this.ie6?this.errorMatrix():(priceMatrixLoader.start(),this._setMinMaxDates(),this.ajaxUrl=this._createMatrixUrlTemplate(),this.prepareNavigation(),this.colDatesNode.innerHTML='<div class="data"></div>',this.rowDatesNode.innerHTML='<div class="data"></div>',this.pricesNode.innerHTML='<div class="data"></div>',this.colDatesDataNode=dojo.query(".data",this.colDatesNode)[0],this.rowDatesDataNode=dojo.query(".data",this.rowDatesNode)[0],this.pricesDataNode=dojo.query(".data",
this.pricesNode)[0],this.loaded=this.drawed=!1,this.draw(),dojo.connect(this,"onDataLoadSuccess",function(){setTimeout(priceMatrixLoader.stop(),1E3)}),dojo.connect(this,"onDataLoadFailure",function(){setTimeout(priceMatrixLoader.stop(),1E3)}))},_createAtagEvent:function(){dojo.query("a[href].new",this.node).onclick(this,function(a){this._activate(a.currentTarget);a.preventDefault();a.stopPropagation();return!1});dojo.query("a[href].new",this.node).removeClass("new")},_addEvents:function(){this.ie6&&
(dojo.query("a:not([href])",this.node).addClass("nohref"),dojo.query(".row.cur",this.node).addClass("depd-cur"),this.params.isOneWay||dojo.query(".col.cur",this.node).addClass("retd-cur"),dojo.query(".price.cur",this.node).addClass("price-cur"));this._createAtagEvent();dojo.query(".price",this.node).onmouseover(this,function(a){a=a.currentTarget;dojo.addClass(this.id+"-col-"+dojo.attr(a,"col"),this.ie6?"col-hover":"hover");this.params.isOneWay||dojo.addClass(this.id+"-row-"+dojo.attr(a,"row"),this.ie6?
"row-hover":"hover")}).onmouseout(this,function(a){a=a.currentTarget;dojo.removeClass(this.id+"-col-"+dojo.attr(a,"col"),this.ie6?"col-hover":"hover");this.params.isOneWay||dojo.removeClass(this.id+"-row-"+dojo.attr(a,"row"),this.ie6?"row-hover":"hover")});if(this.params.isOneWay)dojo.query(".col[href]",this.node).onmouseover(this,function(a){a=dojo.byId(this.id+"-price-"+dojo.attr(a.currentTarget,"col"));dojo.addClass(a,this._getHoverClass(a))}).onmouseout(this,function(a){a=dojo.byId(this.id+"-price-"+
dojo.attr(a.currentTarget,"col"));dojo.removeClass(a,this._getHoverClass(a))});else dojo.query(".col[href]",this.node).onmouseover(this,function(a){a=dojo.byId(this.id+"-price-"+dojo.attr(a.currentTarget,"col")+"-"+dojo.query(".price.cur",this.node).attr("row"));dojo.addClass(a,this._getHoverClass(a))}).onmouseout(this,function(a){a=dojo.byId(this.id+"-price-"+dojo.attr(a.currentTarget,"col")+"-"+dojo.query(".price.cur",this.node).attr("row"));dojo.removeClass(a,this._getHoverClass(a))}),dojo.query(".row[href]",
this.node).onmouseover(this,function(a){a=dojo.byId(this.id+"-price-"+dojo.query(".price.cur",this.node).attr("col")+"-"+dojo.attr(a.currentTarget,"row"));dojo.addClass(a,this._getHoverClass(a))}).onmouseout(this,function(a){a=dojo.byId(this.id+"-price-"+dojo.query(".price.cur",this.node).attr("col")+"-"+dojo.attr(a.currentTarget,"row"));dojo.removeClass(a,this._getHoverClass(a))});this._addNavigationEvents()},_addNavigationEvents:function(){if(!this.navigationEventsAttached){var a=this,b=[];dojo.forEach(dojo.query(".actionArrow",
this.node),function(c){b.push(dojo.connect(c,"onclick",function(){var d=dojo.attr(c,"action");if(a._isPossibleExecuteAction(d))dojo.forEach(b,dojo.disconnect),a.navigationEventsAttached=!1,a._navigateMatrix(d)}))});this.navigationEventsAttached=!0}},_getHoverClass:function(a){if(!this.ie6)return"hover";if(dojo.hasClass(a,"search"))return"search-hover";if(dojo.hasClass(a,"price"))return"price-hover"},_expand:function(){this.node.style.display="block"},_setCellData:function(a,b,c,d){b=this.id+"-price-"+
b;c&&(b+="-"+c);if((c=dojo.byId(b))&&dojo.attr(c,"col")!=null)if(d){if(a.currencySymbol!="€")a.currencySymbol="<small>"+a.currencySymbol+"</small>";c.innerHTML=d+" "+a.currencySymbol;dojo.removeClass(c,"search")}else if(dojo.addClass(c,"search"),!dojo.hasClass(c,"cur"))c.innerHTML=""},_setData:function(a){if(a.prices)if(this.params.isOneWay){var b=a.prices,c;for(c in b)this._setCellData(a,c,null,b[c])}else{var b=a.prices,d;for(d in b){var e=b[d];for(c in e)this._setCellData(a,c,d,e[c])}}},onDataLoadSuccess:function(){},
onDataLoadFailure:function(){},_getAjaxUrl:function(){if(this.params.isOneWay)var a=new Date(this.colMinDate.valueOf()+3*this._day+this._day/2),a=this.ajaxUrl.replace("<DEPD>",this._getDateForUrl(a));else var a=new Date(this.rowMinDate.valueOf()+3*this._day+this._day/2),b=new Date(this.colMinDate.valueOf()+3*this._day+this._day/2),a=this.ajaxUrl.replace("<DEPD>",this._getDateForUrl(a)).replace("<RETD>",this._getDateForUrl(b));return a.replace("/result/","/result/getmatrix/")},_getDateForUrl:function(a){var b=
(a.getMonth()+1).toString();b.length==1&&(b="0"+b);var c=a.getDate().toString();c.length==1&&(c="0"+c);return a.getFullYear()+"-"+b+"-"+c},loadData:function(){if(!this.loaded&&!this.loading){this.loading=!0;var a=this;dojo.xhrGet({url:a._getAjaxUrl(),handleAs:"json",load:function(b){a.loaded=!0;a.loading=!1;a._setData(b);a.onDataLoadSuccess(b)},error:function(b){a.loading=!1;a.onDataLoadFailure(b)}})}},expand:function(){this.ie6&&this.node.style.display=="none"?this.errorMatrix():!this.ie6&&this.node.style.display==
"none"&&this.draw();this._expand();this.onExpand()},onExpand:function(){},_collapse:function(){this.node.style.display="none"},collapse:function(){this.disableErrorMatrix();this.node.style.display!="none"&&(this._collapse(),this.onCollapse())},onCollapse:function(){}});dojo.provide("swoodoo.FlightSearchTabs");
dojo.declare("swoodoo.FlightSearchTabs",null,{params:{imageUrl:"",tabs:[],containerHeights:{}},constructor:function(a,b){this.id=a;this.domNode=dojo.byId(a);this.containerNode=dojo.byId(a+"-container");dojo.mixin(this.params,b)},render:function(){dojo.forEach(this.params.tabs,this._createTab,this)},collapseAll:function(){this._deactivateAllTabs();this._collapseContainer();this._switchToCollapsed();this.onContainerStateChange()},getActiveTab:function(){return this._activeTab},onContainerStateChange:function(){},
_statesSrc:{collapsed_inactive:".png",expanded_inactive:"_expanded.png",active:"_active.png",collapsed_disabled:"_disabled.png",expanded_disabled:"_expanded_disabled.png"},_onclickEventHandlers:[],_activeTab:null,_createTab:function(a){dojo.byId(a);var b=dojo.create("div",{id:a,"class":"tabButton"},this.domNode,"last");dojo.create("img",{src:this.params.imageUrl+"/btn_"+a+this._statesSrc.collapsed_inactive},b,"first");eval("var tabEvents = {\n            on"+a+"Expand:   function(){},\n            on"+
a+"Collapse: function(){},\n              "+a+"Expand:   function(){this._expandTab('"+a+"')},\n              "+a+"Collapse: function(){this._collapseTab('"+a+"')},\n              "+a+"Disable:  function(){this._disableTab(dojo.byId('"+a+"'));},\n              "+a+"Enable:   function(){this._enableTab(dojo.byId('"+a+"'));}\n        };");dojo.mixin(this,tabEvents);this._addOnClick(a)},_addOnClick:function(a){var b=dojo.byId(a),c=this;this._onclickEventHandlers[a]=dojo.connect(b,"onclick",function(){c._getTabState(this)!=
c._statesSrc.active?c._expandTab(this.id):c._collapseTab(this.id)})},_removeOnClick:function(a){dojo.disconnect(this._onclickEventHandlers[a]);this._onclickEventHandlers[a]=null},_expandTab:function(a){a=dojo.byId(a);if(this._activeTab!=a){if(this._activeTab)this._deactivateAllTabs();else this.onContainerStateChange();this._activeTab=a;this._setTabState(a,this._statesSrc.active);this._switchToExpanded();this._expandContainer();eval("this.on"+a.id+"Expand()")}},_collapseTab:function(a){if(this._activeTab==
dojo.byId(a)){var b=this;dojo.connect(this._collapseContainer(),"onEnd",function(){b._deactivateTab(dojo.byId(a));b._switchToCollapsed();b.onContainerStateChange()})}},_deactivateTab:function(a){if(this._getTabState(a)==this._statesSrc.active)this._activeTab=null,this._setTabState(a,this._statesSrc.collapsed_inactive),eval("this.on"+a.id+"Collapse()")},_disableTab:function(a){if(this._onclickEventHandlers[a.id]){a.className="tabButton-disabled";var b=this._getTabState(a);this._activeTab==a&&this.collapseAll();
b==this._statesSrc.expanded_inactive?this._setTabState(a,this._statesSrc.expanded_disabled):this._setTabState(a,this._statesSrc.collapsed_disabled);this._removeOnClick(a.id)}},_enableTab:function(a){if(!this._onclickEventHandlers[a.id])a.className="tabButton",this._getTabState(a)==this._statesSrc.expanded_disabled?this._setTabState(a,this._statesSrc.expanded_inactive):this._setTabState(a,this._statesSrc.collapsed_inactive),this._addOnClick(a.id)},_deactivateAllTabs:function(){dojo.forEach(this.params.tabs,
function(a){this._deactivateTab(dojo.byId(a))},this);this._activeTab=null},_switchToExpanded:function(){dojo.forEach(this.params.tabs,function(a){var a=dojo.byId(a),b=this._getTabState(a);b!=this._statesSrc.active&&b!=this._statesSrc.expanded_disabled&&b!=this._statesSrc.expanded_inactive&&(b==this._statesSrc.collapsed_disabled?this._setTabState(a,this._statesSrc.expanded_disabled):this._setTabState(a,this._statesSrc.expanded_inactive))},this)},_switchToCollapsed:function(){dojo.forEach(this.params.tabs,
function(a){var a=dojo.byId(a),b=this._getTabState(a);b!=this._statesSrc.active&&b!=this._statesSrc.collapsed_disabled&&b!=this._statesSrc.collapsed_inactive&&(b==this._statesSrc.expanded_disabled?this._setTabState(a,this._statesSrc.collapsed_disabled):this._setTabState(a,this._statesSrc.collapsed_inactive))},this)},_collapseContainer:function(){dojo.fadeOut({node:this.containerNode,duration:300}).play();var a=dojo.animateProperty({node:this.containerNode,duration:300,properties:{height:0},easing:dojo.fx.easing.linear}).play(),
b=this.containerNode;dojo.connect(a,"onEnd",function(){b.style.display="none"});return a},_expandContainer:function(){dojo.fadeIn({node:this.containerNode,duration:300}).play();this.containerNode.style.display="block";dojo.animateProperty({node:this.containerNode,duration:300,properties:{height:this.params.containerHeights[this._activeTab.id]},easing:dojo.fx.easing.linear}).play()},_getTabState:function(a){return(new String(a.firstChild.getAttribute("src"))).match(RegExp(a.id+"([^.]*.png)"))[1]},
_setTabState:function(a,b){var c=new String(a.firstChild.getAttribute("src")),c=c.replace(RegExp(a.id+"[^.]*.png"),a.id+b);a.firstChild.setAttribute("src",c)},fadeIn:function(a){this.fadeInVar=dojo.fadeIn({node:a,duration:250}).play()},fadeOut:function(a){this.fadeOutVar=dojo.fadeOut({node:a,duration:250}).play()}});dojo.provide("swoodoo.widgets.Popover");dojo.require("dijit.TooltipDialog");dojo.require("swoodoo.mixin");
dojo.declare("swoodoo.widgets.Popover",dijit.TooltipDialog,{showCloseLink:!0,showConnector:!1,attachTo:null,openOnClick:!0,_openOnClickHandle:null,closeOnBlur:!0,_closeOnBlurHandle:null,maxHeight:204,fixedWidth:null,position:"below",translations:{},constructor:function(a){try{this.translations=dojo.mixin(this.translations,translatedStrings)}catch(b){}swoodoo.mixinRecursive(this,a)},open:function(){if(!this._isOpen)dijit.popup.open({popup:this,around:this.attachTo,orient:this.position=="below"?{BL:"TL"}:
{TL:"BL"}}),this.fixScrollBar(),this._center(),this._isOpen=!0,dojo.addClass(this.attachTo,"active"),dijit.focus(dojo.byId(this.id))},close:function(){if(this._isOpen)dijit.popup.close(this),this.setDefaultWidth(),this._center(),this._isOpen=!1;dojo.removeClass(this.attachTo,"active")},setContent:function(a){typeof a=="string"?this._contentNode.innerHTML=a:typeof a=="object"&&dojo.create(a,{},this._contentNode,"only");this.setDefaultWidth();this.fixScrollBar();this._center()},appendContent:function(a){typeof a==
"string"?this._contentNode.innerHTML+=a:typeof a=="object"&&dojo.create(a,{},this._contentNode,"last");this.setDefaultWidth();this.fixScrollBar();this._center()},addLink:function(a,b){return this._addLink(a,b)},addButton:function(a,b){return this._addLink(a,b,"button")},postCreate:function(){this.inherited(arguments);if(this.showCloseLink){var a=this;this._addLink(this.translations.LANG_DIALOG_CLOSE,function(){a.close()},"close")}if(this.showConnector)if(this.position=="below"){var b=dojo.create("div",
{"class":"dijitTooltipConnector",waiRole:"presentation"},dojo.query("div",this.domNode)[0],"last");dojo.style(b,"top","-3px");dojo.style(this.domNode,"paddingTop","3px")}else b=dojo.create("div",{"class":"dijitTooltipConnector",waiRole:"presentation"},dojo.query("div",this.domNode)[0],"last"),dojo.style(b,"bottom","-11px"),dojo.style(this.domNode,"paddingBottom","3px");else dojo.style(this.domNode,"paddingTop","0px");this._contentNode=dojo.query("div.popoverContent",this.domNode)[0];this._contentContainerNode=
dojo.query("div.dijitTooltipContents",this.domNode)[0];dojo.style(this._contentContainerNode,"maxHeight",this.maxHeight+"px");dojo.style(this._contentContainerNode,"overflowY","auto");dojo.style(this._contentContainerNode,"overflowX","hidden");var c=this;if(this.openOnClick)this._openOnClickHandle=dojo.connect(this.attachTo,"onclick",function(){c.open()});if(this.closeOnBlur)this._closeOnBlurHandle=dojo.connect(this,"onBlur",function(){c.close()})},fixScrollBar:function(){dojo.style(this._contentNode,
"height")>dojo.style(this._contentContainerNode,"maxHeight")&&(dojo.isWebKit?dojo.style(this._contentContainerNode,"width",dojo.style(this._contentContainerNode,"width")+40+"px"):dojo.style(this._contentContainerNode,"width",dojo.style(this._contentContainerNode,"width")+20+"px"))},_calcOffset:function(a){var b={l:a.offsetLeft,t:a.offsetTop};a.offsetParent&&(a=this._calcOffset(a.offsetParent),b.l+=a.l,b.t+=a.t);return b},_center:function(){if(this.domNode.parentNode&&this.domNode.parentNode.style){var a=
Math.floor(dojo.contentBox(this.domNode).w/2),b=Math.floor(dojo.contentBox(this.attachTo).w/2)-a;dojo.style(this.domNode.parentNode,"left",this._calcOffset(this.attachTo).l+b+"px");this.showConnector&&(b=dojo.query("div.dijitTooltipConnector",this.domNode)[0],dojo.style(b,"left",a-Math.floor(dojo.contentBox(b).w/2)+"px"))}},_addLink:function(a,b,c){var d=dojo.query("div.popoverLinks",this.domNode);d.length==1?d=d[0]:(d=dojo.create("div",{"class":"popoverLinks"},dojo.query("div",this.domNode)[0],"last"),
dojo.style(dojo.query("div",this.domNode)[0],"paddingBottom","0px"));a=dojo.create("a",{innerHTML:a,"class":c?c:""},d,"last");b&&dojo.connect(a,"onclick",b);return a},setDefaultWidth:function(){this.fixedWidth?dojo.style(this._contentContainerNode,"width",this.fixedWidth+"px"):dojo.style(this._contentContainerNode,"width","auto");dojo.style(this._contentContainerNode.parentNode,"width","auto")},_contentNode:null,_contentContainerNode:null,_isOpen:!1,baseClass:"swoodooPopover"});dojo.provide("swoodoo.widgets.ListPicker");
dojo.require("swoodoo.widgets.Popover");
dojo.declare("swoodoo.widgets.ListPicker",swoodoo.widgets.Popover,{options:[],showCloseLink:!1,valueField:null,labelField:null,maxHeight:300,constructor:function(a){if(a.valueField&&typeof a.valueField=="string")a.valueField=dojo.byId(a.valueField);if(a.labelField&&typeof a.labelField=="string")a.labelField=dojo.byId(a.labelField)},onSelect:function(){},setOptions:function(a){var b=dojo.create("ul",{className:"swoodooListPicker"}),c=this;dojo.forEach(a,function(a){a=c._createOptionNode(a);dojo.create(a,
null,b)});this.setContent(b)},addOption:function(a){a=this._createOptionNode(a);dojo.create(a,null,dojo.query("ul.swoodooListPicker",this._contentNode)[0])},_createOptionNode:function(a){var b=dojo.create("li",{className:a.selected?"selected":""});if(a.selected)this._selectedOption=b;var c=dojo.create("a",{innerHTML:a.label,value:a.value},b),d=this;dojo.connect(c,"onclick",function(){d._selectOption(b,a)});return b},_selectOption:function(a,b){if(a!=this._selectedOption){this._selectedOption&&dojo.removeClass(this._selectedOption,
"selected");dojo.addClass(a,"selected");this._selectedOption=a;if(this.valueField)this.valueField.value=b.value;if(this.labelField)this.labelField.value=b.label;this.onSelect(b)}this.close()},getSelectedValue:function(){return dojo.query("li.selected a",this._contentNode).attr("value")},selectByValue:function(a){var b=dojo.query("li a",this._contentNode),c=null;dojo.forEach(b,function(b){if(dojo.attr(b,"value")==a)c=b.parentNode});var d=null;dojo.forEach(this.options,function(b){b.value==a&&(d=b)});
this._selectOption(c,d)},_selectedOption:null,postCreate:function(){this.inherited(arguments);this.setOptions(this.options)}});dojo.provide("swoodoo.widgets.InputListPicker");dojo.require("swoodoo.RegExp");dojo.require("swoodoo.widgets.ListPicker");dojo.require("dijit._base.focus");
dojo.declare("swoodoo.widgets.InputListPicker",swoodoo.widgets.ListPicker,{closeOnBlur:!0,defaultValue:"",autofocus:!1,setOptions:function(a){var b=(this.valueField||this.attachTo).value.trim().toLowerCase();b==this.defaultValue.toLowerCase()&&(b="");if(this.filterValueDisplayed!=b){var c=dojo.create("div",{className:"swoodooInputListContainer"}),d=dojo.create("ul",{className:"swoodooListPicker swoodooInputListPicker"},c),e=this;dojo.forEach(a,function(a){a=dojo.clone(a);if(b&&b.length){if(a.label.toLowerCase().indexOf(b)==
-1)return;a.selected=a.label.toLowerCase()==b;a.label=a.label.replace(RegExp("("+RegExp.escape(b)+")","gi"),"<b>$1</b>")}a=e._createOptionNode(a);dojo.create(a,null,d)},this);dojo.query("li a",c).connect("onmouseover",function(){dojo.query("li.hover",c).removeClass("hover");dojo.addClass(this.parentNode,"hover")});this.setContent(c);this.filterValueDisplayed=b;if(d.children.length){if(this._isOpen)this.domNode.style.display="block",this.resize()}else if(this._isOpen)this.domNode.style.display="none"}},
_test:"TEST",_elementsFocused:0,_elementsTimeout:0,_elementsFocusBlur:function(){if(this._elementsFocused&&this._elementsTimeout)window.clearTimeout(this._elementsTimeout),this._elementsTimeout=0;else if(!this._elementsFocused&&!this._elementsTimeout){var a=this;this._elementsTimeout=window.setTimeout(function(){a.close();window.clearTimeout(a._elementsTimeout);a._elementsTimeout=0},100)}},_onElementsFocus:function(){this._elementsFocused++;this._elementsFocusBlur()},_onElementsBlur:function(){this._elementsFocused--;
this._elementsFocusBlur()},_onInputFocus:function(){this.options.length&&(this.setOptions(this.options),dojo.query("li.hover",this._contentNode).removeClass("hover"),this.open())},postCreate:function(){this.inherited(arguments);if(this.closeOnBlur)dojo.disconnect(this._closeOnBlurHandle),this._closeOnBlurHandle=dojo.connect(this,"onBlur",this,this._onElementsBlur),dojo.connect(this.attachTo,"onblur",this,this._onElementsBlur),dojo.connect(this,"onFocus",this,this._onElementsFocus),dojo.connect(this.attachTo,
"onfocus",this,this._onElementsFocus);if(this.openOnClick)dojo.disconnect(this._openOnClickHandle),this._openOnClickHandle=dojo.connect(this.attachTo,"onfocus",this,this._onInputFocus);dojo.connect(this.attachTo,"onkeyup",this,this._filterValues);dojo.connect(this.attachTo,"onkeydown",this,this._filterValues);dojo.connect(this.attachTo,"onkeypress",this,this._filterValues)},_filterValues:function(a){if(a.type!="keypress"&&a.type!="onkeypress")this.setOptions(this.options);else switch(a.keyCode){case dojo.keys.TAB:case dojo.keys.ENTER:var b=
dojo.query("li.hover a",this._contentNode);if(b.length){this.selectByValue(b.attr("value"));dojo.stopEvent(a);break}b=dojo.query("li:first-child a",this._contentNode);b.length&&this.selectByValue(b.attr("value"));dojo.stopEvent(a);break;case dojo.keys.UP_ARROW:if(b=dojo.query("li.hover",this._contentNode)[0])if(dojo.removeClass(b,"hover"),b=b.previousSibling){dojo.addClass(b,"hover");dijit.scrollIntoView(b);dojo.stopEvent(a);break}if(b=dojo.query("li:last-child",this._contentNode)[0])dojo.addClass(b,
"hover"),dijit.scrollIntoView(b);dojo.stopEvent(a);break;case dojo.keys.DOWN_ARROW:if(b=dojo.query("li.hover",this._contentNode)[0])if(dojo.removeClass(b,"hover"),b=b.nextSibling){dojo.addClass(b,"hover");dijit.scrollIntoView(b);dojo.stopEvent(a);break}if(b=dojo.query("li:first-child",this._contentNode)[0])dojo.addClass(b,"hover"),dijit.scrollIntoView(b);dojo.stopEvent(a);break;default:this.setOptions(this.options)}}});dojo.provide("swoodoo.widgets.Tooltip");dojo.provide("swoodoo.widgets._MasterTooltip");
dojo.require("dijit.Tooltip");
dojo.declare("swoodoo.widgets._MasterTooltip",dijit._MasterTooltip,{templatePath:null,templateString:'        <div class="dijitTooltip swoodooTooltipLeft" id="dojoTooltip">            <div class="swoodooTooltip">                <div class="dijitTooltipContainer dijitTooltipContents" dojoAttachPoint="containerNode" waiRole="alert"></div>                <div class="dijitTooltipConnector"></div>            </div>        </div>',orientation:{"BL-TL":"swoodooTooltipBelow dijitTooltipABLeft","TL-BL":"swoodooTooltipAbove dijitTooltipABLeft",
"BR-TR":"swoodooTooltipBelow dijitTooltipABRight","TR-BR":"swoodooTooltipAbove dijitTooltipABRight","BR-BL":"swoodooTooltipRight","BL-BR":"swoodooTooltipLeft"},orient:function(a,b,c){a.className="dijitTooltip "+this.orientation[b+"-"+c]}});
dojo.declare("swoodoo.widgets.Tooltip",null,{params:null,node:null,contents:null,_tooltip:null,_timer:null,_attached:null,attach:function(a){a=a?dojo.byId(a):this.node;if(this._attached){if(this._attached.node==a)return;this._detach()}this._attached={node:a,show:dojo.connect(a,"onmouseover",this,this._show),hide:dojo.connect(a,"onmouseout",this,this._hide)}},detach:function(){if(this._attached)dojo.disconnect(this._attached.show),dojo.disconnect(this._attached.hide),this._attached=null},_position:function(a){a=
a||this.params.position;dojo.isArray(a)||(a=[a]);return a},_show:function(){this._timer=setTimeout(dojo.hitch(this,function(){clearTimeout(this._timer);delete this._timer;var a=dojo.coords(this._attached.node),b=dojo.coords(this._tooltip.id).h+(this._tooltip.isLeftToRight()?0:a.h),c=this._position();c=="above"&&a.y<b&&(c=this._position("below"));this._tooltip.show(this.contents,this._attached.node,c)}),this.params.delay)},_hide:function(){if(this._timer)clearTimeout(this._timer),delete this._timer;
else return this._tooltip.hide(this._attached.node)},_parseContents:function(){return'<div class="Tooltip_Canvas">'+(this.params.title?'<div class="Tooltip_HeadlineCanvas">'+this.params.title+"</div>":"")+(this.params.body?'<div class="Tooltip_ContentCanvas">'+this.params.body+"</div>":"")+"</div>"},constructor:function(a,b){(this.node=dojo.byId(a))&&this._constructMaster(b)},_constructMaster:function(a){this.params=dojo.mixin({title:null,body:null,position:"above",delay:500},a);this.contents=this._parseContents();
var b={};if(a.duration)b.duration=a.duration;if(a.isLeftToRight)b.isLeftToRight=a.isLeftToRight;this._tooltip=new swoodoo.widgets._MasterTooltip(b);this.attach()},destroy:function(){this._tooltip.destroyRecursive();this._tooltip=null}});dojo.require("swoodoo.widgets.Tooltip");dojo.provide("swoodoo.Tooltip.Custom");dojo.declare("swoodoo.Tooltip.Custom",swoodoo.widgets.Tooltip,{_attached:{},attach:function(){},detach:function(){},show:function(){this._attached.node=this.node;this._show()},hide:function(){this._hide()}});
dojo.provide("swoodoo.widgets.Calendar");dojo.require("swoodoo.date");dojo.require("dijit._Calendar");dojo.require("dojo.fx");dojo.require("dojo.fx.easing");
dojo.declare("swoodoo.widgets.Calendar",dijit._Calendar,{templatePath:null,templateString:'        <div class="dijitCalendarContainer">            <div dojoAttachEvent="onclick: _onMonthClick">                <div dojoAttachPoint="monthLabelNode" class="dijitReset dijitCalendarMonthContainer" style="white-space:nowrap">                    <span class="dijitCalendarMonthTemplate dijitCalendarMonthLabel"></span>                </div>            </div>            <div class="dijitCalendarBody" dojoAttachEvent="onclick: _onDayClick, onmouseover: _onDayMouseOver, onmouseout: _onDayMouseOut">                <div class="dijitReset dijitCalendarBodyContainer">                    <table>                        <tr>                            <th class="dijitReset dijitCalendarWeekOfYearLabel">KW</th>                            <th class="dijitReset dijitCalendarDayLabelTemplate"></th>                        </tr>                        <tr class="dijitReset dijitCalendarWeekTemplate">                            <td class="dijitReset dijitCalendarWeekOfYearTemplate"></td>                            <td class="dijitReset dijitCalendarDateTemplate"></td>                        </tr>                    </table>                </div>            </div>        </div>',_clean:function(a){if(!a.query)return this;
a=dojo.query(a.query,a.refNode||this.domNode);if(a.length<2)return this;for(var b=1,c=a.length;b<c;b++)dojo.destroy(a[b]);return this},_clone:function(a){if(!a.query||!a.count)return this;var b=dojo.query(a.query,a.refNode||this.domNode)[0];if(!b)return this;for(var c=b.parentNode,d=0;d<a.count;d++)dojo.place(b.cloneNode(!0),c,a.place||"last");return this},_drawMonth:function(a,b){var c=b.getDay(),d=swoodoo.date.getDaysInMonth(b),e=swoodoo.date.getDaysInMonth(swoodoo.date.add(b,"month",-1)),f=new Date,
g=this.value,h=dojo.cldr.supplemental.getFirstDayOfWeek(this.lang);h>c&&(h-=7);var j=Math.ceil((d+c-1)/7);c==0&&(c+=7,j++);var k=swoodoo.date.locale.getNames("days","abbr","standAlone",this.lang),h=dojo.cldr.supplemental.getFirstDayOfWeek(this.lang);dojo.query(".dijitCalendarDayLabelTemplate",a).forEach(function(a,b){var c=(b+h)%7;(c||7)>5&&dojo.addClass(a.parentNode,"dijitCalendarDayWeekendLabel");this._setText(a,k[c].substr(0,2))},this);this._clean({query:".dijitCalendarWeekTemplate",refNode:a})._clone({query:".dijitCalendarWeekTemplate",
refNode:a,count:j-1});dojo.query(".dijitCalendarDateTemplate",a).forEach(function(a,j){j+=h;var k=new Date(b),o,n="dijitCalendar",q=0;j<c?(o=e-c+j+1,q=-1,n+="Previous"):j>=c+d?(o=j-c-d+1,q=1,n+="Next"):(o=j-c+1,n+="Current");q&&(k=swoodoo.date.add(k,"month",q));k.setDate(o);if((o=b.getMonth()==k.getMonth()&&b.getFullYear()==k.getFullYear())&&(k.getDay()||7)>5)n="dijitCalendarWeekendDate "+n;swoodoo.date.compare(k,f,"date")||(n="dijitCalendarCurrentDate "+n);o&&!swoodoo.date.compare(k,g,"date")&&(n=
"dijitCalendarSelectedDate "+n);if((q=this.isDisabledDate(k,this.lang))||!o)n="dijitCalendarDisabledDate "+n;var r=this.getClassForDate(k,this.lang);r&&(n=r+" "+n);a.className=n+"Month dijitCalendarDateTemplate";a.dijitDateValue=q||!o?null:k.valueOf();this._setText(a,o?k.getDate():"")},this);dojo.query(".dijitCalendarWeekOfYearTemplate",a).forEach(function(a,f){f*=7;f+=h;var j=new Date(b),g,k=0;f<c?(g=e-c+f+1,k=-1):f>=c+d?(g=f-c-d+1,k=1):g=f-c+1;k&&(j=swoodoo.date.add(j,"month",k));j.setDate(g);this._setText(a,
swoodoo.date.getISOWeek(j))},this)},_animateProperties:function(a,b,c,d){dojo.animateProperty({node:a,duration:c||200,unit:d||"px",properties:b}).play()},_getWidth:function(a){return a.clientWidth+dojo.style(a,"paddingLeft")},_adjustHeight:function(){var a=0,b=dojo.query(".dijitCalendarBodyContainer",this.domNode);b.forEach(function(b){a=Math.max(a,dojo.coords(b).h)});this._animateProperties(b[0].parentNode,{height:a})},_adjustPosition:function(){var a=0,b=0,c=dojo.query(".dijitCalendarBodyContainer",
this.domNode);c.forEach(function(c){a+=this._getWidth(c);b=Math.max(b,c.clientHeight)},this);if(b)c.forEach(function(a,b){dojo.style(a,"left",b*this._getWidth(a)+"px")},this),dojo.style(c[0].parentNode,{width:a+"px",height:b+"px"}),this._adjustPosition=function(){}},_fxParams:{duration:300,unit:"px"},_populateGrid:function(){this._adjustPosition();var a=new Date,b=this.displayMonth;b.setDate(1);var c=swoodoo.date.add(b,"month",1),d=swoodoo.date.locale.getNames("months","abbr","standAlone",this.lang);
dojo.query(".dijitCalendarMonthTemplate",this.domNode).forEach(function(c,h){var e=h+a.getMonth(),f=a.getFullYear();e>11&&(e-=12,f+=1);e==b.getMonth()&&f==b.getFullYear()?(dojo.addClass(c,"dijitCalendarMonthSelected"),this._setText(c,d[e]+" ‘"+String(f).substr(2,2))):(dojo.removeClass(c,"dijitCalendarMonthSelected"),this._setText(c,d[e]));c.dijitMonthValue=(new Date(f,e,1)).valueOf()},this);var e=this.previousMonth&&this.displayMonth?swoodoo.date.difference(this.previousMonth,this.displayMonth,"month"):
0;if(e==1){this._clone({query:".dijitCalendarBodyContainer",count:1});var f=dojo.query(".dijitCalendarBodyContainer",this.domNode);this._drawMonth(f[2],c);dojo.style(f[2],"left",2*this._getWidth(f[2])+"px");c=dojo.fx.combine([dojo.fx.slideTo(dojo.mixin({node:f[0],left:-this._getWidth(f[0])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[1],left:0},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[2],left:this._getWidth(f[1])},this._fxParams))]);dojo.connect(c,"onPlay",this,function(){this._adjustHeight()});
dojo.connect(c,"onEnd",this,function(){dojo.destroy(f[0]);this._adjustHeight();this._onAnimationEnd()});c.play()}else e>1?(this._clone({query:".dijitCalendarBodyContainer",count:2}),f=dojo.query(".dijitCalendarBodyContainer",this.domNode),this._drawMonth(f[2],b),this._drawMonth(f[3],c),dojo.style(f[2],"left",2*this._getWidth(f[2])+"px"),dojo.style(f[3],"left",3*this._getWidth(f[2])+"px"),c=dojo.fx.combine([dojo.fx.slideTo(dojo.mixin({node:f[0],left:-2*this._getWidth(f[0])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[1],
left:-this._getWidth(f[1])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[2],left:0},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[3],left:this._getWidth(f[1])},this._fxParams))]),dojo.connect(c,"onPlay",this,function(){this._adjustHeight()}),dojo.connect(c,"onEnd",this,function(){dojo.destroy(f[0]);dojo.destroy(f[1]);this._adjustHeight();this._onAnimationEnd()}),c.play()):e==-1?(this._clone({query:".dijitCalendarBodyContainer",count:1,place:"first"}),f=dojo.query(".dijitCalendarBodyContainer",
this.domNode),this._drawMonth(f[0],b),dojo.style(f[0],"left",-this._getWidth(f[0])+"px"),c=dojo.fx.combine([dojo.fx.slideTo(dojo.mixin({node:f[0],left:0},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[1],left:this._getWidth(f[1])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[2],left:2*this._getWidth(f[2])},this._fxParams))]),dojo.connect(c,"onPlay",this,function(){this._adjustHeight()}),dojo.connect(c,"onEnd",this,function(){dojo.destroy(f[2]);this._adjustHeight();this._onAnimationEnd()}),
c.play()):e<-1?(this._clone({query:".dijitCalendarBodyContainer",count:2,place:"first"}),f=dojo.query(".dijitCalendarBodyContainer",this.domNode),this._drawMonth(f[0],b),this._drawMonth(f[1],c),dojo.style(f[0],"left",-2*this._getWidth(f[0])+"px"),dojo.style(f[1],"left",-this._getWidth(f[1])+"px"),c=dojo.fx.combine([dojo.fx.slideTo(dojo.mixin({node:f[0],left:0},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[1],left:this._getWidth(f[1])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[2],left:2*
this._getWidth(f[2])},this._fxParams)),dojo.fx.slideTo(dojo.mixin({node:f[3],left:3*this._getWidth(f[3])},this._fxParams))]),dojo.connect(c,"onPlay",this,function(){this._adjustHeight()}),dojo.connect(c,"onEnd",this,function(){dojo.destroy(f[2]);dojo.destroy(f[3]);this._adjustHeight();this._onAnimationEnd()}),c.play()):(f=dojo.query(".dijitCalendarBodyContainer",this.domNode),this._drawMonth(f[0],b),this._drawMonth(f[1],c),this._adjustHeight(),this._onAnimationEnd());this.previousMonth=this.displayMonth},
_onMonthClick:function(a){dojo.stopEvent(a);for(a=a.target;a&&!a.dijitMonthValue;a=a.parentNode);if(a&&!dojo.hasClass(a,"dijitCalendarMonthSelected"))this.previousMonth=this.displayMonth,this.displayMonth=new Date(a.dijitMonthValue),this._populateGrid()},_onDayClick:function(a){dojo.stopEvent(a);for(var b=a.target;b&&!b.dijitDateValue;b=b.parentNode);if(b&&!dojo.hasClass(b,"dijitCalendarDisabledDate")){var a=b.dijitDateValue,c=swoodoo.date.difference(this.displayMonth,new Date(a),"month");this.previousMonth=
this.displayMonth;this.attr("value",a);if(c)var d=dojo.connect(this,"_onAnimationEnd",this,function(){this.onValueSelected(this.attr("value"),b);dojo.disconnect(d)});else this.onValueSelected(this.attr("value"),b)}},_onAnimationEnd:function(){},onDayMouseOver:function(){},onDayMouseOut:function(){},__onDayMouseOut:function(){var a=this._currentNode;dojo.removeClass(a,"dijitCalendarHoveredDate");this._currentNode=null;this.onDayMouseOut(a)},_onDayMouseOut:function(a){if(this._currentNode)(a=a.target)&&
a.dijitDateValue&&a==this._currentNode&&this.__onDayMouseOut()},_onDayMouseOver:function(a){if((a=a.target)&&a.dijitDateValue&&a!=this._currentNode)this._currentNode&&this.__onDayMouseOut(),this._currentNode=a,dojo.addClass(a,"dijitCalendarHoveredDate"),this.onDayMouseOver(a)},postCreate:function(){dojo.setSelectable(this.domNode,!1);this._clone({query:".dijitCalendarMonthTemplate",count:12});this._clone({query:".dijitCalendarDayLabelTemplate",count:6});this._clone({query:".dijitCalendarDateTemplate",
count:6});this._clone({query:".dijitCalendarBodyContainer",count:1});this.value=null;this.attr("value",new Date)}});dojo.provide("swoodoo.widgets.Autocompleter");dojo.require("dijit.form.ComboBox");dojo.require("swoodoo.ComboBoxReadStore");
dojo.declare("swoodoo.widgets.Autocompleter",dijit.form.ComboBox,{minChars:3,defaultValue:"",initValue:"",hiddenValue:"",lastSavedValue:"",lastSavedHiddenValue:"",isInvalidLocation:!1,hasDownArrow:!1,autoComplete:!1,labelType:"html",queryExpr:"${0}",searchAttr:"name",labelAttr:"label",requestMethod:"get",constructor:function(a){a.ajaxUrl?a.store=new swoodoo.ComboBoxReadStore({url:a.ajaxUrl,requestMethod:this.requestMethod,hiddenValueId:this._getHiddenValueId(a.id)}):console.log("swoodoo.widgets.Autocompleter: missing property 'ajaxUrl'");
if(a.initValue)a.value=a.initValue;a.name=a.id;a.lastSavedValue=a.initValue;a.lastSavedHiddenValue=a.hiddenValue},postCreate:function(){this.inherited(arguments);this._setHiddenValue(this.hiddenValue);this._initStyles();var a=dojo.byId(this.id),b=this;dojo.connect(a,"onfocus",function(){b._clearDefaultValue()});dojo.connect(a,"onblur",function(){b._restoreDefaultValue()})},_clearDefaultValue:function(){this.attr("displayedValue")==this.defaultValue&&(this.attr("displayedValue",""),dojo.removeClass(this.id,
"autocompleterInputDefaultValue"))},_restoreDefaultValue:function(){this.attr("displayedValue")==""&&this.lastSavedValue==this.defaultValue&&this.attr("displayedValue",this.defaultValue);this._markInputValueAsDefault()},_markInputValueAsDefault:function(){this.lastSavedValue==this.defaultValue&&dojo.addClass(this.id,"autocompleterInputDefaultValue")},_initStyles:function(){var a=dojo.byId("widget_"+this.id),b=dojo.byId(this.id);dojo.addClass(a,"autocompleterContainer");dojo.addClass(b,"autocompleterInput");
dojo.removeClass(b,"dijitReset");dojo.query(".dijitValidationIcon",a).forEach(function(a){a.style.display="none"});this.isInvalidLocation&&dojo.addClass(b,"error");this._markInputValueAsDefault();var c=this,d=dojo.connect(this,"_openResultList",function(){var a=dojo.byId(c._getPopupId());a&&(dojo.addClass(a,"swoodooMenu"),dojo.disconnect(d))})},_startSearch:function(a){this._popupWidget&&this._popupWidget.clearResultList();a.length<this.minChars?this._hideResultList():this.inherited(arguments)},onChange:function(a){this.inherited(arguments);
var b=this,c=!1,d=0;dojo.query("div.region",this._getPopupId()).some(function(e){d++;e=dojo.attr(e,"value");if(a==e.split("|")[0])return b._setHiddenValue(e),b.updateLastSavedValue(),c=!0});d>0&&!c&&(this.restoreLastSavedValue(),this._markInputValueAsDefault());this._popupWidget&&this._popupWidget.clearResultList()},_setHiddenValue:function(a){this.hiddenValue=a;dojo.byId(this._getHiddenValueId())?dojo.byId(this._getHiddenValueId()).value=a:dojo.create("input",{id:this._getHiddenValueId(),name:this._getHiddenValueId(),
type:"hidden",value:a},"widget_"+this.id)},_getHiddenValueId:function(a){return a?"hidden_"+a:"hidden_"+this.id},_getPopupId:function(){return this.id+"_popup"},updateLastSavedValue:function(){this.lastSavedValue=this.attr("displayedValue");this.lastSavedHiddenValue=this.hiddenValue},restoreLastSavedValue:function(){this.attr("displayedValue",this.lastSavedValue);this._setHiddenValue(this.lastSavedHiddenValue)}});dojo.provide("swoodoo.WindowOpener");
dojo.declare("swoodoo.WindowOpener",null,{_top:self,options:{popUnder:!0,tileWindows:!0,heightRule:!1,minWidth:0,minHeight:0,screenWidth:1024,screenHeight:768},constructor:function(a){if(top!=self)try{if(top.document.location.toString())this._top=top}catch(b){}if(a)this.options=dojo.mixin({},this.options,a)},open:function(a,b,c){if(!a)return!0;a=this._getWindow(a,this._getWindowName(),b,c);if(!a)return!1;this._handleInitialWindowFocus(a);this._preparePopUpWindow(a);a.init(a);return!0},_getWindow:function(a,
b,c,d){try{return this._top.window.open(a,b,"toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,top="+this._getWindowTop()+",left="+this._getWindowLeft(c,d)+",width="+this._getWindowWidth(c,d)+",height="+this._getWindowHeight())}catch(e){return!1}},_getWindowWidth:function(a,b){if(this.options.tileWindows)return Math.min(this.options.screenWidth,Math.floor(this._getScreenWidth()/b-10));var c=0;if(typeof this._top.window.innerWidth=="number")c=this._top.window.innerWidth;if(this._top.document.documentElement&&
this._top.document.documentElement.clientWidth)c=this._top.document.documentElement.clientWidth;return this.options.minWidth?this.options.minWidth>c?this.options.minWidth:c:c},_getWindowHeight:function(){if(this.options.heightRule)return Math.round(this._getScreenHeight()*0.6);if(this.options.tileWindows)return this._getScreenHeight();var a=0;if(typeof this._top.window.innerHeight=="number")a=this._top.window.innerHeight;if(this._top.document.documentElement&&this._top.document.documentElement.clientHeight)a=
this._top.document.documentElement.clientHeight;return this.options.minHeight?this.options.minHeight>a?this.options.minHeight:a:a},_getWindowTop:function(){return this.options.heightRule?Math.round(this._getScreenHeight()*0.4):this.options.tileWindows?0:this._top.window.screenTop!=void 0?this._top.window.screenTop:this._top.window.screenY},_getWindowLeft:function(a,b){return this.options.tileWindows?Math.floor(this._getWindowWidth(a,b)*a+10*a):this._top.window.screenLeft!=void 0?this._top.window.screenLeft:
this._top.window.screenX},_getWindowName:function(){return"cucpopup"+Math.floor(89999999*Math.random()+1E7)},_handleInitialWindowFocus:function(a){this.options.popUnder&&(a.blur(),navigator.userAgent.toLowerCase().indexOf("applewebkit")>-1&&(this._top.window.blur(),this._top.window.focus()))},_preparePopUpWindow:function(a){dojo.mixin(a,{init:function(a){this._doMozillaMagic();try{a.opener.window.focus()}catch(c){}},_doMozillaMagic:function(){typeof window.mozPaintCount!="undefined"&&this.window.open("about:blank").close()}})},
_getScreenWidth:function(){return window.screen.availWidth},_getScreenHeight:function(){return window.screen.availHeight?window.screen.availHeight:this.options.screenHeight}});dojo.provide("swoodoo.CompareToBox");dojo.require("swoodoo.WindowOpener");dojo.provide("dijit.DialogUnderlay");
dojo.declare("swoodoo.CompareToBox",null,{_preCheckedCMP2Boxes:{},constructor:function(a){this.id=a.id;this.baseUrl=a.baseUrl;this.origin=a.origin;this.extParams=a.extParams;this.cmp2Counts=a.cmp2Counts;this.cmp2Unchecks=a.cmp2Unchecks;this.swoodooOrigin=typeof a.swoodooOrigin=="undefined"?"":a.swoodooOrigin;this.econda=typeof a.econda=="undefined"?null:a.econda;var b=this;dojo.addOnLoad(function(){b._collectInitialyCheckedProviders();$("#compareToPlaceholder input[type=checkbox]").each(function(){$(this).change(function(){b._trackCmp2UserClicks(b.econda,
this);b.saveUnchecks()})})})},initCompareToClickEvent:function(){var a=dojo.byId(this.id);if(a&&a.innerHTML.trim().length)a.parentNode.style.display="block";this.popupHandlerLink=dojo.connect(dojo.byId("searchnow"),"onclick",this,this._handleCompareToPopups)},initCompareToStartTypeEvent:function(){dojo.connect(dojo.byId("departure"),"keyup",this,this._hideCompareToBox);dojo.connect(dojo.byId("destination"),"keyup",this,this._hideCompareToBox)},updateCompareToBlock:function(a,b,c,d,e,f){if(this.isLocationSelectedFromAutocompleter(a,
b)&&this.isLocationSelectedFromAutocompleter(c,d)){a="/compareto/".concat(b[1],"-",b[2],"/",d[1],"-",d[2],"/",e);f&&(a=e>f?a.concat("/",e):a.concat("/",f));var g=this;dojo.xhrGet({url:this.baseUrl.concat(a,"?cmp2Counts=",this.cmp2Counts,"&cmp2Unchecks=",this.cmp2Unchecks,"&origin=",this.swoodooOrigin),handleAs:"text",load:function(a){var b=dojo.byId(g.id);a.trim().length?(b.innerHTML=a,b.parentNode.style.display="block",$("#compareToPlaceholder input[type=checkbox]").each(function(){$(this).change(function(){g._trackCmp2UserClicks(g.econda,
this);g.saveUnchecks()})})):b.parentNode.style.display="none";g._collectInitialyCheckedProviders()},error:function(){var a=dojo.byId(g.id);a.parentNode.style.display="none";a.innerHTML=""}})}},saveUnchecks:function(){var a=this,b=this.baseUrl+"/uncheck-cmp2?";$("#compareToPlaceholder input[type=checkbox]").each(function(){b+=this.checked?this.name+"&":"unchecked-"+this.name+"&"});$.ajax({url:b,type:"GET",dataType:"json",success:function(b){a.cmp2Unchecks=b},error:function(){}})},isLocationSelectedFromAutocompleter:function(a,
b){return b.length>4&&(b[3]=="A"||b[3]=="T")&&a==b[0]&&b[1].length>0&&b[2].length>0},_handleCompareToPopups:function(a){var b=dojo.query("#compareToPlaceholder input[type='checkbox']:checked");this._storeUncheckedCucList(b);if(b&&b.length){for(var c=new swoodoo.WindowOpener,d=!1,e=[],f=0;f<b.length;f++){var g=this._getCompareToDeeplinkUrl(b[f].value);g&&(c.open(g.substr(g.indexOf("/",15)),f,b.length)?e.push(b[f].value):d=!0)}this._storeOpenedPopupCucs(e);if(d&&(!dojo.isIE||dojo.isIE>6))dojo.stopEvent(a),
this._openIeBlockerHintPanel()}},_storeOpenedPopupCucs:function(a){a=dojo.create("div",{id:"compareToOpenedPopupCucs",innerHTML:a},dojo.body(),"last");dojo.style(a,"display","none")},_storeUncheckedCucList:function(a){var b={};if(a)for(var c=0;c<a.length;c++)b[a[c].id]=a[c].name;a=[];for(c in this._preCheckedCMP2Boxes)b[c]||a.push("unchecked-"+this._preCheckedCMP2Boxes[c]);b=dojo.create("div",{id:"compareToUncheckedCucs",innerHTML:a},dojo.body(),"last");dojo.style(b,"display","none")},_getCompareToDeeplinkUrl:function(a){if(a){var b=
dojo.byId("departure").value,c=dojo.byId("dep_hidden").value.split("|"),d=dojo.byId("destination").value,e=dojo.byId("dst_hidden").value.split("|"),f=dojo.byId("DEPD").value;this._areParamsFromAutocompleterValidForCompareTo(b,c,d,e,f)&&(b=c[2],d=e[2]);var g=dojo.byId("return").checked,c=dojo.byId("nonstop")&&dojo.byId("nonstop").checked?0:1,f=f.split(".").reverse().join("-"),e=dojo.byId("daytime").value,e=e>=0&&e<=3?e:0,h=g?dojo.byId("RETD").value.split(".").reverse().join("-"):0,g=g?dojo.byId("returnDaytime").value:
0,g=g>=0&&g<=3?g:0,j=dojo.byId("adults_count")?dojo.byId("adults_count").value:1,k=dojo.byId("children_count")?dojo.byId("children_count").value:0,l=dojo.byId("infants_count")?dojo.byId("infants_count").value:0;return this.baseUrl+"/ctdeeplink/"+b+"/"+d+"/"+a+("/"+f+"/"+h+"/"+e+"/"+g+"/"+j+"/"+k+"/"+l+"/"+c+"/"+this.origin+"/"+this.extParams)}},_areParamsFromAutocompleterValidForCompareTo:function(a,b,c,d,e){return b.length==5&&(b[3]=="A"||b[3]=="T")&&a==b[0]&&b[1].length>0&&b[2].length>0&&d.length==
5&&(d[3]=="A"||d[3]=="T")&&c==d[0]&&d[1].length>0&&d[2].length>0&&(e.match(/^\d{2}[\.-]\d{2}[\.-]\d{4}$/)||e.match(/^\d{4}[\.-]\d{2}[\.-]\d{2}$/))},_hideCompareToBox:function(a){a=a.keyCode;if(a!=dojo.keys.TAB&&a!=dojo.keys.ENTER&&(a=dojo.byId(this.id)))a.parentNode.style.display="none",a.innerHTML=""},_openIeBlockerHintPanel:function(){this._resizeIeBlockerHintPanel();this._showIeBlockerHintPanelBackground();this._showIeBlockerHintPanel();dojo.disconnect(this.popupHandlerLink);dojo.connect(window,
"onresize",this,"_resizeIeBlockerHintPanel");dojo.connect(window,"onresize",this,"_showIeBlockerHintPanelBackground");dojo.connect(dojo.byId("ieBlockerHintCloseButton"),"onclick",this,"_closeIeBlockerHintPanel");dojo.connect(dojo.byId("ieBlockerHintNoThanks"),"onclick",this,"_closeIeBlockerHintPanel")},_showIeBlockerHintPanel:function(){dojo.fx.wipeIn({node:"ieBlockerHint",duration:1E3,onEnd:function(){dojo.byId("ieBlockerHint").style.display="block"}}).play()},_showIeBlockerHintPanelBackground:function(){if(!dijit._underlay)dijit._underlay=
new dijit.DialogUnderlay;dijit._underlay.show()},_resizeIeBlockerHintPanel:function(){dojo.style("ieBlockerHint","width",this._getIeBlockerPanelWidth()+"px")},_closeIeBlockerHintPanel:function(){dojo.fx.wipeOut({node:"ieBlockerHint",duration:3E3}).play();dojo.byId("searchnow").click()},_getIeBlockerPanelWidth:function(){var a=dojo.isIE?document.documentElement.offsetWidth:window.innerWidth;return a>1044?a:1044},_collectInitialyCheckedProviders:function(){this._preCheckedCMP2Boxes={};var a=dojo.byId(this.id);
if(a){var b=this;dojo.forEach(dojo.query('input[type="checkbox"]:checked',a),function(a){b._preCheckedCMP2Boxes[a.id]=a.name})}},_trackCmp2UserClicks:function(a,b){if(a){var c=$(b).attr("name").match(/^compareto\[([^\]]+)\]/i);if(c){var d=$(b).prop("checked")?"checked":"unchecked",c=c[1]+" ("+$.trim($(b).next().text())+")";a.trackCmp2Click(c,d)}}}});dojo.provide("swoodoo.Hotels.CompareToBox");dojo.require("swoodoo.CompareToBox");
dojo.declare("swoodoo.Hotels.CompareToBox",[swoodoo.CompareToBox],{initCompareToStartTypeEvent:function(){dojo.connect(dojo.byId("location"),"keyup",this,this._hideCompareToBox)},updateCompareToBlock:function(a,b){if(this.isLocationSelectedFromAutocompleter(a,b)){var c=this;dojo.xhrGet({url:this.baseUrl+"/hotelcompareto/"+b[1]+"?cmp2Counts="+this.cmp2Counts+"&cmp2Unchecks="+this.cmp2Unchecks+"&origin="+this.swoodooOrigin,handleAs:"text",load:function(a){var b=dojo.byId(c.id);if(a.trim().length)b.innerHTML=
a,c.onDataWasReturned(b),$("#compareToPlaceholder input[type=checkbox]").each(function(){$(this).change(function(){c._trackCmp2UserClicks(c.econda,this);c.saveUnchecks()})});else c.onDataWasNotReturned(b);c._collectInitialyCheckedProviders()},error:function(){var a=dojo.byId(c.id);c.onDataWasNotReturned(a);a.innerHTML=""}})}},onDataWasReturned:function(a){a.parentNode.style.display="block"},onDataWasNotReturned:function(a){a.parentNode.style.display="none"},isLocationSelectedFromAutocompleter:function(a,
b){return b.length==2&&b[0]==a&&b[1].length>0},_getCompareToDeeplinkUrl:function(a){if(a){var b=dojo.byId("location").value,c=dojo.byId("hidden_location").value.split("|");this.isLocationSelectedFromAutocompleter(b,c)&&(b=c[1]);var c=dojo.byId("STARTD").value.split(".").reverse().join("-"),d=dojo.byId("ENDD").value.split(".").reverse().join("-"),e=dojo.byId("GUESTS").value||1,f=dojo.byId("ROOMS").value||1;return this.baseUrl+"/hotelctdeeplink/"+[a,b,c,d,f,e,this.origin,this.extParams].join("/")}},
_hideCompareToBox:function(a){a=a.keyCode;if(a!=dojo.keys.TAB&&a!=dojo.keys.ENTER)a=dojo.byId(this.id),this.onDataWasNotReturned(a),a.innerHTML=""}});dojo.provide("swoodoo.Hotels.SearchFormAnimator");
dojo.declare("swoodoo.Hotels.SearchFormAnimator",null,{expandCmp2Action:"expandCmp2",collapseCmp2Action:"collapseCmp2",expandFiltersAction:"expandFilters",collapseFiltersAction:"collapseFilters",defaultMainFormHeight:140,defaultCompareToBoxHeight:62,defaultErrorBoxHeight:62,defaultMoreOptionsBoxHeight:62,constructor:function(a){this.compareToBox=a.cmp2Box;this.compare2dataExists=a.cmp2BoxVisible;this.error=a.errorsBoxVisible;this.cmp2AutoExpand=a.cmp2AutoExpand;this.moreOptions=a.moreOptions;this.compareToBoxHeight=
this._getCompareToBoxHeight();this.mainFormHeight=this._getMainFormHeight();this.errorsBoxHeight=this._getErrorsBoxHeight();this.moreOptionsBoxHeight=this._getMoreOptionsBoxHeight();this.animationInProgress=!1;this.connectEvents()},_animationOnEnd:null,connectEvents:function(){var a=this;this.cmp2AutoExpand&&(dojo.connect(this.compareToBox,"onDataWasReturned",function(b){if(!a.animationInProgress&&!a.compare2dataExists)b.parentNode.style.display="none",a._animationOnEnd=function(){a.animationInProgress=
!1;b.parentNode.style.display="block"},a.animationInProgress=!0,a.animateSearchForm(a.expandCmp2Action),a._hideErrorBox(),a.compare2dataExists=!0}),dojo.connect(this.compareToBox,"onDataWasNotReturned",function(b){if(!a.animationInProgress&&a.compare2dataExists)b.parentNode.style.display="none",a._animationOnEnd=function(){a.animationInProgress=!1},a.animationInProgress=!0,a.animateSearchForm(a.collapseCmp2Action),a.compare2dataExists=!1}));this.moreOptions&&dojo.connect(dojo.byId("more-options-button"),
"onclick",function(){var b=dojo.style(a.moreOptionsBoxNode);if(!a.animationInProgress)if(b.display=="none")a._animationOnEnd=function(){a.moreOptionsBoxNode.style.display="block";dojo.byId("moreSearchFormOptionsLink").innerHTML=translate("LANG_HOTEL_SEARCH_FORM_LESS_OPTIONS");a.animationInProgress=!1},a.animationInProgress=!0,a.animateSearchForm(a.expandFiltersAction);else{a._animationOnEnd=function(){dojo.byId("moreSearchFormOptionsLink").innerHTML=translate("LANG_HOTEL_SEARCH_FORM_MORE_OPTIONS");
a.moreOptionsBoxNode.style.display="none";a.animationInProgress=!1};if(dojo.isIE)a.moreOptionsBoxNode.style.display="none";a.animationInProgress=!0;a.animateSearchForm(a.collapseFiltersAction)}})},animateAfterLoad:function(a){if(!(typeof controller=="undefined"||this.error)){var b=dojo.byId("search-form-more-options-row"),c=dojo.style(b);if(a)c.display=="block"?dojo.byId("moreSearchFormOptionsLink").innerHTML=translate("LANG_HOTEL_SEARCH_FORM_LESS_OPTIONS"):(this._animationOnEnd=function(){b.style.display=
"block";dojo.byId("moreSearchFormOptionsLink").innerHTML=translate("LANG_HOTEL_SEARCH_FORM_LESS_OPTIONS")},this.animateSearchForm(this.expandFiltersAction));else if(c.display!="none")this._animationOnEnd=function(){b.style.display="none";dojo.byId("moreSearchFormOptionsLink").innerHTML=translate("LANG_HOTEL_SEARCH_FORM_MORE_OPTIONS")},this.animateSearchForm(this.collapseFiltersAction)}},_getMainFormHeight:function(){this.mainFormNode=dojo.byId("mainbox-search-block");this.advertisementBlockNode=dojo.byId("mainbox-advertisement-block");
return typeof this.mainFormNode!="undefined"&&this.mainFormNode!=null?dojo.style(this.mainFormNode,"height"):this.defaultMainFormHeight},_getCompareToBoxHeight:function(){this.compareToBoxNode=dojo.byId("row-compare-to");return this.defaultCompareToBoxHeight},_getMoreOptionsBoxHeight:function(){this.moreOptionsBoxNode=dojo.byId("search-form-more-options-row");return this.defaultMoreOptionsBoxHeight},_getErrorsBoxHeight:function(){this.errorBoxNode=dojo.byId("search-form-errors-row");return this.error?
this.defaultErrorBoxHeight:0},_hideErrorBox:function(){var a=this;return this.error?(this.errorsBoxHeight=0,dojo.removeClass("location","error"),this.error=!1,dojo.fadeOut({node:this.errorBoxNode,onEnd:function(){a.errorBoxNode.style.display="none"}}).play()):null},animateSearchForm:function(a){switch(a){case this.expandCmp2Action:startHeight=this._getMainFormHeight();endHeight=startHeight+this.compareToBoxHeight-this.errorsBoxHeight;this._animateMainForm(startHeight,endHeight);break;case this.collapseCmp2Action:startHeight=
this._getMainFormHeight();endHeight=startHeight-this.compareToBoxHeight;this._animateMainForm(startHeight,endHeight);break;case this.expandFiltersAction:startHeight=this._getMainFormHeight();endHeight=startHeight+this.moreOptionsBoxHeight;this._animateMainForm(startHeight,endHeight);break;case this.collapseFiltersAction:startHeight=this._getMainFormHeight(),endHeight=startHeight-this.moreOptionsBoxHeight,this._animateMainForm(startHeight,endHeight)}},_animateMainForm:function(a,b){var c=this.advertisementBlockNode?
dojo.fx.combine([this._runExpandCollapseAnimation(this.advertisementBlockNode,startHeight,b),this._runExpandCollapseAnimation(this.mainFormNode,startHeight,b)]):this._runExpandCollapseAnimation(this.mainFormNode,startHeight,b);this._animationOnEnd&&dojo.connect(c,"onEnd",this._animationOnEnd);c.play()},_runExpandCollapseAnimation:function(a,b,c){return dojo.animateProperty({node:a,properties:{height:{start:b,end:c}}})}});dojo.provide("swoodoo.Hotels.SearchFormFilters");
dojo.declare("swoodoo.Hotels.SearchFormFilters",null,{filtersUrl:null,properties:null,locationName:null,locationUrl:null,searchFormAnimator:null,locationChanged:!1,hotelsController:null,validFilters:{mincat:!0,dist:!0,price:!0,attr:!0,orderby:!0},translations:{hotelCategorie:translate("LANG_HOTEL_CATEGORIE"),categoryFrom:translate("LANG_HOTEL_FROM_CATEGORIE"),stars:translate("LANG_HOTEL_STARS"),showAllCategories:translate("LANG_HOTEL_SHOW_ALL_CATEGORIES")},constructor:function(a){if(typeof controller!=
"undefined")this.hotelsController=controller;this.filtersUrl=a.baseUrl+"/hotelformfilters/";this.searchFormAnimator=a.searchFormAnimator;this.locationName=a.locationName==""?null:a.locationName;this.locationUrl=a.locationUrl==""?null:a.locationUrl;this.loadFiltersBox(this._formatHashParamsForAjax());this.connectEvents()},connectEvents:function(){var a=this;hotels_autocomplete.onSelect=function(){a._isLocationChanged(a._getLocation())?a.loadFiltersBox(a._formatHashParamsForAjax()):a.hideFiltersLoader()};
dojo.connect(dojo.byId("location"),"onkeyup",function(b){a.showFiltersLoader();if(b.keyCode==13||b.keyCode==9)dojo.isIE?b.srcElement.blur():b.target.blur();b.keyCode==8&&dojo.byId("location").value.length==0&&(dojo.isIE?b.srcElement.blur():b.target.blur())});this.hotelsController&&(dojo.connect(a.hotelsController,"applyFilter",function(b){a.locationChanged||a.loadFiltersBox(b)}),dojo.connect(this.hotelsController,"hideLoader",function(){a.hideFiltersLoader()}))},loadFiltersBox:function(a){this.showFiltersLoader();
var b=this._getLocation(),c=b.locationUrl;this.locationChanged=this._isLocationChanged(b);typeof a=="undefined"&&(a=this._formatHashParamsForAjax());this._storeFilterValue(a);if(a=="/"||!a)a="";this._isLocationFromAutocompleter()||(c=null);var d=this;return dojo.xhrGet({url:d.filtersUrl+c+a,handleAs:"text",load:function(a){dojo.byId("moreOptionsPlaceholder").innerHTML=a;a.length==0?d.loadFiltersBoxOnEnd(!1):(d.loadFiltersBoxOnEnd(!0),swoodoo.scripts.eval(dojo.byId("moreOptionsPlaceholder")))},error:function(){dojo.byId("moreOptionsPlaceholder").innerHTML=
"";d.loadFiltersBoxOnEnd(!1)}})},loadFiltersBoxOnEnd:function(a){(!this.hotelsController||this.hotelsController.loaderIsOn==!1||this.locationChanged)&&this.hideFiltersLoader();this.searchFormAnimator.animateAfterLoad(a);if(a){var b=dojo.byId("hotel-distance-selectbox"),c=this;b&&dojo.connect(b,"onchange",function(){c.applyFilterParams(b.value)});var d=dojo.byId("hotel-attractions-selectbox");d&&dojo.connect(d,"onchange",function(){c.applyFilterParams(d.value)});var e=dojo.byId("hotel-price-selectbox");
e&&dojo.connect(e,"onchange",function(){c.applyFilterParams(e.value)})}else this.hideFiltersLoader()},showFiltersLoader:function(){dojo.byId("form-filters-loader").style.display="block"},hideFiltersLoader:function(){dojo.byId("form-filters-loader").style.display="none"},loadCategyFilter:function(a){try{this.categoryFilter=new swoodoo.widgets.hotelCategoryFilter({titlePattern:this.translations.hotelCategorie+" <strong>"+this.translations.categoryFrom+" % "+this.translations.stars+"</strong>",inactiveTitle:this.translations.hotelCategorie+
" <strong>"+this.translations.showAllCategories+"</strong>",filterData:a,imgFile:"SF_HotelCategory_Active.png",imgFileInactive:"SF_HotelCategory_InActive.png",applyFilterCallback:this.applyFilterParams}),this.categoryFilter.placeAt(dojo.create("div",{"class":"hotel-category-filters"},dojo.byId("hotel-category-filters"),0),"first")}catch(b){}},_isLocationChanged:function(a){var b=a.locationUrl!=this.locationUrl;if(!this.hotelsController&&b)this.locationName=a.locationName,this.locationUrl=a.locationUrl;
return b},_isLocationFromAutocompleter:function(){return this._getLocation().locationName==dojo.byId("location").value&&dojo.byId("location").value!=""?!0:!1},applyFilterParams:function(a){if(searchFormFilters.hotelsController&&!searchFormFilters.locationChanged&&searchFormFilters._isLocationFromAutocompleter())searchFormFilters.hotelsController.applyFilter(a,!0);else{searchFormFilters.hideFiltersLoader();var b=a.substring(0,1);substring=a;b=="/"&&(substring=a.substring(1,a.length));searchFormFilters._setHash(substring);
searchFormFilters.loadFiltersBox(a)}},_getHashParams:function(){return swoodoo.Location._init(swoodoo.Location.getHash()).replace(/;+/g,",")},_setHash:function(a){if(a.length==0)a=swoodoo.Location.defaultValue;swoodoo.Location.setHash(escape(this._formatHashParamsForUrl(a).replace(/,+/g,";")))},_formatHashParamsForAjax:function(){return this._getHashParams().replace(/#|\|/g,"/")},_formatHashParamsForUrl:function(a){if(typeof a!="undefined"&&a!=null)return a.replace(/\//g,"|")},_getLocation:function(){return this._parseLocation(dojo.byId("hidden_location").value)},
_storeFilterValue:function(a){typeof a=="undefined"&&(a="");if(dojo.byId("filter-value-from-hash"))dojo.byId("filter-value-from-hash").value=this._parseFilterValue(a,this.validFilters)},_parseFilterValue:function(a,b){if(typeof a=="undefined"||!a)return swoodoo.Location.defaultValue;a=a.replace(/\//g,"|");a.substring(0,1)=="|"&&(a=a.replace(/\|/,""));locationArray=a.split("|");var c=locationArray.length;if(c<2)return swoodoo.Location.defaultValue;var d=[];for(i=0;i<c;i+=2){if(typeof locationArray[i+
1]=="undefined"&&!locationArray[i+1])break;b[locationArray[i]]&&(d.push(locationArray[i]),d.push(locationArray[i+1]))}return d.length==0?swoodoo.Location.defaultValue:d.join("|").replace(/,+/g,";")},_parseLocation:function(a){var b={locationName:null,locationUrl:null};if(!a||a=="")return b;a=a.split("|");b.locationName=typeof a[0]!="undefined"&&a[0]!=""?a[0]:null;b.locationUrl=typeof a[1]!="undefined"&&a[1]!=""?a[1]:null;return b}});
function ResultRenderer(a){this.resultPanelIdTop=a.resultPanelId+"Top";this.resultPanelIdBottom=a.resultPanelId+"Bottom";this.testMode=a.testMode;this.deeplinkUrl=a.deeplinkUrl;this.country=a.country;this.overlayEnabled=a.overlay;this.commonImageUrl=a.commonImageUrl;this.isWhitelabel=a.isWhitelabel;this.translatedStrings={};this.translatedStrings.book=translate("LANG_FLIGHTVIEW_MAIN_BOOK_BUTTON");this.translatedStrings.bookBy=translate("LANG_BOOK_BY");this.BigButtonMoreInfoClass="";if(!this.isWhitelabel)this.translatedStrings.book=
translate("LANG_RESULT_MAIN_BOOK_INFO_BUTTON"),this.BigButtonMoreInfoClass="BB-more-info-booking-flights";this.adults=1;this.babies=this.children=0}
ResultRenderer.prototype.drawResults=function(a,b){this.adults=dojo.byId("adults_count").value;this.children=dojo.byId("children_count")?dojo.byId("children_count").value:0;this.babies=dojo.byId("infants_count")?dojo.byId("infants_count").value:0;this.draw(this.generateTripHtml(a[0],0,b),!0);for(var c="",d=1,e=a.length;d<e;++d)c+=this.generateTripHtml(a[d],d,b);this.draw(c,!1)};
ResultRenderer.prototype.drawNoResults=function(a){dojo.byId("sortingPanel").innerHTML="";dojo.byId("horizontal_menu_daytime_header").innerHTML="&nbsp;";dojo.removeClass("filter_panel","mb-o");dojo.byId(this.resultPanelIdTop).innerHTML='<div class="pb-j pl-e pr-g" align="center" style="font-weight:bold">'+a+"</div>";dojo.byId("searchnow").disabled=!1;StatusPanel.prototype.stop()};
ResultRenderer.prototype.clear=function(){dojo.byId(this.resultPanelIdTop).innerHTML="";dojo.byId(this.resultPanelIdBottom).innerHTML=""};ResultRenderer.prototype.getDeeplink=function(a,b,c){a=this.deeplinkUrl+"/"+c+"/"+a+"/"+this.adults+"/"+this.children+"/"+this.babies;b&&(a+="/"+b);return a};
ResultRenderer.prototype.generateTripHtml=function(a,b,c){if(!a)return"";var d=this.overlayEnabled&&!dojo.isIE?' onclick="return DeeplinksDialogRenderer.open(this);"':"",d='<\!-- Line result --\><div>    <div class="font-line ml-a"><img class="imageheight" src="'+this.commonImageUrl+'/box/flightbox_border_top.png" width="576" height="6" alt="" title="" /></div>    <div class="flightbox-border pt-e pb-e '+this.BigButtonMoreInfoClass+'">        <div class="width84 pl-e left">            <\!-- preisbox --\>            <div id="flight_price_'+
b+'" class="flight-price-box">                <img src="'+this.commonImageUrl+'/flightbox_btn_order.png" width="82" height="51" alt="" title="" />                <div class="strong color-2 price-fix-text">                    <div class="font-big" id="totalPrice_'+b+'">'+a.totalPriceFormatted+'</div>                    <div class="font-smaller">'+this.translatedStrings.book+'</div>                </div>                <div class="price-fix-link" style="z-index:5;"><a href="'+this.getDeeplink(a.tripId,
null,c)+'" target="_blank"'+d+'><img src="'+this.commonImageUrl+'/trans.gif" width="82" height="51" alt="" title="" /></a></div>            </div>            <\!-- end preisbox --\>            <div class="pt-l-fix t-right pr-e booking-otas-label-box">                <span class="strong">'+this.translatedStrings.bookBy+":</span>            </div>        </div>        <\!-- first line --\>"+this.generateFlightHtml(a.outboundFlight,!1,b)+"<\!-- end first line --\>";d+="<\!-- second line --\>";d+=a.type==
"BW"?this.generateFlightHtml(a.inboundFlight,!0,b):'<div class="left ml-i font-small data-line"><div class="left" style="width:434px">&nbsp;</div><div class="v-clear"></div></div>';d+="<\!-- end second line --\>";d+='<\!-- bottom line --\>            <div class="left ml-h font-small booking-otas-list-box">                <table>                    <tr>                        <td class="v-top width444 ota-padding">                            <div class="ota-list nowrap-child-a">'+this.generateOtasHtml(a.alternative,
b,c)+'</div><div class="v-clear"></div>                        </td>                    </tr>                </table>            </div>        <\!-- end bottom line --\>        <div class="v-clear"></div>    </div>    <div class="font-line ml-a"><img class="imageheight" src="'+this.commonImageUrl+'/box/flightbox_border_bottom.png" width="576" height="18" alt="" title="" /></div></div>                <\!-- End Line result --\>                ';return d};
ResultRenderer.prototype.generateOtasHtml=function(a,b,c){for(var d="",e=0;e<a.length;e++){var f;typeof a[e].otaTitle!="undefined"&&a[e].otaTitle!=null?f=' title="'+a[e].otaTitle.replace(/\"/g,"&quot;")+'"':(f=a[e].otaName+(a[e].totalFormattedPrice?": "+a[e].totalFormattedPrice:""),f=' title="'+f.replace(/\"/g,"&quot;")+'"');d+='<a id="ota_'+b+"_"+e+'"'+(this.overlayEnabled&&!dojo.isIE?' onclick="return DeeplinksDialogRenderer.open(this);"':"")+' href="'+this.getDeeplink(a[e].tripId,a[e].isTextLink?
a[e].ota:null,c)+'"'+f+' target="_blank">'+a[e].otaName;a[e].totalFormattedPrice&&(d+=": "+a[e].totalFormattedPrice);d+="</a>";e<a.length-1&&(d+='<span class="p-lr-g color-7"> | </span> ')}return d};
ResultRenderer.prototype.generateFlightHtml=function(a,b,c){var d=b?" data-line":"",e=b?"flight_date_ret_"+c:"flight_date_fwd_"+c,f=b?"flight_route_ret_"+c:"flight_route_fwd_"+c,g=b?"airline_ret_"+c:"airline_fwd_"+c,h=b?"flight_times_ret_"+c:"flight_times_fwd_"+c,j=b?"stops_ret_"+c:"stops_fwd_"+c,b=b?"duration_ret_"+c:"duration_fwd_"+c,c=a.depTime.length==0||a.arrTime.length==0?translate("LANG_FLIGHT_UNKNOWN_TIMES"):a.depTime+" - "+a.arrTime,k="&nbsp;";if(a.airlineName)k=a.airlineName;else if(a.airline.airlineName&&
a.airline.airlineName!="")k=a.airline.airlineName;return'        <div class="left ml-i font-small'+d+'">                <div class="left">                    <div class="width51 left color-4" id="'+e+'"><span class="default-strong">'+a.depDateFormatted+".</span> "+a.depWeekday+'</div>                    <div class="left default-strong duration-width" id="'+h+'">'+c+'</div>                    <div id="'+b+'" class="left color-4 width42"><span class="p-lr-c">'+a.duration+'</span></div>                    <div class="cutstring ellipsis column-ab pl-e left color-4" id="'+
f+'">'+a.depName+" - "+a.dstName+'</div>                    <div id="'+g+'" class="cutstring ellipsis width80 pl-e left color-4">'+k+'</div>                    <div id="'+j+'" class="left color-4 pl-r"><span class="default-strong p-lr-c">'+(a.stops!=void 0?a.stops:a.parts.length-1)+'</span></div>                    <div class="v-clear"></div>                </div>                <div class="v-clear"></div>            </div>'};
ResultRenderer.prototype.draw=function(a,b){if(!this.testMode)b?dojo.byId(this.resultPanelIdTop).innerHTML=a:dojo.byId(this.resultPanelIdBottom).innerHTML=a};function CrossSaleRenderer(a,b,c){this.csPanelId=a;this.swAdsMiddlePanelId=b;this.hideMiddleAdsWhenCrossSaleExists=c}CrossSaleRenderer.prototype.drawCsAd=function(a){if(a.length==0)this.clear();else{if(this.hideMiddleAdsWhenCrossSaleExists)dojo.byId(this.swAdsMiddlePanelId).innerHTML="";dojo.byId(this.csPanelId).innerHTML=a}};
CrossSaleRenderer.prototype.clear=function(){dojo.byId(this.csPanelId).innerHTML=""};
CrossSaleRenderer.prototype.drawCsAdEcondaTags=function(){if(!dojo.byId("econda_offer_type")||!dojo.byId("econda_offer_cuc")||!dojo.byId("econda_content")||!dojo.byId("econda_siteid")||!dojo.byId("econda_carea"))return!1;var a={};a.content=dojo.byId("econda_content").innerHTML;a.carea=dojo.byId("econda_carea").innerHTML;a.siteid=dojo.byId("econda_siteid").innerHTML;a.crossEvent=[["crossview",dojo.byId("econda_offer_cuc").innerHTML,dojo.byId("econda_offer_cuc").innerHTML,dojo.byId("econda_cs_departure").innerHTML,
dojo.byId("econda_cs_destination").innerHTML,dojo.byId("econda_cs_route").innerHTML]];a.pageId=a.content;EcondaTracker.trackEvent(a)};CrossSaleRenderer.prototype.renderResponse=function(a){if(this.hideMiddleAdsWhenCrossSaleExists)dojo.byId("swAdsMiddlePlaceHolder").style.display="none",dojo.addClass("swAdsMiddlePlaceHolder","hiddenByXsales");this.drawCsAd(a);this.drawCsAdEcondaTags()};dojo.require("swoodoo.scripts");
function CrossSaleTransporter(a){this.renderer=a.renderer;this.crossSaleUrl=a.crosssaleUrl}CrossSaleTransporter.prototype.deliver=function(){var a=this.renderer;dojo.xhrGet({url:this.crossSaleUrl,handleAs:"text",load:function(b){b.length!=0&&(a.renderResponse(b),swoodoo.scripts.eval("crosssale-offer"))},error:function(){}})};
function FilterRenderer(a,b,c,d){this.filterPanelId=a;this.horizontalPanelId=b;this.horizontalHeaderPanelId="horizontal_menu_daytime_header";this.baseUrl=c;this.testMode=d;this.translations={};this.translations.priceFrom=translate("LANG_BOX_FROMPRICE")+" "}
FilterRenderer.prototype.draw=function(a,b){if(!this.testMode){if(a.returnDaytime)c=!0;else{a.returnDaytime="";var c=!1}dojo.byId(this.filterPanelId).innerHTML=this.getFilterPanelHTML(a,b);dojo.byId(this.horizontalPanelId).innerHTML=this.getHorizontalFilter(a.daytime,a.returnDaytime,c);dojo.byId(this.horizontalHeaderPanelId).innerHTML=this.getHorizontalFilterHeader(c)}};
FilterRenderer.prototype.clear=function(){dojo.byId(this.filterPanelId).innerHTML="";dojo.byId(this.horizontalPanelId).innerHTML="";dojo.byId(this.horizontalHeaderPanelId).innerHTML="&nbsp;"};FilterRenderer.prototype.getHorizontalFilterPanelHTML=function(){};
FilterRenderer.prototype.getHorizontalFilterHeader=function(a){return'<div><div class="width275 left box3-head-soft"><h2 class="inline pr-h">'+translate("LANG_FLIGHTTO_DAYTIME")+':</h2></div><div class="width275 left pl-j" '+(a?"":'style="display:none"')+'><h2 class="inline pr-h">'+translate("LANG_FLIGHTBACK_DAYTIME")+':</h2></div><div class="v-clear"></div></div><div class="v-clear"></div>'};
FilterRenderer.prototype.getHorizontalFilter=function(a,b,c){return'<div class="width275 left box3-head-soft b-r-5"><div class="p-tb-e">'+this.getHorizontalPanelBox(a,"jsf_horizontal_daytimefilter_box_item_")+'</div></div><div class="width275 left pl-j" '+(c?"":'style="display:none"')+'><div class="p-tb-e">'+this.getHorizontalPanelBox(b,"jsf_horizontal_retdaytimefilter_box_item_")+'</div></div><div class="v-clear"></div>'};
FilterRenderer.prototype.getHorizontalPanelBox=function(a,b){var c='<h2 class="inline pr-h"><span class="font-small">';if(!a)return"";c+=a[0].selected?'<span id="'+b+a[0].id+'" class="activelink">'+translate("LANG_FLIGHT_ALL")+"</span>":'<a id="'+b+a[0].id+'" href="'+this.baseUrl+a[0].filterUrl+'">'+translate("LANG_FLIGHT_ALL")+"</a>";for(var d=[null,null,null],e=1;e<a.length;e++)d[parseInt(a[e].id)-1]=a[e];for(e=0;e<=2;e++)c+=d[e]==null||d[e].inactive?' | <span id="'+b+e+'" class="inactivelink">'+
this.dayTimesTitles["id_"+e]+"</span>":d[e].selected?' | <span id="'+b+e+'" class="activelink">'+this.dayTimesTitles["id_"+e]+"</span>":' | <a id="'+b+e+'" href="'+this.baseUrl+d[e].filterUrl+'">'+this.dayTimesTitles["id_"+e]+"</a>";c+="</span></h2>";return c};
FilterRenderer.prototype.getFilterPanelHTML=function(a,b){var c="";c+='<div class="font-line box-top-border-height"><div class="sgrey-box-top-left sgrey-box-color"></div><div class="middle-box-narrow-widht sgrey-box-color"></div><div class="sgrey-box-top-right sgrey-box-color"></div><div class="v-clear"></div></div>';var d=!0;a.fdep&&(c+=this.getFilterBoxHTML("departure",a.fdep,d),d=!1);a.fdst&&(c+=this.getFilterBoxHTML("destination",a.fdst,d),d=!1);a.stops&&(c+=this.getFilterBoxHTML("stops",a.stops,
d));a.airline&&(c+=this.getFilterBoxHTML("airline",a.airline));a.depdays&&(c+=this.getFilterBoxHTML("depdays",a.depdays));a.retdays&&(c+=this.getFilterBoxHTML("retdays",a.retdays));c+='<img height="5" width="186" title="" alt="" src="'+b+'/box/box1_default_border_bottom.png" class="imageheight"/>';return c};
FilterRenderer.prototype.getFilterBoxHTML=function(a,b,c){var d="";d+=c==null||c==!1?'<div class="box1-subtitle bg-04" id="jsf_left_menu_'+a+'_box">'+this.boxTitles[a]+"</div>":'<div id="jsf_left_menu_'+a+'_box" class="box1-head-soft bg-04"><h2>'+this.boxTitles[a]+"</h2></div>";d+='<div class="no-big-padding-top break-long-name"><div class="box1-border p-j"><div class="font-small">';if(a=="stops")d+=this.getStopsFilterItemHTML(b);else for(c=0;c<b.length;c++)d+='<div class="box1-line">',d+=this.getFilterItemHtml(b[c],
a),d+="</div>";d+="</div></div></div>";return d};
FilterRenderer.prototype.getFilterItemHtml=function(a,b){var c="jsf_left_menu_"+b+"_box_item_"+a.id,d="jsf_left_menu_"+b+"_box_item_val_"+a.id,e="";a.name=="all"?e+=a.selected?'<div class="sep1-col1"><span id="'+c+'" class="activelink">'+translate("LANG_FLIGHT_ALL")+"</span></div>":'<div id="'+c+'" class="sep2-col1"><a id="'+c+'_link" href="'+this.baseUrl+a.filterUrl+'">'+translate("LANG_FLIGHT_ALL")+"</a></div>":(a.selected?(e+='<span id="'+c+'"class="sep2-col1 activelink">'+a.name+"</span>",a.price&&
(e+='<div id="'+d+'" class="sep2-col2">'+this.translations.priceFrom+a.price+"</div>")):e+=a.inactive?'<span id="'+c+'"class="sep2-col1 inactivelink">'+a.name+"</span>":'<div id="'+c+'" class="sep2-col1"><a id="'+c+'_link" href="'+this.baseUrl+a.filterUrl+'">'+a.name+'</a></div><div id="'+d+'" class="sep2-col2">'+this.translations.priceFrom+a.price+"</div>",e+='<div class="v-clear"></div>');return e};
FilterRenderer.prototype.getStopsFilterItemHTML=function(a){var b='<div class="box1-line">';b+=a[0].selected?'<div class="sep1-col1"><span id="jsf_left_menu_stops_box_item_'+a[0].id+'" class="activelink"> '+translate("LANG_FLIGHT_ALL")+"</span></div>":'<div id="jsf_left_menu_stops_box_item_'+a[0].id+'" class="sep2-col1"><a id="jsf_left_menu_stops_box_item_'+a[0].id+'_link" href="'+this.baseUrl+a[0].filterUrl+'">'+translate("LANG_FLIGHT_ALL")+"</a></div>";b+='<div class="v-clear"></div>';b+="</div>";
for(var c=[null,null,null],d=1;d<a.length;d++)c[parseInt(a[d].id)]=a[d];for(d=0;d<=2;d++)b+='<div class="box1-line">',c[d]==null||c[d].inactive?b+='<div class="sep2-col1"><span id="jsf_left_menu_stops_box_item_'+d+'" class="inactivelink">'+this.stopsTitles["id_"+d]+"</span></div>":c[d].selected?(b+='<div class="sep2-col2">'+this.translations.priceFrom+c[d].price+"</div>",b+='<div class="sep2-col1"><span id="jsf_left_menu_stops_box_item_'+d+'" class="activelink"> '+this.stopsTitles["id_"+c[d].id]+
"</span></div>"):(b+='<div class="sep2-col1"><a id="jsf_left_menu_stops_box_item_'+d+'" href="'+this.baseUrl+c[d].filterUrl+'">'+this.stopsTitles["id_"+c[d].id]+"</a></div>",b+='<div class="sep2-col2">'+this.translations.priceFrom+c[d].price+"</div>"),b+='<div class="v-clear"></div>',b+="</div>";return b};
FilterRenderer.prototype.boxTitles={daytime:translate("LANG_FILTER_DAYTIME_TITLE"),airline:translate("LANG_FILTER_AIRLINE_TITLE"),retdays:translate("LANG_FITLER_RETDAYS_TITLE"),depdays:translate("LANG_FITLER_DEPDAYS_TITLE"),stops:translate("LANG_FITLER_STOPS_TITLE"),departure:translate("LANG_FILTER_DEPARTURE_TITLE"),destination:translate("LANG_FILTER_DESTINATION_TITLE")};
FilterRenderer.prototype.stopsTitles={id_0:translate("LANG_FILTER_STOPS_ITEM_NONSTOP"),id_1:translate("LANG_FILTER_STOPS_ITEM_1STOP"),id_2:translate("LANG_FILTER_STOPS_ITEM_2STOP")};FilterRenderer.prototype.dayTimesTitles={id_0:translate("LANG_FLIGHT_MORNING"),id_1:translate("LANG_FLIGHT_AFTERNOON"),id_2:translate("LANG_FLIGHT_EVENING")};
function KhotelsResultRenderer(a){this.resultPanelIdTop=a.resultPanelId+"Top";this.resultPanelIdBottom=a.resultPanelId+"Bottom";this.testMode=a.testMode;this.translatedStrings={};this.translatedStrings.book=translate("LANG_HOTELS_MAIN_BOOK_BUTTON");this.translatedStrings.bookBy=translate("LANG_BOOK_BY");this.translatedStrings.bestPrice=translate("LANG_HOTEL_BEST_PRICE_BY");this.translatedStrings.outOf10=translate("LANG_HOTEL_OUT_OF_10_PONTS");this.translatedStrings.reviews=translate("LANG_HOTEL_REVIEWS");
this.translatedStrings.areamap=translate("LANG_HOTEL_AREAMAP");this.translatedStrings.hotelinfo=translate("LANG_HOTEL_HOTELINFO");this.translatedStrings.ratingsNotFound=translate("LANG_HOTEL_RATINGS_NOT_FOUND");this.translatedStrings.descriptionNotFound=translate("LANG_HOTEL_DESCRIPTION_NOT_FOUND");this.translatedStrings.more=translate("LANG_BOX_MORE");this.translatedStrings.allPrices=translate("LANG_HOTEL_ALL_PRICES");this.commonImageUrl=a.commonImageUrl;this.overlayEnabled=a.overlay;this.adults=
1;this.babies=this.children=0;this.country=a.country;this.defaultHotelImage=a.commonImageUrl+"/hotel_no_pic.gif";this.extUserParams=a.extUserParams;this.isWhitelabel=a.isWhitelabel;this.BigButtonMoreInfoClass="";if(!this.isWhitelabel)this.translatedStrings.book=translate("LANG_RESULT_MAIN_BOOK_INFO_BUTTON"),this.BigButtonMoreInfoClass=" big-button-more-info-booking"}
KhotelsResultRenderer.prototype.drawResults=function(a){if(a.length==0)this.drawNoResults();else{HotelsDialogRenderer.listHandle=a[0].listHandle;this.draw(this.generateHotelHtml(new Hotel(a[0]),0),!0);for(var b="",c=1,d=a.length;c<d;++c)b+=this.generateHotelHtml(new Hotel(a[c]),c);this.draw(b,!1)}};
KhotelsResultRenderer.prototype.drawNoResults=function(){dojo.byId(this.resultPanelIdTop).innerHTML='<div class="pb-j" align="center" style="font-weight:bold">'+translate("LANG_HOTEL_NO_RESULTS_FOUND")+"</div>";dojo.byId("searchnow").disabled=!1};KhotelsResultRenderer.prototype.clear=function(){dojo.byId(this.resultPanelIdTop).innerHTML="";dojo.byId(this.resultPanelIdBottom).innerHTML=""};
KhotelsResultRenderer.prototype.generateHotelHtml=function(a,b){var c=this.overlayEnabled?" onclick=\"return DeeplinksDialogRenderer.open(this, 'hotel');\"":"",d='<div class="font-line ml-a">                        <img class="imageheight" src="'+this.commonImageUrl+'/box/flightbox_border_top.png" alt="" title="" width="576" height="6">                    </div>';d+='<div class="flightbox-border hotel-list-item">';d+='<div class="hotel-price'+this.BigButtonMoreInfoClass+'">                    <img style="height: 51px; width: 82px; display: block;" title="" alt="" src="'+
this.commonImageUrl+'/flightbox_btn_order.png" />                    <div class="strong color-2 price-fix-text">                    <div class="font-big price-fix-text-value" id="totalPrice_'+b+'">'+a.price+'</div>                    <div class="font-smaller">'+this.translatedStrings.book+'</div>                    <div style="z-index: 5;" class="price-fix-link">                    <a target="_blank" id="bestPrice_'+b+'" href="'+a.getOffer().deeplinkUrl+'"'+c+'>                    <img style="width: 82px; height: 51px;" title="" alt="" src="'+
this.commonImageUrl+'/trans.gif"/>                    </a>                    </div>                    <div class="hotel-best-price-label">'+this.translatedStrings.bestPrice+'</div>                    <a target="_blank" id="bestPriceLogo_'+b+'" href="'+a.getOffer().deeplinkUrl+'" class="hotel-best-price-offerer" title="'+a.getOffer().partnerName+'"'+c+">"+(a.getOfersImgUrl()?'<img class="hotel-best-price-img" title="'+a.getOffer().partnerName+'" src="'+a.getOfersImgUrl()+'" width="78" />':a.getOffer().partnerName)+
"</a>                  </div></div>";d+='<div class="hotel-info">\n                    <span class="hotel-title" id="hotelTitle_'+b+'"><span style="display:block">'+this.generateHotelCategoryHtml(a.category)+"</span><a onclick=\"return HotelsDialogRenderer.open('"+a.id+"',HotelsDialogRenderer.TAB_OVERVIEW)\">"+a.title+'</a></span><div class="v-clear"></div>                    <div class="hotel-distance hotel-distance-list">'+a.getDistance();a.hasCoordinates&&(d+=' <a href="#" id="hotelLinkToMap_'+
b+'" onclick="return HotelsDialogRenderer.open(\''+a.id+"',HotelsDialogRenderer.TAB_AREAMAP)\">"+this.translatedStrings.areamap+"</a> | ");d+=' <a href="#" onclick="return HotelsDialogRenderer.open(\''+a.id+"',HotelsDialogRenderer.TAB_OVERVIEW)\">"+this.translatedStrings.hotelinfo+'</a></div>                    <div class="v-clear"></div>\n';d+=a.description?'<span id="hotelDescription_'+b+'" class="hotel-description" title="'+a.description+'">'+a.description.replace(/\.\.\.$/,"")+' <a href="#" id="hotelLinkToMore_'+
b+'" onclick="return HotelsDialogRenderer.open(\''+a.id+"',HotelsDialogRenderer.TAB_DETAILS)\">..."+this.translatedStrings.more+"</a>":'<span id="hotelDescription_'+b+'" class="hotel-description" title="'+this.translatedStrings.descriptionNotFound+'">'+this.translatedStrings.descriptionNotFound;d+="</span><br />\n";a.getRating()>0&&(d+='<div class="hotel-rating-box" style="background-position: 0px -'+this._calcRatingBgOffset(a.getRating(),20)+'px"></div>',d+='<div id="hotelRating_'+b+'" class="hotel-rating-text"><span>'+
a.getRating()+"</span> "+this.translatedStrings.outOf10+' (<a href="#" onclick="return HotelsDialogRenderer.open(\''+a.id+"',HotelsDialogRenderer.TAB_REVIEWS)\">"+a.getReviewCount()+" "+this.translatedStrings.reviews+"</a>)</div>");d+="</div>";var e,f;a.imgUrl?(c=a.imgUrl,e="onclick=\"return HotelsDialogRenderer.open('"+a.id+"',HotelsDialogRenderer.TAB_PHOTOS)\"",f="hotel-photo cursor-pointer"):(c=this.defaultHotelImage,e="onclick=\"return HotelsDialogRenderer.open('"+a.id+"',HotelsDialogRenderer.TAB_OVERVIEW)\"",
f="hotel-photo");d+='<div class="hotel-photo-placeholder">\n                    <table>\n                        <tr>';ie6?d+='<td class="'+f+'" '+e+'>\n                                    <img class="hotel-photo-img" src="'+c+'" />':(d+='          <td class="'+f+'" '+e+'>\n                                    <div class="hotel-photos-wraper">\n                                    <img class="hotel-photo-img" src="'+c+'" />',d+="</div>");d+="</td>\n                                </tr>\n                            </table>\n                        </div>";
a.getReviewCount()>0&&(d+='<div class="dot-line"></div>',d+='<div class="hotel-reviews-label">\n                        '+this.translatedStrings.reviews+': \n                     </div>\n                     <div class="hotel-reviews">'+this.generateHotelReviewHtml(a.reviews,b)+' <div class="hotel-item-ending"></div></div>');d+='<div class="dot-line"></div>';d+='<div class="hotel-alternatives-label">\n                        '+this.translatedStrings.bookBy+':                      </div>\n                     <div class="hotel-alternatives">'+
this.generateHotelOffersHtml(a.offers,a.id,b)+"</div>\n                     ";d+='<div class="v-clear"></div>';d+="</div>";d+='<div class="font-line ml-a">                    <img height="18" width="576" title="" alt="" src="'+this.commonImageUrl+'/box/flightbox_border_bottom.png" class="imageheight"/>                  </div>';return d};
KhotelsResultRenderer.prototype.generateHotelCategoryHtml=function(a){for(var b="",c=0;c<a;c++)b+='<img title="" alt="" src="'+this.commonImageUrl+'/HotelCategoryStar.gif" />';return b};
KhotelsResultRenderer.prototype.generateHotelReviewHtml=function(a,b){for(var c="",d=0;d<a.length;d++){var e=a[d],f=e.getRating();c+='<div class="hotel-reviews-bar">\n<span><span id="hotel-'+b+"-ratingPartnerName-"+d+'">'+e.partnerName+'</span> <span class="hotel-reviews-num">(';c+=e.url?'<a href="'+e.url+"/"+this.extUserParams+'" target="_blank">'+e.reviewCount+"</a>":e.reviewCount;c+=')</span></span><br />\n                        <div class="hotel-partnerRating-box" style="background-position: 0px -'+
this._calcRatingBgOffset(f,10)+'px"></div>\n                        <span class="hotel-reviews-rating">'+f+"</span>\n                        </div>"}return c};
KhotelsResultRenderer.prototype.generateHotelOffersHtml=function(a,b,c){for(var b='<div style="width:400px; border:0">',d=this.overlayEnabled?" onclick=\"return DeeplinksDialogRenderer.open(this, 'hotel');\"":"",e=0;e<a.length;e++)b+='<div>\n                        <a id="hotelOffer_'+c+"_"+e+'" href="'+a[e].deeplinkUrl+'" target="_blank"'+d+">"+a[e].partnerName+" "+a[e].averagePrice+"</a>\n                        </div>";b+='<div class="hotel-clear-bar"></div></div>';return b};
KhotelsResultRenderer.prototype.draw=function(a,b){if(!this.testMode)b?dojo.byId(this.resultPanelIdTop).innerHTML=a:dojo.byId(this.resultPanelIdBottom).innerHTML=a};KhotelsResultRenderer.prototype._calcRatingBgOffset=function(a,b){return(100-a*10)*b};dojo.require("swoodoo.Location");dojo.require("swoodoo.scripts");dojo.require("swoodoo.widgets.Dialog");dojo.require("swoodoo.ie");dojo.declare("HotelsDialogRenderer");
dojo.mixin(HotelsDialogRenderer,{PARAM_HOTEL_ID:"hid",PARAM_TAB_NAME:"tab",PARAM_PHOTO_ID:"pid",TAB_OVERVIEW:"overview",TAB_DETAILS:"description",TAB_PHOTOS:"photos",TAB_AREAMAP:"areamap",TAB_REVIEWS:"reviews",TAB_ID_PREFIX:"hotel-dialog-tab-",dialog:null,gallery:null,reviewOpenDetailCount:0,firstTabView:!0,galleryImageList:null,open:function(a,b){HotelsDialogRenderer.firstTabView=!0;var c={};c[HotelsDialogRenderer.PARAM_HOTEL_ID]=a;c[HotelsDialogRenderer.PARAM_TAB_NAME]=b||HotelsDialogRenderer.TAB_OVERVIEW;
swoodoo.Location.setHash(swoodoo.Location.setParam(c));HotelsDialogRenderer.show(a);return!1},close:function(){swoodoo.Location.setHash(swoodoo.Location.removeParam([HotelsDialogRenderer.PARAM_HOTEL_ID,HotelsDialogRenderer.PARAM_TAB_NAME,HotelsDialogRenderer.PARAM_PHOTO_ID]));HotelsDialogRenderer.destroyGallery();return!1},getId:function(a){return parseInt(swoodoo.Location.getParam(HotelsDialogRenderer.PARAM_HOTEL_ID,a))},show:function(a){var b=swoodoo.Location.getParam("attr",window.location),c=
window.location.pathname.replace("/hotel/","/hotel/getdialog/"+HotelsDialogRenderer.listHandle+"/"+HotelsDialogRenderer.extUserParams+"/"+a+"/");b&&(c+="/"+b);var d=HotelsDialogRenderer.dialog;HotelsDialogRenderer.hotelId=a;if(d)d.setHref(c);else{if(!swoodoo.ie.isReady()){swoodoo.ie.onReady(function(){HotelsDialogRenderer.show(a)});return}d=HotelsDialogRenderer.dialog=new swoodoo.widgets.Dialog({href:c,style:"width: "+(dialogAdsEnabled?"968":"800")+"px; height: 600px"},dojo.create("div",{id:"hotel-dialog"},
dojo.body(),"last"));d.startup();dojo.connect(d,"onShow",function(){dojo.connect(dijit._underlay,"onClick",function(){d.hide()})});dojo.connect(d,"onDownloadEnd",function(){swoodoo.scripts.eval(dojo.byId("criteo_hotel_tracking"));dialogAdsEnabled?(dojo.style(d.domNode,{width:"968px",height:"600px"}),dojo.query(".hotel-dialog-rbar").style({right:"168px"})):(dojo.query(".hotel-dialog-rbar").style({right:"0px"}),dojo.style(d.domNode,{width:"800px",height:"580px"}));d._reloadPosition();dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");var b=HotelsDialogRenderer.tabs=new dijit.layout.TabContainer({},"hotel-dialog-tab-container");b.addChild(new dijit.layout.ContentPane({hash:HotelsDialogRenderer.TAB_OVERVIEW,title:translate("LANG_HOTEL_OVERVIEW")},HotelsDialogRenderer.TAB_ID_PREFIX+HotelsDialogRenderer.TAB_OVERVIEW));b.addChild(new dijit.layout.ContentPane({hash:HotelsDialogRenderer.TAB_DETAILS,title:translate("LANG_HOTEL_DESCRIPTIONS")},HotelsDialogRenderer.TAB_ID_PREFIX+HotelsDialogRenderer.TAB_DETAILS));
b.addChild(new dijit.layout.ContentPane({hash:HotelsDialogRenderer.TAB_PHOTOS,title:translate("LANG_HOTEL_PHOTOS")},HotelsDialogRenderer.TAB_ID_PREFIX+HotelsDialogRenderer.TAB_PHOTOS));b.addChild(new dijit.layout.ContentPane({hash:HotelsDialogRenderer.TAB_AREAMAP,title:translate("LANG_HOTEL_MAP")},HotelsDialogRenderer.TAB_ID_PREFIX+HotelsDialogRenderer.TAB_AREAMAP));b.addChild(new dijit.layout.ContentPane({hash:HotelsDialogRenderer.TAB_REVIEWS,title:translate("LANG_HOTEL_REVIEWS")},HotelsDialogRenderer.TAB_ID_PREFIX+
HotelsDialogRenderer.TAB_REVIEWS));b.connect(b,"onClick",function(){HotelsDialogRenderer.setTab(this.selectedChildWidget.hash)});dojo.connect(b,"selectChild",HotelsDialogRenderer,function(a){var a=typeof a=="string"?a:a.id,b=a.substr(a.indexOf(HotelsDialogRenderer.TAB_ID_PREFIX)+HotelsDialogRenderer.TAB_ID_PREFIX.length);b==HotelsDialogRenderer.TAB_AREAMAP?this.loadAttractionsMap():this.destroyAttractionsMap();b==HotelsDialogRenderer.TAB_PHOTOS&&HotelsDialogRenderer.createGallery();if(HotelsDialogRenderer.econdaTrackerEnabled){a=
{};a.siteid=HotelsDialogRenderer.econdaSiteId;a.content="hotel/details/"+b;a.carea="hotel";if(HotelsDialogRenderer.firstTabView)HotelsDialogRenderer.firstTabView=!1,b=dojo.byId("hotel-photos")?"Picture":"NoPicture",b+="_",a.Target=[["Hotel_Details",b,0,"d"]];a.pageId=a.content;EcondaTracker.trackEvent(a)}});b.startup();var c=HotelsDialogRenderer.getTab()||HotelsDialogRenderer.TAB_OVERVIEW;b.selectChild(HotelsDialogRenderer.TAB_ID_PREFIX+c);var g=dojo.byId("hotel-dialog-loading");if(g){var h=dojo.byId("hotel-dialog-offers"),
j=dojo.attr(g,"hotel:handle"),k=dojo.attr(g,"hotel:status");(function m(){k||dojo.xhrGet({url:window.location.pathname.replace(/\/hotel\/.*$/,"/hotel/getdialogoffers/"+HotelsDialogRenderer.listHandle+"/"+a+"/"+j),preventCache:!0,handleAs:"json",load:function(a){k=a.isLoaded;h.innerHTML=a.offers;k?(g.style.display="none",h.style.display="block"):m()},error:function(a){h.innerHTML='<div class="error"><b>Error</b>: '+a+"</div>";g.style.display="none";h.style.display="block"}})})()}});dojo.connect(d,
"hide",function(){HotelsDialogRenderer.close()})}d.show();return d},tabs:null,getTab:function(a){return swoodoo.Location.getParam(HotelsDialogRenderer.PARAM_TAB_NAME,a)},setTab:function(a){var b=swoodoo.Location.setParam(HotelsDialogRenderer.PARAM_TAB_NAME,a);a!=HotelsDialogRenderer.TAB_PHOTOS&&(b=swoodoo.Location.removeParam(HotelsDialogRenderer.PARAM_PHOTO_ID,b));swoodoo.Location.setHash(b);return!1},getPhoto:function(a){return parseInt(swoodoo.Location.getParam(HotelsDialogRenderer.PARAM_PHOTO_ID,
a))},setPhoto:function(a){swoodoo.Location.setHash(swoodoo.Location.setParam(HotelsDialogRenderer.PARAM_PHOTO_ID,a));this.setCopyright(a);return!1},setCopyright:function(a){if(dojo.byId("hotel-photos-copyright"))return typeof this.galleryImageList.items[a].copyright!="undefined"&&this.galleryImageList.items[a].copyright?(dojo.byId("hotel-photos-copyright").innerHTML=this.galleryImageList.items[a].copyright,dojo.byId("hotel-photos-copyright").parentNode.style.display="block"):dojo.byId("hotel-photos-copyright").parentNode.style.display=
"none",!1},moreFields:function(a){dojo.byId("hotel-dialog-field-"+a+"-more").style.display="none";dojo.byId("hotel-dialog-field-"+a+"-less").style.display="block";return!1},lessFields:function(a){dojo.byId("hotel-dialog-field-"+a+"-less").style.display="none";dojo.byId("hotel-dialog-field-"+a+"-more").style.display="inline";return!1},toggleReviewDetails:function(a){var b=dojo.byId("review-group-"+a),a=dojo.byId("review-link-"+a),c=dojo.byId("hotel-dialog-tab-reviews");if(b.style.display==="block"){this.reviewOpenDetailCount--;
if(this.reviewOpenDetailCount==0)c.style.overflow="hidden",c.style.overflowX="hidden",c.style.overflowY="hidden";b.style.display="none";a.innerHTML=translate("LANG_HOTEL_DETAILS")}else this.reviewOpenDetailCount++,c.style.overflow="auto",c.style.overflowX="hidden",c.style.overflowY="auto",b.style.display="block",a.innerHTML=translate("LANG_HOTEL_DETAILS_HIDE");return!1},loadAttractionsMap:function(){if(dojo.byId("GMAPS")&&!(HotelsDialogRenderer.attractionsMap&&dojo.byId("GMAPS").innerHTML.length>
1))try{HotelsDialogRenderer.attractionsMap=new HotelAttractionsMap("GMAPS");HotelsDialogRenderer.attractionsMap.display();var a=new GIcon;a.shadow=imagesPath+"hotel_map_ico/Ico_Shadow.png";a.iconSize=new GSize(30,40);a.shadowSize=new GSize(30,40);a.iconAnchor=new GPoint(15,40);a.infoWindowAnchor=new GPoint(14,10);var b=new MarkerIcon(imagesPath+"hotel_map_ico/Hotel_InActive.png",imagesPath+"hotel_map_ico/Hotel_Active.png",a),c=new MarkerIcon(imagesPath+"hotel_map_ico/Sight_InActive.png",imagesPath+
"hotel_map_ico/Sight_Active.png",a);dojo.query("#attraction_list li").forEach(function(a){var d=dojo.query("input[id$=latitude]",a),g=dojo.query("input[id$=longitude]",a);if(d.length&&g.length){var h=null,h=d[0].name=="hotel"&&g[0].name=="hotel"?new AttractionMarker(d[0].value,g[0].value,b,a.id):new AttractionMarker(d[0].value,g[0].value,c,a.id);HotelsDialogRenderer.attractionsMap.addMarker(h);a.className=="selected"&&(HotelsDialogRenderer.attractionsMap.setCenter(d[0].value,g[0].value),HotelsDialogRenderer.attractionsMap.activateMarker(h.id))}HotelsDialogRenderer.attractionListHandlers.push(dojo.connect(a,
"onclick",HotelsDialogRenderer.attractionsMap,function(a){this.activateMarker(a.target.id)}));HotelsDialogRenderer.attractionListHandlers.push(dojo.connect(HotelsDialogRenderer.attractionsMap,"activateMarker",HotelsDialogRenderer.attractionsMap,function(a){if(a=dojo.byId(a))a.className="selected"}));HotelsDialogRenderer.attractionListHandlers.push(dojo.connect(HotelsDialogRenderer.attractionsMap,"deactivateMarker",HotelsDialogRenderer.attractionsMap,function(a){if(dojo.byId(a))dojo.byId(a).className=
""}))})}catch(d){}},destroyAttractionsMap:function(){if(HotelsDialogRenderer.attractionsMap&&dojo.byId("GMAPS"))dojo.forEach(HotelsDialogRenderer.attractionListHandlers,dojo.disconnect),HotelsDialogRenderer.attractionListHandlers=[],HotelsDialogRenderer.attractionsMap.removeAllMarkers(),HotelsDialogRenderer.attractionsMap=null,dojo.byId("GMAPS").innerHTML=""},createGallery:function(){if(!this.gallery){var a=dojo.byId("hotel-photos");if(a&&(this.galleryImageList=dojo.fromJson(a.innerHTML),this.galleryImageList.items.length>
0)){dojo.require("dojo.data.ItemFileReadStore");var b=new dojo.data.ItemFileReadStore({data:this.galleryImageList});dojo.require("dojox.image.SlideShow");this.gallery=a=new dojox.image.SlideShow({imageHeight:350,imageWidth:480,autoLoad:!1,slideshowInterval:0,pageSize:100,titleTemplate:"",hasNav:!1,fixedHeight:!1},"hotel-slideshow");a.setDataStore(b,{query:{},count:100},{imageThumbAttr:"thumb",imageLargeAttr:"large"});b=this.getPhoto()||0;if(a.imageIndex!=b)a.imageIndex=b,a.showImage(b);this.setCopyright(b);
this.galleryImageList.items.length>1?(HotelsDialogRenderer.galleryHandlers.push(dojo.connect(dojo.byId("previous_photo"),"onclick",a,function(){this.imageIndex-=1;if(this.imageIndex<0)this.imageIndex=this.maxPhotos-1;this.showImage(this.imageIndex);HotelsDialogRenderer.setPhoto(this.imageIndex)})),HotelsDialogRenderer.galleryHandlers.push(dojo.connect(dojo.byId("next_photo"),"onclick",a,function(){this.imageIndex+=1;if(this.imageIndex==this.maxPhotos)this.imageIndex=0;this.showImage(this.imageIndex);
HotelsDialogRenderer.setPhoto(this.imageIndex)}))):(dojo.style("previous_photo","display","none"),dojo.style("next_photo","display","none"));b=dojo.query(".slideShowImageWrapper","hotel-slideshow");b=b[0];HotelsDialogRenderer.galleryHandlers.push(dojo.connect(b,"onclick",a,function(){this.imageIndex+=1;if(this.imageIndex==this.maxPhotos)this.imageIndex=0;this.showImage(this.imageIndex);HotelsDialogRenderer.setPhoto(this.imageIndex)}))}}},destroyGallery:function(){if(this.gallery)dojo.forEach(HotelsDialogRenderer.galleryHandlers,
dojo.disconnect),dojo.destroy(this.gallery),this.gallery=null},attractionListHandlers:[],attractionsMap:null,econdaSiteId:null,econdaTrackerEnabled:!1,galleryHandlers:[]});dojo.require("swoodoo.widgets.InputListPicker");
function KhotelsFilterRenderer(a){this.filterHolderId=a.filterHolderId;this.nameFilterHolderId=a.nameFilterHolderId;this.resetFilterHolderId="reset_hotel_filters_place";this.commonImageUrl=a.commonImageUrl;this.testMode=a.testMode;this.hotelsSearchFormMoreOptionsEnabled=a.hotelsSearchFormMoreOptionsEnabled;this.hotelsNameFilterOnTopEnabled=a.hotelsNameFilterOnTopEnabled;this.translations={};this.translations.priceFrom=translate("LANG_BOX_FROMPRICE")+" ";this.translations.hotelCategorie=translate("LANG_HOTEL_CATEGORIE");
this.translations.categoryFrom=translate("LANG_HOTEL_FROM_CATEGORIE");this.translations.stars=translate("LANG_HOTEL_STARS");this.translations.searchParams=translate("LANG_HOTEL_SEARCH_PARAMS");this.translations.price=translate("LANG_BOX_PRICE");this.translations.priceFilterTitle=translate("LANG_HOTEL_PRICE_FILTER_TITLE");this.translations.pricePerNight=translate("LANG_HOTEL_PRICE_PER_NIGHT");this.translations.to=translate("LANG_HOTEL_TO");this.translations.showAll=translate("LANG_HOTEL_SHOW_ALL_OPTIONS");
this.translations.showLess=translate("LANG_HOTEL_SHOW_LESS_OPTIONS");this.translations.from=translate("LANG_FROM");this.translations.distanceFilterTitle=translate("LANG_HOTEL_DISTANCE_FILTER_TITLE");this.translations.resetFilters=translate("LANG_HOTEL_FILTER_RESET");this.translations.enterHotelname=a.hotelsNameFilterOnTopEnabled?translate("LANG_HOTEL_HOTELNAME")+"...":translate("LANG_HOTEL_ENTER_HOTELNAME")+"...";this.translations.showAllCategories=translate("LANG_HOTEL_SHOW_ALL_CATEGORIES");this.filterIds=
[];this.filterSet=new dijit.WidgetSet;this.priceFilter=this.attractionFilter=this.categoryFilter=null;this.currencySign=a.currencySymbol;this.nameFilter=this.distanceFilter=null;this.distanceMeasurementUnit="km";this.showOptions=3;this.nameFilter=null}
KhotelsFilterRenderer.prototype.createCategorieFilter=function(a){try{this.categoryFilter=new swoodoo.widgets.hotelCategoryFilter({titlePattern:this.translations.hotelCategorie+" <strong>"+this.translations.categoryFrom+" % "+this.translations.stars+"</strong>",inactiveTitle:this.translations.hotelCategorie+" <strong>"+this.translations.showAllCategories+"</strong>",filterData:a,applyFilterCallback:controller.applyFilter}),this.categoryFilter.placeAt(dojo.create("div",{"class":"box1-border p-j category-filter-box"},
dojo.byId(this.filterHolderId),0),"first")}catch(b){}};
KhotelsFilterRenderer.prototype.createPriceFilter=function(a){try{if(parseInt(a.maxPrice)==0)return!1;this.priceFilter=new swoodoo.widgets.hotelPriceFilter({titlePattern:this.translations.priceFilterTitle+" ("+this.translations.pricePerNight+") <strong>"+this.translations.to+" % "+this.currencySign+"</strong>",inactiveTitle:this.translations.priceFilterTitle+" <strong>"+this.translations.showAllCategories+"</strong>",currencySign:this.currencySign,name:"priceFilter",filterData:a,filterPartSeparator:",",
applyFilterCallback:controller.applyFilter,width:"165px",id:"slider1"});this.priceFilter.placeAt(dojo.create("div",{"class":"box1-border p-j price-filter-box"},dojo.byId(this.filterHolderId),1))}catch(b){}};
KhotelsFilterRenderer.prototype.createDistanceFilter=function(a){try{if(!a)return!1;var b=this.translations.distanceFilterTitle+" <strong>%</strong>",c=dojo.byId("hotel_attractions"),d=c.options[c.selectedIndex];this.distanceFilter=new swoodoo.widgets.hotelDistanceFilter({titlePattern:b.replace("%",this.translations.to+" % "+this.distanceMeasurementUnit)+" <br/>"+this.translations.from+" <strong>&quot;"+d.innerHTML+"&quot;</strong>",inactiveTitle:b.replace("%",this.translations.showAllCategories),
measurementUnit:this.distanceMeasurementUnit,name:"distanceFilter",filterData:a,applyFilterCallback:controller.applyFilter,width:"165px",id:"slider2"});this.distanceFilter.placeAt(dojo.create("div",{"class":"box1-border p-j distance-filter-box"},dojo.byId(this.filterHolderId),1))}catch(e){}};
KhotelsFilterRenderer.prototype.draw=function(a,b,c,d,e,f,g,h){try{this.clear();if(!this.hotelsSearchFormMoreOptionsEnabled)dojo.byId(this.filterHolderId).innerHTML=this.getAttractionFilterHtml(g);if(b||a)this.hotelsNameFilterOnTopEnabled?dojo.byId(this.nameFilterHolderId).innerHTML=this.getNameFilterHtml(h):this.hotelsSearchFormMoreOptionsEnabled||(dojo.byId(this.filterHolderId).innerHTML+=this.getNameFilterHtml(h));this.hotelsSearchFormMoreOptionsEnabled?dojo.byId(this.filterHolderId).innerHTML+=
this.getFilterPanelHTML(c,h):dojo.byId(this.filterHolderId).innerHTML+=this.getFilterPanelHTML(c);b.match("/attr|price|filters|mincat|dist|name/")?dojo.byId(this.resetFilterHolderId).innerHTML=this.getResetFiltersHtml():dojo.byId(this.resetFilterHolderId).innerHTML='<img height="5" width="186" title="" alt="" src="'+this.commonImageUrl+'/box/box1_default_border_bottom_gray.png" class="imageheight"/>';dojo.parser.parse(dojo.byId(this.filterHolderId));dojo.parser.parse(dojo.byId(this.filterHolderId).parentNode);
this.hotelsSearchFormMoreOptionsEnabled||(this.createCategorieFilter(d),this.createDistanceFilter(f),this.createPriceFilter(e));for(c=0;c<this.filterIds.length;c++)this.filterSet.add(dijit.byId(this.filterIds[c]));if(b||a)this.hotelsNameFilterOnTopEnabled?(dojo.forEach(a,function(b,c){a[c]={value:b,label:b,selected:b==this.nameFilter}}),this.nameFilterPicker&&this.nameFilterPicker.destroy(),this.nameFilterPicker=new swoodoo.widgets.InputListPicker({options:a,attachTo:dojo.byId("hotel-filter-name-input"),
defaultValue:this.translations.enterHotelname,valueField:dojo.byId("hotel-filter-name-input"),showConnector:!1,showCloseLink:!1,fixedWidth:200}),dojo.connect(this.nameFilterPicker,"onSelect",this,function(){this.applyNameFilter(this.nameFilterPicker.valueField)})):new HotelsAutocompleterLocal("hotel-filter-name-input","hotel-autocomplete-list",a,{fullSearch:!0,partialChars:1}),h!=null&&h.name!=null&&h.name!=""&&h.name!=this.translations.enterHotelname?dojo.addClass(dojo.byId("hotel-filter-name"),
"applied"):dojo.addClass(dojo.byId("hotel-filter-name"),"inactive"),dojo.connect(dojo.byId("hotel-filter-name-input"),"keypress",this,"nameFilterKeypress"),dojo.connect(dojo.byId("hotel-filter-name-input"),"focus",this,"nameFilterFocus"),dojo.connect(dojo.byId("hotel-filter-name-input"),"blur",this,"nameFilterBlur"),dojo.connect(dojo.byId("hotel-filter-name-reset"),"click",this,"nameFilterReset")}catch(j){}dojo.byId(this.filterHolderId).parentNode.style.visibility="visible"};
KhotelsFilterRenderer.prototype.clear=function(){try{this.filterSet.forEach(function(a){a.destroyRecursive()}),this.filterSet=new dijit.WidgetSet,this.filterIds=[],this.categoryFilter!=null&&this.categoryFilter.destroy(),this.priceFilter!=null&&this.priceFilter.destroy(),this.distanceFilter!=null&&this.distanceFilter.destroy(),dojo.byId(this.filterHolderId).innerHTML="",dojo.byId(this.filterHolderId).parentNode.style.visibility="hidden"}catch(a){}};
KhotelsFilterRenderer.prototype.countSelectedItems=function(a){for(var b=0,c=0;c<a.length;c++)for(var d=0;d<a[c].items.length;d++)a[c].items[d].selected&&b++;return b};
KhotelsFilterRenderer.prototype.getFilterPanelHTML=function(a,b){var c="";if(a.length>=1)for(var d=0;d<a.length;d++)d==1&&this.hotelsSearchFormMoreOptionsEnabled&&!this.hotelsNameFilterOnTopEnabled&&typeof b!="undefined"&&(c+=this.getNameFilterHtml(b)),c+=this.getFilterBoxHTML(a[d].groupId,a[d].groupName,a[d].items,a[d].collapsedByDefault);else this.hotelsSearchFormMoreOptionsEnabled&&!this.hotelsNameFilterOnTopEnabled&&typeof b!="undefined"&&(c+=this.getNameFilterHtml(b));return c};
KhotelsFilterRenderer.prototype.getFilterBoxHTML=function(a,b,c,d){for(var e="",f="",g="",f=!1,g=0;g<c.length;g++)f|=c[g].selected;f==1?(f="block",g="none"):d?(f="none",g="block"):(f="block",g="none");e+='<div class="box1-subtitle bg-04 bg_collapsed" id="collapsed_header_'+a+'" style="display:'+g+';" onclick="dojo.style(\'collapsed_header_'+a+"','display','none');dojo.style('expanded_content_"+a+"','display','block');dojo.style('expanded_header_"+a+"','display','block');\" >"+b+"</div>";e+='<div class="box1-subtitle bg-04 bg_expanded" id="expanded_header_'+
a+'" style="display:'+f+';" onclick="dojo.style(\'expanded_content_'+a+"','display','none');dojo.style('expanded_header_"+a+"','display','none');dojo.style('collapsed_header_"+a+"','display','block');\" >"+b+"</div>";e+='<div class="no-big-padding-top break-long-name" id="expanded_content_'+a+'" style="display:'+f+';" ><div class="box1-border p-j"><div class="font-small">';for(g=0;g<c.length;g++)e+='<div class="box1-line hotel-filter-item">',e+=this.getFilterItemHtml(c[g]),e+="</div>",this.filterIds.push(this.createId(c[g]));
e+="</div></div></div>";return e};KhotelsFilterRenderer.prototype.getResetFiltersHtml=function(){var a="",a='<a href="javascript:void(0)" onClick="ControllerInstance.resetFilters()"><div id="resetHotelFilters">'+this.translations.resetFilters+"</div></a>";a+='<img height="5" width="186" title="" alt="" src="'+this.commonImageUrl+'/box/box1_default_border_bottom_gray.png" class="imageheight"/>';return a};
KhotelsFilterRenderer.prototype.getFilterItemHtml=function(a){var b="",c=this.translations.priceFrom,d="";a.price==""&&(c="",d="wider ");b+=a.selected?'<span id="" class="sep2-col1 '+d+'activelink"><input id="'+this.createId(a)+'" dojotype="dijit.form.CheckBox" name="'+this.createId(a)+'" checked="checked" value="on"  type="checkbox" onChange="controller.applyFilter(\''+a.url+'\')" onFocus="this.blur()" /><label fulltitle="'+a.name+'" for="'+this.createId(a)+'">'+a.name+"</label></span>":'<span id="" class="sep2-col1 '+
d+'"><input id="'+this.createId(a)+'" dojotype="dijit.form.CheckBox" name="'+this.createId(a)+'" value="on"  type="checkbox" onChange="controller.applyFilter(\''+a.url+'\')" onFocus="this.blur()" /><label fulltitle="'+a.name+'" for="'+this.createId(a)+'">'+a.name+"</label></span>";c!=""&&(b+='<div id="" class="sep2-col2">'+c+a.price+"</div>");b+='<div class="v-clear"></div>';return b};
KhotelsFilterRenderer.prototype.getAttractionFilterHtml=function(a){if(!a)return"";for(var b='<div class="no-big-padding-top break-long-name">                        <div class="box1-border hotel-attraction-holder">                            '+this.translations.from+' <select class="hotel-attraction-selectbox" id="hotel_attractions"                                  onChange="javascript:controller.applyFilter(this.options[this.selectedIndex].value)">',c=0;c<a.length;c++)b+="<option"+(a[c].isSelected?
' selected="selected" ':"")+' value="'+a[c].url+'" >'+a[c].name+"</option>";b+='</select></div></div><div class="v-clear"></div>';return b};
KhotelsFilterRenderer.prototype.getNameFilterHtml=function(a){var b=a!=null&&a.name!=null&&a.name!=""?a.name:this.translations.enterHotelname,c='<div id="hotel-filter-name"><p id="hotel-filter-name-title"';b&&(c+=' class="hotel-filter-name-used"');c+='></p><div class="input-container"><input id="hotel-filter-name-input" name="hotel-name" value="'+b+'"/><div id="hotel-filter-name-reset"></div></div><div id="hotel-autocomplete-list" class="autocomplete autocompletehotel autocompletehotelfilter" style="position: absolute; display: none; left: 0px; right:0px; top: 0px; z-index: 11; width: 161px;"></div></div>';this.nameFilter=
a;return c};KhotelsFilterRenderer.prototype.createId=function(a){return"F"+String(a.id)};KhotelsFilterRenderer.prototype.applyNameFilter=function(a){a=a.value.trim();a!=this.nameFilter.name&&(a=a==""||a==this.translations.enterHotelname?this.nameFilter.url.replace(/\/name\//,""):this.nameFilter.url+a,ControllerInstance.applyFilter(a))};
KhotelsFilterRenderer.prototype.nameFilterKeypress=function(a){if(!ControllerInstance.loaderIsOn){if(this.nameFilter==null||this.nameFilter.name==null){if(this.nameFilter.name.match(/^\s{1,}$/))this.nameFilter.name="";this.nameFilter={name:"",url:"/name/"}}a.keyCode==dojo.keys.ENTER&&this.applyNameFilter(a.target)}};
KhotelsFilterRenderer.prototype.nameFilterFocus=function(){var a=dojo.byId("hotel-filter-name"),b=dojo.byId("hotel-filter-name-input");if(b.value==this.translations.enterHotelname&&dojo.hasClass(a,"inactive"))b.value="";dojo.forEach("inactive applied value".split(" "),function(b){dojo.removeClass(a,b)});dojo.addClass(a,"active")};
KhotelsFilterRenderer.prototype.nameFilterBlur=function(){var a=dojo.byId("hotel-filter-name"),b=dojo.byId("hotel-filter-name-input");dojo.forEach("active inactive applied value".split(" "),function(b){dojo.removeClass(a,b)});b.value?dojo.addClass(a,"value"):(b.value=this.translations.enterHotelname,dojo.addClass(a,"inactive"))};
KhotelsFilterRenderer.prototype.nameFilterReset=function(){var a=dojo.byId("hotel-filter-name"),b=dojo.byId("hotel-filter-name-input");dojo.forEach("active applied value".split(" "),function(b){dojo.removeClass(a,b)});dojo.addClass(a,"inactive");b.value=this.translations.enterHotelname;this.applyNameFilter(b)};dojo.provide("SearchForm");
dojo.declare("SearchForm",null,{constructor:function(a,b,c,d){this.isBothwayEnabled=a;this.autocompleteUrl=b+"/autocomplete";this.searchStartDelayDaysTimestamp=SEARCH_START_DELAY_DAYS*972E5;this.searchReturnDelayDaysTimestamp=SEARCH_RETURN_DELAY_DAYS*864E5;this.lastAvailableDate=getFieldDate(MAX_AVAILABLE_DATE,"ymd",!0);this.lastAvailableDate.setHours(0,0,0,0);this.storedRetd=this.storedDepd="";this.enabledSearchButtonUrl=d?d+"/btn_flugsuche_big.png":!1;this.disabledSearchButtonUrl=d?d+"/btn_flugsuche_big_disabled.png":
!1;this.compareToBox=c},enableReturnFlightFields:function(){this.isBothwayEnabled=!0;dojo.byId("return_selection").style.display="block";dojo.byId("return_from_to").style.display="inline";dojo.byId("RETD").value=getDateString(this.getLaterReturnDate());if(dojo.byId("returnDaytime"))dojo.byId("returnDaytime").selectedIndex=0;this.storedRetd=dojo.byId("RETD").value},disableReturnFlightFields:function(){this.isBothwayEnabled=!1;dojo.byId("RETD").value="";dojo.byId("return_selection").style.display="none";
dojo.byId("return_from_to").style.display="none";this.storedRetd=""},enableFlexibleDateField:function(){if(dojo.byId("row_flexible_date"))dojo.byId("row_flexible_date").style.display="block"},disableFlexibleDateField:function(){if(dojo.byId("row_flexible_date"))dojo.byId("row_flexible_date").style.display="none",dojo.byId("flexible_date").checked=!1},getStoredDate:function(a){return a=="RETD"?this.storedRetd:this.storedDepd},validateSearchForm:function(a){var b=getFieldDate(dojo.byId("DEPD").value);
if(b==!1)b=getFieldDate(this.storedDepd),dojo.byId("DEPD").value=this.storedDepd;var c=this.isBothwayEnabled?getFieldDate(dojo.byId("RETD").value):null;if(c==!1)c=getFieldDate(this.storedRetd),dojo.byId("RETD").value=this.storedRetd;if(a=="RETD"&&b>c)dojo.byId("DEPD").value=getDateString(c);else if(this.isBothwayEnabled&&c<b)dojo.byId("RETD").value=getDateString(b);this.storedDepd=dojo.byId("DEPD").value;this.storedRetd=dojo.byId("RETD").value},initSearchDates:function(a){if(!getFieldDate(dojo.byId("DEPD").value))dojo.byId("DEPD").value=
getDateString(this.getInitialDepartureDate());if(this.isBothwayEnabled&&!getFieldDate(dojo.byId("RETD").value))dojo.byId("RETD").value=getDateString(this.getLaterReturnDate());this.storedDepd=dojo.byId("DEPD").value;this.storedRetd=this.isBothwayEnabled?dojo.byId("RETD").value:"";this.isBothwayEnabled&&!a&&(a||this.validateSearchForm("RETD"));this.isBothwayEnabled||this.disableReturnFlightFields()},changeSearchButton:function(a){var b=dojo.byId("searchnow");if(this.disabledSearchButtonUrl&&this.enabledSearchButtonUrl)b.src=
a?this.disabledSearchButtonUrl:this.enabledSearchButtonUrl;b.disabled=a},getDateFromParts:function(a,b,c){var d=new Date;d.setHours(0,0,0,0);if(isNaN(a)||a<d.getFullYear||a>this.lastAvailableDate.getFullYear())return!1;if(isNaN(b)||b<0||b>11)return!1;if(isNaN(c)||c<1||c>31)return!1;var e=new Date(a,b,c);return e.getDate()!=c||e.getMonth()!=b||e.getFullYear()!=a?!1:e<d||e>this.lastAvailableDate?!1:e},getInitialDepartureDate:function(){return new Date((new Date).getTime()+this.searchStartDelayDaysTimestamp)},
getLaterReturnDate:function(){var a=getFieldDate(dojo.byId("DEPD").value);a.setHours(23,59,59,999);return a>=this.lastAvailableDate-this.searchReturnDelayDaysTimestamp?this.lastAvailableDate:new Date(a.getTime()+this.searchReturnDelayDaysTimestamp)},documentClickHandler:function(a,b,c){!this.isOnElement(a,b)&&!this.isOnElement(a,c)&&updateDateField(c.name,c.value,!0)},isOnElement:function(a,b){for(var c=Event.pointerX(a),d=Event.pointerY(a),e=b.offsetLeft,f=b.offsetTop,g=b;g.offsetParent;)g=g.offsetParent,
e+=g.offsetLeft,f+=g.offsetTop;var g=b.getDimensions(),h=f+g.height;return this.isBetween(c,e,e+g.width)&&this.isBetween(d,f,h)},isBetween:function(a,b,c){return a>=b&&a<=c?!0:!1},initAutocompleters:function(){var a=this,b=function(){a.updateCompareTo()};$(document).ready(function(){$("#departure").autocomplete(new legacyautocomplete({id:"departure",hiddenFieldId:"dep_hidden",url:a.autocompleteUrl,onUpdateFinished:function(){a.updateCompareTo()}}));$("#destination").autocomplete(new legacyautocomplete({id:"destination",
hiddenFieldId:"dst_hidden",url:a.autocompleteUrl,onUpdateFinished:function(){a.updateCompareTo()}}))});var c=dojo.byId("DEPD");typeof c.onchange=="function"?dojo.connect(c,"onchange",this,b):c.onchange=b;c=dojo.byId("RETD");typeof c.onchange=="function"?dojo.connect(c,"onchange",this,b):c.onchange=b},getBaseUrl:function(){var a=document.location.pathname.split("/");return document.location.protocol+"//"+document.location.hostname+"/"+a[1]},updateCompareTo:function(){var a=$("#compareToPlaceholder");
if(a.length){a.parent().hide();var a=$("#departure").val(),b=$("#dep_hidden").val()?$("#dep_hidden").val().split("|"):"||||".split("|"),c=$("#destination").val(),d=$("#dst_hidden").val()?$("#dst_hidden").val().split("|"):"||||".split("|"),e=dojo.byId("DEPD").value.split(".").reverse().join("-"),f=dojo.byId("oneway").checked?null:dojo.byId("RETD").value.split(".").reverse().join("-");searchForm.compareToBox.updateCompareToBlock(a,b,c,d,e,f)}}});dojo.require("SearchForm");dojo.provide("PowerSearchForm");
dojo.declare("PowerSearchForm",[SearchForm],{constructor:function(a,b,c){this.objectName=c;this.pickedImageId=null;this.useFancyDatePicker=!1},initSearchForm:function(a,b){dojo.byId("day_select_placeholder").innerHTML=this.createDaySelectBox(this.getDaysOfMonth(dojo.byId("depMonth").value),"depDay",dojo.byId("depMonth").value=="");dojo.byId("depDay").value=a;if(!this.isBothwaySearch)dojo.byId("return_day_select_placeholder").innerHTML=this.createDaySelectBox(this.getDaysOfMonth(dojo.byId("retMonth").value),
"retDay",dojo.byId("retMonth").value==""),dojo.byId("retDay").value=b;this.initSearchDates(!0)},enableReturnFlightFields:function(){if(!this.isBothwayEnabled)this.isBothwayEnabled=!0,dojo.byId("return_selection").style.display="block",dojo.byId("return_from_to").style.display="inline",dojo.byId("RETD").value=getDateString(this.getLaterReturnDate()),this.chageDateSelectionFields("RETD",!0),this.storedRetd=dojo.byId("RETD").value,dojo.byId("return_from_to_month").style.display="inline"},disableReturnFlightFields:function(){this.inherited(arguments);
if(dojo.byId("retMonth").value!="")this.storedRetd=dojo.byId("retDay").value!=""?dojo.byId("retDay").value+"."+dojo.byId("retMonth").value:"00."+dojo.byId("retMonth").value;dojo.byId("return_from_to_month").style.display="none"},createDaySelectBox:function(a,b,c){var d=dojo.byId(b)&&!c?dojo.byId(b).value:"";dojo.indexOf(a,d)==-1&&d!=""&&(d=a[0]);b='<select name="'+b+'" id="'+b+'" style="width:66px" tabindex="3" onchange="'+(this.objectName+"."+b+"FieldAction()")+'"'+(c?' disabled="disabled"':"")+
">";b+='<option value="">'+translate("LANG_SEARCHFORM_DAY_ALL")+"</option>";for(c=0;c<a.length;c++)b+='<option value="'+a[c]+'"'+(d==a[c]?" selected":"")+">"+a[c]+"</option>";b+="</select>";return b},getDaysOfMonth:function(a){var b=new Date;b.setDate(b.getDate()+SEARCH_START_DELAY_DAYS);b.setHours(0);var c=[],d=a.split(".");d.length<2&&(d=a.split(translatedStrings.LANG_JS_DATEPICKER_DATE_SEPARATOR));a=null;d.length==2?(a=new Date(d[1],d[0]-1,1),a<b&&(a=b)):a=b;d=b=0;do b=a.getDate(),a.setDate(a.getDate()+
1),c[d]=b<10?"0"+b:""+b,d++;while(a.getDate()>1);return c},depMonthFieldAction:function(){var a=this.getDaysOfMonth(dojo.byId("depMonth").value);dojo.byId("day_select_placeholder").innerHTML=this.createDaySelectBox(a,"depDay",dojo.byId("depMonth").value=="");this.isBothwayEnabled&&this.setRetDateNotEarlierThanDepDate("retDay","retMonth","depDay","depMonth",!0);dojo.byId("DEPD").value=this.getDateFromSelectedFields("depMonth","depDay");if(this.isBothwayEnabled)dojo.byId("RETD").value=this.getDateFromSelectedFields("retMonth",
"retDay");this.useFancyDatePicker&&($("#depd_picker").val(dojo.byId("DEPD").value),this.isBothwayEnabled&&$("#retd_picker").val(dojo.byId("RETD").value))},depDayFieldAction:function(){this.isBothwayEnabled&&this.setRetDateNotEarlierThanDepDate("retDay","retMonth","depDay","depMonth",!0);dojo.byId("DEPD").value=this.getDateFromSelectedFields("depMonth","depDay");if(this.isBothwayEnabled)dojo.byId("RETD").value=this.getDateFromSelectedFields("retMonth","retDay");this.useFancyDatePicker&&($("#depd_picker").val(dojo.byId("DEPD").value),
this.isBothwayEnabled&&$("#retd_picker").val(dojo.byId("RETD").value))},retMonthFieldAction:function(){var a=this.getDaysOfMonth(dojo.byId("retMonth").value);dojo.byId("return_day_select_placeholder").innerHTML=this.createDaySelectBox(a,"retDay",dojo.byId("retMonth").value=="");this.setRetDateNotEarlierThanDepDate("depDay","depMonth","retDay","retMonth",!1);dojo.byId("RETD").value=this.getDateFromSelectedFields("retMonth","retDay");dojo.byId("DEPD").value=this.getDateFromSelectedFields("depMonth",
"depDay");this.useFancyDatePicker&&($("#depd_picker").val(dojo.byId("DEPD").value),$("#retd_picker").val(dojo.byId("RETD").value))},retDayFieldAction:function(){this.setRetDateNotEarlierThanDepDate("depDay","depMonth","retDay","retMonth",!1);dojo.byId("RETD").value=this.getDateFromSelectedFields("retMonth","retDay");dojo.byId("DEPD").value=this.getDateFromSelectedFields("depMonth","depDay");this.useFancyDatePicker&&($("#depd_picker").val(dojo.byId("DEPD").value),$("#retd_picker").val(dojo.byId("RETD").value))},
getDateFromSelectedFields:function(a,b){var c=dojo.byId(a);if(c.selectedIndex==0)return a=="retMonth"?getDateString(this.getLaterReturnDate()):getDateString(this.getInitialDepartureDate());var d=dojo.byId(b);return d.selectedIndex==0?d.options[1].value+"."+c.value:d.value+"."+c.value},setRetDateNotEarlierThanDepDate:function(a,b,c,d,e){if(!(e&&dojo.byId("retMonth").value==""||!e&&dojo.byId("depMonth").value==""||e&&dojo.byId("depMonth").value==""||!e&&dojo.byId("retMonth").value==""))if(e||!(dojo.byId("depMonth").value==
dojo.byId("retMonth").value&&dojo.byId("retDay").value==""&&dojo.byId("depDay").value!="")){var f=new Date(dojo.byId("depMonth").value.substr(3,4),dojo.byId("depMonth").value.substr(0,2),dojo.byId("depDay").value);if(new Date(dojo.byId("retMonth").value.substr(3,4),dojo.byId("retMonth").value.substr(0,2),dojo.byId("retDay").value)<f){if(dojo.byId("retMonth").value!=dojo.byId("depMonth").value)e?dojo.byId("return_day_select_placeholder").innerHTML=this.createDaySelectBox(this.getDaysOfMonth(dojo.byId("depMonth").value),
"retDay"):dojo.byId("day_select_placeholder").innerHTML=this.createDaySelectBox(this.getDaysOfMonth(dojo.byId("retMonth").value),"depDay");dojo.byId(b).selectedIndex=dojo.byId(d).selectedIndex;dojo.byId(a).selectedIndex=dojo.byId(c).selectedIndex}}},displayDatePicker:function(a,b,c){this.pickedImageId=c;c=(a=b=="retDay")?"RETD":"DEPD";dojo.byId(a?"retMonth":"depMonth").value==""&&this.chageDateSelectionFields(c);displayDatePicker(c,dojo.byId(b),!0)},chageDateSelectionFields:function(a,b){var c=dojo.byId(a).value,
d=a=="RETD",e=d?"retDay":"depDay",f=d?dojo.byId("retMonth"):dojo.byId("depMonth"),d=d?"return_day_select_placeholder":"day_select_placeholder";this.selectMonth(b,f,c);monthYear=getFieldDate(c);month=monthYear.getMonth()+1;month=month<10?"0"+month:month;monthYear=month+"."+monthYear.getFullYear();dojo.byId(d).innerHTML=this.createDaySelectBox(this.getDaysOfMonth(monthYear),e);this.selectDay(b,e,c)},validateSearchForm:function(a){this.inherited(arguments);this.chageDateSelectionFields(a);this.isBothwayEnabled&&
dojo.byId("depMonth").value!=""&&dojo.byId("retMonth").value!=""&&(a=a=="RETD"?"DEPD":"RETD",dojo.byId("depDay").value==""||dojo.byId("retDay").value==""?(monthField=a=="RETD"?"retMonth":"depMonth",this.selectMonth(!0,dojo.byId(monthField),dojo.byId(a).value)):this.chageDateSelectionFields(a),this.useFancyDatePicker&&($("#depd_picker").val(dojo.byId("DEPD").value),$("#retd_picker").val(dojo.byId("RETD").value)))},documentClickHandler:function(a,b,c){!this.isOnElement(a,b)&&!this.isOnElement(a,c)&&
!this.isOnElement(a,dojo.byId(this.pickedImageId))&&updateDateField(c.name,c.value,!0)},selectMonth:function(a,b,c){a?this.storedRetd==null||this.storedRetd==""?b.selectedIndex=0:(storedRetMonth=this.storedRetd.substr(3),b.value=storedRetMonth.replace(/-/,".")):(c=getFieldDate(c,dateFormat),a=c.getFullYear(),c=c.getMonth()+1,c<10&&(c="0"+c),b.selectedIndex=dojo.query("option[value='"+c+"."+a+"']",b)[0].index)},selectDay:function(a,b,c){b=dojo.byId(b);if(a)if(this.storedRetd==null||this.storedRetd==
""||this.storedRetd.substr(0,2)=="00"){if(b.selectedIndex=0,this.storedRetd==null||this.storedRetd=="")b.disabled=!0}else b.value=this.storedRetd.substr(0,2);else a=getFieldDate(c,dateFormat).getDate(),a<10&&(a="0"+a),b.selectedIndex=dojo.query("option[value='"+a+"']",b)[0].index},initAutocompleters:function(){var a=this;$(document).ready(function(){$("#power_departure").autocomplete(new powersearch_autocomplete({id:"power_departure",hiddenFieldId:"dep_hidden",url:a.autocompleteUrl}));$("#power_destination").autocomplete(new powersearch_autocomplete({id:"power_destination",
hiddenFieldId:"dst_hidden",url:a.autocompleteUrl}))})},initFancyDatePicker:function(a){this.useFancyDatePicker=!0;var b=new Date,c=new Date(b.getFullYear()+1,b.getMonth(),0),d=this;$(".datepicker").each(function(){$(this).fancydatepicker({showOtherMonths:!0,drawDefaultHeader:!0,drawFancyHeader:!1,selectOtherMonths:!0,hideIfNoPrevNext:!0,calendarWidth:230,showWeek:!1,numberOfMonths:2,firstDay:1,minDate:b,maxDate:c,dateFormat:translate("JQUERY_DATEPICKER_DATE_FORMAT"),showOn:"button",buttonImage:a,
buttonImageOnly:!0,onSelect:function(a,b){var c=b.id=="depd_picker"?"DEPD":"RETD";$("#"+c).val($(this).val());d.validateSearchForm(c)}})});$("#ui-datepicker-div").css("margin-top",$.browser.msie?"20px":"12px")}});function HotelPager(a){this.pagerIds=a}HotelPager.prototype.draw=function(a){for(var a=this.generatePagerHtml(a),b=0;b<this.pagerIds.length;b++)dojo.byId(this.pagerIds[b]).innerHTML=a};
HotelPager.prototype.clear=function(){for(var a=0;a<this.pagerIds.length;a++)dojo.byId(this.pagerIds[a]).innerHTML="&nbsp;"};HotelPager.prototype.generatePagerHtml=function(a){var b="&nbsp;";try{for(var c=a.length,d=0;d<c;d++)b+=(a[d].selected?'<span class="activelink">'+a[d].name+"</span>":"<a href=\"javascript:controller.applyFilter('"+a[d].url+"')\">"+a[d].name+"</a>")+(d+1<c?'<span class="ml-h"> | </span>':"")}catch(e){}return b};
function KHotelSorter(a,b,c){this.sorterId=a;this.sorterContainerId=b;this.commonImageUrl=c}KHotelSorter.prototype.draw=function(a,b){dojo.byId(this.sorterContainerId).style.display="block";dojo.byId(this.sorterId).innerHTML=this.generateSorterHtml(a,b)};KHotelSorter.prototype.clear=function(){dojo.byId(this.sorterContainerId).style.display="none";dojo.byId(this.sorterId).innerHTML=""};
KHotelSorter.prototype.generateSorterHtml=function(a,b){if(!a.length)return"";var c='<span class="hotel-sorter-label">'+translate("LANG_HOTEL_SORT_BY_LABEL")+"</span>";c+='<select name="hotel-search-sorter" onchange="controller.applyFilter(this.options[this.selectedIndex].value);">';for(var d=0;d<a.length;d++){var e=a[d].name+(a[d].name==translate("LANG_KHOTEL_SORTING_TITLE_DISTANCE")?' "'+b+'"':"");c+='<option value="'+(a[d].url?a[d].url:"")+'"'+(a[d].selected?' selected="selected"':"")+">"+e+"</option>"}c+=
"</select>";return c};dojo.provide("KhotelSearchForm");
dojo.declare("KhotelSearchForm",null,{constructor:function(a,b,c,d){this.searchStartDelayDaysTimestamp=SEARCH_START_DELAY_DAYS*864E5;this.searchEndDelayDaysTimestamp=SEARCH_RETURN_DELAY_DAYS*864E5;this.lastAvailableDate=getFieldDate(MAX_AVAILABLE_DATE,"ymd",!0);this.lastAvailableDate.setHours(0,0,0,0);this.storedEndd=this.storedSartd="";this.enabledSearchButtonUrl=c?c+"/btn_hotelsuche_big.png":!1;this.disabledSearchButtonUrl=c?c+"/btn_hotelsuche_big_disabled.png":!1;this.kayakTechnologyLogoUrl=d?
d+"/KAYAKtech-logo.png":!1;this.autocompleteUrl=a+"/hotel/autocomplete";this.compareToBox=b},getStoredDate:function(a){return a=="ENDD"?this.storedEndd:this.storedStartd},validateSearchForm:function(a){var b=getFieldDate(dojo.byId("STARTD").value);if(b==!1)b=getFieldDate(this.storedStartd),dojo.byId("STARTD").value=this.storedStartd;var c=getFieldDate(dojo.byId("ENDD").value);if(c==!1)c=getFieldDate(this.storedEndd),dojo.byId("ENDD").value=this.storedEndd;if(a=="ENDD"&&b>=c)dojo.byId("STARTD").value=
getDateString(this.getEarlierStartDate());else if(b>=c)dojo.byId("ENDD").value=getDateString(this.getLaterEndDate());this.storedStartd=dojo.byId("STARTD").value;this.storedEndd=dojo.byId("ENDD").value},initSearchDates:function(a){if(!getFieldDate(dojo.byId("STARTD").value))dojo.byId("STARTD").value=getDateString(this.getInitialStartDate());if(!getFieldDate(dojo.byId("ENDD").value))dojo.byId("ENDD").value=getDateString(this.getLaterEndDate());this.storedStartd=dojo.byId("STARTD").value;this.storedEndd=
dojo.byId("ENDD").value;a||this.validateSearchForm("ENDD")},changeSearchButton:function(a){var b=dojo.byId("searchnow");if(this.disabledSearchButtonUrl&&this.enabledSearchButtonUrl)b.src=a?this.disabledSearchButtonUrl:this.enabledSearchButtonUrl;b.disabled=a},getDateFromParts:function(a,b,c){var d=new Date;d.setHours(0,0,0,0);if(isNaN(a)||a<d.getFullYear||a>this.lastAvailableDate.getFullYear())return!1;if(isNaN(b)||b<0||b>11)return!1;if(isNaN(c)||c<1||c>31)return!1;var e=new Date(a,b,c);return e.getDate()!=
c||e.getMonth()!=b||e.getFullYear()!=a?!1:e<d||e>this.lastAvailableDate?!1:e},getInitialStartDate:function(){return new Date((new Date).getTime()+this.searchStartDelayDaysTimestamp)},getEarlierStartDate:function(){var a=getFieldDate(dojo.byId("ENDD").value);a.setHours(23,59,59,999);var a=new Date(a.getTime()-this.searchEndDelayDaysTimestamp),b=(new Date).setHours(23,59,59,999)+this.searchStartDelayDaysTimestamp;return a>=b?a:b},getLaterEndDate:function(){var a=getFieldDate(dojo.byId("STARTD").value);
a.setHours(23,59,59,999);return a>=this.lastAvailableDate-this.searchEndDelayDaysTimestamp?this.lastAvailableDate:new Date(a.getTime()+this.searchEndDelayDaysTimestamp)},documentClickHandler:function(a,b,c){!this.isOnElement(a,b)&&!this.isOnElement(a,c)&&updateDateField(c.name,c.value,!0)},isOnElement:function(a,b){for(var c=Event.pointerX(a),d=Event.pointerY(a),e=b.offsetLeft,f=b.offsetTop,g=b;g.offsetParent;)g=g.offsetParent,e+=g.offsetLeft,f+=g.offsetTop;var g=b.getDimensions(),h=f+g.height;return this.isBetween(c,
e,e+g.width)&&this.isBetween(d,f,h)},isBetween:function(a,b,c){return a>=b&&a<=c?!0:!1},initAutocompleter:function(){var a=new hotels_autocomplete({id:"location",url:this.autocompleteUrl,compareToBox:this.compareToBox,delay:300,appendContentContainerClass:"ui-hotel-autocomplete-append-content"});if(!a.appendContent&&this.kayakTechnologyLogoUrl)a.appendContent='<img src="'+this.kayakTechnologyLogoUrl+'" alt="" />';$(document).ready(function(){$("#location").autocomplete(a)})},initRoomsGuestsConstraint:function(){dojo.connect(dojo.byId("ROOMS"),
"onchange",this,function(){var a=dojo.byId("ROOMS").value,b=dojo.byId("GUESTS").value;if(a==2&&b==1)dojo.byId("GUESTS").selectedIndex=1;if(a==1&&b>4)dojo.byId("ROOMS").selectedIndex=1});dojo.connect(dojo.byId("GUESTS"),"onchange",this,function(){var a=dojo.byId("GUESTS").value;if(a>4)dojo.byId("ROOMS").selectedIndex=1;if(a==1)dojo.byId("ROOMS").selectedIndex=0})},initFancyDatePicker:function(){var a=this;$(".datepicker").each(function(){var b=new Date,c=new Date;c.setYear(b.getFullYear()+1);$(this).fancydatepicker({showOtherMonths:!0,
drawDefaultHeader:!0,drawFancyHeader:!1,selectOtherMonths:!0,hideIfNoPrevNext:!0,calendarWidth:230,showWeek:!1,numberOfMonths:2,firstDay:1,minDate:b,maxDate:c,dateFormat:translate("JQUERY_DATEPICKER_DATE_FORMAT"),onSelect:function(b,c){a._checkDates(c)}});$(this).fancydatepicker("getInstance").addMethods({_hideDatepicker:function(b){this._parent(b);a._checkDates(this._curInst)}})})},_checkDates:function(a){var b=new Date(a.selectedYear,a.selectedMonth,a.selectedDay);a.id=="STARTD"?(a=b,b=$.parseDate($("#ENDD").val()),
a>=b&&$("#ENDD").fancydatepicker("setDate",new Date(a.getTime()+864E5))):(a=$.parseDate($("#STARTD").val()),a>=b&&$("#STARTD").fancydatepicker("setDate",new Date(b.getTime()-864E5)))}});
function Hotel(a){this.id=a.id;this.title=a.name;this.distance=a.distance;this.rating=a.overallLiking||0;this.category=a.category;this.description=a.description;this.imgUrl=a.imageUrl;this.offers=[];for(var b=0;b<a.offers.length;b++)this.offers[b]=new HotelOffers(a.offers[b]);this.price=this.getOffer().averagePrice||":-(";this.reviews=[];for(b=this.totalReviewsCount=0;b<a.partnerRatings.length;b++)this.reviews[b]=new HotelReview(a.partnerRatings[b]),this.totalReviewsCount+=this.reviews[b].reviewCount-
0;this.hasCoordinates=a.coordinates?!0:!1}Hotel.prototype.getOffer=function(a){return this.offers[a||0]||{}};Hotel.prototype.getReviewCount=function(){return this.totalReviewsCount};Hotel.prototype.getReviewSourceCount=function(){for(var a=0,b=this.reviews,c=0,d=b.length;c<d;c++)a+=Number(b[c].reviewCount);return a};Hotel.prototype.getRating=function(){return this.rating/10};Hotel.prototype.getOfersImgUrl=function(){return this.getOffer().logoUrl||null};
Hotel.prototype.getDistance=function(){return this.distance?this.distance:""};function HotelReview(a){this.partnerName=a.partnername;this.partnerId=a.partnerid;this.partnerRating=a.partnerrating?a.partnerrating:0;this.reviewCount=a.reviewcount;this.url=a.url}HotelReview.prototype.getRating=function(){return this.partnerRating/10};
function HotelOffers(a){this.partnerName=a.partnerName;this.partnerId=a.partnerId;this.averagePrice=a.averagePrice;this.deeplinkUrl=a.deeplinkUrl;this.logoUrl=a.logoUrl;this.roomType=a.roomType}function HotelFilter(){}function PageState(a,b){this.hash=this._createHash(a);this.changeUrl=this._createHash(a);this.stateLoadCallback=b}PageState.prototype.back=function(){this._setLocationHash();this.stateLoadCallback(this)};PageState.prototype.forward=function(){this._setLocationHash();this.stateLoadCallback(this)};
PageState.prototype.setHash=function(a){a=new String(decodeURIComponent(a));a.charAt(0)=="#"&&(a=a.substr(1));this.hash=a};PageState.prototype.getUrl=function(){var a="";this.hash!=""&&(a=(new String(this.hash)).replace(/\|/g,"/"),a=a.replace(/;/g,","),a="/"+a);return a};PageState.prototype._setLocationHash=function(){document.location.hash=this.hash};
PageState.prototype._createHash=function(a){if(a=="")return"";var b=new String(decodeURIComponent(document.location.hash));b.charAt(0)=="#"&&b.substr(1);a=(new String(a)).replace(/\//g,"|");a=a.replace(/,/g,";");a.charAt(0)=="|"&&(a=a.substr(1));b="";return a};dojo.require("swoodoo.PeriodicalUpdater");var ControllerInstance=null;
function KHotelsController(a){this.resultUrl=a.baseUrl+"/hotel/getlist";this.getHandleUrl=a.baseUrl+"/hotel/gethandleorlist";this.filterUrl="";this.requestId=a.requestId;this.resultRenderer=a.resultRenderer;this.hotelResults=null;this.hotelsSearchFormMoreOptionsEnabled=a.hotelsSearchFormMoreOptionsEnabled;this.hotelsNameFilterOnTopEnabled=a.hotelsNameFilterOnTopEnabled;this.filterRenderer=new KhotelsFilterRenderer({filterHolderId:"filter_panel",nameFilterHolderId:"hotel-filter-name-holder",commonImageUrl:a.commonImageUrl,
testMode:a.testMode,currencySymbol:a.currencySymbol,hotelsSearchFormMoreOptionsEnabled:a.hotelsSearchFormMoreOptionsEnabled,hotelsNameFilterOnTopEnabled:a.hotelsNameFilterOnTopEnabled});this.pager=new HotelPager(a.hotelsNameFilterOnTopEnabled?["hotel_pager_bottom"]:["hotel_pager_top","hotel_pager_bottom"]);this.sorter=new KHotelSorter("hotel_sorter","hotel_sorter_container",a.commonImageUrl);this.searchFormBox="searchformbox";this.handle="";this.searchForm=a.searchForm;this.SEARCH_STATUS_COMPLETE=
"1";this.SEARCH_STATUS_INCOMPLETE="0";this.MAX_REQUEST_ITERATION_COUNT=20;this.MAX_ATTRACTION_NAME_LENGTH=30;this.iterationCount=0;this._loader=null;this.crossSaleUrl=a.crossSaleUrl;ControllerInstance=this;this.setLoader(a.statusPanel);this.hideMiddleAdsWhenCrossSaleExists=a.hideMiddleAdsWhenCrossSaleExists;this.extUserParams=a.extUserParams}
KHotelsController.prototype.draw=function(a){if(($noResults=typeof a.hotels=="undefined"?!0:!1)||a.hotels.length||a.searchStatus==ControllerInstance.SEARCH_STATUS_COMPLETE){this.resetContainers();this.resultRenderer.drawResults($noResults?[]:a.hotels);if(!$noResults&&(a.hotels.length>0||this.filterUrl))this.filterRenderer.draw(a.fullHotelNameList,this.filterUrl,a.filters,a.categoryFilter,a.priceFilter,a.distanceFilter,a.attractions,a.nameFilter),ControllerInstance.loaderIsOn&&ControllerInstance.redrawBlankets();
!$noResults&&a.hotels.length&&this.drawSorter(a.sorting,a.attractions);this.drawPager(a.paging)}};KHotelsController.prototype.resetContainers=function(){this.resultRenderer.clear();this.pager.clear();this.sorter.clear();this.filterRenderer.clear();this.tripsResult=null};KHotelsController.prototype.clearResultPage=function(){dojo.byId("mainResultBox").innerHTML=""};
KHotelsController.prototype.updateResults=function(){var a="",a=this.filterUrl!=""?this.resultUrl+this.filterUrl:this.resultUrl;periodicalUpdater=new swoodoo.PeriodicalUpdater("",a,{method:"post",params:{handle:ControllerInstance.handle,params:this.requestId},frequency:1E3,decay:2,onException:function(){ControllerInstance.stopSearch(!0)},onSuccess:function(a){a=eval("("+a+")");ControllerInstance.hotelResults=a.results;a.status==1&&ControllerInstance.iterationCount<=ControllerInstance.MAX_REQUEST_ITERATION_COUNT?
a.results.searchStatus==ControllerInstance.SEARCH_STATUS_COMPLETE&&ControllerInstance.stopSearch(!0):ControllerInstance.stopSearch(!0);ControllerInstance.iterationCount++;ControllerInstance.draw(ControllerInstance.hotelResults)}});periodicalUpdater.start()};KHotelsController.prototype.stopSearch=function(a){periodicalUpdater&&periodicalUpdater.stop();a&&ControllerInstance.hideLoader();ControllerInstance.changeButtons(!1);ControllerInstance.iterationCount=0};
KHotelsController.prototype.cancelSearch=function(){periodicalUpdater&&periodicalUpdater.stop();ControllerInstance.hideLoader();try{periodicalUpdater&&periodicalUpdater.updater.transport.abort()}catch(a){}ControllerInstance.changeButtons(!1)};KHotelsController.prototype.drawPager=function(a){this.pager.draw(a)};
KHotelsController.prototype.drawSorter=function(a,b){for(var c="",d=0;d<b.length;d++)if(b[d].isSelected==!0){c=b[d].name.length>this.MAX_ATTRACTION_NAME_LENGTH?b[d].name.substr(0,this.MAX_ATTRACTION_NAME_LENGTH)+"...":b[d].name;break}this.sorter.draw(a,c)};
KHotelsController.prototype.toggleSearch=function(a){a?(dojo.byId("searchformbox-header").style.display="none",dojo.byId(this.searchFormBox).style.display=""):(dojo.byId(this.searchFormBox).style.display="none",dojo.byId("searchformbox-header").style.display="")};KHotelsController.prototype.getTripIds=function(a){for(var b="",c=0;c<a.length;c++)b+=a[c].alternative?this.getTripIds(a[c].alternative):a[c].tripId,c+1<a.length&&(b+=",");return b};
KHotelsController.prototype.applyFilter=function(a,b){ControllerInstance.setFilterUrl(a);ControllerInstance.cancelSearch();var c=new swoodoo.hotelFilteringLoader({targetId:"hotel_search_results",alsoBlank:["filter_panel","hotel_search_header"]});c.setCancelCallback(function(){ControllerInstance.cancelSearch()});ControllerInstance.setLoader(c);c=a==""?new PageState("home",ControllerInstance.setPageState):new PageState(a,ControllerInstance.setPageState);dojo.back.addToHistory(c);c=document.getElementById("hotel-search-result-list-description");
if(typeof b=="undefined"){var d=0;if(c.offsetParent){do d+=c.offsetTop;while(c=c.offsetParent)}window.scrollTo(0,d)}ControllerInstance.startSearch()};
KHotelsController.prototype.resetFilters=function(){var a=new String(this.filterUrl),a=a.replace(/\/filters\/[0-9]+(,[0-9]+)*/,""),a=a.replace(/\/price\/[0-9]+,[0-9]+,[0-9]+/,""),a=a.replace(/\/attr\/[0-9]+/,""),a=a.replace(/\/mincat\/[0-9]+/,""),a=a.replace(/\/dist\/[0-9]+/,""),a=a.replace(/\/name\/[^\/]+/,""),a=a.replace(/\/page\/[0-9]+/,""),a=a.replace(/\/+/,"/");swoodoo.Location.setHash(swoodoo.Location.defaultValue);ControllerInstance.applyFilter(a)};
KHotelsController.prototype.setFilterUrl=function(a){a=="/"+swoodoo.Location.defaultValue&&(a="");ControllerInstance.filterUrl=a};KHotelsController.prototype.setPageState=function(a){dojo.addOnLoad(function(){ControllerInstance.setFilterUrl(a.getUrl());var b=HotelsDialogRenderer.getId(ControllerInstance.filterUrl);b&&HotelsDialogRenderer.show(b);ControllerInstance.resetContainers();ControllerInstance.startSearch()})};
KHotelsController.prototype.startSearch=function(){ControllerInstance.changeButtons(!0);ControllerInstance.showLoader();dojo.xhrPost({url:this.filterUrl!=""?this.getHandleUrl+this.filterUrl:this.getHandleUrl,handleAs:"text",content:{params:this.requestId,ext:this.extUserParams},load:function(a){a=eval("("+a+")");if(a.status==1){var b=null;typeof a.results=="string"?(b=ControllerInstance.handle=a.results,ControllerInstance.updateResults()):(ControllerInstance.draw(a.results),b=a.results.searchHandle,
ControllerInstance.changeButtons(!1),ControllerInstance.hideLoader());ControllerInstance.crossSaleUrl&&ControllerInstance.drawCrossSale(b)}else ControllerInstance.draw(a.results),ControllerInstance.changeButtons(!1),ControllerInstance.hideLoader()},error:function(){ControllerInstance.changeButtons(!1);ControllerInstance.hideLoader()}})};
KHotelsController.prototype.drawCrossSale=function(a){var a=this.crossSaleUrl+"/handle/"+this.trimOk(a),b=new CrossSaleRenderer("crossSalesPlaceHolder","swAdsMiddle",this.hideMiddleAdsWhenCrossSaleExists);(new CrossSaleTransporter({renderer:b,crosssaleUrl:a})).deliver()};KHotelsController.prototype.trimOk=function(a){a.substr(0,2)=="OK"&&(a=a.substr(2));return a};KHotelsController.prototype.changeButtons=function(a){this.searchForm.changeSearchButton(a)};
KHotelsController.prototype.setLoader=function(a){ControllerInstance.loaderIsOn&&ControllerInstance.hideLoader();ControllerInstance._loader=a};KHotelsController.prototype.showLoader=function(){if(ControllerInstance._loader)ControllerInstance._loader.start(),ControllerInstance.loaderIsOn=!0};KHotelsController.prototype.redrawBlankets=function(){ControllerInstance._loader&&ControllerInstance._loader.redrawBlankets&&ControllerInstance._loader.redrawBlankets()};
KHotelsController.prototype.hideLoader=function(){if(ControllerInstance._loader&&ControllerInstance.loaderIsOn)ControllerInstance._loader.stop(),ControllerInstance.loaderIsOn=!1};KHotelsController.prototype.loaderIsOn=!1;function KhotelSearchFormUrlManager(a,b){this.baseUrl=a;this.hotelUrlPrefix=b}
KhotelSearchFormUrlManager.prototype.parseResultDataAndRedirect=function(){var a=dojo.byId("location").value,b=dojo.byId("hidden_location").value,c=dojo.byId("STARTD").value,d=dojo.byId("ENDD").value,e=dojo.byId("ROOMS").value,f=dojo.byId("GUESTS").value;if(formatDateToYmd(d,"d.m.y")<=formatDateToYmd(c,"d.m.y"))d=this.getFixedEndDate(c),dojo.byId("ENDD").value=d;this.createFormAndSubmit(this.getFriendlyHotelUrl(a,b,c,d,e,f));return!1};
KhotelSearchFormUrlManager.prototype.createFormAndSubmit=function(a){var b=document.createElement("FORM");dojo.attr(b,"method","POST");dojo.attr(b,"action",a);dojo.attr(b,"style","display:none");var c=dojo.byId("filter-value-from-hash");c&&c.value.length>0&&dojo.attr(b,"action",a+"#"+escape(c.value));dojo.body().appendChild(b);if((a=dojo.byId("compareToOpenedPopupCucs"))&&a.innerHTML){c=a.innerHTML.split(",");for(a=0;a<c.length;a++){var d="compareTo["+c[a]+"]",e=document.createElement("input");dojo.attr(e,
"type","hidden");dojo.attr(e,"name",d);dojo.attr(e,"value","1");b.appendChild(e)}}if((a=dojo.byId("compareToUncheckedCucs"))&&a.innerHTML){c=a.innerHTML.split(",");for(a=0;a<c.length;a++)d=document.createElement("input"),dojo.attr(d,"type","hidden"),dojo.attr(d,"name",c[a]),dojo.attr(d,"value","1"),b.appendChild(d)}b.submit()};
KhotelSearchFormUrlManager.prototype.getFriendlyHotelUrl=function(a,b,c,d,e,f){c=this.getYMDDateFromDMY(c);d=this.getYMDDateFromDMY(d);a=this.pickValidLocation(a,b);a=this.removeInvalidChars(a);return this.baseUrl+"/"+this.hotelUrlPrefix+"/"+a+"/"+c+"/"+d+"/"+e+"/"+f};KhotelSearchFormUrlManager.prototype.getYMDDateFromDMY=function(a){a=a.split(".");return a[2]+"-"+a[1]+"-"+a[0]};KhotelSearchFormUrlManager.prototype.removeInvalidChars=function(a){return(new String(a)).replace(/[%]/g,"")};
KhotelSearchFormUrlManager.prototype.pickValidLocation=function(a,b){if(!b)return a;var c=b.split("|");return c.length!=2||c[0]!=a?a:c[1]};KhotelSearchFormUrlManager.prototype.getFixedEndDate=function(a){a=a.split(".");a=new Date(parseInt(a[2],10),parseInt(a[1],10)-1,parseInt(a[0],10));a.setDate(a.getDate()+1);var b=(a.getDate()<10?"0":"")+a.getDate(),c=(a.getMonth()<9?"0":"")+(a.getMonth()+1);return b+"."+c+"."+a.getFullYear()};function CountryChooser(a,b){this.countryCodes=a;this.baseUrl=b}
CountryChooser.prototype.showCountries=function(){dojo.byId("country-selector").style.height="";for(var a=1;a<this.countryCodes.length;a++)dojo.byId("country-selector-line-"+this.countryCodes[a]).style.display="block"};CountryChooser.prototype.hideCountries=function(){dojo.byId("country-selector").style.height="21px";for(var a=1;a<this.countryCodes.length;a++)dojo.byId("country-selector-line-"+this.countryCodes[a]).style.display="none"};
CountryChooser.prototype.activateCountry=function(a){dojo.byId("country-selector-flag-"+a).style.border="1px solid black";dojo.byId("country-selector-label-"+a).style.color="#ad051e"};CountryChooser.prototype.disableCountry=function(a){dojo.byId("country-selector-flag-"+a).style.border="1px solid white";dojo.byId("country-selector-label-"+a).style.color=""};CountryChooser.prototype.changeCountry=function(a){document.location.href=this.baseUrl+"/"+a+"/"};
function HotelAttractionsMap(a){this._mapType=13;this._markers=[];this._markersByCoords=[];this._activeMarkerId=null;this._clickHandlers=[];this.placeHolderId=a;this.map=null;this.lng=this.lat=0}HotelAttractionsMap.prototype.setCenter=function(a,b){this.lat=a;this.lng=b;this.map&&this.map.setCenter(new GLatLng(this.lat,this.lng),this._mapType)};
HotelAttractionsMap.prototype.display=function(){this.map=new GMap2(document.getElementById(this.placeHolderId));this.map.setUIToDefault();this.lat&&this.lng&&this.map.setCenter(new GLatLng(this.lat,this.lng),this._mapType)};HotelAttractionsMap.prototype.addMarker=function(a){var b=a.getGMarker();this.map.addOverlay(b);this._markers[a.id]=a;this._markersByCoords[b.getLatLng()]=a;var c=this;this._clickHandlers[a.id]=GEvent.addListener(b,"click",function(a){c.activateMarker(c._markersByCoords[a].id)})};
HotelAttractionsMap.prototype.removeMarker=function(a){var b=a.getGMarker();this.map.removeOverlay(b);GEvent.removeListener(this._clickHandlers[a.id]);this._markers[a.id]=null;this._markersByCoords[b.getLatLng()]=null;this._clickHandlers[a.id]=null};HotelAttractionsMap.prototype.removeAllMarkers=function(){dojo.forEach(this._markers,this.removeMarker);this._markers=[];this._markersByCoords=[];this._clickHandlers=[]};HotelAttractionsMap.prototype.getActiveMarkerId=function(){return this._activeMarkerId};
HotelAttractionsMap.prototype.activateMarker=function(a){this.deactivateMarker(this.getActiveMarkerId());if(this._markers[a])var b=this._markers[a];else return!1;b.activate();this.map.panTo(b.getGMarker().getLatLng());this._activeMarkerId=a};HotelAttractionsMap.prototype.deactivateMarker=function(a){if(this._markers[a])a=this._markers[a];else return!1;a.deactivate()};
function AttractionMarker(a,b,c,d){this.id=d;this.isActive=!1;this.latitude=a;this.longitude=b;this.icon=c;this.GMarker=null;a=this.isActive?this.icon.activeIcon:this.icon.icon;this.GMarker=new GMarker(new GLatLng(this.latitude,this.longitude),a)}AttractionMarker.prototype.getGMarker=function(){return this.GMarker};AttractionMarker.prototype.activate=function(){this.GMarker.setImage(this.icon.activeIcon.image)};AttractionMarker.prototype.deactivate=function(){this.GMarker.setImage(this.icon.icon.image)};
function MarkerIcon(a,b,c){this.icon=new GIcon(c);this.icon.image=a;this.activeIcon=new GIcon(c);this.activeIcon.image=b}dojo.require("swoodoo.Location");dojo.require("swoodoo.widgets.Dialog");dojo.require("swoodoo.ie");dojo.declare("NewsletterDialogRenderer");typeof document.readyState=="undefined"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",function(){document.readyState="complete"},!1);
(function newsletterDialogOnLoad(){typeof dojo==="undefined"||typeof NewsletterDialogRenderer==="undefined"||typeof NewsletterActions==="undefined"||document.readyState!="complete"?window.setTimeout(newsletterDialogOnLoad,50):NewsletterActions.loader()})();
dojo.mixin(NewsletterDialogRenderer,{submiturl:null,action:null,userkey:null,dialog:null,locationPathName:window.location.pathname,loadingMessage:'<div class="dijitContentPaneLoading"><div class="hotel-dialog-image"><center><img src="'+imagesPath+'newsletter/dialog_loader.gif" style="margin-bottom:4px"/><br/>'+translate("LANG_NEWSLETTER_LOADING")+"&hellip;</center></div></div>",open:function(a,b,c,d){c||(c="440");d||(d="320");NewsletterDialogRenderer.action=a;NewsletterDialogRenderer.userkey=b;NewsletterDialogRenderer.submiturl=
"";a!=null&&(NewsletterDialogRenderer.submiturl+="/"+a);b!=null&&(NewsletterDialogRenderer.submiturl+="/"+b);NewsletterDialogRenderer.show(c,d);return!1},close:function(){NewsletterDialogRenderer.action=null;NewsletterDialogRenderer.userkey=null;NewsletterDialogRenderer.submiturl=null;swoodoo.Location.issetParam(NewsletterActions.LANG_NEWSLETTER_REGISTER_URL_PARAM)&&swoodoo.Location.setHash(swoodoo.Location.removeParam(NewsletterActions.LANG_NEWSLETTER_REGISTER_URL_PARAM));return!1},show:function(a,
b){var c=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,"$1/ns")+NewsletterDialogRenderer.submiturl,d=NewsletterDialogRenderer.dialog;if(d)d.hide(),d.destroy(),d=NewsletterDialogRenderer.dialog=null;if(swoodoo.ie.isReady())return d=NewsletterDialogRenderer.dialog=new swoodoo.widgets.Dialog({href:c,loadingMessage:NewsletterDialogRenderer.loadingMessage,style:"width: "+a+"px; height: "+b+"px"},dojo.create("div",{id:"newsletter-dialog"},dojo.body(),"last")),d.startup(),dojo.connect(d,
"onShow",function(){dojo.connect(dijit._underlay,"onClick",function(){d.hide()})}),dojo.connect(d,"onDownloadEnd",function(){NewsletterActions.changeDialogInfoContent();NewsletterActions.trackEcondaEvent()}),dojo.connect(d,"hide",function(){NewsletterDialogRenderer.close()}),d.show(),d;else swoodoo.ie.onReady(function(){NewsletterDialogRenderer.show()})},hide:function(){var a=NewsletterDialogRenderer.dialog;if(a)a.hide(),a.destroy(),NewsletterDialogRenderer.dialog=null}});dojo.declare("NewsletterActions");
dojo.mixin(NewsletterActions,{LANG_NEWSLETTER_SYSTEM_MESSAGE_DEFAULT:translate("LANG_NEWSLETTER_SYSTEM_MESSAGE_DEFAULT"),LANG_NEWSLETTER_SYSTEM_MESSAGE_SIGNUP_IN_PROCESS:translate("LANG_NEWSLETTER_SYSTEM_MESSAGE_SIGNUP_IN_PROCESS"),LANG_MEMBER_REGISTRATION_FAILED:translate("LANG_MEMBER_REGISTRATION_FAILED"),LANG_DATA_SEND_FAILED:translate("LANG_DATA_SEND_FAILED"),LANG_NEWSLETTER_WELCOME:translate("LANG_NEWSLETTER_WELCOME"),LANG_NEWSLETTER_REGISTER_URL_PARAM:translate("LANG_NEWSLETTER_REGISTER_URL_PARAM"),
LANG_NEWSLETTER_REGISTER_URL_VALUE:translate("LANG_NEWSLETTER_REGISTER_URL_VALUE"),LANG_NEWSLETTER_URL:translate("LANG_NEWSLETTER_URL"),LANG_NEWSLETTER_SUBSCRIBE_URL:translate("LANG_NEWSLETTER_SUBSCRIBE_URL"),LANG_NEWSLETTER_UNSUBSCRIBE_URL:translate("LANG_NEWSLETTER_UNSUBSCRIBE_URL"),LOADER_IMAGE:"<span class=newsletter-loader-image><img src="+imagesPath+"newsletter/loader.gif align=middle/>&nbsp;</span>",WHITE_CHECKBOX_IMAGE:"<span class=newsletter-loader-image><img src="+imagesPath+"newsletter/checkbox_white.gif align=middle/>&nbsp;</span>",
ERROR_IMAGE:"<span class=newsletter-loader-image><img src="+imagesPath+"newsletter/icon_error.gif align=middle/>&nbsp;</span>",econdaTrackerEnabled:!1,econdaEvent:null,MEMBER_CONFIRM_ERROR:null,MEMBER_UNSUBSCRIBE_ERROR:null,DIALOG_CONTENT_HEIGHT:null,locationPathName:window.location.pathname,trackEcondaEvent:function(){NewsletterActions.econdaTrackerEnabled&&NewsletterActions.econdaEvent&&EcondaTracker.trackEvent(NewsletterActions.econdaEvent)},setEcondaEventTarget:function(a,b){NewsletterActions.econdaEvent=
{};NewsletterActions.econdaEvent.siteid=typeof CURRENT_ECONDA_SITE_ID=="undefined"?"swoodoo":CURRENT_ECONDA_SITE_ID;NewsletterActions.econdaEvent.carea="allgemein";NewsletterActions.econdaEvent.content="newsletter/layer";NewsletterActions.econdaEvent.Target=[["Newsletter",a,b,"d"]];NewsletterActions.econdaEvent.pageId=NewsletterActions.econdaEvent.content},openSignupForm:function(){NewsletterActions.MEMBER_CONFIRM_ERROR=null;NewsletterDialogRenderer.hide();NewsletterActions.DIALOG_CONTENT_HEIGHT=
"260";if(dojo.isIE<7)NewsletterActions.DIALOG_CONTENT_HEIGHT="265";NewsletterActions.setEcondaEventTarget("Layer","0");NewsletterDialogRenderer.open("signup",null,440,310);return!1},openUnsubscribeForm:function(a){NewsletterActions.DIALOG_CONTENT_HEIGHT="185";var b;b=dojo.isIE<7?250:dojo.isOpera?250:240;NewsletterActions.setEcondaEventTarget("UnsubscribeLayer","0");NewsletterDialogRenderer.open("unsubscribe",a,440,b)},openUnsubscribefailedForm:function(a){NewsletterActions.DIALOG_CONTENT_HEIGHT="105";
var b;b=dojo.isIE<7?160:dojo.isOpera?160:150;NewsletterActions.setEcondaEventTarget("Unsubscribe_UserNotFound","0");NewsletterDialogRenderer.open("unsubscribefailed",a,440,b)},openUnsubscribesuccessForm:function(a){NewsletterActions.DIALOG_CONTENT_HEIGHT="170";var b;b=dojo.isIE<7?230:dojo.isOpera?230:215;NewsletterActions.setEcondaEventTarget("UnsubscribeConfirmation","0");NewsletterDialogRenderer.open("unsubscribesuccess",a,440,b)},openEditForm:function(a){NewsletterActions.DIALOG_CONTENT_HEIGHT=
"320";var b;dojo.isIE<7?b=395:dojo.isOpera?(NewsletterActions.DIALOG_CONTENT_HEIGHT="315",b=385):b=375;NewsletterActions.setEcondaEventTarget("DoubleOptIn","1");NewsletterDialogRenderer.open("edit",a,440,b)},openConfirmFailedForm:function(a){NewsletterActions.DIALOG_CONTENT_HEIGHT="185";var b;b=dojo.isIE<7?230:dojo.isOpera?245:230;NewsletterActions.setEcondaEventTarget("DoubleOptIn_UserNotFound","0");NewsletterDialogRenderer.open("confirm-failed",a,440,b)},openUpdateSuccessForm:function(){NewsletterActions.DIALOG_CONTENT_HEIGHT=
"130";var a;a=dojo.isOpera?185:175;NewsletterActions.setEcondaEventTarget("AdditionalData","0");NewsletterDialogRenderer.open("update-success",null,440,a)},loader:function(){var a=NewsletterActions.locationPathName.split("/"),a=a.slice(2,5),b=null,c=null,d=null;a[0]&&(b=a[0]);a[1]&&(c=a[1]);a[2]&&(d=a[2]);if(b==NewsletterActions.LANG_NEWSLETTER_URL&&!swoodoo.Location.issetParam(NewsletterActions.LANG_NEWSLETTER_REGISTER_URL_PARAM))switch(c){case NewsletterActions.LANG_NEWSLETTER_SUBSCRIBE_URL:NewsletterActions.confirmMember(d);
break;case NewsletterActions.LANG_NEWSLETTER_UNSUBSCRIBE_URL:a=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,"$1/ns/confirmkey/")+d,dojo.xhrGet({url:a,preventCache:!0,handleAs:"json",load:function(a){switch(a.status){case "OK":NewsletterActions.openUnsubscribeForm(d);break;default:NewsletterActions.openUnsubscribefailedForm(d)}},error:function(){NewsletterActions.openUnsubscribefailedForm(d)}})}else swoodoo.Location.getParam(NewsletterActions.LANG_NEWSLETTER_REGISTER_URL_PARAM)==
NewsletterActions.LANG_NEWSLETTER_REGISTER_URL_VALUE&&NewsletterActions.openSignupForm()},createNewsletterMember:function(){var a=dojo.byId("newsletter_email"),b=dojo.byId("newsletter_register"),c=dojo.byId("system-message-line"),d=dojo.byId("newsletter-dialog-form-line"),e=dojo.byId("newsletter-dialog-info"),f=dojo.byId("newsletter-register-email-label"),g=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,"$1/ns/create/")+a.value+"/"+NewsletterActions.extUserParams,h=dojo.byId("dijitDialogPaneContent"),
j=dojo.byId("newsletter-dialog-content"),k=dojo.byId("newsletter-dialog-title-img"),l=dojo.byId("newsletter-dialog");c.innerHTML=NewsletterActions.LOADER_IMAGE+NewsletterActions.LANG_NEWSLETTER_SYSTEM_MESSAGE_SIGNUP_IN_PROCESS;b.setAttribute("disabled",!0);a.setAttribute("disabled",!0);dojo.xhrGet({url:g,preventCache:!0,handleAs:"json",load:function(g){var p=g.messages,o=g.messages2;switch(g.status){case "OK":d.innerHTML=NewsletterActions.LANG_NEWSLETTER_WELCOME+" <strong>"+a.value+"</strong>";c.innerHTML=
NewsletterActions.WHITE_CHECKBOX_IMAGE+'<div class="newsletter-message-success-1">'+p+'</div><div class="newsletter-message-success-2">'+o+"</div>";e.innerHTML="";f.innerHTML="";p=k.src;p=p.substring(0,p.lastIndexOf("/")+1);k.src=p+"bestellung-erfolgreich.gif";k.alt=g.titleAlt;dojo.isIE<7?(dojo.query(".bg_e,.bg_w",l).style({height:"272px"}),j.style.height="200px",l.style.height="272px",h.style.height="272px"):(dojo.isOpera&&dojo.query(".bg_e,.bg_w",l).style({height:"252px"}),j.style.height="210px",
l.style.height="252px",h.style.height="252px");NewsletterActions.setEcondaEventTarget("Confirmation","0");NewsletterActions.trackEcondaEvent();break;default:c.innerHTML=NewsletterActions.ERROR_IMAGE+p}b.removeAttribute("disabled");a.removeAttribute("disabled")},error:function(){c.innerHTML=NewsletterActions.ERROR_IMAGE+NewsletterActions.LANG_MEMBER_REGISTRATION_FAILED;b.removeAttribute("disabled");a.removeAttribute("disabled")}});return!1},confirmMember:function(a){var b=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,
"$1/ns/confirm/")+a;dojo.xhrGet({url:b,preventCache:!0,handleAs:"json",load:function(b){var d=b.messages;switch(b.status){case "OK":return NewsletterActions.openEditForm(a),"OK";default:return NewsletterActions.MEMBER_CONFIRM_ERROR=d,NewsletterActions.openConfirmFailedForm(a),b}},error:function(b){NewsletterActions.MEMBER_CONFIRM_ERROR=NewsletterActions.LANG_DATA_SEND_FAILED;NewsletterActions.openConfirmFailedForm(a);return b}});return!1},updateNewsletterMember:function(a){a.preventDefault?a.preventDefault():
a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;var b=dojo.byId("system-message-line"),a=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,"$1/ns/update");dojo.xhrPost({url:a,preventCache:!0,handleAs:"json",load:function(a){var d=a.messages;switch(a.status){case "OK":return NewsletterDialogRenderer.hide(),NewsletterActions.openUpdateSuccessForm(),!1;default:return b.className="edit-system-message-line font-red",b.innerHTML=d,!1}},error:function(){b.className=
"edit-system-message-line font-red";b.innerHTML=NewsletterActions.LANG_DATA_SEND_FAILED;return!1},form:"editNewsletterMember"})},unsubscribeNewsletterMember:function(a,b){a.preventDefault?a.preventDefault():a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;dojo.byId("system-message-line");var c=NewsletterDialogRenderer.locationPathName.replace(/^(\/\w{2})\/.*$/,"$1/ns/unsubscribe-confirm");dojo.xhrPost({url:c,preventCache:!0,handleAs:"json",load:function(a){switch(a.status){case "OK":return NewsletterDialogRenderer.hide(),
NewsletterActions.openUnsubscribesuccessForm(b),"OK";default:NewsletterDialogRenderer.hide(),NewsletterActions.openUnsubscribefailedForm(b)}},error:function(){NewsletterDialogRenderer.hide();NewsletterActions.openUnsubscribefailedForm(b);return!1},form:"unsubscribeNewsletterMember"})},changeDialogInfoContent:function(){if(NewsletterActions.MEMBER_CONFIRM_ERROR)dojo.byId("newsletter-dialog-info").innerHTML=NewsletterActions.MEMBER_CONFIRM_ERROR;if(NewsletterActions.DIALOG_CONTENT_HEIGHT)dojo.byId("newsletter-dialog-content").style.height=
NewsletterActions.DIALOG_CONTENT_HEIGHT+"px"},changeInputBox:function(a,b){if(a.value==b)a.value="";dojo.addClass(a,"colorBlack")}});dojo.require("swoodoo.Location");dojo.require("swoodoo.widgets.Dialog");dojo.require("swoodoo.ie");dojo.require("swoodoo.scripts");dojo.declare("DeeplinksDialogRenderer");
dojo.mixin(DeeplinksDialogRenderer,{id:"deeplink-dialog",dialog:null,partner:null,action:null,defaultResponse:!0,econdaTrackingEnabled:!1,loadingMessage:'<div class="dijitContentPaneLoading"><div class="hotel-dialog-image"><img src="'+imagesPath+'newsletter/dialog_loader.gif" style="margin-bottom: 4px" /></div></div>',open:function(a,b,c,d){c||(c="580");d||(d="420");DeeplinksDialogRenderer.action=b?b:"result";DeeplinksDialogRenderer.partner=DeeplinksDialogRenderer.getPartnerName(a);DeeplinksDialogRenderer.show(c,
d);DeeplinksDialogRenderer.trackLoadEvent();return DeeplinksDialogRenderer.defaultResponse},show:function(a,b){var c=DeeplinksDialogRenderer.getUrl();if(c){var d=DeeplinksDialogRenderer.dialog;if(d)d.hide(),d.destroy(),d=DeeplinksDialogRenderer.dialog=null;if(swoodoo.ie.isReady())return d=DeeplinksDialogRenderer.dialog=new swoodoo.widgets.Dialog({href:c,loadingMessage:DeeplinksDialogRenderer.loadingMessage,style:"width: "+a+"px; height: "+b+"px"},dojo.create("div",{id:DeeplinksDialogRenderer.id},
dojo.body(),"last")),d.startup(),dojo.connect(d,"onShow",function(){dojo.connect(dijit._underlay,"onClick",function(){d.hide()});dojo.connect(d,"onDownloadEnd",function(){swoodoo.scripts.eval(dojo.byId(DeeplinksDialogRenderer.id))})}),dojo.connect(d,"onCancel",function(){DeeplinksDialogRenderer.trackEvent(DeeplinksDialogRenderer.trackEvent.CANCEL)}),dojo.connect(d,"hide",function(){DeeplinksDialogRenderer.close()}),d.show(),d;else swoodoo.ie.onReady(function(){DeeplinksDialogRenderer.show()})}},hide:function(){var a=
DeeplinksDialogRenderer.dialog;if(a)a.hide(),a.destroy(),DeeplinksDialogRenderer.dialog=null},close:function(){DeeplinksDialogRenderer.action=null;return!1},isHotelSearch:function(){return DeeplinksDialogRenderer.action=="hotel"},getTrackEventName:function(a){var b={1:"Cancel",2:"Hotelsearch",3:"Flightsearch",4:"Newsletter"};return a==DeeplinksDialogRenderer.trackEvent.RETURN_TO_SAME_SEARCH?DeeplinksDialogRenderer.isHotelSearch()?b[2]:b[3]:a==DeeplinksDialogRenderer.trackEvent.SEARCH_DIFFERENT_TYPE?
DeeplinksDialogRenderer.isHotelSearch()?b[3]:b[2]:b[a]},trackEvent:function(a){if(DeeplinksDialogRenderer.econdaTrackingEnabled&&EcondaTracker){var b=DeeplinksDialogRenderer.isHotelSearch()?"Hotels":"Flights";window.emosTargetEvent("AfterClick_"+b,DeeplinksDialogRenderer.getTrackEventName(a),0,"d")}},trackLoadEvent:function(){if(DeeplinksDialogRenderer.econdaTrackingEnabled&&EcondaTracker){var a={};a.siteid=typeof CURRENT_ECONDA_SITE_ID=="undefined"?"swoodoo":CURRENT_ECONDA_SITE_ID;a.carea=DeeplinksDialogRenderer.isHotelSearch()?
"hotels":"flug";a.content=DeeplinksDialogRenderer.isHotelSearch()?"afterclick/hotels":"afterclick/flights";var b=DeeplinksDialogRenderer.isHotelSearch()?"Hotels":"Flights";a.Target=[["AfterClick_"+b,"PopUp",0,"d"]];a.pageId=a.content;EcondaTracker.trackEvent(a)}},getYMDDateFromDMY:function(a){a=a.split(".");return a[2]+"-"+a[1]+"-"+a[0]},getUrl:function(){var a=window.location.pathname.replace(/^(\/\w{2})\/.*$/,"$1/"+DeeplinksDialogRenderer.action+"/overlay");switch(DeeplinksDialogRenderer.action){case "result":var b=
dojo.byId("dep_hidden").value.split("|"),c=dojo.byId("dst_hidden").value.split("|"),d=DeeplinksDialogRenderer.getYMDDateFromDMY(dojo.byId("DEPD").value),e=!dojo.byId("oneway").checked?DeeplinksDialogRenderer.getYMDDateFromDMY(dojo.byId("RETD").value):0;return a+"/"+b[1]+"-"+b[2]+"/"+c[1]+"-"+c[2]+"/"+d+"/"+e;case "hotel":return b=dojo.byId("hidden_location").value.split("|"),d=DeeplinksDialogRenderer.getYMDDateFromDMY(dojo.byId("STARTD").value),e=DeeplinksDialogRenderer.getYMDDateFromDMY(dojo.byId("ENDD").value),
a+"/"+b[1]+"/"+d+"/"+e}return""},createNewsletterMember:function(){var a=dojo.byId("dl_overlay_ns_inp"),b=dojo.byId("dl_overlay_ns_btn"),c=dojo.byId("dl_overlay_ns_message"),d=window.location.pathname.replace(/^(\/\w{2})\/.*$/,"$1/ns/create/")+a.value+"/"+DeeplinksDialogRenderer.extUserParams;c.innerHTML='<div class="dl_overlay_ns_loading_wrp"><div class="dl_overlay_ns_loading"><img src="'+imagesPath+'deeplink_overlay/indicator.gif" style="margin-bottom: 4px" /></div>&nbsp;</div>';b.setAttribute("disabled",
!0);a.setAttribute("disabled",!0);dojo.xhrGet({url:d,preventCache:!0,handleAs:"json",load:function(d){var f=d.messages;switch(d.status){case "OK":dojo.removeClass(c,"dl_overlay_message_err");dojo.addClass(c,"dl_overlay_message_success");c.innerHTML=f;break;default:dojo.removeClass(c,"dl_overlay_message_success"),dojo.addClass(c,"dl_overlay_message_err"),c.innerHTML=f}b.removeAttribute("disabled");a.removeAttribute("disabled")},error:function(){dojo.removeClass(c,"dl_overlay_message_success");dojo.addClass(c,
"dl_overlay_message_err");c.innerHTML=translate("LANG_MEMBER_REGISTRATION_FAILED");b.removeAttribute("disabled");a.removeAttribute("disabled")}});return!1},getPartnerName:function(a){switch(DeeplinksDialogRenderer.action){case "result":return dojo.hasClass(a.parentNode,"price-fix-link")&&(a=dojo.query("div:nth-child(4) > table div:first-child > a:first-child",a.parentNode.parentNode.parentNode.parentNode).shift()),a.innerHTML.replace(/^(?:(.+?):\s\d+\s.+|(.+?)\sFlug\s\+\sHotel\s\(bis\s-30%\))$/,"$1$2");
case "hotel":if(dojo.hasClass(a.parentNode,"price-fix-link")||dojo.hasClass(a,"hotel-best-price-offerer"))a=dojo.query(".hotel-alternatives > div:first-child > div:first-child > a",a.parentNode.parentNode.parentNode.parentNode).shift();return a.innerHTML.replace(/^(.+?)\s\d+\s.$/,"$1")}return""}});DeeplinksDialogRenderer.trackEvent.CANCEL=1;DeeplinksDialogRenderer.trackEvent.RETURN_TO_SAME_SEARCH=2;DeeplinksDialogRenderer.trackEvent.SEARCH_DIFFERENT_TYPE=3;
DeeplinksDialogRenderer.trackEvent.NEWSLETTER=4;
(function(a,b){function c(b){function c(b){var b=a(b),d=b.prop("defaultValue"),h=b.val();d!=h&&(b.is(":focus")?b.blur():b.prop("defaultValue",h).change())}var b=b||{},d=b.onSelect;b.onSelect=function(a,b){c(this,"onSelect");d&&d.call(this,a,b)};var e=b.onClose;b.onClose=function(a,b){c(this,"onClose");e&&e.call(this,a,b)};return b}function d(b){b.delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td","mouseout",function(){a(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=
-1&&a(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&a(this).removeClass("ui-datepicker-next-hover")});b.delegate("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td","mouseover",function(){if(!g._isDisabledDatepicker(f.inline?b.parent()[0]:f.input[0]))a(this).parents(".ui-datepicker-slider").find("td").removeClass("ui-state-hover"),a(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&a(this).addClass("ui-datepicker-prev-hover"),
this.className.indexOf("ui-datepicker-next")!=-1&&a(this).addClass("ui-datepicker-next-hover")});return b}var e=(new Date).getTime(),f;_fancydatepicker=a.Class({_firstDay:null,calendarWidth:180,drawDefaultHeader:!1,drawFancyHeader:!0,duration:150,easing:"easeOutQuart",slideAnimationSpeed:300,slideAnimationEasing:"easeInOutQuart",heightChangeAnimationSpeed:150,heightChangeAnimationEasing:"easeInOutQuart",changeInProgress:!1,placement:"below center",init:function(b){a.extend(this,b);this._defaults=
a.extend(this._defaults,{drawDefaultHeader:this.drawDefaultHeader,drawFancyHeader:this.drawFancyHeader,calendarWidth:this.calendarWidth,duration:this.duration,easing:this.easing,slideAnimationSpeed:this.slideAnimationSpeed,slideAnimationEasing:this.slideAnimationEasing,heightChangeAnimationSpeed:this.heightChangeAnimationSpeed,heightChangeAnimationEasing:this.heightChangeAnimationEasing,changeInProgress:this.changeInProgress,placement:this.placement,monthNamesShort:[translate("LANG_DATE_FORMAT_MONTH_1"),
translate("LANG_DATE_FORMAT_MONTH_2"),translate("LANG_DATE_FORMAT_MONTH_3"),translate("LANG_DATE_FORMAT_MONTH_4"),translate("LANG_DATE_FORMAT_MONTH_5"),translate("LANG_DATE_FORMAT_MONTH_6"),translate("LANG_DATE_FORMAT_MONTH_7"),translate("LANG_DATE_FORMAT_MONTH_8"),translate("LANG_DATE_FORMAT_MONTH_9"),translate("LANG_DATE_FORMAT_MONTH_10"),translate("LANG_DATE_FORMAT_MONTH_11"),translate("LANG_DATE_FORMAT_MONTH_12")],monthNames:[translate("LANG_DATE_FORMAT_FULL_MONTH_1"),translate("LANG_DATE_FORMAT_FULL_MONTH_2"),
translate("LANG_DATE_FORMAT_FULL_MONTH_3"),translate("LANG_DATE_FORMAT_FULL_MONTH_4"),translate("LANG_DATE_FORMAT_FULL_MONTH_5"),translate("LANG_DATE_FORMAT_FULL_MONTH_6"),translate("LANG_DATE_FORMAT_FULL_MONTH_7"),translate("LANG_DATE_FORMAT_FULL_MONTH_8"),translate("LANG_DATE_FORMAT_FULL_MONTH_9"),translate("LANG_DATE_FORMAT_FULL_MONTH_10"),translate("LANG_DATE_FORMAT_FULL_MONTH_11"),translate("LANG_DATE_FORMAT_FULL_MONTH_12")],dayNamesShort:[translate("LANG_DATE_FORMAT_WEEKDAY_7"),translate("LANG_DATE_FORMAT_WEEKDAY_1"),
translate("LANG_DATE_FORMAT_WEEKDAY_2"),translate("LANG_DATE_FORMAT_WEEKDAY_3"),translate("LANG_DATE_FORMAT_WEEKDAY_4"),translate("LANG_DATE_FORMAT_WEEKDAY_5"),translate("LANG_DATE_FORMAT_WEEKDAY_6")],dayNamesMin:[translate("LANG_DATE_FORMAT_WEEKDAY_7"),translate("LANG_DATE_FORMAT_WEEKDAY_1"),translate("LANG_DATE_FORMAT_WEEKDAY_2"),translate("LANG_DATE_FORMAT_WEEKDAY_3"),translate("LANG_DATE_FORMAT_WEEKDAY_4"),translate("LANG_DATE_FORMAT_WEEKDAY_5"),translate("LANG_DATE_FORMAT_WEEKDAY_6")],weekHeader:translate("LANG_DATE_FORMAT_WEEKDAY_HEADLINE")})}});
var g=new _fancydatepicker(a.datepicker);g.addMethods({initialized:!1,uuid:(new Date).getTime(),version:"1.0.0/1.8.13",dpDiv:d(a('<div id="'+g._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-slider"></div></div>')),extendRemove:function(c,d){a.extend(c,d);for(var e in d)if(d[e]==null||d[e]==b)c[e]=d[e];return c},_generateHTML:function(b){this._preformatInstance(b);for(var c=this._getNumberOfMonths(b),d=a("<div></div>"),e=0;e<
c[0];e++)for(var f=0;f<c[1];f++)d.append(this._generateSingleCalendarHtml(b,e,f));(c=this._renderButtonPanel(b))&&c.appendTo(d);a.browser.msie&&parseInt(a.browser.version,10)<7&&!b.inline&&b.dpDiv.find("iframe").length===0&&a("<iframe></iframe>").attr("src","javascript:false;").attr("frameborder","0").addClass("ui-datepicker-cover").appendTo(b.dpDiv);b._keyEvent=!1;return d.html()},_attachments:function(b,c){var d=this,e=this._get(c,"appendText"),f=this._get(c,"isRTL");c.append&&c.append.remove();
if(e)c.append=a('<span class="'+this._appendClass+'">'+e+"</span>"),b[f?"before":"after"](c.append);b.unbind("focus",this._showDatepicker);c.trigger&&c.trigger.remove();e=this._get(c,"showOn");(e=="focus"||e=="both")&&b.focus(function(a){d._showDatepicker(a)});if(e=="button"||e=="both"){var e=this._get(c,"buttonText"),g=this._get(c,"buttonImage"),e=this._get(c,"buttonImageOnly")?a("<img/>").addClass(this._triggerClass).attr({src:g,alt:e,title:e}):a('<button type="button"></button>').addClass(this._triggerClass).html(g==
""?e:a("<img/>").attr({src:g,alt:e,title:e}));c.trigger=a(e);b[f?"before":"after"](c.trigger);c.trigger.click(function(){d._datepickerShowing&&d._lastInput==b[0]?d._hideDatepicker():d._showDatepicker(b[0]);return!1})}},_showDatepicker:function(b){var c=this,b=b.target||b;b.nodeName.toLowerCase()!="input"&&(b=a("input",b.parentNode)[0]);if(!(this._isDisabledDatepicker(b)||this._lastInput==b)){var d=this._getInst(b);this._curInst&&this._curInst!=d&&this._curInst.dpDiv.stop(!0,!0);var e=this._get(d,
"beforeShow");this.extendRemove(d.settings,e?e.apply(b,[b,d]):{});d.lastVal=null;this._lastInput=b;this._setDateFromField(d);if(this._inDialog)b.value="";if(!this._pos)this._pos=this._findPos(b),this._pos[1]+=b.offsetHeight;var f=!1;a(b).parents().each(function(){f|=a(this).css("position")=="fixed";return!f});f&&a.browser.opera&&(this._pos[0]-=document.documentElement.scrollLeft,this._pos[1]-=document.documentElement.scrollTop);e={left:this._pos[0],top:this._pos[1]};this._pos=null;d.dpDivCont.empty();
d.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});this._updateDatepicker(d);e=this._checkOffset(d,e,f);d.dpDiv.css({position:this._inDialog&&a.blockUI?"static":f?"fixed":"absolute",display:"none",left:e.left+"px",top:e.top+"px"});if(!d.inline){var e=this._get(d,"showAnim"),g=this._get(d,"duration"),o=this._get(d,"easing"),n=function(){var a=d.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var b=c._getBorders(d.dpDiv);a.css({left:-b[0],top:-b[1],width:d.dpDiv.outerWidth(),height:d.dpDiv.outerHeight()})}};
d.dpDiv.zIndex(a(b).zIndex()+1);this._datepickerShowing=!0;if(a.effects&&a.effects[e])d.dpDiv.show(e,this._get(d,"showOptions"),g,o,n);else d.dpDiv[e||"show"]({duration:e?g:null,easing:e?o:null,complete:n});(!e||!g)&&n();d.input.is(":visible")&&!d.input.is(":disabled")&&d.input.focus();this._curInst=d}}},_singleCalendarRow:function(b,c,d){var f=this._get(b,"beforeShowDay"),g=this._get(b,"selectOtherMonths"),p=this._getMinMaxDate(b,"min"),o=this._getMinMaxDate(b,"max"),n=this._get(b,"showOtherMonths");
this._get(b,"monthNamesShort");this._get(b,"dayNamesShort");for(var q=this._getDefaultDate(b),r=this._daylightSavingAdjust(new Date(b.drawYear,b.drawMonth,b.selectedDay)),t=this._daylightSavingAdjust(!b.currentDay?new Date(9999,9,9):new Date(b.currentYear,b.currentMonth,b.currentDay)),u=new Date,u=this._daylightSavingAdjust(new Date(u.getFullYear(),u.getMonth(),u.getDate())),v=0;v<7;v++){var x=f?f.apply(b.input?b.input[0]:null,[d]):[!0,""],w=d.getMonth()!=b._drawMonth,y=w&&!g||!x[0]||p&&d<p||o&&d>
o,s=a("<td></td>");s.addClass(this._getWeekendClass(b,v)).addClass(this._getOtherMonthClass(w)).addClass(this._getOverDayClass(b,d,r,q));w&&!n?s.append("&#xa0;"):(s.addClass(x[1]),s.addClass(d.getTime()==t.getTime()?this._currentClass:""),s.addClass(d.getTime()==u.getTime()?"ui-datepicker-today":""),y?a("<span></span>").html(d.getDate()).appendTo(s):(s.addClass("ui-state-default").addClass(d.getTime()==u.getTime()?"ui-state-highlight":"").addClass(d.getTime()==t.getTime()?"ui-state-active":""),a("<a></a>").addClass(w?
"ui-priority-secondary":"").html(d.getDate()).appendTo(s)));(!w||n)&&x[2]&&s.attr("title",x[2]);y?(s.addClass(this._unselectableClass),s.addClass("ui-state-disabled")):s.attr("onclick","FDP_jQuery_"+e+"._selectDay('#"+b.id+"',"+d.getMonth()+","+d.getFullYear()+", this); return false;");s.appendTo(c);d.setDate(d.getDate()+1);d=this._daylightSavingAdjust(d)}},_addWeekCell:function(b,c,d){this._get(b,"showWeek")&&a("<td></td>").addClass("ui-datepicker-week-col").html(this._get(b,"calculateWeek")(d)).appendTo(c)},
_getWeekendClass:function(a,b){return(b+this._getFirstDay(a)+6)%7>=5?"ui-datepicker-week-end":""},_getOtherMonthClass:function(a){return a?"ui-datepicker-other-month":""},_getOverDayClass:function(a,b,c,d){return b.getTime()==c.getTime()&&a.drawMonth==a.selectedMonth&&a._keyEvent||d.getTime()==b.getTime()&&d.getTime()==c.getTime()?this._dayOverClass:""},_preformatInstance:function(a){this._adjustDrawDates(a)},_adjustDrawDates:function(a){var b=this._get(a,"showCurrentAtPos"),b=a.drawMonth-b,c=a.drawYear;
b<0&&(b+=12,c--);var d=this._getMinMaxDate(a,"min"),e=this._getMinMaxDate(a,"max"),f=this._getNumberOfMonths(a),f=f[0]*f[1];if(e){e=this._daylightSavingAdjust(new Date(e.getFullYear(),e.getMonth()+1-f,(new Date(e.getFullYear(),e.getMonth()+2-f,0)).getDate()));for(e=d&&e<d?d:e;this._daylightSavingAdjust(new Date(c,b,1))>e;)b--,b<0&&(b=11,c--)}a.drawMonth=a._drawMonth=b;a.drawYear=a._drawYear=c},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),c=this._daylightSavingAdjust(new Date(c,
d+(b<0?b:e[0]*e[1]-1),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_getFirstDay:function(a){if(isNaN(a._firstDay))a._firstDay=parseInt(this._get(a,"firstDay"),10),a._firstDay=a._firstDay?a._firstDay:0;return a._firstDay},_getLeadDays:function(a){return(this._getFirstDayOfMonth(a._drawYear,a._drawMonth)-this._getFirstDay(a)+7)%7},_renderDefaultTableHeader:function(b,c){var d=a("<tr></tr>"),e=this._get(b,"dayNames"),f=this._get(b,"dayNamesMin");
if(this._get(b,"showWeek"))var g=a("<th></th>").addClass("ui-datepicker-week-col").html(this._get(b,"weekHeader")).appendTo(d);var o=this._getFirstDay(b),n=-1;b._drawYear==b.currentYear&&b._drawMonth==b.currentMonth&&(n=this._daylightSavingAdjust(new Date(b.currentYear,b.currentMonth,b.currentDay)).getDay());for(var q=0;q<7;q++){var r=(q+o)%7,g=a("<th></th>");(q+o+6)%7>=5&&g.addClass("ui-datepicker-week-end");q+o==n&&g.addClass("ui-datepicker-selected-day");a("<span></span>").attr("title",e[r]).html(f[r]).appendTo(g);
g.appendTo(d)}e=a("<thead></thead>");d.appendTo(e);e.appendTo(c)},_renderDefaultHeader:function(b,c,d,e){var f=this._get(b,"isRTL"),g="";/all|left/.test(c)&&d==0&&(g+=(f?this._renderNextMonthButton(b):this._renderPreviousMonthButton(b))||"");/all|right/.test(c)&&d==0&&(g+=(f?this._renderPreviousMonthButton(b):this._renderNextMonthButton(b))||"");d=this._generateMonthYearHeader(b,b._drawMonth,b._drawYear,this._getMinMaxDate(b,"min"),this._getMinMaxDate(b,"max"),d>0||e>0,this._get(b,"monthNames"),this._get(b,
"monthNamesShort"));b._drawYear==b._drawYear&&b._drawMonth==b.currentMonth&&(d='<div class="ui-datepicker-title ui-datepicker-month-selected">'+a(d).html()+"</div>");g+=d;return a("<div></div>").addClass("ui-datepicker-header ui-widget-header ui-helper-clearfix").addClass(c).html(g)},_generateFancyHeader:function(b){for(var c=a('<div class="ui-fancydatepicker-header"></div>'),d=this._get(b,"minDate"),f=this._get(b,"maxDate"),g=this._get(b,"monthNamesShort"),d=new Date(d.getFullYear(),d.getMonth(),
d.getDate());d<f;){var p=a("<a></a>").append(g[d.getMonth()]);b.drawYear==d.getFullYear()&&b.drawMonth==d.getMonth()?p.append(" ‘"+d.getFullYear().toString().substr(2)).addClass("ui-fancydatepicker-header-active"):p.attr("onclick","FDP_jQuery_"+e+".changeMonth('#"+b.id+"', '"+d.getFullYear()+"', '"+d.getMonth()+"');");p.appendTo(c);d.setMonth(d.getMonth()+1)}return a("<div></div>").append(c).html()},_getControlButtons:function(b){return!b.inline?a("<button></button>").attr("type","button").attr("onclick",
"FDP_jQuery_"+e+"._hideDatepicker();").addClass("ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all").html(this._get(b,"closeText")):null},_renderButtonPanel:function(b){if(this._get(b,"showButtonPanel")){var c=new Date,c=this._daylightSavingAdjust(new Date(c.getFullYear(),c.getMonth(),c.getDate())),d=this._getControlButtons(b),f=this._daylightSavingAdjust(!b.currentDay?new Date(9999,9,9):new Date(b.currentYear,b.currentMonth,b.currentDay)),c=this._get(b,"gotoCurrent")&&b.currentDay?
f:c,f=a("<div></div>").addClass("ui-datepicker-buttonpane ui-widget-content");this._isInRange(b,c)&&a("<button></button>").attr("type","button").addClass("ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all").html();var g=this._get(b,"currentText");this._get(b,"navigationAsDateFormat")&&(g=this.formatDate(g,c,this._getFormatConfig(b)));this._isInRange(b,c)&&a("<button></button>").addClass("ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all").attr("type",
"button").attr("onclick","FDP_jQuery_"+e+"._gotoToday('#"+b.id+"');").html(g).appendTo(f);d&&(this._get(b,"isRTL")?d.prependTo(f):d.appendTo(f));return f}return null},_renderPreviousMonthButton:function(a){var b=this._get(a,"monthNames"),b=(a.drawMonth?b[a.drawMonth-1]:b[11])+" / "+b[a.drawMonth];if(this._get(a,"navigationAsDateFormat"))var c=this._get(a,"stepMonths"),b=this.formatDate(b,this._daylightSavingAdjust(new Date(a._drawYear,a._drawMonth-c,1)),this._getFormatConfig(a));return this._renderPrevNextMonthButton(a,
b,-1,this._get(a,"isRTL")?"e":"w","prev")},_renderNextMonthButton:function(a){var b=this._get(a,"monthNames"),c=null,d=null;switch(a.drawMonth+2){case 12:c=b[a.drawMonth+1];d=b[0];break;case 13:c=b[0];d=b[1];break;default:c=b[a.drawMonth+1],d=b[a.drawMonth+2]}b=c+" / "+d;this._get(a,"navigationAsDateFormat")&&(c=this._get(a,"stepMonths"),b=this.formatDate(b,this._daylightSavingAdjust(new Date(a._drawYear,a._drawMonth+c,1)),this._getFormatConfig(a)));return this._renderPrevNextMonthButton(a,b,1,this._get(a,
"isRTL")?"w":"e","next")},_renderPrevNextMonthButton:function(b,c,d,f,g){if(this._canAdjustMonth(b,d,b._drawYear,b._drawMonth))return d=d==1?b._drawMonth:b._drawMonth-1,b=a("<a></a>").addClass("ui-datepicker-"+g+" ui-corner-all").attr("title",c).attr("onclick","FDP_jQuery_"+e+".changeMonth('#"+b.id+"', '"+b._drawYear+"', '"+d+"');"),a("<span></span>").addClass("ui-icon").addClass("ui-icon-circle-triangle-"+f).html(c).appendTo(b),a("<div></div>").append(b).html();return!this._get(b,"hideIfNoPrevNext")?
(b=a("<a></a>").addClass("ui-datepicker-"+g+" ui-corner-all ui-state-disabled").attr("title",c),a("<span></span>").addClass("ui-icon").addClass("ui-icon-circle-triangle-"+f).html(c).appendTo(b),a("<div></div>").append(b).html()):null},_updateDatepicker:function(a,c){f=a;c===b&&(c=!1);var d=this._getBorders(a.dpDiv),e=this._getNumberOfMonths(a),g=e[1],p=this._get(a,"calendarWidth")||this.calendarWidth,p=p*g+"px";c&&e[1]>1?this._handleMonthChange(a):(a.dpDivCont.empty(),a.dpDivCont.append(this._generateHTML(a)));
this._get(a,"drawFancyHeader")&&(a.dpDiv.find(".ui-fancydatepicker-header").remove(),a.dpDiv.prepend(this._generateFancyHeader(a)));var o=a.dpDiv.find("iframe.ui-datepicker-cover");o.length&&o.css({left:-d[0],top:-d[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});c||a.dpDiv.find("."+this._dayOverClass+" a").mouseover();a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");g>1&&(a.dpDiv.addClass("ui-datepicker-multi-"+g).css("width",p),a.dpDivCont.css("width",
a.dpDiv.width()*2+"px"));a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==this._curInst&&this._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var n=a.yearshtml;setTimeout(function(){n===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);n=a.yearshtml=
null},0)}a.dpDiv.height(a.dpDiv.height());this._animateContainerHeightChange(a)},_handleMonthChange:function(a){a.dpDiv.find(".ui-datepicker-group").addClass("ui-datepicker-group-old");a.dpDiv.find(".ui-datepicker-row-break").remove();a.placeToRight?this._handleNextMonthsChange(a):this._handlePrevMonthsChange(a)},_handleNextMonthsChange:function(a){a.dpDivCont.append(this._generateHTML(a));a.dpDivCont.css("left","0px");this._animateMonthChange(a,a.dpDivCont.width()/a.settings.numberOfMonths*-1)},
_handlePrevMonthsChange:function(a){a.dpDivCont.prepend(this._generateHTML(a));a.dpDivCont.css("left","-"+a.dpDivCont.width()/a.settings.numberOfMonths+"px");a.dpDivCont.find(".ui-datepicker-row-break").remove();a.dpDivCont.append('<div class="ui-datepicker-row-break"></div>');this._animateMonthChange(a,0)},_animateMonthChange:function(a,b){var c=this;a.dpDivCont.animate({left:b+"px"},{duration:c._get(a,"slideAnimationSpeed"),easing:c._get(a,"slideAnimationEasing"),complete:function(){a.dpDivCont.find(".ui-datepicker-group-old").remove();
a.dpDivCont.css({left:"0px"});c._animateContainerHeightChange(a)}})},_animateContainerHeightChange:function(a){var b=null;this._get(a,"drawFancyHeader")?(b=a.dpDiv.find(".ui-fancydatepicker-header"),b=a.dpDivCont.height()+parseInt(a.dpDivCont.css("padding-top"),10)+parseInt(a.dpDivCont.css("padding-bottom"),10)+parseInt(a.dpDivCont.css("margin-top"),10)+parseInt(a.dpDivCont.css("margin-top"),10)+b.height()+parseInt(b.css("padding-top"),10)+parseInt(b.css("padding-bottom"),10)+parseInt(b.css("margin-top"),
10)+parseInt(b.css("margin-top"),10)):b=a.dpDivCont.outerHeight();a.dpDiv.animate({height:b+"px"},{duration:this._get(a,"heightChangeAnimationSpeed"),easing:this._get(a,"heightChangeAnimationEasing"),complete:function(){a.settings.changeInProgress=!1}})},_newInst:function(b,c){var e=b[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),f=c?d(a('<div id="'+g._mainDivId+'" class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-slider"></div></div>')):
this.dpDiv;return{id:e,input:b,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:c,dpDiv:f,dpDivCont:f.children(".ui-datepicker-slider")}},changeMonth:function(b,c,d){var b=a(b),e=this._getInst(b.get(0));e.placeToRight=new Date(c,d,1)>new Date(e.drawYear,e.drawMonth,1);e.drawYear=parseInt(c,10);e.drawMonth=parseInt(d,10);this._notifyChange(e);this._changeMonthDateAdjust(b)},_changeMonthDateAdjust:function(b){var b=a(b),c=this._getInst(b[0]);if(!this._isDisabledDatepicker(b[0])&&
!c.settings.changeInProgress)this._adjustInstDate(c),c.settings.changeInProgress=!0,this._updateDatepicker(c,!0)},_generateSingleCalendarHtml:function(b,c,d){var e=this._get(b,"isRTL"),f=this._getNumberOfMonths(b),g=f[0]!=1||f[1]!=1,o=a("<div></div>"),n="ui-corner-all";if(g){var q=a("<div></div>").addClass("ui-datepicker-group");if(f[1]>1)switch(d){case 0:q.addClass("ui-datepicker-group-first");n="ui-corner-"+(e?"right":"left");break;case f[1]-1:q.addClass("ui-datepicker-group-last");n="ui-corner-"+
(e?"left":"right");break;default:q.addClass("ui-datepicker-group-middle"),n=""}}if(this._get(b,"drawDefaultHeader"))var r=this._renderDefaultHeader(b,n,c,d);c=a("<table></table>").addClass("ui-datepicker-calendar");this._renderDefaultTableHeader(b,c);n=this._getDaysInMonth(b._drawYear,b._drawMonth);if(b._drawYear==b.selectedYear&&b._drawMonth==b.selectedMonth)b.selectedDay=Math.min(b.selectedDay,n);for(var e=a("<tbody></tbody>"),n=Math.ceil((this._getLeadDays(b)+n)/7),t=this._daylightSavingAdjust(new Date(b._drawYear,
b._drawMonth,1-this._getLeadDays(b))),u=0;u<n;u++){var v=a("<tr></tr>");this._addWeekCell(b,v,t);this._singleCalendarRow(b,v,t);v.appendTo(e)}b._drawMonth++;if(b._drawMonth>11)b._drawMonth=0,b._drawYear++;e.appendTo(c);if(g)return r&&r.appendTo(q),c.appendTo(q),q.appendTo(o),f[0]>0&&d==f[1]-1&&a("<div></div>").addClass("ui-datepicker-row-break").appendTo(o),o.html();r&&r.appendTo(o);c.appendTo(o);return o.html()},_checkExternalClick:function(b){g._curInst&&(b=a(b.target),b[0].id!=g._mainDivId&&b.parents("#"+
g._mainDivId).length==0&&!b.hasClass(g.markerClassName)&&!b.hasClass(g._triggerClass)&&g._datepickerShowing&&(!g._inDialog||!a.blockUI)&&g._hideDatepicker())},_hideDatepicker:function(b){var c=this._curInst;if(c&&!(b&&c!=a.data(b,PROP_NAME))){var d=this;if(this._datepickerShowing){var b=this._get(c,"showAnim"),e=this._get(c,"duration"),f=this._get(c,"easing"),g=function(){d._tidyDialog(c);d._curInst=null};if(a.effects&&a.effects[b])c.dpDiv.hide(b,this._get(c,"showOptions"),e,g);else c.dpDiv[b=="slideDown"?
"slideUp":b=="fadeIn"?"fadeOut":"hide"]({duration:b?e:null,easing:b?f:null,complete:g});b||g();(b=this._get(c,"onClose"))&&b.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._datepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),a.blockUI&&(a.unblockUI(),a("body").append(this.dpDiv)));this._inDialog=!1}}},_doKeyDown:function(b){var c=g,d=c._getInst(b.target),e=a.ui.keyCode,f=d.dpDiv.is(".ui-datepicker-rtl"),p=
d._keyEvent=!0;if(c._datepickerShowing)switch(b.keyCode){case e.TAB:c._hideDatepicker();p=!1;break;case e.ENTER:case e.NUMPAD_ENTER:e=a("td."+c._dayOverClass+":not(."+c._currentClass+")",d.dpDiv);e[0]?c._selectDay(b.target,d.selectedMonth,d.selectedYear,e[0]):c._hideDatepicker();p=!0;break;case e.ESCAPE:c._hideDatepicker();break;case e.PAGE_UP:c._adjustDate(b.target,b.ctrlKey?-c._get(d,"stepBigMonths"):-c._get(d,"stepMonths"),"M");break;case e.PAGE_DOWN:c._adjustDate(b.target,b.ctrlKey?+c._get(d,
"stepBigMonths"):+c._get(d,"stepMonths"),"M");break;case e.END:(b.ctrlKey||b.metaKey)&&c._clearDate(b.target);p=b.ctrlKey||b.metaKey;break;case e.HOME:(b.ctrlKey||b.metaKey)&&c._gotoToday(b.target);p=b.ctrlKey||b.metaKey;break;case e.LEFT:if(b.ctrlKey||b.metaKey)c._adjustDate(b.target,f?1:-1,"D");p=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&c._adjustDate(b.target,b.ctrlKey?-c._get(d,"stepBigMonths"):-c._get(d,"stepMonths"),"M");break;case e.UP:(b.ctrlKey||b.metaKey)&&c._adjustDate(b.target,-7,"D");
p=b.ctrlKey||b.metaKey;break;case e.RIGHT:if(b.ctrlKey||b.metaKey)c._adjustDate(b.target,f?-1:1,"D");p=b.ctrlKey||b.metaKey;b.originalEvent.altKey&&c._adjustDate(b.target,b.ctrlKey?+c._get(d,"stepBigMonths"):+c._get(d,"stepMonths"),"M");break;case e.DOWN:(b.ctrlKey||b.metaKey)&&c._adjustDate(b.target,7,"D");p=b.ctrlKey||b.metaKey;break;default:p=!1}else b.keyCode==e.HOME&&b.ctrlKey?c._showDatepicker(this):p=!1;p&&(b.preventDefault(),b.stopPropagation())},_doKeyPress:function(a){var c=g,d=c._getInst(a.target);
if(c._get(d,"constrainInput"))return c=c._possibleChars(c._get(d,"dateFormat")),d=String.fromCharCode(a.charCode==b?a.keyCode:a.charCode),a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1},_doKeyUp:function(a){var b=g,a=b._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(b.parseDate(b._get(a,"dateFormat"),a.input?a.input.val():null,b._getFormatConfig(a)))b._setDateFromField(a),b._updateAlternate(a),b._updateDatepicker(a)}catch(c){b.log(c)}return!0},_checkOffset:function(b,c,d){var e=b.dpDiv.outerWidth(),
f=b.dpDiv.outerHeight();b.input&&b.input.outerWidth();var g=b.input?b.input.outerHeight():0,o=document.documentElement.clientWidth+a(document).scrollLeft(),n=document.documentElement.clientHeight+a(document).scrollTop(),q=0,r=b.dpDiv.css("box-shadow");if(r=r?r.match(/^rgba?\(.*?\)\s(\d+)px\s(\d+)px\s(\d+)px\s\d+px$/):null)q=parseInt(r[3],10)-parseInt(r[2],10),parseInt(r[3],10),parseInt(r[1],10);var r=this._get(b,"placement").split(" "),t;for(t in r)switch(r[t]){case "above":c.top-=b.dpDiv.height()+
b.input.height()+q;break;case "below":c.top+=Math.round(q/2);break;case "right":c.left-=b.dpDiv.width()-b.input.width();break;case "center":c.left-=Math.round((b.dpDiv.width()-b.input.width())/2)}c.left-=d&&c.left==b.input.offset().left?a(document).scrollLeft():0;c.top-=d&&c.top==b.input.offset().top+g?a(document).scrollTop():0;c.left-=Math.min(c.left,c.left+e>o&&o>e?Math.abs(c.left+e-o):0);c.top-=Math.min(c.top,c.top+f>n&&n>f?Math.abs(f+g):0);return c}});a.fn.fancydatepicker=function(b){if(!this.length)return this;
if(!g.initialized)a(document).mousedown(g._checkExternalClick).find("body").append(g.dpDiv),g.initialized=!0;var d=Array.prototype.slice.call(arguments,1);return typeof b=="string"&&b=="getInstance"?g:typeof b=="string"&&(b=="isDisabled"||b=="getDate"||b=="widget")?g["_"+b+"Datepicker"].apply(g,[this[0]].concat(d)):b=="option"&&arguments.length==2&&typeof arguments[1]=="string"?g["_"+b+"Datepicker"].apply(g,[this[0]].concat(d)):this.each(function(){typeof b=="string"?g["_"+b+"Datepicker"].apply(g,
[this].concat(d)):g._attachDatepicker(this,c(b))})};window["FDP_jQuery_"+e]=g})(jQuery);
var utils_box=$.Class({attachEllipsisAndTooltip:function(a,b){var a=$(a),c=a.filter(":first"),d=$.support.textOverflow?c.width():null,e=this;a.each(function(){var a=$(this),c=a.text();if($.support.textOverflow){if(e.getTextWidth(a)<d+1)return}else if(a.textOverflow(),!a.text().match(/…$/))return;$.fn.tipTip&&a.tipTip($.extend({},{delay:0,maxWidth:"auto",content:c,defaultPosition:"top"},b||{}))})},getTextWidth:function(a){var b=a.clone();b.css({width:"auto",display:"none"});b.appendTo(a.parent());
a=b.width();b.remove();return a},prototype:{}}),utils_type=$.Class({is_numeric:function(a){return!isNaN(a*1)},objectSize:function(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b},prototype:{}}),utils_node=$.Class({directText:function(a){return $(a).contents().filter(function(){return typeof Node=="undefined"?this.nodeType==3:this.nodeType==Node.TEXT_NODE}).text()},prototype:{}}),windowopener=$.Class({_top:self,options:{popUnder:!0,tileWindows:!0,heightRule:!1,minWidth:0,minHeight:0,screenWidth:1024,
screenHeight:768},init:function(a){if(top!=self)try{if(top.document.location.toString())this._top=top}catch(b){}if(a)this.options=$.extend({},this.options,a)},open:function(a,b,c){if(!a)return!0;a=this._getWindow(a,this._getWindowName(),b,c);if(!a)return!1;this._handleInitialWindowFocus(a);this._preparePopUpWindow(a);a.init&&a.init(a);return!0},_getWindow:function(a,b,c,d){try{return this._top.window.open(a,b,"toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,top="+this._getWindowTop()+
",left="+this._getWindowLeft(c,d)+",width="+this._getWindowWidth(c,d)+",height="+this._getWindowHeight())}catch(e){return!1}},_getWindowWidth:function(a,b){if(this.options.tileWindows)return Math.min(this.options.screenWidth,Math.floor(this._getScreenWidth()/b-10));var c=0;if(typeof this._top.window.innerWidth=="number")c=this._top.window.innerWidth;if(this._top.document.documentElement&&this._top.document.documentElement.clientWidth)c=this._top.document.documentElement.clientWidth;return this.options.minWidth?
this.options.minWidth>c?this.options.minWidth:c:c},_getWindowHeight:function(){if(this.options.heightRule)return Math.round(this._getScreenHeight()*0.6);if(this.options.tileWindows)return this._getScreenHeight();var a=0;if(typeof this._top.window.innerHeight=="number")a=this._top.window.innerHeight;if(this._top.document.documentElement&&this._top.document.documentElement.clientHeight)a=this._top.document.documentElement.clientHeight;return this.options.minHeight?this.options.minHeight>a?this.options.minHeight:
a:a},_getWindowTop:function(){return this.options.heightRule?Math.round(this._getScreenHeight()*0.4):this.options.tileWindows?0:this._top.window.screenTop!=void 0?this._top.window.screenTop:this._top.window.screenY},_getWindowLeft:function(a,b){return this.options.tileWindows?Math.floor(this._getWindowWidth(a,b)*a+10*a):this._top.window.screenLeft!=void 0?this._top.window.screenLeft:this._top.window.screenX},_getWindowName:function(){return"cucpopup"+Math.floor(89999999*Math.random()+1E7)},_handleInitialWindowFocus:function(a){this.options.popUnder&&
(a.blur(),navigator.userAgent.toLowerCase().indexOf("applewebkit")>-1&&(this._top.window.blur(),this._top.window.focus()))},_preparePopUpWindow:function(a){$.extend(a,{init:function(a){this._doMozillaMagic();try{a.opener.window.focus()}catch(c){}},_doMozillaMagic:function(){typeof window.mozPaintCount!="undefined"&&this.window.open("about:blank").close()}})},_getScreenWidth:function(){return window.screen.availWidth},_getScreenHeight:function(){return window.screen.availHeight?window.screen.availHeight:
this.options.screenHeight}}),periodicalupdater=$.Class({options:{url:"",cache:!0,type:"GET",data:{},dataType:"json",global:!1,ifModified:!1,frequency:1E3,maxTimeout:8E3,multiplier:2,maxCalls:0,autoStart:!1,autoStop:0},timer:null,timeout:null,callCount:0,noChangeCount:0,previousData:null,xhrHandle:null,init:function(a){if(a)this.options=$.extend({},this.options,a);this.options.autoStart&&this.start();this.timeout=this.options.frequency},error:function(){},success:function(){},start:function(){this.reset();
this.call()},stop:function(){this.reset()},reset:function(){if(this.timer!==null)clearTimeout(this.timer),this.timer=null;this.xhrHandle=null;this.resetCounters()},resetCounters:function(){this.timeout=this.options.frequency;this.noChangeCount=this.callCount=0;this.previousData=null},abort:function(){this.xhrHandle&&this.xhrHandle.abort();this.stop()},call:function(){this.options.maxCalls>0&&this.callCount>this.options.maxCalls?this.stop():(this.callCount++,this.xhrHandle=$.ajax(this._getSettings()))},
updateOptions:function(a){this.options=$.extend({},this.options,a);this.resetCounters()},resume:function(){if(this.xhrHandle){var a=this;this.timer=setTimeout(function(){a.call()},this.timeout)}},inProgress:function(){return this.xhrHandle||this.timer!==null?!0:!1},_success:function(a,b,c){if(this.previousData==c.responseText){this.noChangeCount++;if(this.options.autoStop==this.noChangeCount){this.stop();this.success(a,b,c);return}this._boostTimeout()}else this.noChangeCount=0;this.previousData=c.responseText;
this.success(a,b,c);this.resume()},_boostTimeout:function(){if(!(this.callCount<2||this.options.multiplier<1))if(this.timeout*=this.options.multiplier,this.options.maxTimeout&&this.timeout>this.options.maxTimeout)this.timeout=this.options.maxTimeout},_error:function(a,b,c){this.error(a,b,c)},_getSettings:function(){var a=this;return{url:this.options.url,cache:this.options.cache,type:this.options.type,data:this.options.data,dataType:this.options.dataType,global:this.options.global,ifModified:this.options.ifModified,
error:function(b,c,d){a._error(b,c,d)},success:function(b,c,d){a._success(b,c,d)}}}}),cmp2=$.Class({options:{searchTypeOneway:"O",searchTypeReturn:"R",searchTypeMulti:"M",searchTypeSelector:'.formSearchTypes input[name="searchType"]',searchButtonSelector:"#searchnow",cabinTypeSelector:"#cabinClass",oDepSelector:"#depInput-0",oDepHiddenSelector:"#hidden_depInput-0",oDstSelector:"#dstInput-0",oDstHiddenSelector:"#hidden_dstInput-0",oDepDateSelector:"#flightDate-0",oDepTimeSelector:"#flightTime-0",rDepSelector:"#depInput-0",
rDepHiddenSelector:"#hidden_depInput-0",rDstSelector:"#depInput-1",rDstHiddenSelector:"#hidden_depInput-1",rDepDateSelector:"#flightDate-0",rDepTimeSelector:"#flightTime-0",rRetDateSelector:"#flightDate-1",rRetTimeSelector:"#flightTime-1",nonstopSelector:"#onlyNonStop",adultsSelector:"#passengerCount",childrenSelector:"",infantsSelector:"",windowOpener:null,openInBackground:!0,containerSelector:"#compareToPlaceholder",checkboxSelector:"#compareToPlaceholder input[type=checkbox]",baseUrl:"",cmp2BaseUrl:"",
origin:"",extParams:"",cmp2Counts:"",cmp2Unchecks:"",cmp2Origin:"",openedCucs:[],econda:null,knCmp2:!1},_xhr:null,_requestParams:{searchType:null,dep:null,dst:null,depDate:null,retDate:null},init:function(a){this.options=$.extend({},this.options,a||[]);this.update();this.initLocationEvents()},initSearchTypeEvents:function(){this.hide();this.initLocationEvents();this.update()},initLocationEvents:function(){var a=this._getSearchType(),b="";if(a==this.options.searchTypeOneway)a=this.options.oDepSelector,
b=this.options.oDstSelector;else if(a==this.options.searchTypeReturn)a=this.options.rDepSelector,b=this.options.rDstSelector;else return;var c=this,d,e="";$(a).keydown(function(){d=$(this).val()});$(a).keyup(function(){d!=$(this).val()&&c.hide()});$(b).keydown(function(){e=$(this).val()});$(b).keyup(function(){e!=$(this).val()&&c.hide()})},getOpenedCucs:function(){return this.openedCucs},update:function(){var a=this._getCompareToUrl();if(a){this.abort();this.hide();var b=this;this._xhr=$.ajax({url:a,
type:"GET",dataType:"json",success:function(a){b.onUpdateSuccess(a);if(a.status==1&&a.html)$(b.options.containerSelector).html(a.html).show(),b._xhr=null,$(b.options.checkboxSelector).each(function(){$(this).change(function(){b._trackCmp2UserClicks(b.options.econda,this);b.saveUnchecks()})})},error:function(){b._xhr=null}})}},saveUnchecks:function(){var a=this,b=this.options.baseUrl+"/uncheck-cmp2?";$(this.options.checkboxSelector).each(function(){b+=this.checked?this.name+"&":"unchecked-"+this.name+
"&"});$.ajax({url:b,type:"GET",dataType:"json",success:function(b){a.options.cmp2Unchecks=b},error:function(){}})},handleDeeplinks:function(){var a=this._getWindowOpener(),b=!1;this.openedCucs=[];if(!a)return b;var c=0,d=this._getCheckedValues(),e=utils_type.objectSize(d),f=this;$.each(d,function(d,h){var j=f._getDeeplinkUrl(h);if(!j)return!0;j=a.open(j.substr(j.indexOf("/",15)),c,e);c++;j?f.openedCucs[d]=h:b=!0});return b},hide:function(){var a=$(this.options.containerSelector);a.length&&a.hide()},
isRequestInProgress:function(){return this._xhr!==null},abort:function(){return this.isRequestInProgress()?(this._xhr.abort(),!0):!1},_getCheckedValues:function(){var a=$(this.options.checkboxSelector).filter(":checked");if(!a.length)return[];var b={},c="";a.each(function(){c=$(this).attr("name");b[c]=$(this).val()});return b},onUpdateSuccess:function(){},_getCompareToUrl:function(){var a=this.options,b=this._getSearchType();if(b!=a.searchTypeOneway&&b!=a.searchTypeReturn)return!1;var c,d=[],e,f,
g,h;b==a.searchTypeOneway?(e=$(a.oDepSelector).val(),c=$(a.oDepHiddenSelector).val().split("|"),g=$(a.oDstSelector).val(),d=$(a.oDstHiddenSelector).val().split("|"),f=$(a.oDepDateSelector).val().split(".").reverse().join("-")):(e=$(a.rDepSelector).val(),c=$(a.rDepHiddenSelector).val().split("|"),g=$(a.rDstSelector).val(),d=$(a.rDstHiddenSelector).val().split("|"),f=$(a.rDepDateSelector).val().split(".").reverse().join("-"),h=$(a.rRetDateSelector).val().split(".").reverse().join("-"));var j={searchType:b,
dep:e,dst:g,depDate:f,retDate:h},k=!1,l=this;$.each(j,function(a,b){if(b!=l._requestParams[a])return k=!0,!1});if(!k)return $(this.options.containerSelector).html()!=""&&$(this.options.containerSelector).show(),!1;this._requestParams=j;if(!this._isValidLocation(e,c)||!this._isValidLocation(g,d))return!1;c="/".concat(b,"/",c[2],"/",d[2],"/",f);b==a.searchTypeReturn&&(c=c.concat("/",h));return this.options.cmp2BaseUrl.concat(c,"?cmp2Counts=",this.options.cmp2Counts,"&cmp2Unchecks=",this.options.cmp2Unchecks,
"&origin=",this.options.cmp2Origin)},_getDeeplinkUrl:function(a){if(a){var b=this.options,c=this._getSearchType();if(!(c!=b.searchTypeOneway&&c!=b.searchTypeReturn)){var d,e=[],f,g,h,j,k,l=0;c==b.searchTypeOneway?(c=$(b.oDepSelector).val(),d=$(b.oDepHiddenSelector).val().split("|"),j=$(b.oDstSelector).val(),e=$(b.oDstHiddenSelector).val().split("|"),g=$(b.oDepDateSelector).val().split(".").reverse().join("-"),h=$(b.oDepTimeSelector).val(),k=0):(c=$(b.rDepSelector).val(),d=$(b.rDepHiddenSelector).val().split("|"),
j=$(b.rDstSelector).val(),e=$(b.rDstHiddenSelector).val().split("|"),g=$(b.rDepDateSelector).val().split(".").reverse().join("-"),h=$(b.rDepTimeSelector).val(),k=$(b.rRetDateSelector).val().split(".").reverse().join("-"),l=$(b.rRetTimeSelector).val(),l=l>=0&&l<=3?l:0);h=h>=0&&h<=3?h:0;f=$(b.nonstopSelector).length&&$(b.nonstopSelector).filter(":checked").length?0:1;this._isValidParamsForDeeplink(c,d,j,e,g)&&(c=d[2],j=e[2]);e=$(b.adultsSelector).val()?$(b.adultsSelector).val():1;d=$(b.childrenSelector).val()?
$(b.childrenSelector).val():0;var m=$(b.infantsSelector).val()?$(b.infantsSelector).val():0;return b.knCmp2?(l=parseInt(e)+parseInt(d)+parseInt(m),f=$(b.cabinTypeSelector).val(),b.baseUrl+"/ctdeeplink-kn/"+a+"/"+c+"/"+j+"/"+g+"/"+k+"/"+l+"/"+f+"/"+b.origin+"/"+b.extParams):b.baseUrl+"/ctdeeplink/"+c+"/"+j+"/"+a+("/"+g+"/"+k+"/"+h+"/"+l+"/"+e+"/"+d+"/"+m+"/"+f+"/"+b.origin+"/"+b.extParams)}}},_isValidLocation:function(a,b){return b.length==5&&a==b[0]&&b[1].length>0&&b[2].length==3},_isValidParamsForDeeplink:function(a,
b,c,d,e){return this._isValidLocation(a,b)&&this._isValidLocation(c,d)&&(e.match(/^\d{2}[\.-]\d{2}[\.-]\d{4}$/)||e.match(/^\d{4}[\.-]\d{2}[\.-]\d{2}$/))},_getSearchType:function(){var a=this.options.searchTypeMulti,b=$(this.options.searchTypeSelector);b.length&&b.filter(":checked").length&&(a=b.filter(":checked").val());return a},_getWindowOpener:function(){if(!this.options.windowOpener)this.options.windowOpener=new windowopener({popUnder:this.options.openInBackground});return this.options.windowOpener},
_trackCmp2UserClicks:function(a,b){if(a){var c=$(b).attr("name").match(/^compareto\[([^\]]+)\]/i);if(c){var d=$(b).prop("checked")?"checked":"unchecked",c=c[1]+" ("+$.trim($(b).parent().text())+")";a.trackCmp2Click(c,d)}}}}),ads_google=$.Class({options:{url:"",containers:null,useCache:!0,handleAs:"json",requestType:"GET"},_handle:null,init:function(a){this.options=$.extend({},this.options,a||[])},execute:function(){if(this.options.url&&this.options.containers){var a=this;this._handle=$.ajax({url:this.options.url,
type:this.options.requestType,dataType:this.options.handleAs,cache:this.options.useCache,success:function(b,c,d){if(typeof a.options.onSuccess=="function")a.options.onSuccess(b,c,d);else a.onSuccess(b,c,d)},error:function(b,c,d){if(typeof a.options.onError=="function")a.options.onError(b,c,d);else a.onError(b,c,d)}})}},onSuccess:function(a){for(var b in a)if(this.options.containers[b]){$("#"+this.options.containers[b].container).html(a[b]).show();var c=$("#"+this.options.containers[b].placeholder);
c.length&&c.show()}},onError:function(){}}),ads_inline=$.Class({options:{requestUrl:"",containerIdSelector:"#crossSalesPlaceHolder",trackingOfferTypeSelector:"#econda_offer_type",trackingOfferCucSelector:"#econda_offer_cuc",trackingContentSelector:"#econda_content",trackingSiteIdSelector:"#econda_siteid",trackingCareaSelector:"#econda_carea",trackingDepSelector:"#econda_cs_departure",trackingDstSelector:"#econda_cs_destination",trackingRouteSelector:"#econda_cs_route"},_requestHandle:null,_econdatracker:null,
init:function(a){this.options=$.extend({},this.options,a||{});this._econdatracker=new econdatracker},execute:function(a){if(this.options.requestUrl){var b=this;this._requestHandle=$.ajax({url:this.options.requestUrl+"/handle/"+a,global:!1,typeString:"GET",dataTypeString:"html",success:function(a){b.publish(a)},error:function(){}})}},clear:function(){$(this.options.containerIdSelector).html("")},publish:function(a){a.length&&(this.publishAd(a),this.publishTrackingTags())},publishAd:function(a){a.length?
$(this.options.containerIdSelector).html(a):this.clear()},publishTrackingTags:function(){if(!this._checkTrackingTags())return!1;this._econdatracker.trackInlineAdImpression($(this.options.trackingContentSelector).html(),$(this.options.trackingCareaSelector).html(),$(this.options.trackingSiteIdSelector).html(),$(this.options.trackingOfferCucSelector).html(),$(this.options.trackingDepSelector).html(),$(this.options.trackingDstSelector).html(),$(this.options.trackingRouteSelector).html())},_checkTrackingTags:function(){return!this._econdatracker||
!$(this.options.trackingOfferTypeSelector).length||!$(this.options.trackingOfferCucSelector.length)||!$(this.options.trackingContentSelector).length||!$(this.options.trackingSiteIdSelector.length)||!$(this.options.trackingCareaSelector).length?!1:!0}}),econdatracker=$.Class({trackCmp2Click:function(a,b){emos_userEvent1("marker","cmp2_user_click/"+a+"/"+b)},trackFlightFilterClick:function(a,b){emos_userEvent1("marker","flight_filters/"+a+"/"+b)},trackStartpageBoxLinkClicks:function(a){var b=$("#"+
a+" a");b.length!=0&&b.click(function(){if(this.parentNode.getAttribute("class")!="rss-icon"){var b=this.innerHTML.replace(/<\/?[^>]+>/gi,""),d=this.href;emos_userEvent1("marker","startpage_boxes/"+a+"/"+b);setTimeout(function(){document.location.href=d},100);return!1}})},trackInlineAdImpression:function(a,b,c,d,e,f,g){this._trackEvent({content:a,carea:b,siteid:c,crossEvent:[["crossview",d,d,e,f,g]],pageId:a})},_trackEvent:function(a,b){var b=b?b:1,c=this;window.emosPropertiesEvent?setTimeout(function(){c._reset();
window.emosPropertiesEvent(a)},1E3):b<5&&setTimeout(function(){c._trackEvent(a,b+1)},2E3)},_reset:function(){$('a[name="emos_name"]').each(function(a){$(a).remove()});$('script[src*="emos2.js"]').each(function(a){$(a).remove()});if(window.emosCustomPageArray)window.emosCustomPageArray=null;if(window.emosCustomMultiArray&&window.emosMultiArrayID)window.emosCustomMultiArray=null,window.emosMultiArrayID=null}}),airsearch_form_handler=$.Class({_datePickers:{},_autoCompleters:{},_dropRowButtons:{},_currentSearchType:"M",
options:{cmp2Handler:null,addRowUrl:"",autoCompleteUrl:"",formSubmitUrl:"",formMethod:"post",fetchFormFieldsUrl:"",autoCompleterDelay:0,minRowLimit:2,maxRowLimit:6,minDate:null,maxDate:null,dateAdjustmentDaysCount:0,autocompleteWaitingTimeout:100,searchFormSelector:"#searchForm",addRowBtnSelector:"#addNewCity",rowStyleClass:"formInputRow",rowRemoveSelector:".removeRow a",rowRemoveSelectorPrefix:"#removeRow-",rowSelectorPrefix:"#formInputRow-",depSelectorPrefix:"#depInput-",dstSelectorPrefix:"#dstInput-",
dateSelectorPrefix:"#flightDate-",dateHiddenSelectorPrefix:"#flightDateHidden-",fieldBlockSelector:"#formInputFields",searchTypeSelector:".formSearchTypes input[name='searchType']",selectedSearchTypeSelector:".formSearchTypes input[name='searchType']:checked",datePickerSelector:".datepicker",inputErrorStyleClass:"searchInputError",autoCompleteSelector:".autocomplete",startSearchBtnSelector:"#searchnow",passengersSelector:"#passengerCount",cabinClassSelector:"#cabinClass",nonStopSelector:"#onlyNonStop",
flexibleSelector:"#flexible_date",nonStopHashKey:"f.stops",nonStopHashValue:"0",anyStopHashValue:"~",depTimeSelector:".flightTime select",depTimeHashPrefix:"f.dt.",depNearbySelectorPrefix:"#depNearbyInput-",dstNearbySelectorPrefix:"#dstNearbyInput-",timeSelectorPrefix:"#flightTime-",initFieldToFocus:"#depInput-0",allFlightLegs:null,kayakLogoUrl:null},errorLayer:null,_formSwitchHelper:null,_urlFlightTimeOptions:[],_preCheckedCMP2Boxes:{},init:function(a,b){this.errorLayer=a;this.options.minDate=this._getDateAfterNDays();
this.options.maxDate=this._getDateAfterNDays(365);if(b)this.options=$.extend({},this.options,b);this._formSwitchHelper=new airsearch_form_switchhelper(this.options);this._attachDatePickerEvents();this._attachAutocompleterEvents();this._attachSearchFormSubmitEvent();var c=$(this.options.selectedSearchTypeSelector).val();if(c!==void 0)this._currentSearchType=c;this._attachChangeSearchTypeEvent();this._saveFormFieldsValues(this._currentSearchType);this._backupOriginalUrlFlighTimes();this._currentSearchType==
this._formSwitchHelper.options.searchTypeMulticity&&(this._attachAddNewSearchRowEvent(),this._attachRemoveRowButtonEvents(),this._attachAutoAddRowEvents());this.initialFieldFocus();this.enableSearchTypeOptions(!0);this._extendCMP2Handler()},setNonStop:function(a){$(this.options.nonStopSelector).prop("checked",a)},getNonStop:function(){return $(this.options.nonStopSelector).is(":checked")},toggleNonStopCheckbox:function(a){if(a.filters==null||a.filters.stops==null){if(a.filters==null)a.filters={};
a.filters.stops=this.getNonStop()?this.options.nonStopHashValue:this.options.anyStopHashValue}},getDefaultFlightTimeParams:function(a){var b=this.options,b=$(b.fieldBlockSelector+" > ."+b.rowStyleClass);a.filters={dt:{}};b.each(function(b){a.filters.dt[b]="0!2147483647"});a.filters.stops=this.options.anyStopHashValue;return a},addDefaultFlightTimeParams:function(a,b){var c=this,d=this.options,e=!0,f={};$(d.fieldBlockSelector+" > ."+d.rowStyleClass).each(function(b,g){if(c._getLocationFieldValue(d.depSelectorPrefix+
b)!=d.allFlightLegs[b].dep||$(d.dateSelectorPrefix+b).val()!=d.allFlightLegs[b].displayDate)return e=!1;var k=$(d.depTimeSelector,g).val();if(k=="filter"||k==0)return!0;if(typeof a.filters!="undefined"&&typeof a.filters.dt!="undefined"&&typeof a.filters.dt[b]!="undefined")return!0;f[b]=g});if(e===!1)return a;if(typeof a.filters=="undefined")a.filters={dt:{}};else if(typeof a.filters.dt=="undefined")a.filters.dt={};var g=$.hash();$.each(f,function(d,e){a.filters.dt[d]=c.getFlightTimeStamps(c.options.allFlightLegs[d].date,
e);g.param(b+d,a.filters.dt[d])});if(a.filters.stops==null&&(a.filters.stops=g.param(this.options.nonStopHashKey),a.filters.stops==null))a.filters.stops=this.getNonStop()?this.options.nonStopHashValue:this.options.anyStopHashValue;g.apply();return a},getFlightTimeStamps:function(a,b){var c=(new Date).getTimezoneOffset()*60,d=a.split("-"),e=$(this.options.depTimeSelector+" option",b).filter(":selected").text().match(/(\d+)-(\d+)/),f=new Date(d[0],d[1]-1,d[2],e[1],0,0,0);e[2]==0&&d[2]++;d=new Date(d[0],
d[1]-1,d[2],e[2],0,0,0);return Math.round(f.getTime()/1E3)-c+"!"+(Math.round(d.getTime()/1E3)-c)},addNewSearchRow:function(){var a=this._getUrlForAddNewRow();if(a===!1)return!1;var b=this;$.ajax({type:"GET",url:a,dataType:"html",success:function(a){b._appendNewRow(a)},error:function(){b.errorLayer.display(translate("AIRSEARCH_AJAX_ERROR_TITLE_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE1_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE2_DEFAULT"))}})},markErrorField:function(a){$(a).addClass(this.options.inputErrorStyleClass)},
unmarkErrorField:function(a){$(a).removeClass(this.options.inputErrorStyleClass)},removeSearchRow:function(a){if(!($("."+this.options.rowStyleClass).length<=this.options.minRowLimit)){var b=null,a=this._getNodeLegIndex($(a)),c=$(this.options.rowSelectorPrefix+a),b=$(this.options.dateSelectorPrefix+a).attr("id");delete this._datePickers[b];b=$(this.options.depSelectorPrefix+a).attr("id");this._autoCompleters[b].autocomplete("destroy");delete this._autoCompleters[b];b=$(this.options.dstSelectorPrefix+
a).attr("id");$(this._autoCompleters[b]).autocomplete("destroy");delete this._autoCompleters[b];delete this._dropRowButtons[$(this.options.rowRemoveSelectorPrefix+a).attr("id")];c.remove();this._formSwitchHelper.searchFieldValues.M=[];this.toggleRemoveRowButtons();this._attachAutoAddRowEvents();this._saveFormFieldsValues(this._currentSearchType)}},toggleRemoveRowButtons:function(){var a=$(this.options.rowRemoveSelector),b=a.length>this.options.minRowLimit?!0:!1;a.each(function(){b?$(this).show():
$(this).hide()})},searchFormSubmitter:function(){this.disableSearchButton(!0);var a=this,b=!1;$.each(this._autoCompleters,function(c,d){if($(d).data("autocomplete").isInProgress||$(d).data("autocomplete").pending)return setTimeout(function(){a.searchFormSubmitter()},a.options.autocompleteWaitingTimeout),b=!0,!1});if(b)return!1;var c=this._collectSearchParameters(),d=this._formatSearchFormSubmitUrl(c);d?(d=this.options.formSubmitUrl+"/"+d,d+=this._urlHashParamsToAppend(c),this._openCmp2AndSubmitSearchForm(d)):
this.disableSearchButton();return!1},_openCmp2AndSubmitSearchForm:function(a){var b=!1;this.options.cmp2Handler&&(b=this.options.cmp2Handler.handleDeeplinks());if(b&&(!$.browser.msie||parseInt($.browser.version,10)>6)){var c=this;(new airsearch_popupblockerhint({onCloseCallback:function(){c._createFormAndSubmit(a,c._getAdditionalFormParams())}})).show()}else this._createFormAndSubmit(a,this._getAdditionalFormParams())},_getAdditionalFormParams:function(){var a={};if(this.options.cmp2Handler){var b=
this.options.cmp2Handler.getOpenedCucs(),a=$.extend(a,b),c;for(c in this._preCheckedCMP2Boxes)b[this._preCheckedCMP2Boxes[c]]||(a["unchecked-"+this._preCheckedCMP2Boxes[c]]=1)}return a},_urlHashParamsToAppend:function(a){var b=$.hash(),c=[];a.nonStop&&c.push(this.options.nonStopHashKey+":"+this.options.nonStopHashValue);for(var d in a.legs)if(!utils_type.is_numeric($(this.options.timeSelectorPrefix+d).val())){var e=b.param(this.options.depTimeHashPrefix+d);e&&c.push(this.options.depTimeHashPrefix+
d+":"+e)}return(c.length?"#":"")+c.join(";")},disableSearchButton:function(a){typeof a=="undefined"&&(a=!1);$(this.options.startSearchBtnSelector).get(0).disabled=a},initialFieldFocus:function(){$(this.options.initFieldToFocus).focus()},enableSearchTypeOptions:function(a){$(this.options.searchTypeSelector).each(function(){$(this).prop("disabled",!a)})},loadFormFields:function(a){this._saveFormFieldsValues(this._currentSearchType);var b;b=a==this._formSwitchHelper.options.searchTypeOneway?1:a==this._formSwitchHelper.options.searchTypeReturn?
2:this._formSwitchHelper.getMaxLegsCount();this._formSwitchHelper.searchFieldValues[a].length==0&&(this._formSwitchHelper.searchFieldValues[a]=this._formSwitchHelper.searchFieldValues.M.length?this._formSwitchHelper.searchFieldValues.M.slice(0,1):this._formSwitchHelper.searchFieldValues[this._currentSearchType].slice(0,2));b=this._formatGetFormFieldsUrl(a,b,this._formSwitchHelper.searchFieldValues[this._currentSearchType][0].dateHidden);var c=this;$.ajax({type:"GET",url:b,dataType:"html",success:function(b){c.onLoadFormFieldsSuccess(b,
a)},error:function(){c.errorLayer.display(translate("AIRSEARCH_AJAX_ERROR_TITLE_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE1_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE2_DEFAULT"))}})},onLoadFormFieldsSuccess:function(a,b){$("#searchFormFields").html(a);this._datePickers=[];this._autoCompleters=[];this._dropRowButtons=[];this._attachDatePickerEvents();this._attachAutocompleterEvents();b==this._formSwitchHelper.options.searchTypeMulticity&&(this._attachAddNewSearchRowEvent(),this._attachRemoveRowButtonEvents(),
this._attachAutoAddRowEvents());this._currentSearchType=b;this._restoreFormFieldsValues();this.options.cmp2Handler&&this.options.cmp2Handler.initSearchTypeEvents()},_attachChangeSearchTypeEvent:function(){var a=this;$(this.options.searchTypeSelector).change(function(){a.loadFormFields($(a.options.selectedSearchTypeSelector).val());a.options.cmp2Handler&&a.options.cmp2Handler.abort()})},_formatGetFormFieldsUrl:function(a,b,c){return[this.options.fetchFormFieldsUrl,a,b,c].join("/")},_saveFormFieldsValues:function(a){a==
this._formSwitchHelper.options.searchTypeMulticity?this._formSwitchHelper.saveMultiSearchFieldValues():a==this._formSwitchHelper.options.searchTypeReturn?this._formSwitchHelper.saveReturnSearchFieldValues():a==this._formSwitchHelper.options.searchTypeOneway&&this._formSwitchHelper.saveOnewaySearchFieldValues()},_restoreFormFieldsValues:function(){this._currentSearchType==this._formSwitchHelper.options.searchTypeMulticity?this._formSwitchHelper.fillMultiSearchFormFields():this._currentSearchType==
this._formSwitchHelper.options.searchTypeReturn?this._formSwitchHelper.fillReturnSearchFormFields():this._currentSearchType==this._formSwitchHelper.options.searchTypeOneway&&this._formSwitchHelper.fillOnewaySearchFormFields()},_getDateAfterNDays:function(a){var b=new Date;a&&b.setDate(b.getDate()+a);return b},_attachAddNewSearchRowEvent:function(){var a=this;$(this.options.addRowBtnSelector).click(function(){a.addNewSearchRow()})},_attachSearchFormSubmitEvent:function(){var a=this;$(this.options.searchFormSelector).submit(function(){return a.searchFormSubmitter()})},
_getUrlForAddNewRow:function(){var a=$("."+this.options.rowStyleClass);if(a.length>=this.options.maxRowLimit)return this.errorLayer.display(translate("AIRSEARCH_AJAX_ERROR_TITLE_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE1_LIMIT_REACHED"),translate("AIRSEARCH_AJAX_ERROR_LINE1_LIMIT_EXPLAIN")),!1;var a=this._getNodeLegIndex(a.last()),b=this._getLocationFieldValue(this.options.dstSelectorPrefix+a);return[this.options.addRowUrl,b?b:0,this._getDateValue(this.options.dateSelectorPrefix+a),parseInt(a)+
1].join("/")},_getNodeLegIndex:function(a){return(a=$(a).attr("id").match(/\d+/))?a[0]:!1},_getLocationFieldValue:function(a){var b=$(a).val().trim(),a=(a=$("#hidden_"+$(a).attr("id")).val())?a.split("|"):"",a=a.length==5?a[2]:"";return b&&a.match(/[A-Z0-9]{3}/)?a:""},_getLocationRegionValue:function(a){var b=$(a).val().trim(),a=(a=$("#hidden_"+$(a).attr("id")).val())?a.split("|"):"",a=a.length==5?a[4]:"";return b?a:""},_getLocationUrlCityValue:function(a){var b=$(a).val().trim(),a=(a=$("#hidden_"+
$(a).attr("id")).val())?a.split("|"):"",a=a.length==5?a[3]:"";return b?a:""},_getDateValue:function(a){a=formatDateToYmd($(a).val(),translate("LANG_SEARCHFORM_DATE_FORMAT"));return!a?0:a},_appendNewRow:function(a){if(a=="")return this.errorLayer.display(translate("AIRSEARCH_AJAX_ERROR_TITLE_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE1_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE2_DEFAULT")),!1;$(this.options.fieldBlockSelector).append(a);this._attachDatePickerEvents();this._attachAutocompleterEvents();
this._attachRemoveRowButtonEvents();this._attachAutoAddRowEvents()},_attachDatePickerEvents:function(){var a=this;$(this.options.datePickerSelector).each(function(){var b=$(this).attr("id");a._datePickers[b]||(a._datePickers[b]=a._initDatePicker(this))})},_initDatePicker:function(a){var b=this;$(a).fancydatepicker({showOtherMonths:!0,drawDefaultHeader:!0,drawFancyHeader:!1,selectOtherMonths:!0,hideIfNoPrevNext:!0,calendarWidth:230,showWeek:!1,numberOfMonths:2,firstDay:1,minDate:this.options.minDate,
maxDate:this.options.maxDate,dateFormat:translate("JQUERY_DATEPICKER_DATE_FORMAT"),onSelect:function(a,d){b._adjustFlightDates(d);b.options.cmp2Handler&&b.options.cmp2Handler.update()}});$(a).fancydatepicker("getInstance").addMethods({_hideDatepicker:function(a){this._parent(a);b._adjustFlightDates(this._curInst);b.options.cmp2Handler&&b.options.cmp2Handler.update()}});return $(a)},_adjustFlightDates:function(a){this._currentSearchType==this._formSwitchHelper.options.searchTypeMulticity?this._adjustMulticityFlightDates(a):
this._currentSearchType==this._formSwitchHelper.options.searchTypeReturn?this._adjustReturnFlightDates(a):this._currentSearchType==this._formSwitchHelper.options.searchTypeOneway&&this._adjustOnewayFlightDates(a)},_adjustMulticityFlightDates:function(a){this._validateFlightLegDate([a.selectedYear,(parseInt(a.selectedMonth,10)+1).toString().replace(/^(\d)$/,"0$1"),a.selectedDay.toString().replace(/^(\d)$/,"0$1")].join("-"),this._getNodeLegIndex(a.input))?this.unmarkErrorField($("#"+a.id)):this.markErrorField($("#"+
a.id))},_adjustReturnFlightDates:function(a){var b=null;this._getNodeLegIndex(a.input)==0?(a=new Date(a.selectedYear,a.selectedMonth,a.selectedDay),a>this._strToDate(this._getDateValue(this.options.dateSelectorPrefix+"1"))&&(b=a,this.options.dateAdjustmentDaysCount&&b.setDate(b.getDate()+this.options.dateAdjustmentDaysCount),$(this.options.dateSelectorPrefix+"1").fancydatepicker("setDate",b))):(b=new Date(a.selectedYear,a.selectedMonth,a.selectedDay),b<this._strToDate(this._getDateValue(this.options.dateSelectorPrefix+
"0"))&&(a=b,this.options.dateAdjustmentDaysCount&&a.setDate(a.getDate()-this.options.dateAdjustmentDaysCount),$(this.options.dateSelectorPrefix+"0").fancydatepicker("setDate",a)))},_adjustOnewayFlightDates:function(a){return this._adjustMulticityFlightDates(a)},_validateFlightLegDate:function(a,b){if(!a)return!1;a=this._strToDate(a);if(a<new Date)return!1;for(var c=$(this.options.rowSelectorPrefix+b).get(0);c=c.previousSibling;)if($(c).hasClass(this.options.rowStyleClass)){var d=this._getNodeLegIndex(c);
if(a<new Date(this._strToDate(this._getDateValue(this.options.dateSelectorPrefix+d))))return!1}return!0},_attachAutocompleterEvents:function(){var a=this;$(this.options.autoCompleteSelector).each(function(){var b=$(this).attr("id");a._autoCompleters[b]||(a._autoCompleters[b]=a._initAutoCompleter(this))})},_initAutoCompleter:function(a,b){var c=$(a).attr("id");if(typeof b=="undefined"||!(b instanceof airsearch_autocomplete))b=new airsearch_autocomplete({id:c,url:this.options.autoCompleteUrl,searchInputErrorClass:this.inputErrorStyleClass});
if(!b.appendContent&&this.options.kayakLogoUrl)b.appendContent='<img src="'+this.options.kayakLogoUrl+'" alt="" />';return $("#"+c).autocomplete(b)},_attachRemoveRowButtonEvents:function(){var a=this;$(this.options.rowRemoveSelector).each(function(){var b=$(this).attr("id");a._dropRowButtons[b]||($(this).click(function(){a.removeSearchRow(this)}),a._dropRowButtons[b]=!0)});this.toggleRemoveRowButtons()},_collectSearchParameters:function(){var a={};a.searchType=this._currentSearchType;a.passengers=
$(this.options.passengersSelector).val();a.cabin=$(this.options.cabinClassSelector).val();a.nonStop=$(this.options.nonStopSelector).is(":checked");a.flexible=$(this.options.flexibleSelector).is(":checked");a.legs={};if(this._currentSearchType!=this._formSwitchHelper.options.searchTypeReturn){var b=this;$(this.options.fieldBlockSelector+" ."+this.options.rowStyleClass).each(function(){var c=b._getNodeLegIndex(this);c!==!1&&(a.legs[c]={dep:b._getLocationFieldValue(b.options.depSelectorPrefix+c),depCity:b._getLocationUrlCityValue(b.options.depSelectorPrefix+
c),depRegion:b._getLocationRegionValue(b.options.depSelectorPrefix+c),dst:b._getLocationFieldValue(b.options.dstSelectorPrefix+c),dstCity:b._getLocationUrlCityValue(b.options.dstSelectorPrefix+c),dstRegion:b._getLocationRegionValue(b.options.dstSelectorPrefix+c),depNearby:$(b.options.depNearbySelectorPrefix+c).val(),dstNearby:$(b.options.dstNearbySelectorPrefix+c).val(),date:b._getDateValue(b.options.dateSelectorPrefix+c),time:b._getTimeFieldValue(b.options.timeSelectorPrefix+c)})})}else this._currentSearchType==
this._formSwitchHelper.options.searchTypeReturn&&(a.legs[0]={dep:this._getLocationFieldValue(this.options.depSelectorPrefix+"0"),depCity:this._getLocationUrlCityValue(this.options.depSelectorPrefix+"0"),depRegion:this._getLocationRegionValue(this.options.depSelectorPrefix+"0"),dst:this._getLocationFieldValue(this.options.depSelectorPrefix+"1"),dstCity:this._getLocationUrlCityValue(this.options.depSelectorPrefix+"1"),dstRegion:this._getLocationRegionValue(this.options.depSelectorPrefix+"1"),depNearby:$(this.options.depNearbySelectorPrefix+
"0").val(),dstNearby:$(this.options.depNearbySelectorPrefix+"1").val(),date:this._getDateValue(this.options.dateSelectorPrefix+"0"),time:this._getTimeFieldValue(this.options.timeSelectorPrefix+"0")},a.legs[1]={dep:this._getLocationFieldValue(this.options.depSelectorPrefix+"1"),depCity:this._getLocationUrlCityValue(this.options.depSelectorPrefix+"1"),depRegion:this._getLocationRegionValue(this.options.depSelectorPrefix+"1"),dst:this._getLocationFieldValue(this.options.depSelectorPrefix+"0"),dstCity:this._getLocationUrlCityValue(this.options.depSelectorPrefix+
"0"),dstRegion:this._getLocationRegionValue(this.options.depSelectorPrefix+"0"),depNearby:$(this.options.depNearbySelectorPrefix+"1").val(),dstNearby:$(this.options.depNearbySelectorPrefix+"0").val(),date:this._getDateValue(this.options.dateSelectorPrefix+"1"),time:this._getTimeFieldValue(this.options.timeSelectorPrefix+"1")});return a},_formatSearchFormSubmitUrl:function(a){var b=[],c=!1,d;for(d in a.legs){var e={},e=this._currentSearchType==this._formSwitchHelper.options.searchTypeReturn?this._validateReturnFlightLeg(a.legs[d],
d):this._validateFlightLeg(a.legs[d],d);e.title?c||(this.errorLayer.display(e.title,e.line1,e.line2),c=!0):b.push([a.legs[d].depCity,a.legs[d].dstCity,a.legs[d].dep,a.legs[d].dst,a.legs[d].date,a.legs[d].depNearby,a.legs[d].dstNearby,a.legs[d].time].join("-"))}b.push(a.passengers);b.push(a.cabin);b.push(a.nonStop?"1":"0");a.flexible&&(b.push("flexible"),b.push("1"));return!c?b.join("/"):!1},_createFormAndSubmit:function(a,b){var c=$("<form>").appendTo("body").attr("method",this.options.formMethod).attr("action",
a).css("display","none");if(typeof b!="undefined")for(var d in b)$('<input type="hidden" name="'+d+'" value="'+b[d]+'">').appendTo(c);c.submit()},_validateFlightLeg:function(a,b){var c=errorLine1="",d=translate("AIRSEARCH_VALIDATION_ERROR_LINE2_DEFAULT"),c=!1,e={};a.dep||(this.markErrorField(this.options.depSelectorPrefix+b),c||(errorLine1=(c=$(this.options.depSelectorPrefix+b).val())?translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DEPARTURE").replace("%s",$("<div/>").text(c).html()):translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DEPARTURE").replace('"%s"',
"")),c=!0);if(!a.dst||a.dst==a.dep)this.markErrorField(this.options.dstSelectorPrefix+b),c||(errorLine1=(c=$(this.options.dstSelectorPrefix+b).val())?translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DESTINATION").replace("%s",$("<div/>").text(c).html()):translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DESTINATION").replace('"%s"',"")),c=!0;a.depRegion==a.dstRegion&&(this.markErrorField(this.options.dstSelectorPrefix+b),c||(errorLine1=translate("AIRSEARCH_VALIDATION_ERROR_LINE1_SAME_CITY")),c=!0);this._validateFlightLegDate(a.date,
b)||(this.markErrorField(this.options.dateSelectorPrefix+b),c||(c=$(this.options.dateSelectorPrefix+b).val(),d=translate("AIRSEARCH_VALIDATION_ERROR_LINE2_DATE"),errorLine1=c?translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DATE").replace("%s",c):translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DATE").replace('"%s"',"")),c=!0);return!c?{}:e={title:translate("AIRSEARCH_VALIDATION_ERROR_TITLE"),line1:errorLine1,line2:d}},_validateReturnFlightLeg:function(a,b){var c="",c="",d=translate("AIRSEARCH_VALIDATION_ERROR_LINE2_DEFAULT"),
e=!1,f={};a.dep||(this.markErrorField(this.options.depSelectorPrefix+b),e||(c=$(this.options.depSelectorPrefix+b).val(),e=b==0?"AIRSEARCH_VALIDATION_ERROR_LINE1_DEPARTURE":"AIRSEARCH_VALIDATION_ERROR_LINE1_DESTINATION",c=c?translate(e).replace("%s",$("<div/>").text(c).html()):translate(e).replace('"%s"',"")),e=!0);f=$(this.options.rowSelectorPrefix+b);if(f=$(f).prev("div").get(0))f=this._getNodeLegIndex(f),this._getLocationRegionValue("#"+$(this.options.depSelectorPrefix+f).attr("id"))==a.depRegion&&
(this.markErrorField(this.options.depSelectorPrefix+b),e=!0,c=translate("AIRSEARCH_VALIDATION_ERROR_LINE1_SAME_CITY"));this._validateFlightLegDate(a.date,b)||(this.markErrorField(this.options.dateSelectorPrefix+b),e||(d=translate("AIRSEARCH_VALIDATION_ERROR_LINE2_DATE"),c=(c=$(this.options.dateSelectorPrefix+b).val())?translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DATE").replace("%s",c):translate("AIRSEARCH_VALIDATION_ERROR_LINE1_DATE").replace('"%s"',"")),e=!0);return!e?{}:f={title:translate("AIRSEARCH_VALIDATION_ERROR_TITLE"),
line1:c,line2:d}},_strToDate:function(a){if(!a)return null;a=a.split("-");return a.length!==3?null:new Date(a[0],a[1]-1,a[2],23,59,59,999)},_attachAutoAddRowEvents:function(){var a=this._getNodeLegIndex($(this.options.fieldBlockSelector+" ."+this.options.rowStyleClass+":first")),a=$(this.options.dstSelectorPrefix+a).data("autocomplete").options;if(!a._autoAddRowInitiated){var b=this;a.addMethods({_autoAddRowInitiated:!0,select:function(a,d){this._parent(a,d);$(b.options.fieldBlockSelector+" ."+b.options.rowStyleClass).length<
2&&b.addNewSearchRow()},_onBlurFocusItem:function(a){this._parent(a);$(b.options.fieldBlockSelector+" ."+b.options.rowStyleClass).length<2&&b.addNewSearchRow()}})}},_stripHashFromHref:function(a){return a.indexOf("#")!=-1?a.substring(0,a.indexOf("#")):a},_getTimeFieldValue:function(a){var b=$(a+"-custom");return b.length?parseInt(b.attr("class"),10):$(a).val()},_backupOriginalUrlFlighTimes:function(){var a=this;$(this.options.searchFormSelector+" ."+this.options.rowStyleClass).each(function(){var b=
a._getNodeLegIndex(this);b!==!1&&(a._urlFlightTimeOptions[b]=$(a.options.timeSelectorPrefix+b).val())})},_extendCMP2Handler:function(){if(this.options.cmp2Handler){var a=this;this.options.cmp2Handler.addMethods({onUpdateSuccess:function(b){this._parent(b);a._preCheckedCMP2Boxes={};b&&b.status==1&&b.html&&$('input[type="checkbox"]:checked',b.html).each(function(){a._preCheckedCMP2Boxes[$(this).attr("id")]=$(this).attr("name")})}})}}}),airsearch_form_errorlayer=$.Class({options:{layerSelector:"#searchFormErrorLayer",
imgSelector:"#errorLayerMessageImg",titleSelector:"#errorLayerMessageTitle",line1Selector:"#errorLayerMessageLine1",line2Selector:"#errorLayerMessageLine2",closeSelector:"#errorLayerCloseBtn",startSearchSelector:"#errorLayerStartBtn"},init:function(a){if(a)this.options=$.extend({},this.options,a);this._attachHideErrorLayerEvent()},display:function(a,b,c){this.preDisplay();this._handleTitle(a);this._handleLine(this.options.line1Selector,b);this._handleLine(this.options.line2Selector,c);$(this.options.layerSelector).show()},
hide:function(){$(this.options.layerSelector).hide()},preDisplay:function(){},_handleTitle:function(a){a?($(this.options.imgSelector).show(),$(this.options.titleSelector).html(a).show()):($(this.options.imgSelector).hide(),$(this.options.titleSelector).hide())},_handleLine:function(a,b){b?$(a).html(b).show():$(a).hide()},_attachHideErrorLayerEvent:function(){var a=this;$(this.options.closeSelector).click(function(){a.hide()})}}),airsearch_form_switchhelper=$.Class({searchFieldValues:{R:[],O:[],M:[]},
options:{depSelectorPrefix:null,dstSelectorPrefix:null,depNearbySelectorPrefix:null,dstNearbySelectorPrefix:null,dateSelectorPrefix:null,dateHiddenSelectorPrefix:null,timeSelectorPrefix:null,searchTypeReturn:"R",searchTypeOneway:"O",searchTypeMulticity:"M"},init:function(a){if(a)this.options=$.extend({},this.options,a)},getMaxLegsCount:function(){var a=0;$.each(this.searchFieldValues.M,function(b,d){(d.dep[0].length||d.dst[0].length)&&a++});var b=0;$.each(this.searchFieldValues.R,function(a,d){d.dep[0].length&&
b++});return Math.max(a,b)},saveMultiSearchFieldValues:function(){var a=this,b=0;$(this.options.fieldBlockSelector+" ."+this.options.rowStyleClass).each(function(){var c=a._getNodeLegIndex(this);c!==!1&&(a.searchFieldValues.M[b++]={dep:a._getLocationHiddenFieldValue(a.options.depSelectorPrefix,c),dst:a._getLocationHiddenFieldValue(a.options.dstSelectorPrefix,c),depNearby:a._getFieldValue(a.options.depNearbySelectorPrefix,c),dstNearby:a._getFieldValue(a.options.dstNearbySelectorPrefix,c),date:a._getFieldValue(a.options.dateSelectorPrefix,
c),dateHidden:a._getFieldValue(a.options.dateHiddenSelectorPrefix,c),time:a._getFieldValue(a.options.timeSelectorPrefix,c)})})},saveReturnSearchFieldValues:function(){this.searchFieldValues.R[0]={dep:this._getLocationHiddenFieldValue(this.options.depSelectorPrefix,0),dst:this._getLocationHiddenFieldValue(this.options.depSelectorPrefix,1),depNearby:this._getFieldValue(this.options.depNearbySelectorPrefix,0),dstNearby:this._getFieldValue(this.options.depNearbySelectorPrefix,1),date:this._getFieldValue(this.options.dateSelectorPrefix,
0),dateHidden:this._getFieldValue(this.options.dateHiddenSelectorPrefix,0),time:this._getFieldValue(this.options.timeSelectorPrefix,0)};this.searchFieldValues.R[1]={dep:this._getLocationHiddenFieldValue(this.options.depSelectorPrefix,1),dst:this._getLocationHiddenFieldValue(this.options.depSelectorPrefix,0),depNearby:this._getFieldValue(this.options.depNearbySelectorPrefix,1),dstNearby:this._getFieldValue(this.options.depNearbySelectorPrefix,0),date:this._getFieldValue(this.options.dateSelectorPrefix,
1),dateHidden:this._getFieldValue(this.options.dateHiddenSelectorPrefix,1),time:this._getFieldValue(this.options.timeSelectorPrefix,1)}},saveOnewaySearchFieldValues:function(){this.searchFieldValues.O[0]={dep:this._getLocationHiddenFieldValue(this.options.depSelectorPrefix,0),dst:this._getLocationHiddenFieldValue(this.options.dstSelectorPrefix,0),depNearby:this._getFieldValue(this.options.depNearbySelectorPrefix,0),dstNearby:this._getFieldValue(this.options.dstNearbySelectorPrefix,0),date:this._getFieldValue(this.options.dateSelectorPrefix,
0),dateHidden:this._getFieldValue(this.options.dateHiddenSelectorPrefix,0),time:this._getFieldValue(this.options.timeSelectorPrefix,0)}},_getLocationHiddenFieldValue:function(a,b){return $("#hidden_"+$(a+b).attr("id")).val().split("|")},_getFieldValue:function(a,b){return $(a+b).val()},fillMultiSearchFormFields:function(){var a=this.searchFieldValues.M,b=this;$.each(a,function(a,c){try{$(b.options.depSelectorPrefix+a).val(c.dep[0]),$("#hidden_"+$(b.options.depSelectorPrefix+a).attr("id")).val(c.dep.join("|")),
$(b.options.dstSelectorPrefix+a).val(c.dst[0]),$("#hidden_"+$(b.options.dstSelectorPrefix+a).attr("id")).val(c.dst.join("|")),$(b.options.depNearbySelectorPrefix+a).val(c.depNearby),$(b.options.dstNearbySelectorPrefix+a).val(c.dstNearby),c.date&&($(b.options.dateSelectorPrefix+a).val(c.date),$(b.options.dateHiddenSelectorPrefix+a).val(c.dateHidden)),$(b.options.timeSelectorPrefix+a).val(c.time)}catch(f){}});if(!$(this.options.depSelectorPrefix+"0").val()){var c=null;if(this.searchFieldValues.R.length&&
b.searchFieldValues.R[0].dep[0].length)c=b.searchFieldValues.R[0].dep;else if(this.searchFieldValues.O.length&&this.searchFieldValues.O[0].dep[0].length)c=this.searchFieldValues.O[0].dep;c&&($(b.options.depSelectorPrefix+"0").val(c[0]),$("#hidden_"+$(b.options.depSelectorPrefix+"0").attr("id")).val(c.join("|")))}if(!$(this.options.dstSelectorPrefix+"0").val()){c=null;if(this.searchFieldValues.R.length>1&&b.searchFieldValues.R[1].dep[0].length)c=b.searchFieldValues.R[1].dep;else if(this.searchFieldValues.O.length&&
this.searchFieldValues.O[0].dst[0].length)c=this.searchFieldValues.O[0].dst;c&&($(b.options.dstSelectorPrefix+"0").val(c[0]),$("#hidden_"+$(b.options.dstSelectorPrefix+"0").attr("id")).val(c.join("|")))}if($(this.options.depSelectorPrefix+"1")&&!$(this.options.depSelectorPrefix+"1").val()){c=null;if(this.searchFieldValues.R.length>1&&b.searchFieldValues.R[1].dep[0].length)c=b.searchFieldValues.R[1].dep;c&&($(b.options.depSelectorPrefix+"1").val(c[0]),$("#hidden_"+$(b.options.depSelectorPrefix+"1").attr("id")).val(c.join("|")))}if($(this.options.dstSelectorPrefix+
"1")&&!$(this.options.dstSelectorPrefix+"1").val()){c=null;if(this.searchFieldValues.R.length>0&&this.searchFieldValues.R[0].dep[0].length)c=this.searchFieldValues.R[0].dep;c&&($(this.options.dstSelectorPrefix+"1").val(c[0]),$("#hidden_"+$(this.options.dstSelectorPrefix+"1").attr("id")).val(c.join("|")))}if(a.length>1&&(!a[1].date||!a[1].time)&&this.searchFieldValues.R.length&&this.searchFieldValues.R[1].date)$(this.options.dateSelectorPrefix+"1").val(this.searchFieldValues.R[1].date),$(this.options.dateHiddenSelectorPrefix+
"1").val(this.searchFieldValues.R[1].dateHidden),$(this.options.timeSelectorPrefix+"1").val(this.searchFieldValues.R[1].time)},fillReturnSearchFormFields:function(){var a=this.searchFieldValues.R;$(this.options.depSelectorPrefix+"0").val(a[0].dep[0]);$("#hidden_"+$(this.options.depSelectorPrefix+"0").attr("id")).val(a[0].dep.join("|"));$(this.options.depNearbySelectorPrefix+"0").val(a[0].depNearby);$(this.options.dateSelectorPrefix+"0").val(a[0].date);$(this.options.dateHiddenSelectorPrefix+"0").val(a[0].dateHidden);
$(this.options.timeSelectorPrefix+"0").val(a[0].time);var b=$(this.options.depSelectorPrefix+"1"),c=$("#hidden_"+b.attr("id")),d=$(this.options.depNearbySelectorPrefix+"1");a.length>1&&a[1].dep[0].length?(b.val(a[1].dep[0]),c.val(a[1].dep.join("|")),d.val(a[1].depNearby)):this.searchFieldValues.M.length&&this.searchFieldValues.M[0].dst[0].length&&this.searchFieldValues.M[0].dst[0]!=a[0].dep[0]?(b.val(this.searchFieldValues.M[0].dst[0]),c.val(this.searchFieldValues.M[0].dst.join("|")),d.val(this.searchFieldValues.M[0].dstNearby)):
this.searchFieldValues.O.length&&this.searchFieldValues.O[0].dst[0].length&&this.searchFieldValues.O[0].dst[0]!=a[0].dep[0]&&(b.val(this.searchFieldValues.O[0].dst[0]),c.val(this.searchFieldValues.O[0].dst.join("|")),d.val(this.searchFieldValues.O[0].dstNearby));a.length>1&&a[1].date&&a[1].time?($(this.options.dateSelectorPrefix+"1").val(a[1].date),$(this.options.dateHiddenSelectorPrefix+"1").val(a[1].dateHidden),$(this.options.timeSelectorPrefix+"1").val(a[1].time)):this.searchFieldValues.M.length>
1&&($(this.options.dateSelectorPrefix+"1").val(this.searchFieldValues.M[1].date),$(this.options.dateHiddenSelectorPrefix+"1").val(this.searchFieldValues.M[1].dateHidden),$(this.options.timeSelectorPrefix+"1").val(this.searchFieldValues.M[1].time))},fillOnewaySearchFormFields:function(){var a=this.searchFieldValues.O;$(this.options.depSelectorPrefix+"0").val(a[0].dep[0]);$("#hidden_"+$(this.options.depSelectorPrefix+"0").attr("id")).val(a[0].dep.join("|"));$(this.options.depNearbySelectorPrefix+"0").val(a[0].depNearby);
var b=$(this.options.dstSelectorPrefix+"0"),c=$("#hidden_"+b.attr("id")),d=$(this.options.dstNearbySelectorPrefix+"0");a[0].dst[0].length?(b.val(a[0].dst[0]),c.val(a[0].dst.join("|")),d.val(a[0].dstNearby)):this.searchFieldValues.M.length&&this.searchFieldValues.M[0].dst[0].length&&this.searchFieldValues.M[0].dst[0]!=a[0].dep[0]?(b.val(this.searchFieldValues.M[0].dst[0]),c.val(this.searchFieldValues.M[0].dst.join("|")),d.val(this.searchFieldValues.M[0].dstNearby)):this.searchFieldValues.R.length>
1&&this.searchFieldValues.R[1].dep[0].length&&this.searchFieldValues.R[1].dep[0]!=a[0].dep[0]&&(b.val(this.searchFieldValues.R[1].dep[0]),c.val(this.searchFieldValues.R[1].dep.join("|")),d.val(this.searchFieldValues.R[1].depNearby));$(this.options.dateSelectorPrefix+"0").val(a[0].date);$(this.options.dateHiddenSelectorPrefix+"0").val(a[0].dateHidden);$(this.options.timeSelectorPrefix+"0").val(a[0].time)},_getNodeLegIndex:function(a){return(a=$(a).attr("id").match(/\d+/))?a[0]:!1}}),airsearch_resultloader=
$.Class({options:{getHandleUrl:"",updateResultsUrl:"",detailsUrl:"",abortUrl:"",requestId:"",origin:"",spl:"",filterLoaderSelector:"#filtersLoader",searchProgressProvidersEnabled:!1,searchProgressProvidersLimit:24,searchProgressProvidersVisible:!1,searchProgressSelector:"#searchInProgress",searchProgressLoaderSelector:"#searchInProgressLoader",listPeriodicalUpdaterStepTimeout:1E3,listPeriodicalUpdaterMaxTimeout:1E3,detailsPeriodicalUpdaterStepTimeout:1E3,detailsPeriodicalUpdaterMaxTimeout:2E3,expandDetailsAnimationDuration:250,
collapseDetailsAnimationDuration:250,detailsFromUrlLimit:5,detailsErrorFadeSpeed:500,detailsErrorHideTimeout:2E3,resultListContentSelector:"#resultListContent",resultBlockTopSelector:"#resultListTop",resultBlockBottomSelector:"#resultListBottom",filterBlockSelector:"#filtersContent",listPagerBlockSelector:"#resultListPager",stopsDetailsSelector:".stopDetails",stopsCountSelector:".legStops",providersSelector:".offerProviders a.provider, .offerProviders a.textLink",showMoreProvidersSelector:"a.showMoreOfferProviders",
showDetailsSelector:".tripDetails a.showDetails",hideDetailsSelector:".tripDetails a.hideDetails",detailsHandleClass:"tripDetailsLink",showMoreOffersHandleClass:"moreProvidersLink",errorLayer:null,resultContentSelector:".resultContent",noResultsContainerSelector:"#resultListNoResults",noResultsMsgSelector:"#resultListNoResultsMsg",noResultsRestartSearchSelector:"#searchRestart",searchProgressStopSelector:"#searchInProgressStop",filterContainerSelector:"#filterContainer",resultRowPrefix:"#resultRow-",
resultRowClassName:"resultRow",detailsLoaderSelector:"#resultDetailsLoader",detailsLoaderClass:"resultDetailsLoader",detailsLoaderContentSelector:".resultDetailsLayer",detailsErrorSelector:"#resultDetailsError",detailsErrorClass:"resultDetailsError",detailsSummaryClass:"resultDetailsSummary",detailsFullClass:"resultDetailsFull",detailsFullSelector:".resultDetailsFull",detailsLegAirportsSelector:".detailsLegSegment .airports",detailsLegFlightNumberSelector:".detailsLegSegment .flightNumber",detailsLegAirlineNameSelector:".detailsLegSegment .airlineName",
detailsLegStopsSelector:".detailsLegStop .stopLocation",listExpiredSelector:"#resultListExpired",listExpiredUpdateSelector:"#updateExpiredLink",priceDisclaimerSelector:"#priceDisclaimer",priceTabsSelector:"#pricetabs"},isSearching:!0,isFiltering:!1,_handle:null,_searchRequest:null,_searchRequestAborted:!1,_periodicalUpdater:null,_detailsPeriodicalUpdater:null,_resultOffset:0,_searchCount:0,_trips:[],_currentTrip:null,_loaderProviders:{},init:function(a){if(a)this.options=$.extend({},this.options,
a,{priceTabsSelector:window.prototypePriceTabsEnabled?"#pricetabs":"#airsearchFlexDateTabs"});this._attachDetailsWindowEvents();this._attachMoreResultsEvent();this._attachSearchProgressStopEvent();this._attachListExpiredUpdateEvent();this._attachNoResultsRestartSearchEvent();a=$.hash().param("page");this._resultOffset=typeof a=="undefined"?0:parseInt(a)},startSearch:function(a){this.onStartSearch(a);this._searchCount++;var b=this;this._searchRequest=$.ajax({type:"POST",url:b.options.getHandleUrl,
data:{requestid:b.options.requestId,origin:b.options.origin,spl:b.options.spl,sc:b._searchCount},dataType:"json",success:function(a){b._startSearchSuccess(a)},error:function(a){b.pageIsReloading=$.xhr.isReload(a);b.hideStatusPanel();b.pageIsReloading||($.xhr.isError(a)?(b.displayErrorLayer(),$(b.options.filterBlockSelector).html(""),b.clearResultList()):(b.displayNoResults(),b.hideFilterBlock()))}})},stopSearch:function(){this.isSearching=!1;this._searchRequest!=null&&this._searchRequest.abort();
this.stopPeriodicalUpdater();this.disableSearchButton();this.onSearchStop()},displayNoResults:function(){this._periodicalUpdater&&this.stopSearch();this.hideStatusPanel();this.clearResultList();$(this.options.noResultsContainerSelector).show()},hideNoResults:function(){$(this.options.noResultsContainerSelector).hide()},displayErrorLayer:function(){this._periodicalUpdater&&this.stopSearch();this.getErrorLayer().display(translate("AIRSEARCH_AJAX_ERROR_TITLE_DEFAULT"),translate("AIRSEARCH_AJAX_ERROR_LINE1_DEFAULT"),
translate("AIRSEARCH_AJAX_ERROR_LINE2_DEFAULT"));this.disableSearchButton();$(this.options.resultContentSelector).hide()},getErrorLayer:function(){if(this.errorLayer)return this.errorLayer;var a=this;this.errorLayer=new airsearch_form_errorlayer;this.errorLayer.addMethods({preDisplay:function(){var b=$(this.options.startSearchSelector);b.show();b.unbind("click");b.click(function(){a._searchCount=0;a.errorLayer.hide();$(a.options.resultContentSelector).show();a.startSearch()})}});return this.errorLayer},
updateResults:function(a){this.preUpdateResults();if(!this._periodicalUpdater)this.hideNoResults(),this.displayStatusPanel(),this._periodicalUpdater=this._getPeriodicalUpdater(a),this._periodicalUpdater.start();this.postUpdateResults()},displayStatusPanel:function(){!this.isSearching&&this.isFiltering&&this.options.searchProgressProvidersEnabled&&($(this.options.searchProgressSelector).addClass("searchInProgressOverResultsFiltering"),$(this.options.searchProgressLoaderSelector+" span").text(translate("AIRSEARCH_FILTERING_IN_PROGRESS")),
$(this.options.searchProgressLoaderSelector+" img").show());$(this.options.searchProgressSelector).is(":visible")||$(this.options.searchProgressSelector).fadeIn("fast")},hideStatusPanel:function(){$(this.options.filterLoaderSelector).hide();(this.pageIsReloading||!this.options.searchProgressProvidersEnabled||this._searchRequestAborted)&&$(this.options.searchProgressSelector).fadeOut("fast")},handleProgressPanel:function(a,b){this.options.searchProgressProvidersEnabled?(this.handleProgressProviders(a,
b),b||$(this.options.searchProgressSelector).fadeOut("fast")):b||$(this.options.searchProgressSelector).fadeIn("fast")},handleProgressProviders:function(a,b){var c=this;(this.isSearching||!this.isFiltering)&&a&&$.each(a,function(a,d){c.handleProgressProvider(a,d,!b||a in c._loaderProviders)});if(!b){this._loaderProviders={};var d=$(this.options.searchProgressSelector);if(!this.isSearching&&this.isFiltering)d.fadeOut("fast");else{var e=$(this.options.priceTabsSelector);if(e.length){var f=e.height(),
g=Math.max(d.height(),f);e.height(g).animate({height:f,opacity:"show"},"slow",function(){e.height("")}).dequeue();d.css({position:"absolute",width:d.width()}).fadeOut("slow",function(){d.css({position:"",width:""}).find(".loader").remove()})}else d.animate({height:"hide",marginTop:"hide",marginBottom:"hide",opacity:"hide"},"slow",function(){d.find(".loader").remove()})}}},removeProgressProviders:function(a,b){if($.isEmptyObject(a))typeof b=="function"&&b();else{var c=[],d;for(d in a)c.push("#loader_"+
d);c=$(c.join(", "),this.options.searchProgressSelector);c.length?c.fadeOut("fast",b):typeof b=="function"&&b()}},handleProgressProvider:function(a,b,c){if(this.options.searchProgressProvidersVisible){if(!(a in this._loaderProviders)){if(Object.keys(this._loaderProviders).length==this.options.searchProgressProvidersLimit)return;this._loaderProviders[a]=b}var a="loader_"+a,d=$("#"+a);d.length||(d=$('<div id="'+a+'" class="loader">'+b+"</div>").appendTo(this.options.searchProgressSelector),utils_box.attachEllipsisAndTooltip(d));
c&&d.addClass("active")}},restartPeriodicalUpdater:function(a,b){this._resultOffset=a?a:0;if(!this._periodicalUpdater||!this._periodicalUpdater.inProgress())this._periodicalUpdater=null,this.updateResults(b)},stopPeriodicalUpdater:function(){if(this._periodicalUpdater)this._periodicalUpdater.abort(),this._periodicalUpdater=null},changeResultPageEvent:function(a,b){a.disabled=!0;var c=$(a).attr("id").match(/\d+/),c=c==null?0:c[0];$.hash().param("page",c).apply();this.restartPeriodicalUpdater(c,b)},
onStartSearch:function(a){a||($(this.options.filterBlockSelector).html(""),this.options.searchProgressProvidersEnabled&&$(this.options.priceTabsSelector).hide());this.clearResultList();this.displayStatusPanel()},onSearchStop:function(){},preUpdateResults:function(){},postUpdateResults:function(){},onUpdateSuccess:function(){},disableSearchButton:function(){},onUpdateFinished:function(){var a=$(this.options.listPagerBlockSelector);a.html()&&a.show()},getDetailsFromUrl:function(){var a=$.hash();if(a.hasParam("details")){var b=
this,c=$.makeArray(a.param("details")),d=[];$(this.options.showDetailsSelector).each(function(){var a=b._getTripId(this);a&&$.inArray(a,c)>-1&&d.push(a)});d.length?this.openDetails(d):a.removeParam("details").apply()}},openDetails:function(a){var b=this,a=$.makeArray(a);this._trips=$.unique($.merge(this._trips,a));this._setDetailsHash(this._trips);this._trips=this._cropDetailsList(this._trips);$.each(this._trips,function(a,d){b.expandOfferDetails(d)})},updateDetailsRequest:function(a){this._trips.length>
0?(this._currentTrip=this._trips.splice(0,1)[0],this.changeDetailsRequestOptions(a,this._currentTrip.tripId)):(this._currentTrip=null,a.stop())},changeDetailsRequestOptions:function(a,b,c){a.updateOptions($.extend({url:this.options.detailsUrl+"/"+this._handle+"/"+b},c||{}))},getOfferDetails:function(a){var b=this._findParentNode(a,this.options.resultRowClassName),a=this._getTripId(a);a!==null&&this.openDetails([{tripId:a,row:b}])},expandOfferDetails:function(a){a=this._getTripRow(a);if(a.length){var b=
a.find("."+this.options.detailsFullClass);b.is(":visible")||(a.find("."+this.options.detailsSummaryClass).hide(),b.show(),utils_box.attachEllipsisAndTooltip(b.find(this.options.detailsLegAirportsSelector)),utils_box.attachEllipsisAndTooltip(b.find(this.options.detailsLegStopsSelector)),utils_box.attachEllipsisAndTooltip(b.find(this.options.detailsLegAirlineNameSelector)),b.find(this.options.detailsLegFlightNumberSelector).tipTip({delay:0,maxWidth:"auto",defaultPosition:"top"}),this._addProviderTiptip($(this.options.providersSelector,
this.options.detailsFullSelector)))}},collapseOfferDetails:function(a){this._removeDetailsHash(a);var b=$.inArray(a,this._trips);b>-1&&this._trips.splice(b,1);b=this._getTripRow(a);a=b.find("."+this.options.detailsFullClass);a.is(":hidden")||(b=b.find("."+this.options.detailsSummaryClass),a.hide(),b.show())},showDetailsLoadingLayer:function(a,b){var c=$(a).find("."+this.options.detailsLoaderClass);c.length||(c=$('<div class="'+this.options.detailsLoaderClass+'"></div>'),c.appendTo($(a)),c.html($(this.options.detailsLoaderSelector).html()));
b?c.find(this.options.detailsLoaderContentSelector).hide():c.find(this.options.detailsLoaderContentSelector).show();c.show()},hideDetailsLoadingLayer:function(){},showDetailsErrorLayer:function(){},showListExpiredMessage:function(a){a&&$(this.options.listExpiredSelector).show()},_startSearchSuccess:function(a){!a||a.status!=1?this.displayErrorLayer():(this._handle=a.handle,this.updateResults())},_setDetailsHash:function(a){var b=$.hash(),a=$.unique($.merge($.makeArray(b.param("details")),$.makeArray(a)));
a.length>this.options.detailsFromUrlLimit&&(a=a.slice(0,this.options.detailsFromUrlLimit));b.param("details",a.length?a:null).apply()},_cropDetailsList:function(a){return $.makeArray(a).slice(0,this.options.detailsFromUrlLimit)},_removeDetailsHash:function(a){var b=$.hash(),c=$.makeArray(b.param("details")),d;(d=$.inArray(a,c))>-1&&c.splice(d,1);b.param("details",c.length?c:null).apply()},_pushToStack:function(a,b){if(typeof a!="object")return[b];var c=!1,d;for(d in a)if(a[d]==b){c=!0;break}c||a.push(b);
return a},_removeFromStack:function(a,b){if(typeof a!="object")return[];for(var c in a)if(a[c]==b){a.splice(c,1);break}return a},_attachSearchProgressStopEvent:function(){var a=this;$(this.options.searchProgressStopSelector).click(function(){a._searchRequestAborted=!0;a.stopSearch();a.options.abortUrl&&$.get(a.options.abortUrl+"/"+a._handle);a.options.searchProgressProvidersEnabled&&$(".loader",a.options.searchProgressSelector).remove()})},_attachNoResultsRestartSearchEvent:function(){var a=this;
$(this.options.noResultsRestartSearchSelector).unbind("click").click(function(b){a._restartNoResultsSearch(b)})},_restartNoResultsSearch:function(){this.hideNoResults();this._searchCount=0;this.startSearch(!0)},_attachListExpiredUpdateEvent:function(){var a=this;$(this.options.listExpiredUpdateSelector).click(function(){a._searchCount=0;a.startSearch();a.hideFilterBlock();$(a.options.listExpiredSelector).hide()})},_getPeriodicalUpdater:function(a){var b={requestid:this.options.requestId,spl:this.options.spl};
typeof a=="object"&&(b=$.extend({},a,b));var a=new periodicalupdater({url:this._getUpdateResultsUrl(),type:"POST",data:b,frequency:this.options.listPeriodicalUpdaterStepTimeout,maxTimeout:this.options.listPeriodicalUpdaterMaxTimeout}),c=this;a.addMethods({success:function(a){c._handleResponseContent(a)},error:function(a,b,f){this._parent(a,b,f);c.pageIsReloading=$.xhr.isReload(a);c.hideStatusPanel();c.pageIsReloading||($.xhr.isError(a)?c.displayErrorLayer():!$(c.options.resultBlockTopSelector).html()&&
!$(c.options.resultBlockBottomSelector).html()&&(c.displayNoResults(),c.clearResultList()))},abort:function(){this._parent();c.hideStatusPanel();c.onUpdateFinished();c._searchRequestAborted=!1}});return a},_getUpdateResultsUrl:function(){return[this.options.updateResultsUrl,this._handle,this._resultOffset].join("/")},_handleResponseContent:function(a){a.status!=1&&this.displayErrorLayer();this._publishResults(a);this.onUpdateSuccess()},_pushPriceMatrixPrice:function(){typeof airsearch_pricematrix_getprice!=
"undefined"&&airsearch_pricematrix_getprice()},_publishResults:function(a){if(!a||!a.results||a.results.listTop==null||a.results.listBottom==null||a.results.filters==null)this.displayErrorLayer();else if(a.results.expired)this.stopSearch(),this.startSearch(),this.hideFilterBlock();else{this.handleProgressPanel(a.results.providers,a.morePending);!a.results.listTop&&!a.results.listBottom&&!a.morePending?this.displayNoResults():this.hideNoResults();if(a.results.filters){this.showFilterBlock();var b=
$(this.options.filterBlockSelector);b.html(a.results.filters);b.find('input[type="checkbox"]:disabled').prop("disabled",!1).parents(".filterItem").removeClass("inactive");if(window.prototypeNoSingleValueSliderFilters){var c=b.find(".legFilters");b.find('div.rangeFilter span[id^="ranges_slider-"]').each(function(a,b){var b=$(b),f=b.parents(".filterBlockContent").eq(0),g=f.parents(".filterBlock").eq(0),h=b.text();h!=null&&(h=h.split(";"),h[0]==h[1]&&(f.remove(),g.find("hr.routeFilterDivide").remove()));
g.find(".noRouteFilter").remove();g.find(".filterBlockContent").children().length||g.remove();c.find("form").children().length||c.remove()})}}if(a.results.listTop||a.results.listBottom)$(this.options.priceDisclaimerSelector).show(),$(this.options.resultBlockTopSelector).html(a.results.listTop),$(this.options.resultBlockBottomSelector).html(a.results.listBottom),$("body").trigger("resultloader.published"),this._attachListTooltips(),utils_box.attachEllipsisAndTooltip(this.options.resultListContentSelector+
" .resultList .legAirline"),utils_box.attachEllipsisAndTooltip(this.options.resultListContentSelector+" .resultList .legLocations"),a.results.pager&&$(this.options.listPagerBlockSelector).html(a.results.pager),this._pushPriceMatrixPrice();a.morePending||(this.hideStatusPanel(),this.stopSearch(),this.getDetailsFromUrl())}},_attachListTooltips:function(){var a=this;$(this.options.resultListContentSelector).find(this.options.stopsDetailsSelector).each(function(){var b=$(this);$(a.options.stopsCountSelector,
b.parent()).tipTip({delay:0,maxWidth:"auto",content:b.html(),defaultPosition:"top"})});this._addProviderTiptip($(this.options.providersSelector))},_attachDetailsWindowEvents:function(){var a=this,b=$(this.options.resultListContentSelector);b.delegate([this.options.showDetailsSelector,this.options.showMoreProvidersSelector].join(","),"click",function(){var b=a._getTripId(this);b!=null&&a.openDetails(b)});b.delegate(this.options.hideDetailsSelector,"click",function(){var b=a._getTripId(this);b!=null&&
a.collapseOfferDetails(b)})},_getTripId:function(a){a=$(a).attr("id");if(!a)return null;a=a.match(/-([0-9a-f]+?)$/i);return a[1]?a[1]:null},_getTripRow:function(a){return $(this.options.hideDetailsSelector+'[id$="-'+a+'"]').parents("."+this.options.resultRowClassName).eq(0)},_attachMoreResultsEvent:function(){var a=this;$(this.options.listPagerBlockSelector).delegate("a.showPage","click",function(){a.changeResultPageEvent(this)})},clearResultList:function(){$(this.options.listPagerBlockSelector).html("").hide();
$(this.options.resultBlockTopSelector).html("");$(this.options.resultBlockBottomSelector).html("");$(this.options.priceDisclaimerSelector).hide()},hideFilterBlock:function(){$(this.options.filterContainerSelector).hide()},showFilterBlock:function(){$(this.options.filterContainerSelector).show()},_findParentNode:function(a,b){return!a||!a.length?null:$(a).parent("."+b)},_addProviderTiptip:function(a){a.filter("[title]").tipTip({delay:0,maxWidth:"auto",defaultPosition:"top"})}}),airsearch_controller=
$.Class({options:{scrollToTopSpeed:500,searchFormHandler:null,resultLoader:null,filterHandler:null,inlineAdLoader:null,priceMatrix:null,priceGraph:null,listPagerLoaderSelector:"#resultListPager .showPageLoader",priceMatrixUrl:""},_anchor:null,_ignoreDefaultFlightTimeParams:!1,init:function(a){if(a)this.options=$.extend({},this.options,a);this._overrideDefaultAnchorBehavior();this._createUrlChangeCallback();this._scrollIntoView();this._extendSearchFormHandler();this._attachEventsToAutocompleters()},
initPriceTabs:function(){this.options.priceMatrix&&this.options.priceGraph&&(this._setupPriceGraphs(),this._setupPriceMatrix(),this.options.priceGraph.load())},startSearch:function(){this.options.resultLoader==null||this.options.searchFormHandler==null||this.options.filterHandler==null||(this.options.searchFormHandler.toggleNonStopCheckbox(this.options.filterHandler.getFilteringValues()),this._extendResultLoader(),this._extendFilterHandler(),this.options.searchFormHandler.disableSearchButton(!0),
this.options.resultLoader.startSearch())},_extendResultLoader:function(){var a=this;this.options.resultLoader.addMethods({disableSearchButton:function(b){a.options.searchFormHandler.disableSearchButton(b)},changeResultPageEvent:function(b,c){typeof c=="undefined"&&(c=a.options.filterHandler.getFilteringValues());this._parent(b,c);this.hideStatusPanel(!0);this._updateIsPageChange=!0;$(a.options.listPagerLoaderSelector).show()},onUpdateSuccess:function(){this._parent();a.options.filterHandler.onUpdateSuccess()},
updateResults:function(b){typeof b=="undefined"&&(b=a.options.filterHandler.getFilteringValues());this._ignoreDefaultFlightTimeParams?(this._ignoreDefaultFlightTimeParams=!1,b=a.options.searchFormHandler.getDefaultFlightTimeParams(b,a.options.filterHandler.options.filterDepTimeParamPrefix)):b=a.options.searchFormHandler.addDefaultFlightTimeParams(b,a.options.filterHandler.options.filterDepTimeParamPrefix);a.options.searchFormHandler.toggleNonStopCheckbox(b);this._parent(b)},_restartNoResultsSearch:function(b){if(a.options.filterHandler.hasFilters()){a.options.filterHandler.clearFilters();
this._ignoreDefaultFlightTimeParams=!0;var c=a.options.searchFormHandler;$(c.options.searchFormSelector+" ."+c.options.rowStyleClass).each(function(){var a=c._getNodeLegIndex(this);a!==!1&&($(c.options.timeSelectorPrefix+a).val(c._urlFlightTimeOptions[a]),$(c.options.timeSelectorPrefix+a+"-custom").remove())})}this._parent(b)},displayNoResults:function(){a.options.filterHandler.hasFilters()?$(this.options.noResultsRestartSearchSelector).show():$(this.options.noResultsRestartSearchSelector).hide();
this._parent()},onUpdateFinished:function(){if(this._updateIsPageChange)this.hideStatusPanel(!0),$(a.options.listPagerLoaderSelector).hide(),this._updateIsPageChange=!1;a.options.priceMatrix&&a.options.priceGraph&&(a.options.priceMatrix.loading||a.options.priceMatrix.reload(),a.options.priceGraph.load());this._parent()},_startSearchSuccess:function(b){this._parent(b);a.options.inlineAdLoader&&a.options.inlineAdLoader.execute(this._handle)}})},_extendFilterHandler:function(){var a=this,b=a.options.searchFormHandler.options.nonStopHashKey;
this.options.filterHandler.addMethods({updateResults:function(){this._parent(a.options.resultLoader)},toggleFilterOption:function(c){this._parent(c);this._getFilterHashName(c)==b&&(c=$(c),c=c.parents(this.options.blockContentSelector).find(this.options.listFilterValueSelector+":checked"),c.length==1&&$(c[0]).attr("value")=="0"?a.options.searchFormHandler.setNonStop(!0):a.options.searchFormHandler.setNonStop(!1))},_getFlightTimeFilterUrlValue:function(b,d,e){if($(e).attr("id").replace("hidden_","").indexOf(this.options.depTimeSliderIdPrefix)===
0){var f=this._getNodeLegIndex(e);if(f!==!1){var g=a.options.searchFormHandler,h=$(g.options.timeSelectorPrefix+f).val();if(utils_type.is_numeric(h)&&g._urlFlightTimeOptions[f]){h!=g._urlFlightTimeOptions[f]?b.param(d,$(e).val()):b.removeParam(d);return}}}this._parent(b,d,e)}})},_overrideDefaultAnchorBehavior:function(){var a=this;$("body").delegate('a[href^="#"]',"click",function(b){b.preventDefault();$.hash().anchor($(this).attr("href").substr(1)).apply();a._scrollIntoView()})},_scrollIntoView:function(){this._anchor=
$.hash(this.url).anchor();this._anchor.length&&$.scrollTo("#"+this._anchor+', a[name="'+this._anchor+'"]',this.options.scrollToTopSpeed)},_createUrlChangeCallback:function(){var a=this;$.history().urlchange(function(){var b=$.hash(this.url).anchor();b&&b!=a._anchor&&a._scrollIntoView()})},_extendSearchFormHandler:function(){var a=this;this.options.searchFormHandler.addMethods({_initAutoCompleter:function(b){var c=new airsearch_autocomplete({id:$(b).attr("id"),url:this.options.autoCompleteUrl,searchInputErrorClass:this.inputErrorStyleClass});
a._extendAutocompleterInstance(c);return this._parent(b,c)}})},_setupPriceGraphs:function(){var a=PriceGraphs.prototype;a._getSelectedTripType=function(){var a=$(".formInputRow"),b=a.attr("id").match(/\d+/)[0],b=$("#hidden_dstInput-"+b);return a.length>=2||!b.length?"return":"oneway"};a.refreshObservables=function(){var a=$(".formInputRow"),b=a.attr("id").match(/\d+/)[0],c=a.length>1?a.eq(1).attr("id").match(/\d+/)[0]:null,d=$("#hidden_dstInput-"+b),a=a.length>=2||!d.length?"return":"oneway";this.setObservables({depInputId:"depInput-"+
b,hidden_depInputId:"hidden_depInput-"+b,dstInputId:a=="return"?"depInput-1":"dstInput-"+b,hidden_dstInputId:a=="return"?"hidden_depInput-1":"hidden_dstInput-"+b,depDateInputId:"flightDate-"+b,retDateInputId:c?"flightDate-"+c:null,onewayInputId:"searchType-o",returnInputId:"searchType-r"})};var b=this.options.priceGraph;b.addMethods&&b.addMethods({_getSelectedTripType:a._getSelectedTripType,refreshObservables:a.refreshObservables});var c=$($(".formInputRow").get(0)).attr("id").match(/\d+/)[0],d=b._getSelectedTripType(),
a=$("#hidden_depInput-"+c).val(),e=null,e=d!="return"?$("#hidden_dstInput-"+c).val():$("#hidden_depInput-1").val(),c=$("#flightDate-"+c).val(),d=null;$(".formInputRow").length>1&&(d=$($(".formInputRow").get(1)).attr("id").match(/\d+/)[0],d=$("#flightDate-"+d).val());b.refreshObservables();b.setDep(a.split("|",3)[2]);b.setDepFull(a.split("|",3)[0]);b.setDepUrlName(a.split("|",3)[1]);b.setDst(e.split("|",3)[2]);b.setDstFull(e.split("|",3)[0]);b.setDstUrlName(e.split("|",3)[1]);b.setDepDate(c);b.setDepDeviation(0);
d&&(b.setRetDate(d),b.setRetDeviation(0));b.bindObservers();b.getTeaser();b.fold()},_setupPriceMatrix:function(){var a=this;this.options.priceMatrix.urlDatesPartRx=/\w{3}-\w{3}-(\d{4}-\d{2}-\d{2})-\d-\d-\d(?:\/.*?\w{3}-\w{3}-(\d{4}-\d{2}-\d{2})-\d-\d-\d)?/;this.options.priceMatrix.getRefreshUrlTemplateCallback=function(){var a=top.location.href;if(!a.match(/\d{4}-\d{2}-\d{2}/))return a;if(a.indexOf("/flexible/1")==-1){var c=a.indexOf("#");c==-1?a+="/flexible/1":a=a.substr(0,c)+"/flexible/1"+a.substr(c)}return a=
a.replace(/(\w{3}-\w{3}-)\d{4}-\d{2}-\d{2}(-\d-\d-\d)/,"$1<DEPD>$2").replace(/(\w{3}-\w{3}-)\d{4}-\d{2}-\d{2}(-\d-\d-\d)/,"$1<RETD>$2")};this.options.priceMatrix.getMatrixUrlTemplateCallback=function(){var b={};$(".filtersContent .filterItemCheck input").each(function(a,c){var d=c.name.replace(/filters\[([a-z]+)\]\[(\d*)\]/,"$1$2");c.value!="all"&&c.value!="Mixed"&&(b[d]||(b[d]=[]),b[d][b[d].length]=c)});var c="";$.each(b,function(a,b){var d=!0,h=!1,j=[];$.each(b,function(a,b){d&=$(b).is(":checked");
h|=$(b).is(":radio");$(b).is(":checked")&&j.push(b.value)});if((!d||h)&&j.length>0)c+="/"+a+"/"+j.join(",")});var d=a.options.filterHandler.getFilteringValues();d.filters&&d.filters.dt&&(d.filters.dt[0]&&(c+="/dt0/"+d.filters.dt[0]),d.filters.dt[1]&&(c+="/dt1/"+d.filters.dt[1]));c.substring(c.length-1,c.length)=="/"&&(c=c.slice(0,-1));return a.options.priceMatrixUrl+c}},_attachEventsToAutocompleters:function(){if(this.options.searchFormHandler&&this.options.searchFormHandler.options.cmp2Handler){var a=
this.options.searchFormHandler._autoCompleters,b;for(b in a){var c=$(a[b]).data("autocomplete");c&&this._extendAutocompleterInstance(c.options)}}},_extendAutocompleterInstance:function(a){if(this.options.searchFormHandler&&this.options.searchFormHandler.options.cmp2Handler){var b=this.options.searchFormHandler.options.cmp2Handler;a.addMethods({close:function(a,d){this._parent(a,d);setTimeout(function(){b.update()},200)},_onBlurFocusItem:function(a){this._parent(a);b.update()}})}}}),airsearch_filters=
$.Class({options:{activeLeg:0,blockHideSpeed:300,blockShowSpeed:300,sliderWidth:165,minSliderStep:600,minDurationSliderStep:10,filterParamAbbreviation:"f",filterLegParamName:"fleg",filterDepTimeParamPrefix:"f.dt.",filterDstTimeParamPrefix:"f.at.",filterAllOptionId:"all",filtersBlockSelector:"#filtersContent",blockSelector:".filterBlock",blockHeaderSelector:".filterBlockHeader",blockContentSelector:".filterBlockContent",blockCollapsedClassName:"filterBlockCollapsed",listFilterValueSelector:"input[type=checkbox]",
listFilterRadioSelector:".tripFilterList input[type=radio]",sliderHandleSelector:".flightTimeFilter .filterSlider",durationSliderHandleSelector:".durationFilters .filterSlider",timeSliderBlockClass:"timeFilters",timeSliderLabelClass:"rangeLb",activeTimeSliderLabelClass:"rangeLbAct",sliderRightLabelSelector:".rightRange .sliderLabelValue",activeTimeFilterLabelClass:"timeFilterActive",defaultCollpaseSelector:".defaultCollapse",userForcedFullIncludeValue:"~",userForcedNoneIncludeValue:"-",userForcingItemPattern:"^(aa|da|al)(_.*?)?_.*?$",
sliderContainerClass:"rangeFilter",activeSliderContainerClass:"activeRangeFilter",dayTimeOptions:{},dayTimeFieldPrefixSelector:"#flightTime-",depTimeSliderIdPrefix:"slider-dt-",dstTimeSliderIdPrefix:"slider-at-",econdaTrackerEnabled:!1,linkResetClass:"reset",linkResetSelector:"a.reset",linkResetXClass:"reset-x",linkResetXSelector:"a.reset-x",linkAllSelector:"a.all",linkNoneSelector:"a.none",linkNoneClass:"none",airlinesBlockSelector:"#filterBlock-al",airportsBlockSelector:"#filterBlock-ap",stopsBlockSelector:"#filterBlock-stops"},
_collapseStates:null,_timeSliderSelectStates:{},_econdatracker:null,init:function(a){if(a)this.options=$.extend({},this.options,a);this._attachFilterBlockToggleEvents();this._attachFilterCheckBoxesEvents();this._attachFilterRadioButtonEvents();this._attachTimeFilterEvents();a=$.hash();if(!this.options.activeLeg&&a.hasParam(this.options.filterLegParamName))this.options.activeLeg=a.param(this.options.filterLegParamName);this._econdatracker=new econdatracker},updateSliderReset:function(a){var b=$("#"+
a),c=b.slider("option"),b=b.closest(this.options.blockSelector).find(this.options.linkResetSelector),d=b.data("sliders")||[],e=$.inArray(a,d);c.min!=c.values[0]||c.max!=c.values[1]?e<0&&d.push(a):e>=0&&d.splice(e,1);b.data("sliders",d).toggle(d.length>0)},attachSliders:function(){var a=this;$(this.options.sliderHandleSelector).each(function(){var b=$(this),c=b.attr("id"),d=a._prepareSliderFields(this,a.options.minSliderStep,!0);$.extend(d,{slide:function(b,e){var f=typeof e.values!=="undefined"?e.values:
[e.value];$("#hidden_"+c).val(f.join("!"));a._isDateSlider(this)&&a.updateDateSliderLabels(this,e.values,d);window.prototypeNoAllOptions&&a.updateSliderReset(c)},stop:function(){a.updateSliderFilterUrlValues($("#hidden_"+$(this).attr("id")));a.updateResults()}});b.slider(d);if(window.prototypeNoAllOptions&&(!window.isMultiCity||window.prototypeResetMultiCity))if(b=b.closest(a.options.blockSelector),b=$(a.options.blockHeaderSelector,b),d.min!=d.values[0]||d.max!=d.values[1]){var e=$(a.options.linkResetSelector,
b);if(!e.length){var e=translate("AIRSEARCH_FILTER_RESET"),f=a.options.linkResetClass,g="";window.prototypeResetX&&(g=' title="'+e+'"',e="",f+=" "+a.options.linkResetXClass);e=$('<a class="'+f+'" href="#"'+g+">"+e+"</a>").appendTo(b).click(function(){var b=$(this);$.each(b.data("sliders"),function(b,c){var d=$("#"+c),e=[d.slider("option","min"),d.slider("option","max")];d.slider("option","values",e);d=$("#hidden_"+c);d.val(e.join("!"));a.updateSliderFilterUrlValues(d)});a.updateResults();b.data("sliders",
[]).hide();$("#tiptip_holder").hide();return!1})}b=e.data("sliders")||[];b.push(c);e.data("sliders",b)}});$(this.options.durationSliderHandleSelector).each(function(){var b=$(this).attr("id"),c=a._prepareSliderFields(this,a.options.minDurationSliderStep,!1);$.extend(c,{slide:function(d,e){var f=typeof e.values!=="undefined"?e.values:[e.value];$("#hidden_"+b).val(f.join("!"));a.updateDurationSliderLabels(this,e.value,c);window.prototypeNoAllOptions&&(f=$(a.options.linkResetSelector,$(this).closest(a.options.blockSelector)),
c.max!=c.value?f.show():f.hide())},stop:function(){a.updateSliderFilterUrlValues($("#hidden_"+b));a.updateResults()}});$(this).slider(c);if(window.prototypeNoAllOptions&&(!window.isMultiCity||window.prototypeResetMultiCity)){var d=$(this).closest(a.options.blockSelector),d=$(a.options.blockHeaderSelector,d),e=this;if(c.max!=c.value){var f=translate("AIRSEARCH_FILTER_RESET"),g=a.options.linkResetClass,h="";window.prototypeResetX&&(h=' title="'+f+'"',f="",g+=" "+a.options.linkResetXClass);$('<a class="'+
g+'" href="#"'+h+">"+f+"</a>").appendTo(d).click(function(){$(e).slider("option","value",c.max);var d=a._getFilterHashName($("#hidden_"+b));$.hash().removeParam(d).apply();a.updateResults();$(this).hide();$("#tiptip_holder").hide();return!1})}}});$("."+this.options.timeSliderBlockClass).each(function(b,c){$("label",c).removeClass(a.options.activeTimeFilterLabelClass);a.attachActiveSliderLabel(c)});$(this.options.linkResetXSelector).tipTip($.extend({},{delay:0,maxWidth:"auto",defaultPosition:"top"}))},
attachActiveSliderLabel:function(a){var b=this,c=$.hash();$('label > input[type="radio"]',a).each(function(){var a=$(this),e=a.parent(),f=a.val()=="dep",a=e.attr("id").match(/-(\d+)$/)[1],g=f?b.options.filterDepTimeParamPrefix:b.options.filterDstTimeParamPrefix,f=(f?b.options.depTimeSliderIdPrefix:b.options.dstTimeSliderIdPrefix)+a,h=$("#"+f).slider("option");c.hasParam(g+a)&&!(h.min==h.values[0]&&h.max==h.values[1])&&(e.addClass(b.options.activeTimeFilterLabelClass),window.prototypeNoAllOptions&&
b.updateSliderReset(f))})},toggleFilterBlock:function(a,b){a=$(a);typeof b=="undefined"&&(b=!1);var c=$(a.parent().find(this.options.blockContentSelector).get(0));c.css("display")=="none"?this.showFilterBlock(a,c,b):this.hideFilterBlock(a,c,b)},showFilterBlock:function(a,b,c){delete this._collapseStates[$(a).parent().attr("id")];$(a).removeClass(this.options.blockCollapsedClassName);c?b.show():b.slideDown(this.options.blockHideSpeed)},hideFilterBlock:function(a,b,c){var d=this;this._collapseStates[$(a).parent().attr("id")]=
!0;c?(b.hide(),$(a).addClass(this.options.blockCollapsedClassName)):b.slideUp(this.options.blockShowSpeed,function(){$(a).addClass(d.options.blockCollapsedClassName)})},collapseListedBlocks:function(){$(this.options.filtersBlockSelector).hide();this._initDefaultBlockCollapses();for(var a in this._collapseStates)this.toggleFilterBlock($("#"+a).find(this.options.blockHeaderSelector),!0);$(this.options.filtersBlockSelector).show()},selectTimeSlidersBlocks:function(){for(var a in this._timeSliderSelectStates)this.selectTimeFilter($("#"+
this._timeSliderSelectStates[a]));this.attachSliders()},updateResults:function(a){if(a){var b=$.hash();b.hasParam("page")&&b.removeParam("page").apply();a.isFiltering=!0;a.stopPeriodicalUpdater();a.restartPeriodicalUpdater(0,this.getFilteringValues())}},onUpdateSuccess:function(){this.attachAirlinesFilterEvents();this.attachStopsFilterEvents();this.collapseListedBlocks();this.attachFilterHeaderTooltips();this.selectTimeSlidersBlocks();this._attachStopsFilterEcondaTrackingEvents()},attachAirlinesFilterEvents:function(){if(window.prototypeNoAllOptions){var a=
this,b=function(){var b=$(this).hasClass(a.options.linkNoneClass)?!1:!0,c=$(this).closest(a.options.blockSelector),f=$(a.options.listFilterValueSelector,c).prop("checked",b);$(a.options.linkResetSelector,c).remove();$("#tiptip_holder").hide();b?f.closest(".filterItem").removeClass("inapplicable"):f.closest(".filterItem").addClass("inapplicable");a.updateFilterOptionUrl(f);a.updateResults();return!1},c=window.prototypeSingleAirportFilter?[this.options.airlinesBlockSelector,this.options.airportsBlockSelector].join(","):
this.options.airlinesBlockSelector;$(this.options.blockHeaderSelector,c).undelegate(this.options.linkResetSelector,"click",b).delegate(this.options.linkResetSelector,"click",b);$(this.options.blockContentSelector,c).undelegate(this.options.linkAllSelector,"click",b).delegate(this.options.linkAllSelector,"click",b).undelegate(this.options.linkNoneSelector,"click",b).delegate(this.options.linkNoneSelector,"click",b)}},attachStopsFilterEvents:function(){if(window.prototypeNoAllOptions){var a=this,b=
$(a.options.linkResetSelector,this.options.stopsBlockSelector);b.length&&b.click(function(){$(".filterItem",b.closest(a.options.blockSelector)).addClass("inapplicable");var c=null;if($("#stops_all").length)$("#stops_all").prop("checked",!0).closest(".filterItem").removeClass("inapplicable"),c=a.options.userForcedFullIncludeValue;else if($("#stops_0\\,1").length)$("#stops_0\\,1").prop("checked",!0).closest(".filterItem").removeClass("inapplicable"),c=$("#stops_0\\,1").val().split(",");else return;
$.hash().param("f.stops",c).apply();b.remove();$("#tiptip_holder").hide();a.updateResults();return!1})}},toggleFilterOption:function(a){a=$(a);a.parents(".filterItem").toggleClass("inapplicable",!a.prop("checked"));var b=a.parents(this.options.blockContentSelector).find(this.options.listFilterValueSelector+":checked");a.val()==this.options.filterAllOptionId?(this._toggleAll(a,!1),this._handleAllOption(a.parents(this.options.blockContentSelector))):b.length&&b.eq(0).val()==this.options.filterAllOptionId?
this._toggleAll(a,!1):this.updateFilterOptionUrl(a);this.updateResults()},clickFilterRadioOption:function(a){var a=$(a),b=this._getFilterHashName(a),a=a.val(),c=$.hash(),d=c.hasParam(b)?c.param(b):this.options.filterAllOptionId;Array.isArray(d)&&(d=d.join(","));d!=a&&(a==this.options.filterAllOptionId?b=="f.stops"?c.param(b,this.options.userForcedFullIncludeValue):c.removeParam(b):c.param(b,a.split(",")),c.apply(),this.updateResults())},updateFilterOptionUrl:function(a){var a=$(a),b=this._getFilterHashName(a);
if(b&&a.val()!=this.options.filterAllOptionId){var c=$.hash(),d=this;if(window.prototypeNoAllOptions){var e={},f=$(this.options.listFilterValueSelector,window.prototypeSingleAirportFilter?[this.options.airlinesBlockSelector,this.options.airportsBlockSelector].join(","):this.options.airlinesBlockSelector);if(a.is(f)){var g=[],h=[],j={},k={};a.each(function(a,b){var b=$(b),c=b.attr("name");if(g.indexOf(c)==-1){g.push(c);h.push('[name="'+c+'"]');var e=d._getFilterHashName(b);e&&(j[c]=e)}});f=f.filter(h.join(","));
a.length==1&&(a=f);a.each(function(a,b){var b=$(b),c=b.attr("name");k[c]=(k[c]||0)+1;if(b.is(":checked")&&(c=j[b.attr("name")]))e[c]||(e[c]=[]),e[c].push(b.val())});$.each(j,function(a,b){!e[b]||!e[b].length?c.param(b,d.options.userForcedNoneIncludeValue):k[a]==e[b].length?c.removeParam(b):c.param(b,e[b])});c.apply();return}}e=[];f=$.makeArray(c.param("details"));if(f.length)e.details=f;c.hasParam(b)&&(e=$.makeArray(c.param(b)));e=a.is(":checked")?this._handleOptionChecked(a,e):$.grep(e,function(b){return b!=
a.val()});e!=null&&e.length?c.param(b,e):c.removeParam(b);c.apply()}},updateSliderFilterUrlValues:function(a){var b=this._getFilterHashName(a);if(b&&$(a).val()!=this.options.filterAllOptionId){var c=$.hash();this._getRangeFilterUrlValue(c,b,a);c.apply()}},getFilteringValues:function(){var a=$.hash().param(),b={filterLeg:this.options.activeLeg},c;for(c in a){var d=c.match(/^f\.(.+?)(?:\.(.+?))?$/);if(d){if(typeof b.filters=="undefined")b.filters={};typeof b.filters[d[1]]=="undefined"&&(b.filters[d[1]]=
{});d[2]?b.filters[d[1]][d[2]]=a[c]:b.filters[d[1]]=a[c]}else c!=this.options.filterLegParamName&&(b[c]=a[c])}return b},updateDateSliderLabels:function(a,b,c){this._updateFlightTimeRangeLabel($(a).parent(),b,c)},updateDurationSliderLabels:function(a,b){var c=$(a).parent(),d=Math.floor(b/60);$(c).find(this.options.sliderRightLabelSelector).html(d+"h "+(b-d*60)+"m");c=c.find("."+this.options.timeSliderLabelClass);c.length&&(c.hasClass(this.options.activeTimeSliderLabelClass)||c.addClass(this.options.activeTimeSliderLabelClass))},
getDayTimeLabel:function(a,b){if(b===0)return this.options.dayTimeOptions[0];var c=this._getNodeLegIndex(a);if(c===!1)return"";var d="";$(this.options.dayTimeFieldPrefixSelector+c+" option").each(function(){b==$(this).val()&&(d=$(this).html())});return d},hasFilters:function(){return this.getFilteringValues().filters!==void 0?!0:!1},clearFilters:function(){var a=$.hash(),b=a.param(),c;for(c in b)c.match(/^f\.(.+?)(?:\.(.+?))?$/)&&a.removeParam(c);a.apply()},attachFilterHeaderTooltips:function(){utils_box.attachEllipsisAndTooltip(this.options.blockHeaderSelector,
{defaultPosition:"right"})},_attachFilterBlockToggleEvents:function(){var a=this;$(this.options.filtersBlockSelector).delegate(this.options.blockHeaderSelector,"click",function(){a.toggleFilterBlock(this)})},_attachTimeFilterEvents:function(){var a=this;$(this.options.filtersBlockSelector).delegate("."+this.options.blockContentSelector+" > ."+this.options.timeSliderBlockClass+" > label","click",function(){if(window.prototypeNoAllOptions){var b=$(a.options.blockHeaderSelector,$(this).closest(a.options.blockSelector)),
c=$(this).attr("id").match(/\d$/),b=$(a.options.linkResetSelector,b);$(this).hasClass("timeFilterDep")?(b.filter("."+a.options.depTimeSliderIdPrefix+c).show(),b.filter("."+a.options.dstTimeSliderIdPrefix+c).hide()):(b.filter("."+a.options.depTimeSliderIdPrefix+c).hide(),b.filter("."+a.options.dstTimeSliderIdPrefix+c).show())}a.selectTimeFilter(this);$(this).siblings().removeClass(a.options.activeTimeFilterLabelClass);a.attachActiveSliderLabel($(this).parent())})},selectTimeFilter:function(a){var b=
$("input",a);if(b.length&&!(b.val()!="dep"&&b.val()!="dst")){var a=$(a),c=a.attr("id"),d=c.match(/\d+/);d&&(b.prop("checked",!0),this._timeSliderSelectStates[d]=c,a=a.parent(),c="."+this.options.sliderContainerClass,$(c,a).removeClass(this.options.activeSliderContainerClass),b.val()=="dep"?$(c,a).eq(0).addClass(this.options.activeSliderContainerClass):$(c,a).eq(1).addClass(this.options.activeSliderContainerClass))}},_attachFilterCheckBoxesEvents:function(){var a=this;$(a.options.filtersBlockSelector).delegate(a.options.listFilterValueSelector,
"click",function(){var b=$(this);if(b.val()==a.options.filterAllOptionId&&!b.is(":checked"))return!1;a.toggleFilterOption(this)})},_attachFilterRadioButtonEvents:function(){var a=this;$(a.options.filtersBlockSelector).delegate(a.options.listFilterRadioSelector,"click",function(){a.clickFilterRadioOption(this)})},_handleAllOption:function(a){var b=this,c=$.hash(),d=null;a.eq(0).find(b.options.listFilterValueSelector).each(function(a,c){var g=$(c);g.prop("checked",g.val()==b.options.filterAllOptionId);
d||(d=b._getFilterHashName(c))});c.removeParam(d).apply();c.param(d,this.options.userForcedFullIncludeValue).apply()},_toggleAll:function(a,b){var c=this,a=$(a);a.parents(this.options.blockContentSelector).eq(0).find(this.options.listFilterValueSelector).each(function(d,e){$(e).attr("id")!=a.attr("id")?$(e).prop("checked",b):$(e).prop("checked",!0);var f=$(e).parent().find(c.options.listFilterValueSelector);c.updateFilterOptionUrl($(f))})},_getNodeLegIndex:function(a){return(a=$(a).attr("id").match(/\d+/))?
a[0]:!1},_prepareSliderFields:function(a,b,c){var d=$("#ranges_"+$(a).attr("id"));if(!d.html())return null;d=d.html().trim().split(";");if(d.length!=1&&d.length!=2)return null;a=$("#hidden_"+$(a).attr("id"));if(!a.val())return null;a=a.val().trim().split("!");if(a.length!=1&&a.length!=2)return null;for(var e=0;e<a.length;e++)a[e]=parseInt(a[e]);var c=!c||d.length==1||d[0]==0||a.length==1?!1:!0,e=d.length<2?0:parseInt(d[0]),d=d.length<2?parseInt(d[0]):parseInt(d[1]),f=Math.ceil((d-e)/this.options.sliderWidth),
f=Math.ceil(f/b)*b,b={range:c?!0:"min",min:e,max:d,step:f};c?b.values=a:b.value=a[1];return b},_isDateSlider:function(a){return $(a).parent().parent().hasClass(this.options.timeSliderBlockClass)?!0:!1},_proccessSliderDate:function(a,b){var c=this._getLocalDate(a);typeof b=="undefined"&&(b=!0);return(b?translate("LANG_DATE_FORMAT_WEEKDAY_"+(c.getDay()!==0?c.getDay():7))+", ":"")+c.getHours().toString().replace(/^(\d)$/,"0$1")+":"+c.getMinutes().toString().replace(/^(\d)$/,"0$1")},_getLocalDate:function(a){a*=
1E3;var b=new Date(a);b.setTime(a+b.getTimezoneOffset()*6E4);return b},_getFilterHashName:function(a){a=this._explodeFilterName(a);return!a?null:this.options.filterParamAbbreviation+"."+a[1]+(a[2].length>0?"."+a[2]:"")},_explodeFilterName:function(a){a=$(a).attr("name").match(/^.*?\[(.*?)\]\[(.*?)\]$/);return!a||a.length!=3?null:a},_pushFilterParamToStack:function(a,b){if(typeof a!="object")return[b];$.inArray(b,a)<0&&a.push(b);return a},_removeFilterParamFromStack:function(a,b){if(typeof a!="object")return[];
for(i in a)if(a[i]==b){a.splice(i,1);break}return a},_getPriceFilterUrlValue:function(a,b,c){var d=$(c).attr("id").match(/^hidden_(.*)$/);d&&(d=$("#ranges_"+d[1]).html().split(";"),d.length==2&&(d[1]==$(c).val()?a.removeParam(b):a.param(b,$(c).val())))},_getRangeFilterUrlValue:function(a,b,c){var d=$("#"+$(c).attr("id").replace(/hidden_/,"ranges_"));b.indexOf(this.options.filterDepTimeParamPrefix)==-1&&$(c).val().replace("!",";")==d.html()?a.removeParam(b):a.param(b,$(c).val())},_initDefaultBlockCollapses:function(){if(this._collapseStates===
null){this._collapseStates={};var a=this;$(this.options.filtersBlockSelector).find(this.options.defaultCollpaseSelector).each(function(){a._collapseStates[$(this).attr("id")]=!0})}},_handleOptionChecked:function(a,b){var c=this.options.userForcedFullIncludeValue;console.log(a,b,c);b.join()==c&&(b=[]);b=this._pushFilterParamToStack(b,a.val());if(!this.options.userForcingItemPattern)return null;if(RegExp(this.options.userForcingItemPattern).test($(a).attr("id"))){var d=!0,e=this,f=$(a).parents(this.options.blockContentSelector).get(0);
$(f).find(e.options.listFilterValueSelector).each(function(a,b){var c=$(b);!c.is(":checked")&&!c.is(":disabled")&&c.val()!=e.options.filterAllOptionId&&(d=!1)});return!d?b:[c]}return null},_checkIfPredefinedRange:function(a,b){var c=(new Date).getTimezoneOffset()*6E4,a=new Date(a*1E3+c),b=new Date(b*1E3+c),c=[a.getHours(),a.getMinutes(),b.getHours(),b.getMinutes()].join("-");return this.options.dayTimeOptions[c]?this.options.dayTimeOptions[c]:!1},_updateFlightTimeRangeLabel:function(a,b,c){a=a.find("."+
this.options.timeSliderLabelClass);if(a.length){a.hasClass(this.options.activeTimeSliderLabelClass)||a.addClass(this.options.activeTimeSliderLabelClass);var d=this._getLocalDate(c.min),c=this._getLocalDate(c.max),c=d.getDay()==c.getDay()?!1:!0;a.find("span:first").html(this._proccessSliderDate(b[0],c));a.find("span:last").html(this._proccessSliderDate(b[1],c))}},_updateFlightTimeTextLabel:function(a,b,c){a=a.find("."+this.options.timeSliderLabelClass);(b=this.getDayTimeLabel(b,c))&&a.html(b);a.hasClass(this.options.activeTimeSliderLabelClass)||
a.addClass(this.options.activeTimeSliderLabelClass)},_attachStopsFilterEcondaTrackingEvents:function(){if(this.options.econdaTrackerEnabled){var a=this;$(this.options.stopsBlockSelector).delegate("input","click",function(){a._econdatracker.trackFlightFilterClick("stops",this.id)})}}}),airsearch_popupblockerhint=$.Class({options:{id:"#ieBlockerHint",closeSelectors:["#ieBlockerHintCloseButton","#ieBlockerHintNoThanks"],onCloseCallback:null},init:function(a){if(a)this.options=$.extend({},this.options,
a)},show:function(){this._adjustSize();this._animatedOpen();this._showBackground();var a=this;$(window).resize(function(){a._adjustSize();a._showBackground()});$.each(this.options.closeSelectors,function(b,c){$(c).click(function(){a.hide()})})},hide:function(){$(this.options.id).slideToggle(100);this.options.onCloseCallback()},_animatedOpen:function(){$(this.options.id).slideToggle(100)},_showBackground:function(){$(this.options.id).overlay({mask:{color:"#333",loadSpeed:200,opacity:0.75},top:0,closeOnClick:!1,
load:!0})},_adjustSize:function(){$(this.options.id).width(this._getWidth())},_getWidth:function(){var a=$(window).width();return a>1044?a:1044}}),airsearch_autocomplete=$.Class({selectRange:!0,hiddenPrefix:"#hidden_",defaultHiddenValue:null,searchInputErrorClass:"searchInputError",id:null,url:null,appendTo:"#swoodooAutocompleterMenu",appendContent:null,appendContentContainerClass:"ui-autocomplete-append-content",delay:300,minLength:3,dataType:"json",autoFill:!0,xhr:null,autoFocus:!0,_autocomplete:null,
closeTimeout:150,isInProgress:!1,customMenuStyleClass:"",init:function(a){typeof a!="undefined"&&a!=null&&$.extend(this,a);this._addEvents();this._autocomplete=$("#"+this.id).autocomplete().data("autocomplete");if(this._autocomplete.element.val())this._autocomplete.term=this._autocomplete.element.val();this._autocomplete.pending=!1;this._autocomplete.term="";this._autocomplete.preSelectedRange=!1;this._overrideRenderItem();this._overrideRenderMenu();this._autocompleteMenuRefresh();this._autocompleteMenuMove();
this._autocompleteMenuActivate();this._resizeMenu();this._response();this.search();this.close();this._initCustomOnBlur();this._initOnFocus();this._initCustomFieldEvents()},source:function(a,b){var c=this;this.options.xhr=$.ajax({url:this.options.url,dataType:this.options.dataType,data:{q:a.term},beforeSend:function(){c.isInProgress=!0;c.options._abortRequestCheck();c.options._showLoader(c.options.id)},success:function(a){if(a.status==="1"){if(!a.items.length){c.options.updateHiddenValue("");c.options._hideLoader(c.options.id);
c.options._addSearchError(c.options.id);return}a=$.map(a.items,function(a){return{label:a.label,value:a.name,name:a.name,hidden:a.hidden}});c.blurAutohide?(c.blurAutohide=!1,c.options._onBlurResponse(a)):b(a)}c.options._hideLoader(c.options.id);c.options._removeSearchError(c.options.id)},error:function(a,b){c.options._hideLoader(c.options.id);b!="abort"&&c.options._addSearchError(c.options.id)},complete:function(){c.isInProgress=!1}})},search:function(){$.extend(this._autocomplete,{search:function(a,
b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.pending=!1,this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)this.pending=!1;else return this._search(a)},_search:function(a){this.pending=!0;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)}})},_overrideRenderItem:function(){var a=this;$.extend(this._autocomplete,{_renderItem:function(b,c,d){a._renderItem(b,c,d)}})},_renderItem:function(a,
b,c){(!a.attr("id")||a.attr("id").length==0)&&a.attr("id","autocomplete_items_"+this._autocomplete.element[0].id);var d=b.label;d.indexOf("</a>")===-1&&(d="<a>"+d+"</a>");a=$("<li></li>").data("item.autocomplete",b).append(d).appendTo(a);typeof c!="undefined"&&a.attr("id","autocomplete_items_"+this._autocomplete.element[0].id+"_"+c);return a},_overrideRenderMenu:function(){var a=this;$.extend(this._autocomplete,{_renderMenu:function(b,c){a._renderMenu(b,c)}})},_renderMenu:function(a,b){$.browser.msie&&
a.addClass("ui-autocomplete-ie ui-autocomplete-ie"+Math.floor($.browser.version));this.customMenuStyleClass&&a.addClass(this.customMenuStyleClass);var c=$("<li></li>").appendTo(a),c=$("<ul></ul>").appendTo(c),d=this;$.each(b,function(a,b){d._renderItem(c,b,a)});this.appendContent&&a.append('<li class="'+this.appendContentContainerClass+'">'+this.appendContent+"</li>");$.browser.msie&&parseInt($.browser.version,10)<7&&$("<iframe></iframe>").attr("src","javascript:false;").attr("frameborder","0").addClass("ui-autocomplete-cover").css({left:0,
top:0,width:"100%",height:a.outerHeight()}).appendTo(a)},_autocompleteMenuRefresh:function(){$.extend(this._autocomplete.menu,{refresh:function(){var a=this;this.element.find("li > ul > li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(b){a.activate(b,$(this).parent())}).mouseleave(function(){a.deactivate()})}})},_autocompleteMenuMove:function(){$.extend(this._autocomplete.menu,{move:function(a,
b,c){this.active?(a=this.active[a+"All"](".ui-menu-item").eq(0),a.length?this.activate(c,a):this.activate(c,this.element.children(b))):this.activate(c,this.element.find(b))}})},_autocompleteMenuActivate:function(){$.extend(this._autocomplete.menu,{activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=this.element.find("ul"),d=b.offset().top-c.offset().top,e=c.scrollTop(),f=this.element.height();d<0?c.scrollTop(e+d):d+b.height()>=f&&c.scrollTop(e+d-f+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id",
"ui-active-menuitem").end();this._trigger("focus",a,{item:b})}})},_addEvents:function(){var a=this;this.addMethods({focus:function(b,c){a._focusItem(c.item)},select:function(b,c){a.updateHiddenValue(c.item.hidden,c.item.name)}})},_abortRequestCheck:function(){if(this.xhr!=null)this.xhr.abort(),this.xhr=null},_focusItem:function(a){if(this.autoFill){var b=a.name;if(typeof b!="undefined"){var c=$("#"+this.id),d=c.val();if(b.match(RegExp("^"+d,"i"))&&(c.val(b),this.updateHiddenValue(a.hidden,a.name),
this.selectRange&&typeof c.selectrange=="function"))c.selectrange(d.length,b.length),this._autocomplete.preSelectedRange=!0}}},_showLoader:function(a){$("#"+a).addClass("ui-autocomplete-loading")},_hideLoader:function(a){$("#"+a).removeClass("ui-autocomplete-loading")},_addSearchError:function(a){$("#"+a).addClass(this.searchInputErrorClass);this._autocomplete.pending=!1},_removeSearchError:function(a){$("#"+a).removeClass(this.searchInputErrorClass)},onblurSearch:function(a,b){a=a!=null?a:this._autocomplete.element.val();
this._autocomplete.term=this._autocomplete.element.val();if(a.length<this._autocomplete.options.minLength)return this._addSearchError(this._autocomplete.options.id),this._autocomplete.close(b);clearTimeout(this._autocomplete.closing);return this._autocomplete._trigger("search",b)===!1?void 0:this._onblurSearch(a)},clearStates:function(){this._autocomplete.term="";this._autocomplete.pending=!1},_triggerChange:function(a,b){var c=this;a.closing=setTimeout(function(){c.getHiddenValue()&&c.getHiddenValue()!=
c.defaultHiddenValue&&($($.idSelector(c.id)).trigger("change"),$(c.hiddenPrefix+$.selectorEscape(c.id)).trigger("change"),a._change(b))},this.closeTimeout)},close:function(){var a=this;$.extend(this._autocomplete,{close:function(b){clearTimeout(this.closing);this.pending=!1;this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",b),a._triggerChange(this,b))}})},updateHiddenValue:function(a){$(this.hiddenPrefix+this.id).val(a)},getHiddenValue:function(){return $(this.hiddenPrefix+
this.id).val()},_onblurSearch:function(a){this._autocomplete.pending=!0;this._autocomplete.element.addClass("ui-autocomplete-loading");var b=this;this._autocomplete.source({term:a},function(){var a=b._onBlurResponse.apply(b._autocomplete,arguments);b._triggerChange(b._autocomplete);return a})},_onBlurResponse:function(a){var b=this._autocomplete?this._autocomplete:this;a[0]!==void 0&&b.options._onBlurFocusItem(a[0]);b.close()},_onBlurFocusItem:function(a){var b=a.name;if(typeof b!="undefined")$("#"+
this.id).val(b),this._autocomplete.term=b,this.updateHiddenValue(a.hidden,a.name)},_response:function(){$.extend(this._autocomplete,{_response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close();(this.pending=!1)||this.element.removeClass("ui-autocomplete-loading")}})},_clearMenuState:function(a){if(this._autocomplete.menu.element.css("display")=="block"&&(this._autocomplete.close(a),!RegExp("^"+this._autocomplete.element.val()+
"\\|.+$").test(!this.getHiddenValue())))this._autocomplete.term=""},_initCustomOnBlur:function(){var a=this;$("#"+this.id).unbind("blur.autocomplete").bind("blur.autocomplete",function(b){a._autocomplete.pending=!0;if(a._autocomplete.preventOnBlur===!0)return a._autocomplete.preventOnBlur=!1;a._autocomplete.options.disabled?a._autocomplete.pending=!1:a.getHiddenValue()?(a._autocomplete.pending=!1,a._clearMenuState(b)):(clearTimeout(a._autocomplete.searching),a._autocomplete.searching=null,a._autocomplete.blurAutohide=
!0,a._autocomplete.xhr&&a._autocomplete.xhr.abort(),a._autocomplete.searching=setTimeout(function(){a._clearMenuState(b);a._autocomplete.term.toLowerCase()!=a._autocomplete.element.val().toLowerCase()?(a._autocomplete.selectedItem=null,a._autocomplete.blurAutohide=!1,a.onblurSearch(null,b)):(a._autocomplete.element.val()&&a._autocomplete.element.val().length<a.minLength&&a._addSearchError(a.id),a._autocomplete.pending=!1)},a._autocomplete.options.delay))})},_initOnFocus:function(){var a=this;$("#"+
this.id).focus(function(){a.defaultHiddenValue=a.getHiddenValue();a._autocomplete.blurAutohide=!1;$(this).select()})},_checkExternalClick:function(a){if(this._autocomplete.menu.element.is(":visible")){var b=this,c=$(a.target);if(c.attr("id")==this._autocomplete.element.attr("id"))clearTimeout(this._autocomplete.searching),this._autocomplete.closing=setTimeout(function(){b._autocomplete.close(a);b._autocomplete._change(a)},this.closeTimeout);else{if(c.attr("id")!==this._autocomplete.menu.element.find("ul").attr("id"))this.updateHiddenValue(""),
this._autocomplete.term="",this._autocomplete.element.trigger("blur");if(this._autocomplete.preventOnBlur===void 0&&!$.browser.mozilla)this._autocomplete.preventOnBlur=!0}}else delete this._autocomplete.preventOnBlur},_initCustomFieldEvents:function(){var a=this,b=$("#"+this.id),c=!1;b.unbind("keydown.autocomplete").bind("keydown.autocomplete",function(b){var e=$.ui.keyCode;switch(b.keyCode){case e.PAGE_UP:a._autocomplete._move("previousPage",b);c=!0;break;case e.PAGE_DOWN:a._autocomplete._move("nextPage",
b);c=!0;break;case e.UP:a._autocomplete._move("previous",b);c=!0;b.preventDefault();break;case e.DOWN:a._autocomplete._move("next",b);c=!0;b.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:if(a._autocomplete.menu.active)c=!0,b.preventDefault();else if(a._autocomplete.element.val()&&(e=a._autocomplete.element.val(),RegExp("(^"+e+"\\|)|(\\|"+e+"$)","i").test(a.getHiddenValue())||a.updateHiddenValue(""),!a.getHiddenValue()))$(b.target).trigger("blur"),$(b.target).focus(),a._autocomplete.term=
"",b.preventDefault();case e.TAB:c=!0;if(!a._autocomplete.menu.active)break;a._autocomplete.menu.select(b);break;case e.ESCAPE:a._autocomplete.element.val(a._autocomplete.term);a.updateHiddenValue("");a.clearStates();a._autocomplete.close(b);c=!0;break;case 86:case 88:(b.ctrlKey||b.metaKey)&&a._onKeyPress(b);break;case e.CONTROL:case e.ALT:case 91:case 93:case 224:c=!0;break;case e.BACKSPACE:$.browser.webkit&&a._onKeyPress(b)}});b.unbind("keyup.autocomplete").bind("keyup.autocomplete",function(b){var c=
$.ui.keyCode;switch(b.keyCode){case c.BACKSPACE:$.browser.msie&&a._onKeyPress(b)}});b.unbind("keypress.autocomplete");b.keypress(function(b){c?c=!1:a._onKeyPress(b)});$(document).mousedown(function(b){return a._checkExternalClick(b)})},_onKeyPress:function(a){var b=$.ui.keyCode,c=$(a.target).val(),d=!1;if(b.BACKSPACE==a.keyCode)this.updateHiddenValue(""),this._autocomplete.preSelectedRange?(this._autocomplete.preSelectedRange=!1,a.target.selectionStart!==void 0&&a.target.selectionEnd!==void 0&&(c=
c.substring(0,a.target.selectionStart)+c.substring(a.target.selectionEnd,c.length)),this._autocomplete.term=c,d=!0):c=a.target.selectionStart===0&&a.target.selectionEnd==c.length?"":c;c.length||this._removeSearchError($(a.target).attr("id"));this._autocomplete.options._abortRequestCheck();this._autocomplete.menu.element.is(":visible")&&this._autocomplete.close();c.length!=this._autocomplete.term.length&&(this.updateHiddenValue(""),this.clearStates());var e=this;clearTimeout(this._autocomplete.searching);
this._autocomplete.pending=!0;this._autocomplete.searching=setTimeout(function(){if(e._autocomplete.term.toLowerCase()!=e._autocomplete.element.val().toLowerCase())e._autocomplete.selectedItem=null,e._autocomplete.search(null,a);else if(e._autocomplete.pending=!1,d)d=!1,e._autocomplete.term=""},this._autocomplete.options.delay)},_resizeMenu:function(){$.extend(this._autocomplete,{_resizeMenu:function(){var a=this.menu.element;if($.browser.msie&&parseInt($.browser.version,10)<9){var b=Math.max(a.width("").outerWidth(),
this.element.outerWidth());a.outerWidth(b)}else b=Math.max(a.width("").css("min-width","").outerWidth(),this.element.outerWidth()),a.css("min-width",b),$.browser.msie&&parseInt($.browser.version,10)<7&&a.find("iframe.ui-datepicker-cover").css({left:0,top:0,width:"100%",height:a.outerHeight()})}})}});
(function(a,b){b.airsearch_pricetabs=function(){var c=a("#searchForm").searchform({selectors:{priceMatrix:"#flexible_date",searchType:'input[type="radio"][name="searchType"]',searchTypeReturn:"#searchType-r",searchTypeOneway:"#searchType-o",departure:"#depInput-0",departureHidden:"#hidden_depInput-0",destination:"#dstInput-0,#depInput-1",destinationHidden:"#hidden_dstInput-0,#hidden_depInput-1",departureDate:"#flightDate-0",returnDate:"#flightDate-1",submit:"#searchnow",cancel:"#searchInProgressStop"}}),
d=a("#pricetabs").pricetabs(),e=d.find(".ui-tabs-nav li a"),f=e.index(a("#pricetab-tab-charts")),g=e.index(a("#pricetab-tab-matrix")),h="/"+a.culture().language+"/"+a.localize("LANG_AIRSEARCH_URL");d.on("click",".collapse a",function(){d.pricetabs("select",-1);return!1});d.on("pricetabsshow",function(a,b){d.find(".collapse").show();b.index==g&&c.searchform("priceMatrix","check")});d.on("pricetabshide",function(a,b){d.pricetabs("option","selected")<0&&d.find(".collapse").hide();b.index==g&&c.searchform("priceMatrix",
"uncheck")});c.on("searchformsearchtypechange",function(){d.toggleClass("swoodoo-pricetabs-oneway",c.searchform("oneway","checked"),"fast")});c.on("searchformpricematrixchange",function(b,c){var e=a(c.input).is(":checked");d.pricetabs(e?"unfold":"fold",g)});c.searchform("oneway","checked")&&d.addClass("swoodoo-pricetabs-oneway");c.searchform("filled")&&(c.searchform("priceMatrix","checked")?d.pricetabs("select",g):b.startSearch||d.pricetabs("select",f),d.show());var j=a('<div id="pricematrix"/>').appendTo("#pricetab-matrix").pricematrix({labels:{today:a.localize("LANG_TODAY"),
outward:a.localize("LANG_FLIGHTTO"),backward:a.localize("LANG_FLIGHTBACK")},loader:a(".swoodoo-pricetabs-loading","#pricetab-matrix"),load:{url:function(){if(!c.searchform("filled"))return!1;var a=c.searchform("departure","code"),b=c.searchform("destination","code"),d=h+"/matrix/1/"+a+"-"+b+"-"+c.searchform("departureDate","get")+"-0-0-0";c.searchform("oneway","checked")||(d+="/"+b+"-"+a+"-"+c.searchform("returnDate","get")+"-0-0-0");return d},error:function(b){a.xhr.isError(b)&&d.pricetabs("disable",
g)},success:function(a){d.pricetabs(Object.isEmpty(a)?"disable":"enable",g)}},click:function(b,d){(d.isDep||d.isPrice)&&c.searchform("departureDate","set",a.format(new Date(d.dep),"d"),!1);(d.isRet||d.isPrice&&d.ret)&&c.searchform("returnDate","set",a.format(new Date(d.ret),"d"),!1);c.searchform("priceMatrix","check");c.searchform("restartSearch")}});c.on("searchformsearchtypechange searchformlocationchange searchformdatechange",function(){j.pricematrix("load")});j.pricematrix("load");var k=!1,l=
!1;b.airsearch_pricematrix_getprice=function(b){if(k&&(!b||!l))if(b=a("#resultListContent #resultListTop .resultDetailsRow .bookItPrice").eq(0).text()){l=!0;var c=a(".swoodoo-pricematrix-price.swoodoo-pricematrix-selected",j).eq(0);if(!c.is(".swoodoo-pricematrix-unavailable")){var d=c.text();(!d||a.parseFloat(b)<a.parseFloat(d))&&c.removeClass("swoodoo-pricematrix-search").text(b)}}};j.on("pricematrixdraw",function(){k=!0;airsearch_pricematrix_getprice(!0)});var m=a('<div id="pricecharts">').appendTo("#pricetab-charts").pricecharts({labels:{onewayDetails:a.localize("LANG_CHART_DETAILS_TITLE_ONEWAY"),
bothwayDetails:a.localize("LANG_CHART_DETAILS_TITLE_BOTHWAY"),outward:a.localize("LANG_FLIGHTTO"),backward:a.localize("LANG_FLIGHTBACK"),approx:a.localize("LANG_RESULT_FLIGHTPRICE_CA"),checkPrice:a.localize("LANG_CHART_DETAILS_CHECK_PRICE")},loader:a(".swoodoo-pricetabs-loading","#pricetab-charts"),load:{url:function(){return c.searchform("filled")?h+"/getresultgraph":!1},data:function(){var b={json:1,dep:c.searchform("departure","code"),depFull:c.searchform("departure","name"),depUrlName:c.searchform("departure",
"urlname"),dst:c.searchform("destination","code"),dstFull:c.searchform("destination","name"),dstUrlName:c.searchform("destination","urlname"),depDate:c.searchform("departureDate","get"),depDeviation:0};c.searchform("oneway","checked")||a.extend(b,{retDate:c.searchform("returnDate","get"),retDeviation:0});return b},type:"GET",error:function(b){a.xhr.isError(b)&&d.pricetabs("disable",f)},success:function(a){d.pricetabs(Object.isEmpty(a)?"disable":"enable",f)}},form:{isOneway:function(){return c.searchform("oneway",
"checked")},getDepartureDate:function(){return c.searchform("departureDate","get")},setDepartureDate:function(a){return c.searchform("departureDate","set",a)},getReturnDate:function(){return c.searchform("returnDate","get")},setReturnDate:function(a){return c.searchform("returnDate","set",a)},restartSearch:function(){return c.searchform("restartSearch")}}});d.on("pricetabsshow",function(a,b){b.index==f&&m.pricecharts("draw")});c.on("searchformdatechange",function(){m.pricecharts("load")});c.on("searchformsearchtypechange searchformlocationchange",
function(){m.pricecharts("load",!0)});m.pricecharts("load")}})(jQuery,window);
var hotels_autocomplete=airsearch_autocomplete.extend({compareToBox:null,onSelect:function(){},_addEvents:function(){var a=this;this.focus=function(b,c){a._focusItem(c.item)};this.select=function(b,c){$(a.hiddenPrefix+a.id).val(c.item.hidden);$("#compareToPlaceholder").length&&a.compareToBox&&a.compareToBox.updateCompareToBlock(c.item.name,c.item.hidden.split("|"));hotels_autocomplete.onSelect()}},_renderItem:function(a,b){(!a.attr("id")||a.attr("id").length==0)&&a.attr("id","autocomplete_items_hotels");
return $("<li></li>").data("item.autocomplete",b).append("<a>"+b.label+"</a>").appendTo(a)}}),powersearch_autocomplete=airsearch_autocomplete.extend({dataType:"text",requestType:"POST",hiddenFieldId:"",customMenuStyleClass:"ui-autocomplete-powersearch",source:function(a,b){var c=this;this.options.xhr=$.ajax({url:this.options.url,dataType:this.options.dataType,type:this.options.requestType,data:{dep:a.term,isPowerSearch:1},beforeSend:function(){c.options._abortRequestCheck()},success:function(a){if(a.length){var e=
[];$("li",a).each(function(a,b){var c=$(this).attr("title");e.push({name:c,label:$(b).html(),hidden:$(b).attr("id"),value:c})});c.blurAutohide?(c.blurAutohide=!1,c.options._onBlurResponse(e)):b(e)}else c.options.updateHiddenValue("")}})},updateHiddenValue:function(a,b){if(this.hiddenFieldId){var c="";if(a)var c=a.split("|"),d=c[0].search("child-")>-1?c[0].substr(8):c[0],c=b+"|"+c[1]+"|"+d+"|"+c[2]+"|"+c[3];$("#"+this.hiddenFieldId).val(c)}},getHiddenValue:function(){return!this.hiddenFieldId?"":$("#"+
this.hiddenFieldId).val()}}),legacyautocomplete=airsearch_autocomplete.extend({dataType:"text",requestType:"POST",hiddenFieldId:"",customMenuStyleClass:"ui-autocomplete-legacy",onUpdateFinished:null,onUpdateFinishedTimeout:200,_onUpdateFinishedTimer:null,source:function(a,b){var c=this;this.options.xhr=$.ajax({url:this.options.url,dataType:this.options.dataType,type:this.options.requestType,data:{dep:a.term,isPowerSearch:0},beforeSend:function(){c.options._abortRequestCheck()},success:function(a){a.length?
(a=c.options._proccesSourceEntries(a,[]),c.blurAutohide?(c.blurAutohide=!1,c.options._onBlurResponse(a)):b(a)):c.options.updateHiddenValue("")}})},updateHiddenValue:function(a,b){if(this.hiddenFieldId){var c="";if(a)var c=a.split("|"),d=c[0].search("child-")>-1?c[0].substr(8):c[0],c=b+"|"+c[1]+"|"+d+"|"+c[2]+"|"+c[3];$("#"+this.hiddenFieldId).val(c)}},getHiddenValue:function(){return!this.hiddenFieldId?"":$("#"+this.hiddenFieldId).val()},close:function(){var a=this;$.extend(this._autocomplete,{close:function(b){clearTimeout(this.closing);
this.pending=!1;this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",b));if(a.onUpdateFinished)clearTimeout(a._onUpdateFinishedTimer),a._onUpdateFinishedTimer=setTimeout(function(){a.onUpdateFinished()},a.onUpdateFinishedTimeout)}})},_proccesSourceEntries:function(a,b){b||(b=[]);var c=this;$(a).children("li").each(function(){if(!c._isEntryPresent($(this).attr("id"),b)){var a=$(this).attr("title");b.push({name:a,label:$(this).html(),hidden:$(this).attr("id"),
value:a})}});return b},_isEntryPresent:function(a,b){for(var c=0;c<b.length;c++)if(RegExp(b[c].hidden.replace(/\|/g,"\\|")+"$").test(a))return!0;return!1}});

