
if(Ext.isOpera){YAHOO.widget.Calendar.prototype.doNextMonthNav=function(e,cal){e.preventDefault();setTimeout(function(){cal.nextMonth();},0);};YAHOO.widget.Calendar.prototype.doPreviousMonthNav=function(e,cal){e.preventDefault();setTimeout(function(){cal.previousMonth();},0);};}
YAHOO.namespace("calendar.common");YAHOO.calendar.common.calendars=new Array();YAHOO.calendar.common.lastClicked=null;YAHOO.calendar.common.dateFormat=null;YAHOO.calendar.common.setDateFormat=function(dateFormat){YAHOO.calendar.common.dateFormat=dateFormat;}
YAHOO.calendar.common.dateToYUI=function(date){return(date.getMonth()+1)+"/"+date.getDate()+"/"+date.getFullYear();}
YAHOO.calendar.common.stringToDate=function(dateString){if(dateString==null||dateString=="")
return null;var date;if(YAHOO.calendar.common.dateFormat=="MM/dd/yyyy"){var milliseconds=Date.parse(dateString);date=new Date(milliseconds);}else if(YAHOO.calendar.common.dateFormat=="dd.MM.yyyy"){var d=dateString.substring(0,2);var m=dateString.substring(3,5);var y=dateString.substring(6,10);date=YAHOO.widget.DateMath.getDate(y,m-1,d);}
return date;}
Event.observe(window,"load",function(event){Event.observe(document,"click",function(event){YAHOO.calendar.common.calendars.each(function(calendar){if(YAHOO.calendar.common.lastClicked!=calendar){calendar.hide();}});YAHOO.calendar.common.lastClicked=null;});});
YAHOO.namespace("search");YAHOO.search.isAccommodation=false;YAHOO.search.hasEndDate=true;YAHOO.search.maxDateLimit=14;YAHOO.search.setIsAccommodation=function(isAcc){YAHOO.search.isAccommodation=isAcc;}
YAHOO.search.setHasEndDate=function(hasEnd){YAHOO.search.hasEndDate=hasEnd;}
YAHOO.search.setMaxDateLimit=function(maxDateLimit){YAHOO.search.maxDateLimit=maxDateLimit;}
YAHOO.search.initCalendars=function(currentDateString){var currentDate=YAHOO.calendar.common.stringToDate(currentDateString);YAHOO.search.startDate=new YAHOO.widget.CalendarGroup("searchStartDateCalendar","searchStartDateCalendarContainer",{PAGES:2});YAHOO.search.startDate.cfg.setProperty("mindate",currentDate);YAHOO.calendar.common.translate(YAHOO.search.startDate);var searchStartDateInput=$$(".searchStartDateInput")[0];var startDate=YAHOO.calendar.common.stringToDate(searchStartDateInput.value);YAHOO.search.startDate.select(startDate);YAHOO.search.startDate.cfg.setProperty("pagedate",startDate);YAHOO.search.startDate.render();$$(".searchStartDateButton").each(function(element){Event.observe(element,"click",YAHOO.search.showStartDateCalendar);});searchStartDateInput.readOnly=true;searchStartDateInput.onfocus=function(event){this.blur();}
YAHOO.search.startDate.selectEvent.subscribe(YAHOO.search.handleStartDateSelect,YAHOO.search.startDate,true);YAHOO.calendar.common.calendars.push(YAHOO.search.startDate);Event.observe($("searchStartDateCalendarContainer"),"click",function(event){YAHOO.calendar.common.lastClicked=YAHOO.search.startDate;});if(YAHOO.search.isAccommodation){YAHOO.search.nightsCount=Ext.getCmp('request.nightsCount');YAHOO.search.nightsCount.on("select",YAHOO.search.handleNightsCountChange);}
if(YAHOO.search.hasEndDate){YAHOO.search.endDate=new YAHOO.widget.CalendarGroup("searchEndDateCalendar","searchEndDateCalendarContainer",{PAGES:2});YAHOO.calendar.common.translate(YAHOO.search.endDate);var searchEndDateInput=$$(".searchEndDateInput")[0];var endDate=YAHOO.calendar.common.stringToDate(searchEndDateInput.value);YAHOO.search.endDate.select(endDate);YAHOO.search.endDate.cfg.setProperty("pagedate",endDate);YAHOO.search.endDate.render();YAHOO.search.updateEndDateCalendar();$$(".searchEndDateButton").each(function(element){Event.observe(element,"click",YAHOO.search.showEndDateCalendar);});searchEndDateInput.readOnly=true;searchEndDateInput.onfocus=function(event){this.blur();}
YAHOO.search.endDate.selectEvent.subscribe(YAHOO.search.handleEndDateSelect,YAHOO.search.endDate,true);YAHOO.calendar.common.calendars.push(YAHOO.search.endDate);Event.observe($("searchEndDateCalendarContainer"),"click",function(event){YAHOO.calendar.common.lastClicked=YAHOO.search.endDate;});}}
YAHOO.search.showStartDateCalendar=function(){YAHOO.calendar.common.lastClicked=YAHOO.search.startDate;var startDate=YAHOO.search.startDate.getSelectedDates()[0];YAHOO.search.startDate.cfg.setProperty("pagedate",startDate);YAHOO.search.startDate.render();YAHOO.search.startDate.show();}
YAHOO.search.showEndDateCalendar=function(){YAHOO.calendar.common.lastClicked=YAHOO.search.endDate;var endDate=YAHOO.search.endDate.getSelectedDates()[0];YAHOO.search.endDate.cfg.setProperty("pagedate",endDate);YAHOO.search.endDate.render();YAHOO.search.endDate.show();}
YAHOO.search.handleStartDateSelect=function(type,args,obj){var date=args[0][0];var year=""+date[0],month=""+date[1],day=""+date[2];var fullDate=new Date(0);fullDate.setFullYear(year,month-1,day);$$(".searchStartDateInput")[0].value=dateFormat(fullDate,YAHOO.calendar.common.dateFormat.toLowerCase());if(YAHOO.search.hasEndDate){YAHOO.search.updateEndDateCalendar();}
YAHOO.search.startDate.hide();}
YAHOO.search.updateEndDateCalendar=function(){var startDate=YAHOO.search.startDate.getSelectedDates()[0];var minDiff;if(YAHOO.search.isAccommodation){minDiff=1;}else{minDiff=0;}
var minDate=YAHOO.widget.DateMath.add(startDate,YAHOO.widget.DateMath.DAY,minDiff);YAHOO.search.endDate.cfg.setProperty("mindate",minDate);var maxDate=YAHOO.widget.DateMath.add(startDate,YAHOO.widget.DateMath.DAY,minDiff+YAHOO.search.maxDateLimit);YAHOO.search.endDate.cfg.setProperty("maxdate",maxDate);if(YAHOO.search.isAccommodation){nightsCount=parseInt(YAHOO.search.nightsCount.getValue(),10);var endDate=YAHOO.widget.DateMath.add(startDate,YAHOO.widget.DateMath.DAY,nightsCount);}else{var endDate=YAHOO.search.endDate.getSelectedDates()[0];if(YAHOO.widget.DateMath.after(minDate,endDate)){endDate=minDate;}
if(YAHOO.widget.DateMath.before(maxDate,endDate)){endDate=maxDate;}}
YAHOO.search.endDate.select(endDate);YAHOO.search.endDate.cfg.setProperty("pagedate",endDate);YAHOO.search.endDate.render();}
YAHOO.search.handleNightsCountChange=function(){var nightsCount=parseInt(YAHOO.search.nightsCount.getValue(),10);var startDate=YAHOO.search.startDate.getSelectedDates()[0];var endDate=YAHOO.widget.DateMath.add(startDate,YAHOO.widget.DateMath.DAY,nightsCount);YAHOO.search.endDate.select(endDate);YAHOO.search.endDate.cfg.setProperty("pagedate",endDate);YAHOO.search.endDate.render();}
YAHOO.search.handleEndDateSelect=function(type,args,obj){var date=args[0][0];var year=""+date[0],month=""+date[1],day=""+date[2];var fullDate=new Date(0);fullDate.setFullYear(year,month-1,day);$$(".searchEndDateInput")[0].value=dateFormat(fullDate,YAHOO.calendar.common.dateFormat.toLowerCase());var startDate=YAHOO.search.startDate.getSelectedDates()[0];var endDate=YAHOO.search.endDate.getSelectedDates()[0];if(YAHOO.search.isAccommodation){YAHOO.search.nightsCount.setValue(YAHOO.widget.DateMath.getDayOffset(endDate,2000)-YAHOO.widget.DateMath.getDayOffset(startDate,2000));}
YAHOO.search.endDate.hide();};
YAHOO.namespace("booking");YAHOO.booking.initCalendars=function(currentDateString,options){var currentDate=YAHOO.calendar.common.stringToDate(currentDateString);options.each(function(calendarOptions){if(calendarOptions){var calendar=new YAHOO.widget.Calendar(null,calendarOptions.container.id);calendar.opt=calendarOptions;calendar.cfg.setProperty("mindate",YAHOO.calendar.common.stringToDate(calendarOptions.mindate));calendar.cfg.setProperty("maxdate",YAHOO.calendar.common.stringToDate(calendarOptions.maxdate));YAHOO.calendar.common.translate(calendar);var selectedDate=YAHOO.calendar.common.stringToDate(calendarOptions.input.getValue());if(selectedDate!=null){calendar.select(selectedDate);}else{selectedDate=YAHOO.calendar.common.stringToDate(calendarOptions.mindate);}
calendar.cfg.setProperty("pagedate",selectedDate);calendar.render();Event.observe(calendarOptions.button,"click",function(event){YAHOO.booking.showCalendar(calendar);});calendar.selectEvent.subscribe(YAHOO.booking.handleSelect,calendar,true);YAHOO.calendar.common.calendars.push(calendar);Event.observe(calendarOptions.container,"click",function(event){YAHOO.calendar.common.lastClicked=calendar;});}});}
YAHOO.booking.showCalendar=function(calendar){YAHOO.calendar.common.lastClicked=calendar;var selectedDate=calendar.getSelectedDates()[0];if(selectedDate!=null){calendar.cfg.setProperty("pagedate",selectedDate);}
calendar.render();calendar.show();}
YAHOO.booking.handleSelect=function(type,args,calendar){var date=args[0][0];var year=""+date[0],month=""+date[1],day=""+date[2];var fullDate=new Date(0);fullDate.setFullYear(year,month-1,day);calendar.opt.input.setValue(dateFormat(fullDate,YAHOO.calendar.common.dateFormat.toLowerCase()));calendar.hide();};
YAHOO.namespace("user");YAHOO.user.initCalendars=function(currentDateString){var currentDate=YAHOO.calendar.common.stringToDate(currentDateString);currentDate.setYear(currentDate.getYear()-13);YAHOO.user.birthDate=new YAHOO.widget.Calendar("userBirthDateCalendar","userBirthDateCalendarContainer");YAHOO.user.birthDate.cfg.setProperty("maxdate",currentDate);YAHOO.calendar.common.translate(YAHOO.user.birthDate);var userBirthDateInput=$$(".userBirthDateInput")[0];var birthDate=YAHOO.calendar.common.stringToDate(userBirthDateInput.value);YAHOO.user.birthDate.select(birthDate);YAHOO.user.birthDate.cfg.setProperty("pagedate",birthDate);YAHOO.user.birthDate.render();$$(".userBirthDateButton").each(function(element){Event.observe(element,"click",YAHOO.user.showBirthDateCalendar);});userBirthDateInput.readOnly=true;userBirthDateInput.onfocus=function(event){this.blur();}
YAHOO.user.birthDate.selectEvent.subscribe(YAHOO.user.handleBirthDateSelect,YAHOO.user.birthDate,true);YAHOO.calendar.common.calendars.push(YAHOO.user.birthDate);Event.observe($("userBirthDateCalendarContainer"),"click",function(event){YAHOO.calendar.common.lastClicked=YAHOO.user.birthDate;});}
YAHOO.user.showBirthDateCalendar=function(){YAHOO.calendar.common.lastClicked=YAHOO.user.birthDate;var birthDate=YAHOO.user.birthDate.getSelectedDates()[0];YAHOO.user.birthDate.cfg.setProperty("pagedate",birthDate);YAHOO.user.birthDate.render();YAHOO.user.birthDate.show();}
YAHOO.user.handleBirthDateSelect=function(type,args,obj){var date=args[0][0];var year=""+date[0],month=""+date[1],day=""+date[2];month=month.length!=2?"0"+month:month;day=day.length!=2?"0"+day:day;$$(".userBirthDateInput")[0].value=day+"."+month+"."+year;YAHOO.user.birthDate.hide();};
var dateFormat=function(){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return function(date,mask,utc){var dF=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(date)=="[object String]"&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date;if(isNaN(date))throw SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}
var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(mask,utc){return dateFormat(this,mask,utc);};
YAHOO.namespace("dwr");Event.observe(window,"load",function(event){dwr.engine.setPreHook(function(){var disabledZone=$('disabledZone');if(disabledZone)
disabledZone.style.visibility='visible';});dwr.engine.setPostHook(function(){var disabledZone=$('disabledZone');if(disabledZone)
disabledZone.style.visibility='hidden';});dwr.engine.setErrorHandler(YAHOO.dwr.erroHandler);});YAHOO.dwr.errorHandler=function(e){window.location.reload();};
XssProxy=Class.create();XssProxy.prototype={initialize:function(proxy){Event.observe(window,"load",function(){var el=document.createElement("iframe");el.id="xss_frame";el.style.position="absolute";el.style.visibility="hidden";el.style.top=el.style.left="0px";el.src=proxy;el.style.width=el.style.height="100px";document.body.appendChild(el);});},send:function(frameId,message){var el=$("xss_frame");var src=el.src;if(src.indexOf("#")!=-1){src=src.substr(0,src.indexOf("#"));}
el.src=src+"#xss|"+frameId+"|"+message;el.style.width=el.style.width=="100px"?"101px":"100px";}};Event.observe(window,"load",function(){Event.observe(window,"resize",function(){var hash=window.location.hash.substr(1);if(hash.indexOf("xss|")==0){hash=hash.substr(4);var delimIndex=hash.indexOf("|");var frameName=hash.substr(0,delimIndex);hash=hash.substr(delimIndex+1);var doc=null;if(frameName!="_parent"){doc=parent.frames[frameName].document;}else{doc=parent.parent.document;}
doc.fire("xss:message",{msg:hash});}});});
YAHOO.namespace("utils");YAHOO.utils.copyInput=function(src,dest){dest.value=src.value;Event.observe(src,"keyup",function(event){dest.value=src.value;});Event.observe(src,"change",function(event){dest.value=src.value;});Event.observe(src,"mouseup",function(event){dest.value=src.value;});};
Ext.namespace("destination");destination.init2=function(locale,withRestrictions,cityId){destination.locale=locale;destination.withRestrictions=withRestrictions;var coCmp=Ext.getCmp("person.countryId");if(coCmp){coCmp.on("select",destination.onCountryChange);if(cityId!=undefined){coCmp.fireEvent("select",coCmp,null,null,cityId);}}}
destination.onCountryChange=function(cmp,record,index,cityId,callback){var ciCmp=Ext.getCmp("citySelect");ciCmp.store.removeAll();var countryId=cmp.getValue();if(countryId!=-1){destination.load(ciCmp,accommodationBookingService.getCityOptionsJSON,[countryId,destination.locale,destination.withRestrictions],cityId,callback);}else{ciCmp.setValue("");}}
destination.load=function(cmp,dwrFunction,dwrArgs,defaultSelection,callback){var store=new Ext.data.Store({proxy:new Ext.ux.data.DwrProxy({apiActionToHandlerMap:{read:{dwrFunction:dwrFunction,getDwrArgsFunction:function(trans){return dwrArgs;}}}}),reader:new Ext.data.JsonReader({root:'rows',fields:[{name:'value'},{name:'text'},{name:'misc'}]})});store.load({callback:function(r,success){if(success){cmp.store.add(r);if(Ext.isDefined(defaultSelection)&&cmp.store.findExact("value",defaultSelection+"")!=-1){cmp.setValue(defaultSelection);}else{cmp.setValue(-1);}}
if(callback!=undefined){callback();}}});},destination.hasLocation=null;destination.setHasLocation=function(hasLocation){destination.hasLocation=hasLocation;}
IDestinations=Class.create();IDestinations.prototype={initialize:function(anId,options){this.id=anId;this.setOptions(options);var _this=this;Ext.getCmp(this.options.popularPlace).on("select",function(cmp){_this.onPopularPlaceChange(cmp)});var ppRadioCnt=$('popularPlaceRadios');if(ppRadioCnt){ppRadioCnt.select('input').each(function(radio){Event.observe(radio,"click",function(){_this.onPopularPlaceClick(radio);});});}
Ext.getCmp(this.options.countryId).on("select",function(cmp,record,index,cityId,callback){_this.onCountryChange(cmp,record,index,cityId,callback)});Ext.getCmp(this.options.citySelect).on("select",function(ciCmp,record,index,cityId,callback,countryChanged){_this.onCityChange(ciCmp,record,index,cityId,callback,countryChanged)});Ext.getCmp(this.options.citySuggestion).on("select",function(ciCmp,record,index,cityId,callback,countryChanged){_this.onCityChange(ciCmp,record,index,cityId,callback,countryChanged)});Ext.each(Ext.select(this.options.switchLink),function(link){link.on("click",function(){_this.switchMode()});});},setOptions:function(options){var defaultOptions={switchLink:".switch-mode-link",popularPlace:"popularPlace",citySelect:"citySelect",citySuggestion:"citySuggestion",countryId:"request.countryId",manualMode:"manualMode",suggestMode:"suggestMode",withRestrictions:false};this.options=Object.extend(defaultOptions,options||{});},onCountryChange:function(cmp,record,index,cityId,callback){var ciCmp=Ext.getCmp(this.options.citySelect);ciCmp.store.removeAll();var countryId=cmp.getValue();if(countryId!=-1){destination.load(ciCmp,accommodationBookingService.getCityOptionsJSON,[countryId,this.options.locale,this.options.withRestrictions],cityId,callback);if(destination.hasLocation){ciCmp.fireEvent("select",ciCmp,record,index,cityId,null,true);}}else{ciCmp.setValue("");}},onCityChange:function(ciCmp,record,index,cityId,callback,countryChanged){if(cityId==null){cityId=ciCmp.getValue();}
var ppRadioCnt=$('popularPlaceRadios');if(ppRadioCnt){var ppRadios=ppRadioCnt.select('input');ppRadios.each(function(elem){if(elem.value.split("#")[0]==cityId){elem.checked=true;}else{elem.checked=false;}});}
if(destination.hasLocation){var deCmp=Ext.getCmp(this.options.destinationSelect);var previousValue=deCmp.getValue();deCmp.store.removeAll();if(cityId!=-1){destination.load(deCmp,accommodationBookingService.getAirportHotelOptionsJSON,[cityId,this.options.locale],previousValue,callback);}else{deCmp.setValue("");}
if(!countryChanged&&this.options.alterManualMode!=undefined){if(this.isAlterSuggestActive()){var aSCmp=Ext.getCmp(this.options.alterCitySuggestion);if(aSCmp.getValue()==""){aSCmp.store.removeAll();destination.load(aSCmp,accommodationBookingService.getCityJSON,[cityId,this.options.locale],cityId);var aDeCmp=Ext.getCmp(this.options.alterDestinationSelect);aDeCmp.store.removeAll();destination.load(aDeCmp,accommodationBookingService.getAirportHotelOptionsJSON,[cityId,this.options.locale],null,null);}}else{var aCiCmp=Ext.getCmp(this.options.alterCitySelect);var aCityId=aCiCmp.getValue();if(aCityId==""||aCityId=="-1"){if(this.isSuggestActive()){Ext.getCmp(this.options.citySuggestion).store.data.items.each(function(item){if(item.json.value==cityId){countryId=item.json.misc;}});}else{var coCmp=Ext.getCmp(this.options.countryId);countryId=coCmp.getValue();}
var aCoCmp=Ext.getCmp(this.options.alterCountryId);aCoCmp.setValue(countryId);aCoCmp.fireEvent("select",aCoCmp,null,null,cityId);}}}}},onPopularPlaceClick:function(radio){var cityCountryPair=radio.value;if(cityCountryPair!=-1){this.modifyPopular(cityCountryPair);}},onPopularPlaceChange:function(cmp){var cityCountryPair=cmp.getValue();if(cityCountryPair!=-1){this.modifyPopular(cityCountryPair);}
cmp.setValue(-1);},modifyPopular:function(cityCountryPair){var cityId=cityCountryPair.split("#")[0];var countryId=cityCountryPair.split("#")[1];if(this.isSuggestActive()){var sCmp=Ext.getCmp(this.options.citySuggestion);sCmp.store.removeAll();destination.load(sCmp,accommodationBookingService.getCityJSON,[cityId,this.options.locale],cityId);if(destination.hasLocation){var deCmp=Ext.getCmp(this.options.destinationSelect);deCmp.store.removeAll();destination.load(deCmp,accommodationBookingService.getAirportHotelOptionsJSON,[cityId,this.options.locale],null,null);}}else{var coCmp=Ext.getCmp(this.options.countryId);coCmp.setValue(countryId);coCmp.fireEvent("select",coCmp,null,null,cityId);}},isSuggestActive:function(){return Ext.get(this.options.manualMode).hasClass("x-hidden");},isAlterSuggestActive:function(){return Ext.get(this.options.alterManualMode).hasClass("x-hidden");},switchMode:function(){var manualMode=Ext.get(this.options.manualMode);var suggestMode=Ext.get(this.options.suggestMode);var ciCmp=Ext.getCmp(this.options.citySelect);var sCmp=Ext.getCmp(this.options.citySuggestion);var coCmp=Ext.getCmp(this.options.countryId);if(!this.isSuggestActive()){var cityId=ciCmp.getValue();if(cityId!=""&&cityId!=-1){sCmp.store.removeAll();destination.load(sCmp,accommodationBookingService.getCityJSON,[cityId,this.options.locale],cityId,function(){ciCmp.disable();coCmp.disable();sCmp.enable();manualMode.addClass("x-hidden");suggestMode.removeClass("x-hidden");});}else{coCmp.setValue("");sCmp.setValue("");sCmp.store.removeAll();ciCmp.disable();coCmp.disable();sCmp.enable();manualMode.addClass("x-hidden");suggestMode.removeClass("x-hidden");}}else{var sCmp=Ext.getCmp(this.options.citySuggestion);var cityId=sCmp.getValue();if(cityId!=""&&cityId!=-1){var countryId=sCmp.store.getAt(sCmp.store.find("value",cityId)).get("misc");coCmp.setValue(countryId);coCmp.fireEvent("select",coCmp,null,null,cityId,function(){ciCmp.enable();coCmp.enable();sCmp.disable();suggestMode.addClass("x-hidden");manualMode.removeClass("x-hidden");});}else{coCmp.setValue("");ciCmp.setValue("");ciCmp.store.removeAll();ciCmp.enable();coCmp.enable();sCmp.disable();suggestMode.addClass("x-hidden");manualMode.removeClass("x-hidden");}}}};
destination.popularPlace=null;DepartureDest=Class.create(IDestinations,{onPopularPlaceChange:function($super,cmp){var cityCountryPair=cmp.getValue();destination.popularPlace=cityCountryPair;$super(cmp);}});ArrivalDest=Class.create(IDestinations,{onPopularPlaceChange:function($super,cmp){var cityCountryPair=destination.popularPlace;if(cityCountryPair!=-1){this.modifyPopular(cityCountryPair);}
cmp.setValue(-1);}});
Ext.namespace("rooms");rooms.init=function(roomsCount){var roomCmp=Ext.getCmp("tempRoomCount");if(roomCmp!=undefined){rooms.currentRoomCount=roomCmp.value;rooms.updateRoomInfo(roomCmp);roomCmp.on("select",rooms.updateRoomInfo);}
for(var i=0;i<roomsCount;i++){var chCmp=Ext.getCmp("tempChildCount["+i+"]");YAHOO.search.currentChildCount[i]=chCmp.value;YAHOO.search.updateChild(chCmp);chCmp.on("select",YAHOO.search.updateChild);}}
rooms.updateRoomInfo=function(cmp){var roomCount=parseInt(cmp.getValue());for(var i=0;i<roomCount;i++){var container=Ext.get('roomInfoContainer_'+i);if(container!=null){container.removeClass('x-hidden');}}
if(roomCount<rooms.currentRoomCount){for(var i=roomCount;i<rooms.currentRoomCount;i++){var container=Ext.get('roomInfoContainer_'+i);if(container!=null){container.addClass('x-hidden');}}}
rooms.currentRoomCount=roomCount;};
YAHOO.namespace("search");YAHOO.search.show=false;YAHOO.search.currentChildCount=[];YAHOO.search.isAccommodation=false;YAHOO.search.setIsAccommodation=function(isAcc){YAHOO.search.isAccommodation=isAcc;}
YAHOO.search.setHasEndDate=function(hasEnd){YAHOO.search.hasEndDate=hasEnd;}
YAHOO.search.setShow=function(needshow){YAHOO.search.show=needshow;}
YAHOO.search.changeAdvSearchState=function(){if(YAHOO.search.show){YAHOO.search.showAdvSearch();}else{YAHOO.search.hideAdvSearch();}
YAHOO.search.show=!YAHOO.search.show;}
YAHOO.search.hideAdvSearch=function(){document.getElementById("advanced").style.display="none";}
YAHOO.search.showAdvSearch=function(){document.getElementById("advanced").style.display="block";}
YAHOO.search.setMode=function(mode,cmpId){if(cmpId==undefined){Ext.get("searchMode").dom.value=mode;}else{Ext.get(cmpId).dom.value=mode;}}
YAHOO.search.setModeArr=function(mode){Ext.get("searchModeArr").dom.value=mode;}
YAHOO.search.init=function(){var chCmp=Ext.getCmp("childCount");var adCmp=Ext.getCmp("adultCount");YAHOO.search.updateChild(chCmp);YAHOO.search.currentChildCount[0]=chCmp.value;chCmp.on("select",YAHOO.search.updateChild);adCmp.on("select",YAHOO.search.updateAdult);}
YAHOO.search.updateChild=function(cmp){var indexInService;if(YAHOO.search.isAccommodation){var startIndex=cmp.id.indexOf("[")+1;var endIndex=cmp.id.indexOf("]");indexInService=cmp.id.substring(startIndex,endIndex);}else{indexInService=0;}
var childCount=parseInt(cmp.getValue());var containerIdPrefix='';if(YAHOO.search.isAccommodation){containerIdPrefix='room'+indexInService;}
for(var i=1;i<=childCount;i++){var container=Ext.get(containerIdPrefix+'child'+i+'Container');if(container!=null){container.removeClass("x-hidden");}}
if(childCount<YAHOO.search.currentChildCount[indexInService]){for(var i=childCount+1;i<=YAHOO.search.currentChildCount[indexInService];i++){var container=Ext.get(containerIdPrefix+'child'+i+'Container');if(container!=null){container.addClass("x-hidden");}}}
YAHOO.search.currentChildCount[indexInService]=childCount;var containerId=containerIdPrefix+'childContainer';if(childCount>0){Ext.get(containerId).removeClass("x-hidden");}else{Ext.get(containerId).addClass("x-hidden");}}
YAHOO.search.updateAdult=function(adCmp){var adultCount=parseInt(adCmp.getValue());var maxChildCount=50-adultCount;var chCmp=Ext.getCmp("childCount");if(chCmp.value>maxChildCount){chCmp.setValue(maxChildCount);YAHOO.search.updateChild(chCmp);}
var records=[];chCmp.store.removeAll();for(var i=0;i<=maxChildCount;i++){records[i]=new chCmp.store.recordType({text:i,value:i});}
chCmp.store.add(records);};
Ext.ns("order");order.onReadyListeners=new Array();order.orders={};order.showCnt=function(refNum){var cnt=$('order_'+refNum+'_details_cnt');cnt.show();order.orders[refNum]=true;var lastServiceRow=cnt.previous();lastServiceRow.addClassName("no-brdr");var firstServiceRow=cnt.previous(".first-service");firstServiceRow.childElements().first().addClassName("no-brdr");firstServiceRow.childElements().last().addClassName("no-brdr");}
order.hideCnt=function(refNum){var cnt=$('order_'+refNum+'_details_cnt');cnt.hide();order.orders[refNum]=false;var lastServiceRow=cnt.previous();lastServiceRow.removeClassName("no-brdr");var firstServiceRow=cnt.previous(".first-service");firstServiceRow.childElements().first().removeClassName("no-brdr");firstServiceRow.childElements().last().removeClassName("no-brdr");}
order.showOrHideDetails=function(refNum,lang){var cnt=$('order_'+refNum+'_details_cnt');var contentLoaded=cnt.select(".order_details_cell > div.loaded_content").length>0;if(!order.orders[refNum]||order.orders[refNum]==undefined){if(contentLoaded){order.showCnt(refNum);}else{orderListForm.renderDetails(refNum,lang,{callback:function(res){var cell=cnt.select(".order_details_cell")[0];var loadedDiv=document.createElement("div");Element.extend(loadedDiv);loadedDiv.addClassName('loaded_content');loadedDiv.innerHTML=res.stripScripts();cell.appendChild(loadedDiv);res.evalScripts();order.onReadyListeners.each(function(callback){callback();});order.onReadyListeners.clear();order.showCnt(refNum);jQuery(document).loadProductImages();jQuery(".infoService").initServiecInfoPopup();}});}}else{order.hideCnt(refNum);}}
order.updateDetails=function(refNum,lang,frameId,url){orderListForm.updateDetails(refNum,lang,{callback:function(res){YAHOO.results.openPopup(frameId,url);}});};
YAHOO.namespace("urlProcessing");YAHOO.urlProcessing.processUrl=function(url){return url.replace('{mainThumbnailSize}',CFG.mainThumbnailSize).replace('{currentLocation}',window.location.href.substr(0,window.location.href.lastIndexOf('/')));};
var CFG={};CFG.mainThumbnailSize=120;
