function loadSection(n,t,i,r,u){u=typeof u!="undefined"?u:"application/x-www-form-urlencoded; charset=UTF-8";var f=u=="application/json"?JSON.stringify(t):t;$.ajax({url:n,data:f,contentType:u,type:"POST",success:function(d){$("#"+i).html(d);typeof r!="undefined"&&r!=null&&eval(r+"()")}})}function loadMap(n,t,i,r){$.ajax({url:n,datatype:"json",contentType:"application/json",traditional:!0,data:JSON.stringify(t),type:"POST",success:function(d){$("#"+i).html(d);$("#map-loading").css({display:"none"});typeof r!="undefined"&&r!=null&&eval(r+"()")}})}var AddOptionsDlg=dejavu.Class.declare({$name:"AddOptionsDlg",__wnd:null,__selectedOptions:[],selectedOptions:[],__callBack:null,__templateRender:null,__id:"",__wndPriceProgress:null,__wndSubTotalPrice:null,__wndSubTotalPriceLabel:null,__optionSelectionAmountURL:"",__errorOptionMsg:null,__reservationId:"",__requestId:"",$static:{TITLE_DIALOG:""},initialize:function(n,t,i,r,u){this._id=r;this._reservationId=n;this._requestId=t;this.__optionSelectionAmountURL=u;this.__selectedOptions=i;this.__templateRender=kendo.template($("#ADD_OPTIONS").html());this.selectedOptions=[]},__atachEvents:function(){this.__wnd.bind("close",this.__onWndClose.$bind(this));this.__wnd.bind("deactivate",this.__onWndDeactivate.$bind(this));$("#addOptionsBtn").click(this.__addOptionsClick.$bind(this));$("#noThanksBtn").click(this.__noThanksClick.$bind(this));$(".chkOptionSupplement").click(this.__chkClick.$bind(this))},__detachEvents:function(){$("#addOptionsBtn").unbind();$("#noThanksBtn").unbind();$(".chkOptionSupplement").unbind()},__addOptionsClick:function(){this.selectedOptions=this.__getSelectedOptions();this.selectedOptions.length==0?this.__errorOptionMsg.show():this.__wnd.close()},__noThanksClick:function(){this.selectedOptions=[];this.__wnd.close()},__onWndClose:function(){this.__wnd.unbind("close",this.__onWndClose);this.__detachEvents();this.__callBack!=null&&this.__callBack(this.selectedOptions)},__onWndDeactivate:function(){this.__wnd.destroy();$("#dialogWnd").remove()},__renderDialogContent:function(n){return this.__templateRender(n)},__getRoomFromSelected:function(n,t){var i=_.indexOf(n,function(n){return n.RoomMealPlanOption.Id==t});return i==-1?null:n[i]},__getRoomFromOptions:function(n,t){if(n.length==0)return null;var i=_.find(n,function(n){return n.HotelFareRoomMealPlanOptionId==t});return typeof i=="undefined"?null:i},__getSelectedOptions:function(){var n=[];return _.each($(".chkOptionSupplement:checked"),function(t){values=t.value.split(".");values.length==2&&(room=this.__getRoomFromOptions(n,values[0]),room==null?(room={HotelFareRoomMealPlanOptionId:values[0].toString(),OptionalSupplementCodes:[values[1].toString()]},n.push(room)):room.OptionalSupplementCodes.push(values[1].toString()))},this),n},__refreshPrice:function(){var n,t,i,r;this.__wndSubTotalPrice.hide();this.__wndSubTotalPriceLabel.hide();this.__wndPriceProgress.show();n=[];i=[];_.each(this.__selectedOptions,function(n){i.push({HotelFareRoomMealPlanOptionId:n.RoomMealPlanOption.Id,OptionalSupplementCodes:[]})},this);_.each($(".chkOptionSupplement:checked"),function(r){n=r.value.split(".");n.length==2&&(t=this.__getRoomFromOptions(i,n[0]),t==null?(t={HotelFareRoomMealPlanOptionId:n[0].toString(),OptionalSupplementCodes:[n[1].toString()]},i.push(t)):t.OptionalSupplementCodes.push(n[1].toString()))},this);r={ReservationId:this._reservationId,RequestId:this._requestId,ResultItemId:this._id,HotelFareRoomMealPlanOptionSelection:i};$.ajax({type:"POST",url:this.__optionSelectionAmountURL,data:JSON.stringify(r),dataType:"json",context:this,contentType:"application/json, charset=utf-8",success:function(n){this.__wndPriceProgress.hide();this.__wndSubTotalPrice.html(n.StringValue);this.__wndSubTotalPrice.show();this.__wndSubTotalPriceLabel.show()},error:function(){this.__wndPriceProgress.hide();this.__wndSubTotalPrice.html("");this.__wndSubTotalPrice.show();this.__wndSubTotalPriceLabel.show()}})},__chkClick:function(){$(".chkOptionSupplement:checked").length>0&&this.__errorOptionMsg.hide();this.__refreshPrice()},showDialog:function(n){$("<div />",{id:"dialogWnd"}).appendTo("body");$("#dialogWnd").kendoWindow({width:600,maxHeight:620,title:!1,actions:["Close"],visible:!1,resizable:!1,modal:!0});$("#dialogWnd").parent().addClass("dlg");$("#dialogWnd").parent().addClass("dlgOptionalSupplements");this.__wnd=$("#dialogWnd").data("kendoWindow");this.__callBack=n;$("#dialogWnd").data("kendoWindow").content(this.__renderDialogContent(this.__selectedOptions));this.__wndPriceProgress=$("#wndPriceProgress");this.__wndSubTotalPrice=$("#wndSubTotalPrice");this.__wndSubTotalPriceLabel=$("#wndSubTotalPriceLabel");this.__errorOptionMsg=$("#optionsError");$("#closeAddOptionsBtn").unbind().click(function(){this.__wnd.close()}.$bind(this));this.__atachEvents();this.__refreshPrice();$("#dialogWnd").data("kendoWindow").center();$("#dialogWnd").data("kendoWindow").open()}}),SelectExcursionPickupLocationLanguageDlg=dejavu.Class.declare({$name:"SelectExcursionPickupLocationLanguageDlg",__wnd:null,__selectedOptions:{},selectedOptions:{selectedPickupPoint:0,selectedRequestedLanguage:0},__callBack:null,__templateRender:null,__id:"",__errorMsg_PickupPoint:null,__errorMsg_Language:null,__errorMsg_Hour:null,__reservationId:"",__requestId:"",__selectedPickupPoint:0,__selectedPickupPointCode:"",__selectedRequestedLanguage:0,__selectedHour:null,__destinationCB:null,__hotelCB:null,__languageCB:null,__hourCB:null,$static:{ADD_PICKUP_LOCATION:"",ADD_RETURN_LOCATION:"",ADDED:""},initialize:function(n){this.__selectedOptions=n;this.__templateRender=kendo.template($("#SELECT_PICKUP_LOCATION_LANGUAGE").html());this.selectedOptions={selectedPickupPoint:n.selectedPickupPoint,selectedRequestedLanguage:n.selectedRequestedLanguage};this.__selectedPickupPoint=n.selectedPickupPoint;this.__selectedPickupPointCode=n.selectedPickupPointCode;this.__selectedRequestedLanguage=n.selectedRequestedLanguage;this.__selectedHour=n.selectedHour},__getHotelsByDestination:function(n){return this.__errorMsg_PickupPoint.hide(),n==""?this.__selectedOptions.pickupPoints:_.filter(this.__selectedOptions.pickupPoints,function(t){return t.Data.Id==n||t.Data.Data!=null&&t.Data.Data.Id==n})},__onDestinationChange:function(){if(this.__hotelCB!=null){var t=this.__destinationCB.value(),n=this.__getHotelsByDestination(t);this.__hotelCB.dataSource.data(n);this.__hotelCB.dataSource.query();n.length==1?(this.__hotelCB==null?(this.__hotelCB=$("#hotelCB"),this.__hotelCB.length>0&&(this.__hotelCB.hide(),this.__hotelCB=null)):(this.__hotelCB.value(n[0].Id),this.__hotelCB.wrapper.hide()),labelValue=$("#hotelValue"),labelValue.length>0&&(labelValue.html(n[0].Name),labelValue.show())):this.__hotelCB!=null&&(labelValue=$("#hotelValue"),labelValue.length>0&&labelValue.hide(),this.__hotelCB.wrapper.show())}},__formatDestinationsList:function(n){var i=[],f=_.filter(n,function(n){return n.Data==null}),t,r,u;if(f.length>0)for(t=[],r=0;r<f.length;r++){for(i.push(f[r]),t=_.filter(n,function(n){return n.Data!=null&&n.Data.Id==f[r].Id}),u=0;u<t.length;u++)t[u].Name=" - "+t[u].Name;i=i.concat(t)}else i=n;return i},__atachEvents:function(){var n,t;this.__wnd.bind("close",this.__onWndClose.$bind(this));this.__wnd.bind("deactivate",this.__onWndDeactivate.$bind(this));$("#addPickupBtn").unbind().click(this.__onOkClick.$bind(this));$("#closeWndBtn").unbind().click(this.__onCancelClick.$bind(this));typeof this.__selectedOptions.timeLabel!="undefined"&&this.__selectedOptions.timeLabel!=""&&$("#timeSelectorLabel").html(this.__selectedOptions.timeLabel+": ");n=null;typeof this.__selectedOptions.destinations!="undefined"&&this.__selectedOptions.destinations.length>1?($("#destinationCB").kendoDropDownList({autoBind:!0,dataTextField:"Name",dataValueField:"Id",optionLabel:CommonMessages.CHOOSE_DESTINATION,dataSource:this.__formatDestinationsList(this.__selectedOptions.destinations),change:this.__onDestinationChange.$bind(this)}),this.__destinationCB=$("#destinationCB").data("kendoDropDownList"),typeof this.__destinationCB=="undefined"&&(this.__destinationCB=null)):typeof this.__selectedOptions.destinations=="undefined"||this.__selectedOptions.destinations.length==1?(this.__destinationCB=$("#destinationCB"),this.__destinationCB.length>0&&(this.__destinationCB.hide(),this.__destinationCB=null),typeof this.__selectedOptions.destinations!="undefined"?(n=$("#destinationValue"),n.length>0&&(n.html(this.__selectedOptions.destinations[0].Name),n.show())):$("#destinationSelection").hide()):$("#destinationSelection").hide();this.__selectedOptions.pickupPoints.length>1?($("#hotelCB").kendoDropDownList({autoBind:!0,dataTextField:"Name",dataValueField:"Id",optionLabel:CommonMessages.CHOOSE_HOTEL,dataSource:this.__selectedOptions.pickupPoints,change:function(){this.__errorMsg_PickupPoint.hide()}.$bind(this)}),this.__hotelCB=$("#hotelCB").data("kendoDropDownList"),typeof this.__hotelCB=="undefined"?this.__hotelCB=null:(this.__hotelCB.select(function(n){return n.Name==this.__selectedPickupPoint}.$bind(this)),t=this.__hotelCB.dataItem(),this.__destinationCB!=null&&typeof t!="undefined"&&t!=null&&typeof t.Data!="undefined"&&t.Data!=null&&this.__destinationCB.select(function(n){return n.Id==t.Data.Id}))):this.__selectedOptions.pickupPoints.length==1?(this.__hotelCB=$("#hotelCB"),this.__hotelCB.length>0&&(this.__hotelCB.hide(),this.__hotelCB=null),n=$("#hotelValue"),n.length>0&&(n.html(this.__selectedOptions.pickupPoints[0].Name),n.show())):$("#hotelSelection").hide();this.__selectedOptions.supportedLanguages.length>1?($("#languageCB").kendoDropDownList({autoBind:!0,optionLabel:CommonMessages.CHOOSE_LANGUAGE,dataTextField:"Name",dataValueField:"Code",dataSource:this.__selectedOptions.supportedLanguages,value:this.__selectedRequestedLanguage,change:function(){this.__errorMsg_Language.hide()}.$bind(this)}),this.__languageCB=$("#languageCB").data("kendoDropDownList"),typeof this.__languageCB=="undefined"?this.__languageCB=null:this.__languageCB.value(this.__selectedRequestedLanguage)):this.__selectedOptions.supportedLanguages.length==1?(this.__languageCB=$("#languageCB"),this.__languageCB.length>0&&(this.__languageCB.hide(),this.__languageCB=null),n=$("#languageValue"),n.length>0&&(n.html(this.__selectedOptions.supportedLanguages[0].Name),n.show())):$("#languageSelection").hide();this.__selectedOptions.hours.length>1?($("#hourCB").kendoDropDownList({autoBind:!0,optionLabel:CommonMessages.CHOOSE_HOUR,dataTextField:"TimeToString",dataValueField:"TimeToString",dataSource:this.__selectedOptions.hours,value:this.__selectedHour==null?"":this.__selectedHour.TimeToString,change:function(){this.__errorMsg_Hour.hide()}.$bind(this)}),this.__hourCB=$("#hourCB").data("kendoDropDownList"),typeof this.__hourCB=="undefined"?this.__hourCB=null:this.__selectedHour!=null&&this.__hourCB.value(this.__selectedHour.TimeToString)):this.__selectedOptions.hours.length==1?(this.__hourCB=$("#hourCB"),this.__hourCB.length>0&&(this.__hourCB.hide(),this.__hourCB=null),n=$("#hourValue"),n.length>0&&(n.html(this.__selectedOptions.hours[0].TimeToString),n.show())):$("#hourSelection").hide()},__onOkClick:function(n){n.preventDefault();var t=!1,e="",o="",i="",r="",u="",s="",f=null;this.__hotelCB!=null?(e=this.__hotelCB.value(),e.toString()==""?(this.__errorMsg_PickupPoint.show(),t=!0):(i=this.__hotelCB.text(),r=this.__hotelCB.dataItem().Data.Code,this.__errorMsg_PickupPoint.hide())):this.__selectedOptions.pickupPoints.length==1?(i=this.__selectedOptions.pickupPoints[0].Name,r=this.__selectedOptions.pickupPoints[0].Data.Code):(i=this.__selectedPickupPoint,r=this.__selectedPickupPointCode);this.__languageCB!=null?(o=this.__languageCB.value(),o.toString()==""?(this.__errorMsg_Language.show(),t=!0):(u=this.__languageCB.value(),this.__errorMsg_Language.hide())):u=this.__selectedOptions.supportedLanguages.length==1?this.__selectedOptions.supportedLanguages[0].Code:this.__selectedRequestedLanguage;this.__hourCB!=null?(s=this.__hourCB.dataItem(),typeof s.Hour=="undefined"?(this.__errorMsg_Hour.show(),t=!0):(f=this.__hourCB.dataItem(),this.__errorMsg_Hour.hide())):f=this.__selectedOptions.hours.length==1?this.__selectedOptions.hours[0]:this.__selectedHour;t||(this.selectedOptions.selectedPickupPoint=i,this.selectedOptions.selectedPickupPointCode=r,this.selectedOptions.selectedRequestedLanguage=u,this.selectedOptions.selectedHour=f,this.__wnd.close())},__cancelWnd:!1,__onCancelClick:function(n){n.preventDefault();this.__cancelWnd=!0;this.__wnd.close()},__detachEvents:function(){$(".addPickupBtn").unbind();$(".closeWndBtn").unbind()},__onWndClose:function(){this.__wnd.unbind("close",this.__onWndClose);this.__detachEvents();this.__callBack==null||this.__cancelWnd?this.__cancelWnd&&this.__callBack!=null&&this.__callBack({result:ActionResult.ERROR,message:""}):this.__callBack(this.selectedOptions)},__onWndDeactivate:function(){this.__wnd.destroy();$("#dialogWnd").remove()},__renderDialogContent:function(n){return this.__templateRender(n)},showDialog:function(n){if(this.__callBack=n,this.__selectedOptions.supportedLanguages.length!=0&&this.__selectedOptions.hours.length!=0&&typeof n=="function"){if(this.__selectedOptions.pickupPoints.length==1&&this.__selectedOptions.supportedLanguages.length==1&&this.__selectedOptions.hours.length==1){this.selectedOptions.selectedPickupPoint=this.__selectedOptions.pickupPoints[0].Name;this.selectedOptions.selectedRequestedLanguage=this.__selectedOptions.supportedLanguages[0].Code;this.selectedOptions.selectedHour=this.__selectedOptions.hours[0];n(this.selectedOptions);return}if(this.__selectedOptions.pickupPoints.length==0&&this.__selectedOptions.supportedLanguages.length==1&&this.__selectedOptions.hours.length==1){this.selectedOptions.selectedPickupPoint=this.__selectedPickupPoint;this.selectedOptions.selectedRequestedLanguage=this.__selectedOptions.supportedLanguages[0].Code;this.selectedOptions.selectedHour=this.__selectedOptions.hours[0];n(this.selectedOptions);return}this.__selectedOptions.hours.length==1&&(this.selectedOptions.selectedHour=this.__selectedOptions.hours[0]);$("<div />",{id:"dialogWnd"}).appendTo("body");$("#dialogWnd").kendoWindow({width:700,title:!1,actions:["Close"],visible:!1,resizable:!1,maxHeight:620,modal:!0});$("#dialogWnd").parent().addClass("dlg");$("#dialogWnd").parent().addClass("dlgCarLocation");this.__wnd=$("#dialogWnd").data("kendoWindow");this.__wnd.content(this.__renderDialogContent(this.__selectedOptions));this.__errorMsg_PickupPoint=$("#addPickupPointErrorMsg");this.__errorMsg_Language=$("#addRequiredLanguageErrorMsg");this.__errorMsg_Hour=$("#addHourErrorMsg");this.__atachEvents();this.__wnd.center();this.__wnd.open()}}}),SelectProgramLanguageDlg=dejavu.Class.declare({$name:"SelectProgramLanguageDlg",__wnd:null,__selectedOptions:{},selectedOptions:{selectedRequestedLanguage:0},__callBack:null,__templateRender:null,__id:"",__errorMsg_Language:null,__reservationId:"",__requestId:"",__selectedRequestedLanguage:0,__languageCB:null,$static:{ADDED:""},initialize:function(n){this.__selectedOptions=n;this.__templateRender=kendo.template($("#SELECT_LANGUAGE").html());this.selectedOptions={selectedRequestedLanguage:n.selectedRequestedLanguage};this.__selectedRequestedLanguage=n.selectedRequestedLanguage},__atachEvents:function(){this.__wnd.bind("close",this.__onWndClose.$bind(this));this.__wnd.bind("deactivate",this.__onWndDeactivate.$bind(this));$("#addPickupBtn").unbind().click(this.__onOkClick.$bind(this));typeof this.__selectedOptions.btnCaption!="undefined"&&this.__selectedOptions.btnCaption!=""&&$("#addPickupBtn").html(this.__selectedOptions.btnCaption);$("#closeWndBtn").unbind().click(this.__onCancelClick.$bind(this));var n=null;this.__selectedOptions.supportedLanguages.length>1?($("#languageCB").kendoDropDownList({autoBind:!0,optionLabel:CommonMessages.CHOOSE_LANGUAGE,dataTextField:"Name",dataValueField:"Code",dataSource:this.__selectedOptions.supportedLanguages,value:this.__selectedRequestedLanguage,change:function(){this.__errorMsg_Language.hide()}.$bind(this)}),this.__languageCB=$("#languageCB").data("kendoDropDownList"),typeof this.__languageCB=="undefined"?this.__languageCB=null:this.__languageCB.value(this.__selectedRequestedLanguage)):this.__selectedOptions.supportedLanguages.length==1?(this.__languageCB=$("#languageCB"),this.__languageCB.length>0&&(this.__languageCB.hide(),this.__languageCB=null),n=$("#languageValue"),n.length>0&&(n.html(this.__selectedOptions.supportedLanguages[0].Code),n.show())):$("#languageSelection").hide()},__onOkClick:function(n){n.preventDefault();var i=!1,r="",t="";this.__languageCB!=null?(r=this.__languageCB.value(),r.toString()==""?(this.__errorMsg_Language.show(),i=!0):(t=this.__languageCB.value(),this.__errorMsg_Language.hide())):t=this.__selectedOptions.supportedLanguages.length==1?this.__selectedOptions.supportedLanguages[0].Code:this.__selectedRequestedLanguage;i||(this.selectedOptions.selectedRequestedLanguage=t,this.__wnd.close())},__cancelWnd:!1,__onCancelClick:function(n){n.preventDefault();this.__cancelWnd=!0;this.__wnd.close()},__detachEvents:function(){$(".addPickupBtn").unbind();$(".closeWndBtn").unbind()},__onWndClose:function(){this.__wnd.unbind("close",this.__onWndClose);this.__detachEvents();this.__callBack==null||this.__cancelWnd?this.__cancelWnd&&this.__callBack!=null&&this.__callBack({result:ActionResult.ERROR,message:""}):this.__callBack(this.selectedOptions)},__onWndDeactivate:function(){this.__wnd.destroy();$("#dialogWnd").remove()},__renderDialogContent:function(n){return this.__templateRender(n)},showDialog:function(n){if(this.__callBack=n,this.__selectedOptions.supportedLanguages.length!=0&&typeof n=="function"){if(this.__selectedOptions.supportedLanguages.length==1){this.selectedOptions.selectedRequestedLanguage=this.__selectedOptions.supportedLanguages[0].Code;n(this.selectedOptions);return}$("<div />",{id:"dialogWnd"}).appendTo("body");$("#dialogWnd").kendoWindow({width:700,title:!1,actions:["Close"],visible:!1,resizable:!1,maxHeight:620,modal:!0});$("#dialogWnd").parent().addClass("dlg");$("#dialogWnd").parent().addClass("dlgCarLocation");this.__wnd=$("#dialogWnd").data("kendoWindow");this.__wnd.content(this.__renderDialogContent(this.__selectedOptions));this.__errorMsg_Language=$("#addRequiredLanguageErrorMsg");this.__atachEvents();this.__wnd.center();this.__wnd.open()}}}),SelectLocationsDlg=dejavu.Class.declare({$name:"SelectLocationsDlg",__wnd:null,__selectedOptions:{},selectedOptions:{selectedPickupLocation:0,selectedReturnLocation:0},__callBack:null,__templateRender:null,__id:"",__errorMsg:null,__reservationId:"",__requestId:"",__selectedPickup:0,__selectedReturn:0,$static:{ADD_PICKUP_LOCATION:"",ADD_RETURN_LOCATION:"",ADDED:""},initialize:function(n){this.__selectedOptions=n;this.__templateRender=kendo.template($("#SELECT_LOCATIONS").html());this.selectedOptions={selectedPickupLocation:n.selectedPickupLocation,selectedReturnLocation:n.selectedReturnLocation};this.__selectedPickup=n.selectedPickupLocation;this.__selectedReturn=n.selectedReturnLocation},__atachEvents:function(){var n,t,r,i,u;for(this.__wnd.bind("close",this.__onWndClose.$bind(this)),this.__wnd.bind("deactivate",this.__onWndDeactivate.$bind(this)),n=$(".selectPickupLocation"),t=0;t<n.length;t++)r=$(n[t]),r.unbind().click(this.__selectPickupClick.$bind(this));for(n=$(".selectDropoffLocation"),i=0;i<n.length;i++)u=$(n[i]),u.unbind().click(this.__selectDropoffClick.$bind(this));$("#addCarLocations").unbind().click(this.__onOkClick.$bind(this));$("#cancelAddCarLocations").unbind().click(this.__onCancelClick.$bind(this))},__selectPickupClick:function(n){for(var r=$(n.currentTarget),i=$(".selectPickupLocation"),t=0;t<i.length;t++)i[t].id!==r[0].id&&(i[t].checked=!1);this.__selectedPickup=r.data("locationid");this.__selectedReturn!=0&&this.__errorMsg.css("display")!="none"&&this.__errorMsg.hide()},__selectDropoffClick:function(n){for(var r=$(n.currentTarget),i=$(".selectDropoffLocation"),t=0;t<i.length;t++)i[t].id!==r[0].id&&(i[t].checked=!1);this.__selectedReturn=r.data("locationid");this.__selectedPickup!=0&&this.__errorMsg.css("display")!="none"&&this.__errorMsg.hide()},__onOkClick:function(n){n.preventDefault();this.__selectedPickup==0||this.__selectedReturn==0?this.__errorMsg.show():(this.__errorMsg.hide(),this.selectedOptions.selectedPickupLocation=this.__selectedPickup,this.selectedOptions.selectedReturnLocation=this.__selectedReturn,this.__wnd.close())},__onCancelClick:function(n){n.preventDefault();this.__wnd.close()},__detachEvents:function(){$(".selectPickupBtn").unbind();$(".selectDropoffBtn").unbind()},__onWndClose:function(){this.__wnd.unbind("close",this.__onWndClose);this.__detachEvents();this.__callBack!=null&&this.__callBack(this.selectedOptions)},__onWndDeactivate:function(){this.__wnd.destroy();$("#dialogWnd").remove()},__renderDialogContent:function(n){return this.__templateRender(n)},showDialog:function(n){$("<div />",{id:"dialogWnd"}).appendTo("body");$("#dialogWnd").kendoWindow({width:700,title:!1,actions:["Close"],visible:!1,resizable:!1,maxHeight:620,modal:!0});$("#dialogWnd").parent().addClass("dlg");$("#dialogWnd").parent().addClass("dlgCarLocation");this.__wnd=$("#dialogWnd").data("kendoWindow");this.__callBack=n;this.__wnd=$("#dialogWnd").data("kendoWindow");this.__wnd.content(this.__renderDialogContent(this.__selectedOptions));this.__errorMsg=$("#addCarLocationsErrorMsg");this.__atachEvents();this.__wnd.center();this.__wnd.open()}}),SelectedSoFarItems=[],SelectedSoFarItem=dejavu.Class.declare({$name:"SelectedSoFarItem",_data:null,_item:null,_owner:null,_closeBtn:null,_onClose:null,_options:{},_objTooltip:null,__hideTooltip:null,initialize:function(n){if(this._options=n,this._item=$("#"+n.id),this._item.length==0&&(this._item=null),this._item!=null){this._data=this._item.data("sofardata");typeof this._data=="undefined"&&(this._data=null);this._closeBtn=this._item.find(n.removeServiceItemSelector);this._closeBtn.length==0?this._closeBtn=null:this._closeBtn.unbind().click(function(n){n.preventDefault();this.__onClose()}.$bind(this));this.setOnClose(this._options.onClose);this.setOwner(this._options.owner);var t=this._item.children();if(t.length>0&&(t=$(t[0])),typeof this._options.tooltipAdded!="undefined"&&this._options.tooltipAdded!=""){if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(i){}this._objTooltip.tooltipster({content:this._options.tooltipAdded,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom"})}}},showValidState:function(n){n?this._item.removeClass("selectedSoFarItemPartial"):this._item.addClass("selectedSoFarItemPartial")},isValid:function(){return!0},hide:function(){this._item!=null&&this._item.hide()},show:function(){this._item!=null&&this._item.show()},destroy:function(){this._data=null;this._closeBtn!=null&&this._closeBtn.unbind()},remove:function(){this._item!=null&&(this.destroy(),this._item.remove())},addStyle:function(n){this._item!=null&&this._item.addClass(n)},removeStyle:function(n){this._item!=null&&this._item.removeClass(n)},getData:function(){return this._item!=null&&this._data==null&&(this._data=this._item.data("sofardata"),typeof this._data=="undefined"&&(this._data=null)),this._data},getItem:function(){return this._item==null&&(this._item=$("#"+this._options.id),this._item.length==0&&(this._item=null)),this._item},getId:function(){return this._options.id},getDataForRequest:function(){return{}},getDataForRemoving:function(){return{}},enable:function(n){n?this._closeBtn!=null&&this._closeBtn.unbind().click(function(n){n.preventDefault();this.__onClose()}.$bind(this)):this._closeBtn!=null&&this._closeBtn.unbind().click(function(n){n.preventDefault()}.$bind(this))},updateData:function(n){this._data=n},getStatus:function(){return typeof this._data!="undefined"&&this._data!=null?this._data.Status:ItemState.UNDEFINED},setOwner:function(n){this._owner=n},setOnClose:function(n){typeof n=="function"&&(this._onClose=n)},setToolTipFunction:function(n){this.__hideTooltip=n!=null&&typeof n=="function"?n:null},__onClose:function(){this.__hideTooltip!=null&&typeof this.__hideTooltip=="function"&&this.__hideTooltip();this._onClose!=null&&this._onClose(this)},showNotification:function(n){if(this._item!=null&&this._objTooltip!=null){var i=$(this._item),t=this;i.scrollMinimal(!1,null);setTimeout(function(){typeof $(t._objTooltip).data("tooltipster")!="undefined"&&(typeof n=="string"&&t._objTooltip.tooltipster("content",n),t._objTooltip.tooltipster("show"))},200)}},hideNotification:function(){typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined"&&this._objTooltip.tooltipster("hide")}}),SelectedSoFarItemsController=dejavu.Class.declare({$name:"SelectedSoFarItemsController",_options:null,_templateDelete:null,_itemTemplate:null,_itemsContainer:null,_onItemCreated:null,_onItemDeleted:null,_owner:null,_lastId:1,_data:[],__hideTooltip:null,__pageUnloading:!1,initialize:function(n){var i,t,r;this._options=n;$(window).on("beforeunload",this.__onPageUnload.$bind(this));i=$("#"+n.ownerSelector);i.length>0&&(this._owner=i);t=$("#"+n.deleteConfirmationTemplateSelector);t.length>0&&(this._templateDelete=kendo.template(t.html()));t=$("#"+n.itemTemplateSelector);t.length>0&&(this._itemTemplate=kendo.template(t.html()));r=$("#"+n.itemsContainerSelector);r.length>0&&(this._itemsContainer=r);n.isCurrentStep&&this._owner!=null&&this._owner.show();this._initData();typeof n.onItemCreated!="undefined"&&typeof n.onItemCreated=="function"&&(this._onItemCreated=n.onItemCreated);typeof n.onItemDeleted!="undefined"&&typeof n.onItemDeleted=="function"&&(this._onItemDeleted=n.onItemDeleted);this._getItemsCount()==0&&typeof this._options.defaultContent!="undefined"&&$("#"+this._options.soFarContent).html(this._options.defaultContent)},getOwnerSelector:function(){return this._options.ownerSelector},__onPageUnload:function(){this.__pageUnloading=!0},PageUnLoading:function(){return this.__pageUnloading},setToolTipFunction:function(n){if(n!=null&&typeof n=="function")this.__hideTooltip=n;else{this.__hideTooltip=null;return}for(var t=0;t<this._data.length;t++)this._data[t].setToolTipFunction(n)},_onContinueBooking:function(){},_onAddAnotherProduct:function(){},addOptions:function(n){this._options==null&&(this._options={});$.extend(this._options,n);this._optionsAdded()},_optionsAdded:function(){typeof this._options.defaultContent!="undefined"&&this._getItemsCount()==0&&$("#"+this._options.soFarContent).html(this._options.defaultContent)},_initData:function(){for(var t,r,i,n=0;n<this._data.length;n++)this._data[n].destroy();if(this._data=[],t=this._getItems(),t.length!=0)for(i=0;i<t.length;i++)r=new this._options.Type({id:$(t[i]).attr("id"),owner:this,onClose:function(n){this.__onItemClose(n)}.$bind(this)}),r.setToolTipFunction(this.__hideTooltip),this._data.push(r)},__onItemClose:function(n){this._onItemDelete(n)},destroy:function(){$(this._options.removeServiceItemSelector).unbind()},hasData:function(){return this._data.length>0},hasAddedData:function(){return this._getItemsAdded().length>0},hasServiceData:function(){return this._getItemsService().length>0},getAllItemsData:function(){for(var t=[],n=0;n<this._data.length;n++)typeof this._data[n]!="undefined"&&(t=t.concat(this._data[n].getData()));return t},_getItemsAdded:function(){return _.filter(this._data,function(n){var t=n.getData();return t.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS||t.selectedSoFarItemType==SelectedSoFarItemType.ONREQUEST})},_getItemsAddedByRequestId:function(n){var t=this._getItemsAdded();return _.filter(t,function(t){var i=t.getData();return i.requestId==n&&(i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS||i.selectedSoFarItemType==SelectedSoFarItemType.ONREQUEST)})},_getServiceItemsAdded:function(){return _.filter(this._data,function(n){var t=n.getData();return t.selectedSoFarItemType==SelectedSoFarItemType.SERVICE})},getServiceItemAddedByServiceId:function(n){var t=_.find(this._data,function(t){var i=t.getData();return i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE&&i.serviceId==n});return typeof t=="undefined"?null:t},getServiceItemAddedByResultItemId:function(n,t){var i=_.find(this._data,function(n){var i=n.getData();return i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&i.resultItemId==t});return typeof i=="undefined"?null:i},_getAddedServices:function(){return _.filter(this._data,function(n){var t=n.getData();return t.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS})},_getItemsService:function(){return _.filter(this._data,function(n){var t=n.getData();return t.selectedSoFarItemType!=SelectedSoFarItemType.INPROCESS&&t.selectedSoFarItemType!=SelectedSoFarItemType.ONREQUEST})},_getItemAdded:function(n){if(typeof n=="undefined")return null;var i=SelectedSoFarItemType.INPROCESS,t=$(this._options.itemsSelector+"[id*='"+n.toString()+i+"']");return t.length==0?null:t},_getServiceItemAdded:function(n){if(typeof n=="undefined")return null;var i=SelectedSoFarItemType.SERVICE,t=$(this._options.itemsSelector+"[id*='"+n.toString()+i+"']");return t.length==0?null:t},_getItemById:function(n){var t=_.filter(this._data,function(t){return t.getId()==n});return t.length>0?t[0]:null},_refreshItem:function(n,t,i){if(typeof this._options.addSelectedSoFarActionURL=="undefined"||this._options.addSelectedSoFarActionURL==""){i!=null&&i(!1);return}t.NeedTotalPrices=!0;var u=null,r=null;u=typeof t.ServiceId=="undefined"?$(this._getItemAdded(n)):$(this._getServiceItemAdded(n));u.length==1&&(r=this._getItemById(u.attr("id")),r!=null&&r.enable(!1));try{$.ajax({type:"POST",context:this,contentType:"application/json",url:this._options.addSelectedSoFarActionURL,data:JSON.stringify(t),dataType:"html",success:function(u){var e,f;r!=null&&r.enable(!0);var o=$(u),s=o.hasClass("selectedSoFarItem"),h=o.hasClass("OperationErrorSelectedSoFar");if(!s&&h){i!=null&&i(!1,{errorMessage:o.val()});return}e=[];f=null;e=typeof t.ServiceId=="undefined"?$(this._getItemAdded(n)):$(this._getServiceItemAdded(n));e.length==0?(typeof this._options.defaultContent!="undefined"&&this._getItemsCount()==0&&$("#"+this._options.soFarContent).html(""),$("#"+this._options.soFarContent).append(u)):e.replaceWith(u);f=$(u).data("sofardata");typeof f=="undefined"&&(f=null);this.onItemCreated();i!=null&&i(!0,f)},error:function(){r!=null&&r.enable(!0);i!=null&&i(!1,null)}})}catch(f){r!=null&&r.enable(!0);i!=null&&i(!1,null)}},_getNewId:function(){return this._lastId++,"new_"+this._lastId},_getItems:function(){return $(this._options.itemsSelector)},_getItemsCount:function(){return this._getItems().length},_removeItem:function(n){var t=n.getData();this._data=_.filter(this._data,function(n){return n.getData().uid!=t.uid});n.remove();this._getItemsCount()==0&&(this._options.isCurrentStep?typeof this._options.defaultContent!="undefined"&&$("#"+this._options.soFarContent).html(this._options.defaultContent):this._hide())},_updatePrice:function(n){$(this._options.priceSelector).html(n)},_onItemDelete:function(n){var t=n.getData(),i=this;ConfirmDlg(CommonMessages.CONFIRM_TITLE,t.removeMessage,"czConfirm",[CommonMessages.YES,CommonMessages.NO],".item-video",function(r){var u,f,e;if(r==CommonMessages.YES){if(u="",f={},t.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS||t.selectedSoFarItemType==SelectedSoFarItemType.ONREQUEST?(u=this._options.removeSelectedSoFarActionURL,e=n.getDataForRemoving(),f={reservationId:this._options.reservationId,needTotalPrice:!0},$.extend(f,e)):(u=this._options.deleteServiceActionURL,f={serviceId:t.serviceId,reservationId:this._options.reservationId,needTotalPrice:!0}),u=="")return;$.ajax({context:this,type:"POST",contentType:"application/json",url:u,data:JSON.stringify(f),success:function(t){typeof t!="undefined"&&t!=null&&(t.Result?(this._removeItem(n),this._updatePrice(t.price),typeof this._options.customOnDelete!="undefined"&&this._options.customOnDelete!=null&&setTimeout(this._options.customOnDelete,100),this._onItemDeleted!=null&&(t.totals="$ 100.00",setTimeout(function(){i._onItemDeleted(t)},100))):ConfirmDlg(CommonMessages.ERROR_SORRY,t.ErrorMessage,"czError",[CommonMessages.OK],".item-video"))},error:function(){this.PageUnLoading()||ConfirmDlg(CommonMessages.ERROR_SORRY,CommonMessages.ALERT_TECH_ERROR,"czError",[CommonMessages.OK],".item-video")}})}}.$bind(this))},deleteItem:function(n){var u=this,t,r,i;try{if(t=this.getServiceItemAddedByResultItemId(n.requestId,n.resultItemId),t==null)return;r=this._options.removeSelectedSoFarActionURL;i={reservationId:this._options.reservationId,needTotalPrice:!0};$.extend(i,n);$.ajax({context:this,type:"POST",contentType:"application/json",url:r,data:JSON.stringify(i),success:function(n){typeof n!="undefined"&&n!=null&&(n.Result?(this._removeItem(t),this._updatePrice(n.price),typeof this._options.customOnDelete!="undefined"&&this._options.customOnDelete!=null&&setTimeout(this._options.customOnDelete,100),this._onItemDeleted!=null&&(n.totals="$ 100.00",setTimeout(function(){u._onItemDeleted(n)},100))):ConfirmDlg(CommonMessages.ERROR_SORRY,n.ErrorMessage,"czError",[CommonMessages.OK],".item-video"))},error:function(){this.PageUnLoading()||ConfirmDlg(CommonMessages.ERROR_SORRY,CommonMessages.ALERT_TECH_ERROR,"czError",[CommonMessages.OK],".item-video")}})}catch(f){ConfirmDlg(CommonMessages.ERROR_SORRY,CommonMessages.ALERT_TECH_ERROR,"czError",[CommonMessages.OK],".item-video")}},onItemCreated:function(){this._initData();this.updateValidState();this._onItemCreated!=null&&setTimeout(this._onItemCreated,100)},addItem:function(n){n.id=this._getNewId();this._renderItem(n)&&this.onItemCreated()},_renderItem:function(n){if(this._itemTemplate==null||this._itemsContainer==null)return!1;var t=this._itemTemplate(n);return this._itemsContainer.append(t),!0},_hide:function(){typeof this._owner!="undefined"&&this._owner!=null&&this._owner.hide()},_show:function(){typeof this._owner!="undefined"&&this._owner!=null&&this._owner.show()},visible:function(n){n?this._show():this._hide()},setIsCurrentStep:function(n){this._options.isCurrentStep=n;n&&this._show()},isValid:function(){for(var n=0;n<this._data.length;n++)if(!this._data[n].isValid())return!1;return!0},updateValidState:function(){for(var n=0;n<this._data.length;n++)this._data[n].showValidState(this._data[n].isValid())},getDataForRequest:function(){for(var i=this._getAddedServices(),r={url:this._options.addServiceURL,services:[]},t,n=0;n<i.length;n++)i[n].isValid()&&(t=i[n].getDataForRequest(),t.ReservationId=this._options.reservationId,t.ServiceId=this._options.serviceId,r.services.push(t));return r},hideNotifications:function(){for(var n=0;n<this._data.length;n++)this._data[n].hideNotification()},getListController:function(){return this._options==null?null:typeof this._options.listController=="undefined"||this._options.listController==null?null:this._options.listController}}),PackageSelectedSoFarItem=dejavu.AbstractClass.declare({$name:"PackageSelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){this.$super(n)},isValid:function(){return!0},getDataForRemoving:function(){var n=this.getData();return{requestId:n.requestId,resultItemId:n.resultItemId}}}),PackageSelectedSoFarItemsController=dejavu.Class.declare({$name:"PackageSelectedSoFarItemsController",$extends:SelectedSoFarItemsController,_updatePackageHourLanguageActionURL:"",initialize:function(n){this.$super(n);this._updatePackageHourLanguageActionURL=n.updatePackageHourLanguageActionURL},isValid:function(){return!0}}),ExcursionSelectedSoFarItem=dejavu.Class.declare({$name:"ExcursionSelectedSoFarItem",$extends:PackageSelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeExcursion",onClose:n.onClose,owner:n.owner,tooltipAdded:CommonMessages.EXCURSION_ADDED});this.__eventBinding()},__eventBinding:function(){var n,t,i;this._item!=null&&(n=this._item.find(".excursionShowDetailsLink"),n.length>0&&n.unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleDetails($(n.target).data("detailsection"),$(n.target))}.$bind(this)),t=this._item.find(".excursionShowBreakdownLink"),t.length>0&&t.unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleBreakdown($(n.target).data("breakdownsection"),$(n.target))}.$bind(this)),i=this._item.find("a.changePickupLanguage"),i.length>0&&i.click(this.__onChangePickupLanguageClick.$bind(this)))},__toogleDetails:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html(CommonMessages.SHOW_DETAILS)):(i.show("slow"),t.html(CommonMessages.HIDE_DETAILS)))},__onChangePickupLanguageClick:function(n){n.preventDefault();this._owner!=null&&this._owner.editPickupLanguage(this,this.__onEditPickupLanguageComplete.$bind(this))},__onEditPickupLanguageComplete:function(n){var i,t;n.result==ActionResult.OK?(i=this.getData(),typeof n.serviceId!="undefined"&&(i.serviceId=n.serviceId),i.pickupPlace=n.selectedPickupPoint,i.requestedLanguageCode=n.selectedRequestedLanguage,i.requestedLanguage=n.languageName,i.selectedStartTime=n.selectedStartTime,this._item.data("sofardata",i),t=this._item.find("strong.requestedLanguage"),t.length>0&&t.html(n.selectedRequestedLanguage),t=this._item.find("strong.pickupPlaceName"),t.length>0&&t.html(n.selectedPickupPoint),t=this._item.find("strong.pickupHourValue"),t.length>0&&t.html(n.selectedStartTime.TimeToString)):n.result==ActionResult.ERROR&&n.errorMessage!=""&&ConfirmDlg(CommonMessages.ERROR_SORRY,n.errorMessage,"czError",[CommonMessages.OK],".item-video")},getDataForRemoving:function(){var n=this.getData();return{requestId:n.requestId,resultItemId:n.resultItemId}},__toogleBreakdown:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html("+ "+CommonMessages.PRICE_BREAKDOWN)):(i.show("slow"),t.html("- "+CommonMessages.PRICE_BREAKDOWN)))},isValid:function(){return!0},getDataForRequest:function(){var n=this.getData(),t={BookingServiceRequestId:n.requestId,BookingServiceRequestOptionId:n.resultItemId,ReservationId:0,ServiceId:0,PackageBookingServiceVersionFareOptionId:n.fareOptionId,PickupPoint:n.pickupPlace,PickupPointCode:n.pickupPointCode,RequiredLanguage:n.requestedLanguageCode,CharacterId:n.characterId,StartTime:{Hour:n.selectedStartTime.Hour,Minute:n.selectedStartTime.Minute}};return typeof n.selectedStartTime.MaxHour!="undefined"&&n.selectedStartTime.MaxHour!=null&&n.selectedStartTime.MaxHour.toString()!=""&&typeof n.selectedStartTime.MaxMinute!="undefined"&&n.selectedStartTime.MaxMinute!=null&&n.selectedStartTime.MaxMinute.toString()!=""&&(t.PickupMaxTime={Hour:n.selectedStartTime.MaxHour,Minute:n.selectedStartTime.MaxMinute}),t}}),ExcursionsSelectedSoFarItemsController=dejavu.Class.declare({$name:"ExcursionsSelectedSoFarItemsController",$extends:PackageSelectedSoFarItemsController,__updateExcursionPickupPointLanguageActionURL:"",__getHotelsFromFareOptionActionURL:"",initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addServiceURL:n.addServiceURL,addSelectedSoFarActionURL:n.addSelectedExcursionSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,step:SystemSteps.EXCURSIONS,deleteConfirmationTemplateSelector:"delete-confirmation",itemTemplateSelector:"itemExcursionTemplate",itemsContainerSelector:"itemsExcursionContainer",itemsSelector:".itemExcursion",ownerSelector:"excursionspanel",soFarContent:"excursionSoFarContent",Type:ExcursionSelectedSoFarItem});this.__updateExcursionPickupPointLanguageActionURL=n.updateExcursionPickupPointLanguageActionURL;this.__getHotelsFromFareOptionActionURL=n.getHotelsFromFareOptionActionURL},__addIsPosible:function(){return!0},__isValidExcursion:function(){return!0},__getDataForRequest:function(n,t){var i={ReservationId:this._options.reservationId,ResultItemId:t.resultItemId,RequestId:n,FareOptionId:t.fareOptionId,PickupPlace:t.pickupPlace,RequiredLanguageCode:t.requiredLanguageCode,SelectedStartTime:t.selectedStartTime,PickupPointCode:t.selectedPickupPointCode};return typeof t.serviceId!="undefined"?i.ServiceId=t.serviceId:typeof t.editingResultItemId!="undefined"&&(i.EditingResultItemId=t.editingResultItemId),i},checkIfWasInserted:function(n){var i=[],u=!1,t,r;if(typeof n.serviceId!="undefined"?(u=!0,i=this._getServiceItemsAdded()):i=this._getItemsAdded(),i.length==0)return null;for(r=0;r<i.length;r++)if(t=i[r].getData(),t!=null)if(u){if(t.serviceId==n.serviceId&&t.excursionId==n.excursionId&&t.versionId==n.versionId&&t.characterId==n.privacyTypeId&&_.contains(n.pickupPointCodes,t.pickupPointCode))return i[r]}else if(t.excursionId==n.excursionId&&t.requestId==n.requestId&&t.fareOptionId==n.fareOptionId)return i[r];return null},__sendErrorBack:function(n,t){typeof n!="undefined"&&n!=null&&n({result:ActionResult.ERROR,selectedPickupPoint:"",selectedRequestedLanguage:"",languageName:"",errorMessage:t})},__showPickupPointLanguageEditor:function(n,t){var i=new SelectExcursionPickupLocationLanguageDlg(n),r=this;i.showDialog(function(n){if(typeof n.selectedPickupPoint=="undefined"||typeof n.selectedRequestedLanguage=="undefined"||n.selectedPickupPoint==""&&n.selectedRequestedLanguage==""){r.__sendErrorBack(t,"");return}typeof t!="undefined"&&t!=null&&t({result:ActionResult.OK,selectedPickupPoint:n.selectedPickupPoint,selectedRequestedLanguage:n.selectedRequestedLanguage,selectedHour:n.selectedHour,selectedPickupPointCode:n.selectedPickupPointCode,errorMessage:""})})},__showPickupPointLanguageEditorForAjaxPointsLoader:function(n,t){var i=this,r;try{r={bid:n.bid,fareOptionId:n.fareOptionId,requestId:n.requestId};n.data.selectedSoFarItemType==SelectedSoFarItemType.SERVICE?r.serviceId=n.data.serviceId:n.data.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&(r.resultItemId=n.data.resultItemId);$.ajax({type:"POST",context:this,contentType:"application/json",dataType:"json",url:this.__getHotelsFromFareOptionActionURL,data:JSON.stringify(r),success:function(r){if(r!=null&&r.Result){if(n.destinations=r.Destinations,n.pickupPoints=r.Hotels,n.hours=r.Hours,n.supportedLanguages=r.SupportedLanguages,n.supportedLanguages.length==1&&r.Hotels.length==1&&r.Hours.length==1){var u={result:ActionResult.OK,selectedPickupPoint:r.Hotels[0].Name,selectedPickupPointCode:n.selectedPickupPointCode,selectedRequestedLanguage:n.supportedLanguages[0].Code,selectedHour:r.Hours[0],errorMessage:""};t!=null&&t(u);return}if(typeof n.pickupPoints=="undefined"||n.pickupPoints==null||n.pickupPoints.length==0||typeof n.hours=="undefined"||n.hours==null||n.hours.length==0||typeof n.supportedLanguages=="undefined"||n.supportedLanguages==null||n.supportedLanguages.length==0){i.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}i.__showPickupPointLanguageEditor(n,t)}else i.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR)},error:function(){i.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}})}catch(u){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}},__modifyPickupLanguage:function(n,t){n.data.selectedSoFarItemType==SelectedSoFarItemType.SERVICE||n.hasPickup?this.__showPickupPointLanguageEditorForAjaxPointsLoader(n,t):this.__showPickupPointLanguageEditor(n,t)},editPickupLanguage:function(n,t){var i=n.getData(),r;if(i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&i.supportedLanguages.length==0||this.__getHotelsFromFareOptionActionURL==""){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}r={data:i,requestId:i.requestId,bid:this._options.reservationId,fareOptionId:i.fareOptionId,supportedLanguages:i.supportedLanguages,selectedRequestedLanguage:i.requestedLanguageCode,pickupPoints:[],selectedPickupPoint:i.pickupPlace,selectedPickupPointCode:i.pickupPointCode,hasPickup:i.pickupPoints.length>0,selectedHour:i.selectedStartTime,hours:i.pickupHours,timeLabel:i.timeLabel};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE?r.serviceId=i.serviceId:i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&(r.resultItemId=i.resultItemId);this.__modifyPickupLanguage(r,function(n){if(n.result==ActionResult.OK){if(this.__updateExcursionPickupPointLanguageActionURL==""||n.selectedPickupPoint==r.selectedPickupPoint&&n.selectedRequestedLanguage==r.selectedRequestedLanguage&&n.selectedHour.TimeToString==r.selectedHour.TimeToString){this.__sendErrorBack(t,"");return}var u={bid:this._options.reservationId,resultItemId:i.resultItemId,fareOptionId:i.fareOptionId,serviceId:i.serviceId,pickupPlace:n.selectedPickupPoint,requiredLanguageCode:n.selectedRequestedLanguage,selectedStartTime:n.selectedHour,pickupPointCode:n.selectedPickupPointCode};try{$.ajax({type:"POST",context:this,contentType:"application/json",dataType:"json",url:this.__updateExcursionPickupPointLanguageActionURL,data:JSON.stringify(u),success:function(r){if(r.Result){if(typeof t!="undefined"&&t!=null){var u={result:ActionResult.OK,selectedPickupPoint:n.selectedPickupPoint,selectedRequestedLanguage:n.selectedRequestedLanguage,selectedStartTime:n.selectedHour,languageName:r.LanguageName,errorMessage:""};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE&&typeof r.ServiceId!="undefined"&&(u.serviceId=r.ServiceId);t(u)}}else this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR)},error:function(){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}})}catch(f){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}}else this.__sendErrorBack(t,typeof n.errorMessage=="string"?n.errorMessage:"")}.$bind(this))},__getServiceItemAddedByResultItemId:function(n,t){var i=_.find(this._data,function(n){var i=n.getData();return i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&i.resultItemId==t});return typeof i=="undefined"?null:i},selectPickupLanguage:function(n,t){var i,u,r;if(n.supportedLanguages.length==0||n.hours.length==0||this.__getHotelsFromFareOptionActionURL==""){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}i={data:n,requestId:n.requestId,bid:this._options.reservationId,fareOptionId:n.fareOptionId,supportedLanguages:n.supportedLanguages,pickupPoints:[],selectedRequestedLanguage:"",selectedPickupPoint:"",selectedHour:{TimeToString:"",Hour:0,Minute:0,MaxHour:0,MaxMinute:0},resultItemId:n.resultItemId,serviceId:n.serviceId,hours:n.hours,timeLabel:n.timeLabel};i.data.selectedSoFarItemType=typeof i.serviceId=="undefined"?SelectedSoFarItemType.INPROCESS:SelectedSoFarItemType.SERVICE;u=null;n.isEditing&&(u=i.data.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS?this.getServiceItemAddedByResultItemId("",n.editingResultItemId):this.getServiceItemAddedByServiceId(n.serviceId));u!=null&&(r=u.getData(),r!=null&&(i.selectedRequestedLanguage=r.requestedLanguageCode,i.selectedPickupPoint=r.pickupPlace,i.selectedHour=r.selectedStartTime));n.hasPickup?this.__showPickupPointLanguageEditorForAjaxPointsLoader(i,t):this.__showPickupPointLanguageEditor(i,t)},AddExcursion:function(n,t,i){if(t.requestId=n,t.isEditing=typeof t.serviceId!="undefined"||typeof t.editingResultItemId!="undefined",this.__addIsPosible(t)){var r=this;this.selectPickupLanguage(t,function(r){var u,f;if(r.result==ActionResult.OK){if(t.pickupPlace=r.selectedPickupPoint,t.requiredLanguageCode=r.selectedRequestedLanguage,t.selectedStartTime=r.selectedHour,t.selectedPickupPointCode=r.selectedPickupPointCode,u=this.__getDataForRequest(n,t),u==null&&i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1});return}f="";f=typeof u.ServiceId!="undefined"?u.ServiceId:typeof u.EditingResultItemId!="undefined"?u.EditingResultItemId:n+"_"+t.resultItemId;this._refreshItem(f,u,function(n,r){if(n){if(i!=null&&r!=null){typeof t.serviceId!="undefined"?t.serviceId=r.serviceId:typeof t.editingResultItemId!="undefined"&&(t.resultItemId=r.resultItemId);var u=this.checkIfWasInserted(t);u!=null&&u.showNotification();i({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidExcursion(u):!1,soFarData:u!=null?u.getData():null})}}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:typeof r.errorMessage=="string"?r.errorMessage:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}}),ProgramSelectedSoFarItem=dejavu.Class.declare({$name:"ProgramSelectedSoFarItem",$extends:PackageSelectedSoFarItem,__showDetailsLink:"",__showBreakdownLink:"",initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:typeof n.removeServiceItemSelector=="undefined"?".removeProgramService":n.removeServiceItemSelector,onClose:n.onClose,owner:n.owner,tooltipAdded:typeof n.tooltipAdded=="undefined"?CommonMessages.SPECIAL_PROGRAM_ADDED:n.tooltipAdded});this.__showDetailsLink=typeof n.showDetailsLink=="undefined"?".programDetailsLink":n.showDetailsLink;this.__showBreakdownLink=typeof n.showBreakdownLink=="undefined"?".programBreakdownLink":n.showBreakdownLink;this.__eventBinding()},__eventBinding:function(){var n,t,i;this._item!=null&&(n=this._item.find(this.__showDetailsLink),n.length>0&&n.unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleDetails($(n.target).data("detailsection"),$(n.target))}.$bind(this)),t=this._item.find(this.__showBreakdownLink),t.length>0&&t.unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleBreakdown($(n.target).data("breakdownsection"),$(n.target))}.$bind(this)),i=this._item.find("a.changeLanguage"),i.length>0&&i.unbind().click(this.__onChangeLanguageClick.$bind(this)))},__toogleDetails:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html(CommonMessages.SHOW_DETAILS)):(i.show("slow"),t.html(CommonMessages.HIDE_DETAILS)))},__toogleBreakdown:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html("+ "+CommonMessages.PRICE_BREAKDOWN)):(i.show("slow"),t.html("- "+CommonMessages.PRICE_BREAKDOWN)))},__onChangeLanguageClick:function(n){n.preventDefault();this._owner!=null&&this._owner.editLanguage(this,this.__onEditLanguageComplete.$bind(this))},__onEditLanguageComplete:function(n){var t,i;n.result==ActionResult.OK?(t=this.getData(),typeof n.serviceId!="undefined"&&(t.serviceId=n.serviceId),t.requestedLanguageCode=n.selectedRequestedLanguage,t.requestedLanguage=n.languageName,this._item.data("sofardata",t),i=this._item.find("strong.requestedLanguage"),i.length>0&&i.html(n.selectedRequestedLanguage)):n.result==ActionResult.ERROR&&n.errorMessage!=""&&ConfirmDlg(CommonMessages.ERROR_SORRY,n.errorMessage,"czError",[CommonMessages.OK],".item-video")},getDataForRequest:function(){var n=this.getData();return{BookingServiceRequestId:n.requestId,BookingServiceRequestOptionId:n.resultItemId,ReservationId:0,ServiceId:0,PackageBookingServiceVersionFareOptionId:n.fareOptionId,RequiredLanguage:n.requestedLanguageCode,CharacterId:n.characterId,ProgramTypeId:n.programTypeId}}}),ProgramsSelectedSoFarItemsController=dejavu.Class.declare({$name:"ProgramsSelectedSoFarItemsController",$extends:PackageSelectedSoFarItemsController,_programType:"SpecialProgram",initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addServiceURL:n.addServiceURL,addSelectedSoFarActionURL:n.addSelectedProgramSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,updatePackageHourLanguageActionURL:n.updatePackageHourLanguageActionURL,step:typeof n.step=="undefined"?SystemSteps.PROGRAMS:n.step,deleteConfirmationTemplateSelector:typeof n.deleteConfirmationTemplateSelector=="undefined"?"delete-confirmation":n.deleteConfirmationTemplateSelector,itemTemplateSelector:typeof n.itemTemplateSelector=="undefined"?"itemProgramTemplate":n.itemTemplateSelector,itemsContainerSelector:typeof n.itemsContainerSelector=="undefined"?"itemsProgramContainer":n.itemsContainerSelector,itemsSelector:typeof n.itemsSelector=="undefined"?".itemProgram":n.itemsSelector,ownerSelector:typeof n.ownerSelector=="undefined"?"programspanel":n.ownerSelector,soFarContent:typeof n.soFarContent=="undefined"?"programSoFarContent":n.soFarContent,Type:typeof n.Type=="undefined"?ProgramSelectedSoFarItem:n.Type});this._programType=typeof n.programType=="undefined"?ProgramType.SPECIAL_PROGRAM:n.programType},getProgramType:function(){return this._programType},__getDataForRequest:function(n,t){var i={ReservationId:this._options.reservationId,ResultItemId:t.resultItemId,RequestId:n,FareOptionId:t.fareOptionId,RequiredLanguageCode:t.requiredLanguageCode,SelectedStartTime:t.selectedStartTime,ProgramType:t.programType};return typeof t.serviceId!="undefined"?i.ServiceId=t.serviceId:typeof t.editingResultItemId!="undefined"&&(i.EditingResultItemId=t.editingResultItemId),i},__addIsPosible:function(){return!0},__isValidProgram:function(){return!0},checkIfWasInserted:function(n){var i=[],u=!1,t,r;if(typeof n.serviceId!="undefined"?(u=!0,i=this._getServiceItemsAdded()):i=this._getItemsAdded(),i.length==0)return null;for(r=0;r<i.length;r++)if(t=i[r].getData(),t!=null)if(u){if(t.serviceId==n.serviceId&&t.programId==n.programId&&t.versionId==n.versionId&&t.characterId==n.privacyTypeId)return i[r]}else if(t.programId==n.programId&&t.requestId==n.requestId&&t.fareOptionId==n.fareOptionId)return i[r];return null},__sendErrorBack:function(n,t){typeof n!="undefined"&&n!=null&&n({result:ActionResult.ERROR,selectedRequestedLanguage:"",languageName:"",errorMessage:t})},AddProgram:function(n,t,i){if(t.requestId=n,t.isEditing=typeof t.serviceId!="undefined"||typeof t.editingResultItemId!="undefined",this.__addIsPosible(t)){var r=this;this.selectLanguage(t,function(r){var u,f;if(r.result==ActionResult.OK){if(t.requiredLanguageCode=r.selectedRequestedLanguage,u=this.__getDataForRequest(n,t),u==null&&i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1});return}f="";f=typeof u.ServiceId!="undefined"?u.ServiceId:typeof u.EditingResultItemId!="undefined"?u.EditingResultItemId:n+"_"+t.resultItemId;this._refreshItem(f,u,function(n,r){if(n){if(i!=null&&r!=null){typeof t.serviceId!="undefined"?t.serviceId=r.serviceId:typeof t.editingResultItemId!="undefined"&&(t.resultItemId=r.resultItemId);var u=this.checkIfWasInserted(t);u!=null&&u.showNotification();i({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidProgram(u):!1,soFarData:u!=null?u.getData():null})}}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:typeof r.errorMessage=="string"?r.errorMessage:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}},selectLanguage:function(n,t){var i,r,u;if(n.supportedLanguages.length==0){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}i={data:n,requestId:n.requestId,bid:this._options.reservationId,fareOptionId:n.fareOptionId,supportedLanguages:n.supportedLanguages,selectedRequestedLanguage:"",resultItemId:n.resultItemId,serviceId:n.serviceId,btnCaption:n.btnCaption};i.data.selectedSoFarItemType=typeof i.serviceId=="undefined"?SelectedSoFarItemType.INPROCESS:SelectedSoFarItemType.SERVICE;r=null;n.isEditing&&(r=i.data.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS?this.getServiceItemAddedByResultItemId("",n.editingResultItemId):this.getServiceItemAddedByServiceId(n.serviceId));r!=null&&(u=r.getData(),u!=null&&(i.selectedRequestedLanguage=u.requestedLanguageCode));this.__showLanguageEditor(i,t)},__showLanguageEditor:function(n,t){var i=new SelectProgramLanguageDlg(n),r=this;i.showDialog(function(n){if(typeof n.selectedRequestedLanguage=="undefined"||n.selectedRequestedLanguage==""){r.__sendErrorBack(t,"");return}typeof t!="undefined"&&t!=null&&t({result:ActionResult.OK,selectedRequestedLanguage:n.selectedRequestedLanguage,errorMessage:""})})},editLanguage:function(n,t){var i=n.getData(),r;if(i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&i.supportedLanguages.length==0){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}r={data:i,requestId:i.requestId,bid:this._options.reservationId,fareOptionId:i.fareOptionId,supportedLanguages:i.supportedLanguages,selectedRequestedLanguage:i.requestedLanguageCode,btnCaption:i.btnCaption};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE?r.serviceId=i.serviceId:i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&(r.resultItemId=i.resultItemId);this.__showLanguageEditor(r,function(n){if(n.result==ActionResult.OK){if(this._updatePackageHourLanguageActionURL==""||n.selectedRequestedLanguage==r.selectedRequestedLanguage&&n.selectedHour.TimeToString==r.selectedHour.TimeToString){this.__sendErrorBack(t,"");return}var u={bid:this._options.reservationId,resultItemId:i.resultItemId,fareOptionId:i.fareOptionId,serviceId:i.serviceId,requiredLanguageCode:n.selectedRequestedLanguage};try{$.ajax({type:"POST",context:this,contentType:"application/json",dataType:"json",url:this._updatePackageHourLanguageActionURL,data:JSON.stringify(u),success:function(r){if(r.Result){if(typeof t!="undefined"&&t!=null){var u={result:ActionResult.OK,selectedRequestedLanguage:n.selectedRequestedLanguage,languageName:r.LanguageName,errorMessage:""};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE&&typeof r.ServiceId!="undefined"&&(u.serviceId=r.ServiceId);t(u)}}else this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR)},error:function(){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}})}catch(f){this.__sendErrorBack(t,CommonMessages.ALERT_TECH_ERROR);return}}else this.__sendErrorBack(t,typeof n.errorMessage=="string"?n.errorMessage:"")}.$bind(this))}}),TourSelectedSoFarItem=dejavu.Class.declare({$name:"TourSelectedSoFarItem",$extends:ProgramSelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeTourService",onClose:n.onClose,owner:n.owner,tooltipAdded:CommonMessages.TOUR_ADDED,showDetailsLink:".tourDetailsLink",showBreakdownLink:".tourBreakdownLink"})}}),ToursSelectedSoFarItemsController=dejavu.Class.declare({$name:"ToursSelectedSoFarItemsController",$extends:ProgramsSelectedSoFarItemsController,initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addServiceURL:n.addServiceURL,addSelectedProgramSoFarActionURL:n.addSelectedProgramSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,updatePackageHourLanguageActionURL:n.updatePackageHourLanguageActionURL,step:SystemSteps.TOURS,itemsContainerSelector:"itemsTourContainer",itemsSelector:".itemTour",ownerSelector:"tourspanel",soFarContent:"tourSoFarContent",Type:TourSelectedSoFarItem,programType:ProgramType.TOUR})}}),FlightSelectedSoFarItem=dejavu.Class.declare({$name:"FlightSelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeFlightService",onClose:n.onClose,owner:n.owner,tooltipAdded:""});this.__initTooltip();this.__eventBinding()},enable:function(n){if(this.$super(n),this._item!=null){var t=this._item.find(".selectReturnFlightLink");typeof t!="undefined"&&t.length==1&&(n?t.unbind():t.unbind().click(function(n){n.preventDefault()}))}},__initTooltip:function(){var n=this.getData();if(n.oneWay){if(this._data.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS){if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header.ssf-item-outbound-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(t){}this._objTooltip.tooltipster({content:CommonMessages.FLIGHT_ADDED,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom",contentAsHTML:!0})}}else if(n.inboundLegId==""){if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header.ssf-item-outbound-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(t){}this._objTooltip.tooltipster({content:CommonMessages.FLIGHT_OUTBOUND_ADDED_NEED_INBOUND,contentAsHTML:!0,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom"})}else{if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header.ssf-item-outbound-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(t){}this._objTooltip.tooltipster({content:CommonMessages.FLIGHT_ADDED,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom"})}},__eventBinding:function(){this._item!=null&&(this._item.find(".flightShowDetailsLink").unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleDetails($(n.target).data("detailsection"),$(n.target))}.$bind(this)),this._item.find(".flightShowBreakdownLink").unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleBreakdown($(n.target).data("breakdownsection"),$(n.target))}.$bind(this)))},__toogleBreakdown:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html("+ "+CommonMessages.PRICE_BREAKDOWN)):(i.show("slow"),t.html("- "+CommonMessages.PRICE_BREAKDOWN)))},__toogleDetails:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html(CommonMessages.SHOW_FLIGHT_DETAILS)):(i.show("slow"),t.html(CommonMessages.HIDE_FLIGHT_DETAILS)))},isValid:function(){return this._data.oneWay?typeof this._data.outboundLegId!="undefined"&&this._data.outboundLegId!="":typeof this._data.outboundLegId!="undefined"&&this._data.outboundLegId!=""&&typeof this._data.inboundLegId!="undefined"&&this._data.inboundLegId!=""},getDataForRemoving:function(){var n=this.getData();return{requestId:n.requestId,resultItemId:n.resultItemId}},getDataForRequest:function(){var n=this.getData();return{BookingServiceRequestId:n.requestId,BookingServiceRequestOptionId:n.resultItemId,ReservationId:0,ServiceId:0,FlightFareId:n.flightFareId,FlightFareTripId:n.flightFareTripId}}}),FlightSelectedSoFarItemsController=dejavu.Class.declare({$name:"FlightSelectedSoFarItemsController",$extends:SelectedSoFarItemsController,initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addSelectedSoFarActionURL:n.addSelectedFlightSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,step:SystemSteps.FLIGHTS,deleteConfirmationTemplateSelector:"delete-confirmation",itemTemplateSelector:"itemFlightTemplate",itemsContainerSelector:"itemsFlightContainer",itemsSelector:".itemFlight",ownerSelector:"flightspanel",soFarContent:"flightSoFarContent",Type:FlightSelectedSoFarItem,addServiceURL:n.addServiceURL})},__addIsPosible:function(){return!0},__getDataForRequest:function(n,t){var i={ReservationId:this._options.reservationId,isOneWay:t.isOneWay,ResultItemId:t.resultItemId,RequestId:n,OutboundFlightFareLegId:t.outboundFlightFareLegId,InboundFlightFareLegId:t.inboundFlightFareLegId};return typeof t.editingOutboundFareLegId!="undefined"&&(i.EditingOutboundFareLegId=t.editingOutboundFareLegId,typeof t.serviceId!="undefined"?i.ServiceId=t.serviceId:typeof t.editingResultItemId!="undefined"&&(i.EditingResultItemId=t.editingResultItemId)),i},getOutboundFlightlegId:function(n){var i=this._getItemsAdded(),r,t;if(i.length>0)for(t=0;t<i.length;t++)if(r=i[t].getData(),r.resultItemId==n)return r.outboundLegId;return-1},__isValidFlight:function(n){return n.isValid()},checkIfWasInserted:function(n){var i=[],u=!1,f=!1,t,r;if(typeof n.editingOutboundFareLegId!="undefined"||typeof n.serviceId!="undefined"?(u=!0,typeof n.serviceId!="undefined"?(f=!0,i=this._getServiceItemsAdded()):i=this._getItemsAdded()):i=this._getItemsAdded(),i.length==0)return null;for(r=0;r<i.length;r++)if(t=i[r].getData(),t!=null)if(u){if(f){if(t.serviceId==n.serviceId&&t.outboundLegId==n.outboundFlightFareLegId)return i[r]}else if(typeof n.checkFromList!="undefined"&&n.checkFromList){if(n.isOneWay){if(t.requestId==n.requestId&&t.outboundLegId==n.outboundFlightFareLegId)return i[r]}else if(t.requestId==n.requestId&&t.resultItemId==n.resultItemId&&t.outboundLegId==n.outboundFlightFareLegId&&t.inboundLegId==n.inboundFlightFareLegId)return i[r]}else if(typeof n.inboundFlightFareLegId=="undefined"||n.inboundFlightFareLegId==""){if(t.requestId==n.requestId&&t.resultItemId==n.resultItemId&&t.outboundLegId==n.outboundFlightFareLegId)return i[r]}else if(t.requestId==n.requestId&&t.resultItemId==n.resultItemId&&t.outboundLegId==n.outboundFlightFareLegId&&t.inboundLegId==n.inboundFlightFareLegId)return i[r]}else if(n.isOneWay){if(t.requestId==n.requestId&&t.outboundLegId==n.outboundFlightFareLegId)return i[r]}else if(typeof n.inboundFlightFareLegId=="undefined"||n.inboundFlightFareLegId==""){if(t.requestId==n.requestId&&t.outboundLegId==n.outboundFlightFareLegId)return i[r]}else if(t.requestId==n.requestId&&t.outboundLegId==n.outboundFlightFareLegId&&t.inboundLegId==n.inboundFlightFareLegId)return i[r];return null},AddFlight:function(n,t,i){var r,u,f;if(this.__addIsPosible(t.resultItemId,n)){if(r=this.__getDataForRequest(n,t),r==null&&i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1});return}var e=t.outboundFlightFareLegId,o=t.resultItemId,s=this._getItemsAddedByRequestId(n);s.length>0&&(u=s[0].getData(),e=u.outboundLegId,o=u.resultItemId);f="";f=typeof r.EditingOutboundFareLegId!="undefined"?typeof r.ServiceId!="undefined"?r.ServiceId:r.EditingResultItemId+"_"+r.EditingOutboundFareLegId:n+"_"+o+"_"+e;this._refreshItem(f,r,function(n,r){var u,f;if(n)i!=null&&r!=null&&(typeof t.editingOutboundFareLegId!="undefined"&&(delete t.serviceId,t.editingOutboundFareLegId=r.outboundLegId,t.outboundFlightFareLegId=r.outboundLegId,t.inboundFlightFareLegId=r.inboundLegId,t.resultItemId=r.resultItemId,t.editingResultItemId=r.resultItemId),u=this.checkIfWasInserted(t),u!=null&&u.showNotification(),i({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidFlight(u):!1,soFarData:u!=null?u.getData():null}));else if(i!=null){f="";typeof r!="undefined"&&r!=null&&(f=r.errorMessage);i({result:ActionResult.ERROR,message:f,isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}},isValid:function(){return this.$super()}}),MiscelanySelectedSoFarItem=dejavu.Class.declare({$name:"MiscelanySelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeMiscelanyService",onClose:n.onClose,owner:n.owner});this.__eventBinding()},__eventBinding:function(){this._item!=null&&this._item.find(".miscelanyShowDetailsLink").unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleDetails($(n.target).data("detailsection"),$(n.target))}.$bind(this))},__toogleDetails:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html(CommonMessages.SHOW_DETAILS)):(i.show("slow"),t.html(CommonMessages.HIDE_DETAILS)))}}),MiscelanySelectedSoFarItemsController=dejavu.Class.declare({$name:"MiscelanySelectedSoFarItemsController",$extends:SelectedSoFarItemsController,initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,itemsContainerSelector:"itemsMiscelanyContainer",itemsSelector:".itemMiscelany",ownerSelector:"miscelanypanel",soFarContent:"miscelanySoFarContent",Type:MiscelanySelectedSoFarItem})},isValid:function(){return this.$super()}}),HotelSelectedSoFarItem=dejavu.Class.declare({$name:"HotelSelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeHotelService",onClose:n.onClose,owner:n.owner,tooltipAdded:""});this.__initTooltip();this.__eventBinding()},__initTooltip:function(){var n=this.getData(),t=this;if(n.isReady){if(this._data.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS){if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header.ssf-item-hotel-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(i){}this._objTooltip.tooltipster({content:CommonMessages.HOTEL_ADDED,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom"})}}else{if(this._objTooltip=$(this._item.find(".selectedSoFarItem-header.ssf-item-hotel-header")),typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined")try{this._objTooltip.tooltipster("destroy")}catch(i){}this._objTooltip.tooltipster({content:CommonMessages.ROOM_ADDED,contentAsHTML:!0,position:"left",timer:3e3,theme:"tooltipster-ssf-added",trigger:"custom"})}},__eventBinding:function(){this._item!=null&&this._item.find(".hotelShowDetailsLink").unbind().click(function(n){n.preventDefault();n.stopPropagation();this.__toogleDetails($(n.target).data("detailsection"),$(n.target))}.$bind(this))},__toogleDetails:function(n,t){var i=$("#"+n);i.length!=0&&(i.is(":visible")?(i.hide("slow"),t.html(CommonMessages.SHOW_DETAILS)):(i.show("slow"),t.html(CommonMessages.HIDE_DETAILS)))},setRoomIdx:function(n){var t,i;if(this._data!=null)for(i=0;i<this._data.HotelFareRoomMealPlanOptionSelection.length;i++)t=_.find(n,function(n){return n.hotelFareRoomMealPlanOptionId==this._data.HotelFareRoomMealPlanOptionSelection[i].hotelFareRoomMealPlanOptionId}.$bind(this)),typeof t!="undefined"&&(this._data.HotelFareRoomMealPlanOptionSelection[i].roomIdx=t.roomIdx,$("#roomIdxLabel_"+t.hotelFareRoomMealPlanOptionId).text(CommonMessages.ROOM+" "+t.roomIdx))},isValid:function(){return this.getData().HotelFareRoomMealPlanOptionSelection.length==this.getData().nRooms},getDataForRequest:function(){for(var n=this.getData(),u={BookingServiceRequestId:n.requestId,BookingServiceRequestOptionId:n.resultItemId,ReservationId:0,ServiceId:0,RoomsParameters:[]},r,i,t=0;t<n.HotelFareRoomMealPlanOptionSelection.length;t++){for(r={FareRoomId:n.HotelFareRoomMealPlanOptionSelection[t].hotelFareRoomId,FareRoomMealPlanOptionId:n.HotelFareRoomMealPlanOptionSelection[t].hotelFareRoomMealPlanOptionId,FareRoomOptionId:n.HotelFareRoomMealPlanOptionSelection[t].hotelFareRoomOptionId,OptionalSupplements:[]},i=0;i<n.HotelFareRoomMealPlanOptionSelection[t].OptionalSupplementCodes.length;i++)r.OptionalSupplements.push({Code:n.HotelFareRoomMealPlanOptionSelection[t].OptionalSupplementCodes[i]});u.RoomsParameters.push(r)}return u},getDataForRemoving:function(){var n=this.getData();return{requestId:n.requestId,resultItemId:n.resultItemId}},updateTooltip:function(n){var i=this.getData(),t;i.isReady||typeof this._objTooltip!="undefined"&&this._objTooltip!=null&&typeof $(this._objTooltip).data("tooltipster")!="undefined"&&(t=CommonMessages.ROOM_ADDED,t=t.replace("{0}",n.HotelFareRoomMealPlanOptionSelection[0].roomIdx),this._objTooltip.tooltipster("content",t))}}),HotelSelectedSoFarItemsController=dejavu.Class.declare({$name:"HotelSelectedSoFarItemsController",$extends:SelectedSoFarItemsController,initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addSelectedSoFarActionURL:n.addSelectedHotelSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,step:SystemSteps.HOTELS,deleteConfirmationTemplateSelector:"delete-confirmation",itemTemplateSelector:"itemHotelTemplate",itemsContainerSelector:"itemsHotelContainer",itemsSelector:".itemHotel",ownerSelector:"hotelspanel",soFarContent:"hotelSoFarContent",Type:HotelSelectedSoFarItem,addServiceURL:n.addServiceURL})},__addIsPosible:function(){return!0},__getDataForRequest:function(n){var s=this._getItemsAdded(),i=null,f,t,r,e,o,u;if(s.length>0&&(f=_.find(s,function(t){var i=t.getData();return i.hotelId==n.hotelId&&i.requestId==n.requestId}),typeof f!="undefined"&&f!=null&&(i=f.getData())),t={ReservationId:this._options.reservationId,ResultItemId:n.resultItemId,RequestId:n.requestId,HotelFareRoomMealPlanOptionSelection:[]},typeof n.serviceId!="undefined"?t.ServiceId=n.serviceId:typeof n.editingResultItemId!="undefined"&&(t.EditingResultItemId=n.editingResultItemId),i!=null){for(r=0;r<i.HotelFareRoomMealPlanOptionSelection.length;r++)t.HotelFareRoomMealPlanOptionSelection.push({OptionalSupplementCodes:[],HotelFareRoomMealPlanOptionId:i.HotelFareRoomMealPlanOptionSelection[r].hotelFareRoomMealPlanOptionId,roomIdx:i.HotelFareRoomMealPlanOptionSelection[r].roomIdx});e=_.find(t.HotelFareRoomMealPlanOptionSelection,function(t){return t.roomIdx==n.HotelFareRoomMealPlanOptionSelection[0].roomIdx});typeof e!="undefined"&&e!=null?e.HotelFareRoomMealPlanOptionId=n.HotelFareRoomMealPlanOptionSelection[0].HotelFareRoomMealPlanOptionId:t.HotelFareRoomMealPlanOptionSelection.push({OptionalSupplementCodes:[],HotelFareRoomMealPlanOptionId:n.HotelFareRoomMealPlanOptionSelection[0].HotelFareRoomMealPlanOptionId,roomIdx:n.HotelFareRoomMealPlanOptionSelection[0].roomIdx})}else t.HotelFareRoomMealPlanOptionSelection.push({OptionalSupplementCodes:[],HotelFareRoomMealPlanOptionId:n.HotelFareRoomMealPlanOptionSelection[0].HotelFareRoomMealPlanOptionId,roomIdx:n.HotelFareRoomMealPlanOptionSelection[0].roomIdx});if(n.optionalSupplements.length>0)for(u=0;u<n.optionalSupplements.length;u++)o=_.find(t.HotelFareRoomMealPlanOptionSelection,function(t){return t.HotelFareRoomMealPlanOptionId==n.optionalSupplements[u].HotelFareRoomMealPlanOptionId}),typeof o!="undefined"&&(o.OptionalSupplementCodes=n.optionalSupplements[u].OptionalSupplementCodes);return t},__getDataForHotelRequest:function(n){var e=this._getItemsAdded(),o=null,u,t,i,f,r;for(e.length>0&&(u=_.find(e,function(t){var i=t.getData();return i.hotelId==n.hotelId&&i.requestId==n.requestId}),typeof u!="undefined"&&u!=null&&(o=u.getData())),t={ReservationId:this._options.reservationId,ResultItemId:n.resultItemId,RequestId:n.requestId,HotelFareRoomMealPlanOptionSelection:[]},typeof n.serviceId!="undefined"?t.ServiceId=n.serviceId:typeof n.editingResultItemId!="undefined"&&(t.EditingResultItemId=n.editingResultItemId),i=0;i<n.HotelFareRoomMealPlanOptionSelection.length;i++)t.HotelFareRoomMealPlanOptionSelection.push({OptionalSupplementCodes:[],HotelFareRoomMealPlanOptionId:n.HotelFareRoomMealPlanOptionSelection[i].HotelFareRoomMealPlanOptionId,roomIdx:n.HotelFareRoomMealPlanOptionSelection[i].roomIdx});if(n.optionalSupplements.length>0)for(r=0;r<n.optionalSupplements.length;r++)f=_.find(t.HotelFareRoomMealPlanOptionSelection,function(t){return t.HotelFareRoomMealPlanOptionId==n.optionalSupplements[r].HotelFareRoomMealPlanOptionId}),typeof f!="undefined"&&(f.OptionalSupplementCodes=n.optionalSupplements[r].OptionalSupplementCodes);return t},__compareRequestRooms:function(n,t){if(typeof n=="undefined"||typeof t=="undefined"||n==null||t==null||n.length!=t.length)return!1;for(var i=null,u,r=0;r<n.length;r++)if(i=n[r],u=_.find(t,function(n){return n.Adults==i.Adults&&n.Children==i.Children&&n.Infants==i.Infants&&n.Type==i.Type}),typeof u=="undefined")return!1;return!0},checkIfWasInserted:function(n){var r=[],o=!1,s=!1,t,u,i,f,e;if(typeof n.serviceId!="undefined"?(o=!0,s=!0,r=this._getServiceItemsAdded()):typeof n.editingResultItemId!="undefined"?(o=!0,r=this._getItemsAdded()):r=this._getItemsAdded(),r.length==0)return null;for(u=0;u<r.length;u++)if(t=r[u].getData(),t!=null&&t.hotelId==n.hotelId)if(o){if(i=null,s?t.serviceId==n.serviceId&&(i=t):typeof n.updateStatus=="undefined"?t.resultItemId==n.resultItemId&&(i=t):i=t,i==null)continue;if(typeof n.updateStatus=="undefined"){if(i.requestId==n.requestId&&i.HotelFareRoomMealPlanOptionSelection.length>0&&n.HotelFareRoomMealPlanOptionSelection.length>0&&(f=_.find(i.HotelFareRoomMealPlanOptionSelection,function(t){return t.hotelFareRoomMealPlanOptionId==n.HotelFareRoomMealPlanOptionSelection[0].HotelFareRoomMealPlanOptionId}),typeof f!="undefined"))return r[u]}else if(i.HotelFareRoomMealPlanOptionSelection.length>0&&n.HotelFareRoomMealPlanOptionSelection.length>0&&i.checkIn==n.hotelRequest.checkIn&&i.checkOut==n.hotelRequest.checkOut&&(e=_.find(i.HotelFareRoomMealPlanOptionSelection,function(t){return t.roomIdx==n.HotelFareRoomMealPlanOptionSelection[0].roomIdx&&t.mealPlanId==n.HotelFareRoomMealPlanOptionSelection[0].mealPlanId&&t.roomTypeId==n.HotelFareRoomMealPlanOptionSelection[0].roomTypeId}),typeof e!="undefined"))return r[u]}else if(typeof n.updateStatus=="undefined"){if(t.requestId==n.requestId&&t.HotelFareRoomMealPlanOptionSelection.length>0&&n.HotelFareRoomMealPlanOptionSelection.length>0&&(f=_.find(t.HotelFareRoomMealPlanOptionSelection,function(t){return t.hotelFareRoomMealPlanOptionId==n.HotelFareRoomMealPlanOptionSelection[0].HotelFareRoomMealPlanOptionId}),typeof f!="undefined"))return r[u]}else if(t.HotelFareRoomMealPlanOptionSelection.length>0&&n.HotelFareRoomMealPlanOptionSelection.length>0&&t.checkIn==n.hotelRequest.checkIn&&t.checkOut==n.hotelRequest.checkOut&&this.__compareRequestRooms(t.RequestsRooms,n.hotelRequest.rooms)&&(e=_.find(t.HotelFareRoomMealPlanOptionSelection,function(t){return t.roomIdx==n.HotelFareRoomMealPlanOptionSelection[0].roomIdx&&t.mealPlanId==n.HotelFareRoomMealPlanOptionSelection[0].mealPlanId&&t.roomTypeId==n.HotelFareRoomMealPlanOptionSelection[0].roomTypeId}),typeof e!="undefined"))return r[u];return null},verifyHotelRoomOptions:function(n){var r=this._getItemsAdded(),t,i,u,f;if(r.length==0)return[];for(i=0;i<r.length;i++)if(t=r[i].getData(),t!=null&&t.hotelId==n.hotelId&&t.requestId==n.requestId&&t.resultItemId==n.resultItemId&&t.HotelFareRoomMealPlanOptionSelection.length>0&&n.fareRoomMealPlanOptionsIds.length>0&&this.__compareRequestRooms(t.RequestsRooms,n.hotelRequest.rooms))return u=_.pluck(t.HotelFareRoomMealPlanOptionSelection,"hotelFareRoomMealPlanOptionId"),f=_.intersection(n.fareRoomMealPlanOptionsIds,u),f;return[]},_optionsAdded:function(){this.$super()},__isValidHotel:function(n){return typeof n=="undefined"?!1:n.isValid()},getNRooms:function(){return this._options.nRooms},isValid:function(){return this.$super()},AddHotelRoom:function(n,t){var i,r;if(this.__addIsPosible(n)){if(i=this.__getDataForRequest(n),i==null&&t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1});return}r="";r=typeof i.ServiceId!="undefined"?i.ServiceId:typeof i.EditingResultItemId!="undefined"?i.EditingResultItemId:n.requestId+"_"+n.resultItemId;this._refreshItem(r,i,function(i,r){if(i){if(t!=null&&r!=null){typeof n.serviceId!="undefined"?n.serviceId=r.serviceId:typeof n.editingResultItemId!="undefined"&&(n.resultItemId=r.resultItemId);var u=this.checkIfWasInserted(n);u!=null&&(u.updateTooltip(n),u.showNotification(),u.setRoomIdx(this._options.roomIdxs));t({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidHotel(u):!1,soFarData:u!=null?u.getData():null})}}else if(t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}},AddHotel:function(n,t){var i,r;if(this.__addIsPosible(n)){if(i=this.__getDataForHotelRequest(n),i==null&&t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1});return}r="";r=typeof i.ServiceId!="undefined"?i.ServiceId:typeof i.EditingResultItemId!="undefined"?i.EditingResultItemId:n.requestId+"_"+n.resultItemId;this._refreshItem(r,i,function(i,r){if(i){if(t!=null&&r!=null){typeof n.serviceId!="undefined"?n.serviceId=r.serviceId:typeof n.editingResultItemId!="undefined"&&(n.resultItemId=r.resultItemId);var u=this.checkIfWasInserted(n);u!=null&&(u.updateTooltip(n),u.showNotification(),u.setRoomIdx(this._options.roomIdxs));t({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidHotel(u):!1,soFarData:u!=null?u.getData():null})}}else if(t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}.$bind(this))}else if(t!=null){t({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}}),CarSelectedSoFarItem=dejavu.Class.declare({$name:"CarSelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){if(this.$super({id:n.id,removeServiceItemSelector:".removeCarService",onClose:n.onClose,owner:n.owner,tooltipAdded:CommonMessages.CAR_ADDED}),this._item!=null){var t=this._item.find("a.changeLocationsLink");t.length>0&&t.click(this.__onChangeLocationsClick.$bind(this))}},__onChangeLocationsClick:function(n){n.preventDefault();this._owner!=null&&this._owner.editLocations(this,this.__onEditLocationComplete.$bind(this))},__onEditLocationComplete:function(n){var i,f,r,u,t;n.result==ActionResult.OK?(i=this.getData(),f=i.locations,typeof n.serviceId!="undefined"&&(i.serviceId=n.serviceId),i.pickupLocationId=n.locations.selectedPickupLocation,i.dropoffLocationId=n.locations.selectedReturnLocation,i.locations.selectedPickupLocation=n.locations.selectedPickupLocation,i.locations.selectedReturnLocation=n.locations.selectedReturnLocation,this._item.data("sofardata",i),r=_.find(f.pickupLocations,function(t){return t.id==n.locations.selectedPickupLocation}),u=_.find(f.returnLocations,function(t){return t.id==n.locations.selectedReturnLocation}),typeof r!="undefined"&&typeof u!="undefined"&&(t=this._item.find("div.car-pickup-location"),t.length>0?t.html(r.selectedTitle):(t=this._item.find("div.sf-car-pickup_info div.carLocationName"),t.length>0&&t.html(r.name)),t=this._item.find("div.car-return-location"),t.length>0?t.html(u.selectedTitle):(t=this._item.find("div.sf-car-return_info div.carLocationName"),t.length>0&&t.html(u.name)))):n.result==ActionResult.ERROR&&n.errorMessage!=""&&ConfirmDlg(CommonMessages.ERROR_SORRY,n.errorMessage,"czError",[CommonMessages.OK],".item-video")},getDataForRequest:function(){var n=this.getData();return{BookingServiceRequestId:n.requestId,BookingServiceRequestOptionId:n.resultItemId,ReservationId:0,ServiceId:0,DropoffLocationId:n.dropoffLocationId,PickupLocationId:n.pickupLocationId,CarId:n.carId}},isValid:function(){var n=this.getData();return n.dropoffLocationId>0&&n.pickupLocationId>0},getDataForRemoving:function(){var n=this.getData();return{requestId:n.requestId,resultItemId:n.resultItemId,carId:n.carId}}}),CarSelectedSoFarItemsController=dejavu.Class.declare({$name:"CarSelectedSoFarItemsController",$extends:SelectedSoFarItemsController,__updateCarLocationsActionURL:"",initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addSelectedSoFarActionURL:n.addSelectedCarSoFarActionURL,removeSelectedSoFarActionURL:n.removeSelectedSoFarActionURL,deleteServiceActionURL:n.deleteServiceActionURL,step:SystemSteps.CARS,deleteConfirmationTemplateSelector:"delete-confirmation",itemTemplateSelector:"itemCarTemplate",itemsContainerSelector:"itemsCarContainer",itemsSelector:".itemCar",ownerSelector:"carspanel",soFarContent:"carSoFarContent",Type:CarSelectedSoFarItem,addServiceURL:n.addServiceURL});this.__updateCarLocationsActionURL=n.updateCarLocationsActionURL},__addIsPosible:function(){return!0},__isValidCar:function(n){return typeof n=="undefined"?!1:n.isValid()},__getDataForRequest:function(n,t){var i={ReservationId:this._options.reservationId,ResultItemId:t.resultItemId,RequestId:n,CarId:t.carId,PickupLocationId:t.pickupLocationId,DropoffLocationId:t.dropoffLocationId};return typeof t.editingCarId!="undefined"&&(i.EditingCarId=t.editingCarId,typeof t.serviceId!="undefined"?i.ServiceId=t.serviceId:typeof t.editingResultItemId!="undefined"&&(i.EditingResultItemId=t.editingResultItemId)),i},checkIfWasInserted:function(n){var t=[],u=!1,f=!1,i,r;if(typeof n.editingCarId!="undefined"||typeof n.serviceId!="undefined"?(u=!0,typeof n.serviceId!="undefined"?(f=!0,t=this._getServiceItemsAdded()):t=this._getItemsAdded()):t=this._getItemsAdded(),t.length==0)return null;for(r=0;r<t.length;r++)if(i=t[r].getData(),i!=null)if(u){if(f){if(i.serviceId==n.serviceId&&i.carId==n.carId)return t[r]}else if(i.resultItemId==n.resultItemId&&i.requestId==n.requestId&&i.carId==n.carId)return t[r]}else if(i.requestId==n.requestId&&i.carId==n.carId)return t[r];return null},editLocations:function(n,t){var i=n.getData(),r=i.locations,f=new SelectLocationsDlg(r),u=this;f.showDialog(function(n){if((n.selectedPickupLocation!=0||n.selectedReturnLocation!=0)&&(n.selectedPickupLocation!=r.selectedPickupLocation||n.selectedReturnLocation!=r.selectedReturnLocation)&&this.__updateCarLocationsActionURL!=""){var f={bid:u._options.reservationId,pickUpLocationId:n.selectedPickupLocation,dropOffLocationId:n.selectedReturnLocation,carId:i.carId};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE?f.serviceId=i.serviceId:i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS&&(f.resultItemId=i.resultItemId);try{$.ajax({type:"POST",context:u,contentType:"application/json",dataType:"json",url:u.__updateCarLocationsActionURL,data:JSON.stringify(f),success:function(r){if(r.Result){if(typeof t!="undefined"&&t!=null){var u={result:ActionResult.OK,locations:n,errorMessage:""};i.selectedSoFarItemType==SelectedSoFarItemType.SERVICE&&typeof r.ServiceId!="undefined"&&(u.serviceId=r.ServiceId);t(u)}}else typeof t!="undefined"&&t!=null&&t({result:ActionResult.ERROR,locations:null,errorMessage:r.ErrorMessage})},error:function(){typeof t!="undefined"&&t!=null&&t({result:ActionResult.ERROR,locations:null,errorMessage:CommonMessages.ALERT_TECH_ERROR});return}})}catch(e){typeof t!="undefined"&&t!=null&&t({result:ActionResult.ERROR,locations:null,errorMessage:CommonMessages.ALERT_TECH_ERROR});return}}})},AddCar:function(n,t,i){var r,u;if(this.__addIsPosible(t)){if(r=this.__getDataForRequest(n,t),r==null&&i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1});return}u="";u=typeof r.EditingCarId!="undefined"?typeof r.ServiceId!="undefined"?r.ServiceId:r.EditingResultItemId+"_"+r.EditingCarId:n+"_"+t.resultItemId+"_"+t.carId;this._refreshItem(u,r,function(n,r){if(n){if(i!=null&&r!=null){typeof t.editingCarId!="undefined"&&(t.carId=r.carId,typeof t.serviceId!="undefined"?t.serviceId=r.serviceId:typeof t.editingResultItemId!="undefined"&&(t.resultItemId=r.resultItemId));var u=this.checkIfWasInserted(t);u!=null&&u.showNotification();i({result:u!=null?ActionResult.OK:ActionResult.ERROR,message:"",isValid:u!=null?this.__isValidCar(u):!1,soFarData:u!=null?u.getData():null})}else if(i!=null){i({result:ActionResult.ERROR,message:CommonMessages.ALERT_TECH_ERROR,isValid:!1,soFarData:null});return}}else if(i!=null){i({result:ActionResult.ERROR,message:CommonMessages.ALERT_TECH_ERROR,isValid:!1,soFarData:null});return}}.$bind(this))}else if(i!=null){i({result:ActionResult.ERROR,message:"",isValid:!1,soFarData:null});return}}}),TransferSelectedSoFarItem=dejavu.Class.declare({$name:"TransferSelectedSoFarItem",$extends:SelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeTransferService",onClose:n.onClose,owner:n.owner,tooltipAdded:CommonMessages.TRANSFER_ADDED})}}),TransferSelectedSoFarItemsController=dejavu.Class.declare({$name:"TransferSelectedSoFarItemsController",$extends:SelectedSoFarItemsController,initialize:function(n){this.$super({reservationId:n.reservationId,isCurrentStep:n.isCurrentStep,onItemCreated:n.onItemCreated,onItemDeleted:n.onItemDeleted,behavior:n.behavior,addSelectedSoFarActionURL:"",removeSelectedSoFarActionURL:"",deleteServiceActionURL:n.deleteServiceActionURL,step:SystemSteps.TRANSFERS,deleteConfirmationTemplateSelector:"delete-confirmation",itemTemplateSelector:"itemTransferTemplate",itemsContainerSelector:"itemsTransferContainer",itemsSelector:".itemTransfer",ownerSelector:"transferspanel",soFarContent:"transferSoFarContent",Type:TransferSelectedSoFarItem,addServiceURL:n.addServiceURL})}}),CruiseSelectedSoFarItem=dejavu.Class.declare({$name:"CruiseSelectedSoFarItem",$extends:PackageSelectedSoFarItem,initialize:function(n){this.$super({id:n.id,removeServiceItemSelector:".removeCruiseService",onClose:n.onClose,owner:n.owner,tooltipAdded:CommonMessages.CRUISE_ADDED})}}),SelectedSoFar=dejavu.Class.declare({$name:"SelectedSoFar",_options:null,_items:[],_continueBookingBtn:null,_addAnotherProductBtn:null,_goToCheckoutBtn:null,_orLabel:null,_onRequestSubtotalValue:null,_toPayNowSubtotalValue:null,_totalValue:null,_servicesTotalValue:null,__addedServices:[],__currentServiceIdx:0,__currentServiceDataIdx:0,__countAddedServices:0,__errorSavingService:!1,__errorMessage:"",__addServiceCompleteCallback:null,$static:{preloadingImage:"",skipLabel:"skip"},initialize:function(n){$("<img/>")[0].src=SelectedSoFar.preloadingImage;this._options=n;this.__initSteps();this.refreshBinding();this._onRequestSubtotalValue=$("#onRequestSubTotalPrice");this._onRequestSubtotalValue.length==0&&(this._onRequestSubtotalValue=null);this._toPayNowSubtotalValue=$("#toPayNowSubTotalPrice");this._toPayNowSubtotalValue.length==0&&(this._toPayNowSubtotalValue=null);this._totalValue=$("#totalPrice");this._totalValue.length==0&&(this._totalValue=null);this._servicesTotalValue=$("#servicesTotalPrice");this._servicesTotalValue.length==0&&(this._servicesTotalValue=null);this._continueBookingBtn=$("#continueBookingBtn");this._continueBookingBtn.length>0?this._options.fromBookingProcess?this._continueBookingBtn.unbind().click(this.__addMoreServices.$bind(this)):this._continueBookingBtn.unbind().click(this.__onContinueBooking.$bind(this)):this._continueBookingBtn=null;this._continueBookingBtn!=null&&this._continueBookingBtn.length>0?this._options.fromBookingProcess?this._continueBookingBtn.unbind().click(this.__addMoreServices.$bind(this)):this._continueBookingBtn.unbind().click(this.__onContinueBooking.$bind(this)):(this._continueBookingBtn=$("#continueBookingProcessBtn"),this._continueBookingBtn.length>0?this._options.fromBookingProcess?this._continueBookingBtn.unbind().click(this.__addMoreServices.$bind(this)):this._continueBookingBtn.unbind().click(this.__onContinueBooking.$bind(this)):this._continueBookingBtn=null);this._continueBookingBtn!=null&&this._continueBookingBtn.tooltipster({content:this._continueBookingBtn.data("hint"),position:"top",timer:1e3,maxWidth:200,theme:"tooltipster-ctn-style",trigger:"hover"});this._goToCheckoutBtn=$("#goToCheckoutBtn");this._goToCheckoutBtn.length>0?(this._goToCheckoutBtn.unbind().click(this.__goToCheckout.$bind(this)),this._goToCheckoutBtn!=null&&this._goToCheckoutBtn.tooltipster({content:this._goToCheckoutBtn.data("hint"),position:"top",timer:1e3,maxWidth:200,theme:"tooltipster-ctn-style",trigger:"hover"})):this._goToCheckoutBtn=null;this._addAnotherProductBtn=$("#addAnotherProductbtn");this._addAnotherProductBtn.length>0?(this._addAnotherProductBtn.hide(),this._addAnotherProductBtn.unbind().click(this.__onAddAnotherProduct.$bind(this))):this._addAnotherProductBtn=null;this._orLabel=$("#ssf_or");this._orLabel.length==0&&(this._orLabel=null);this.__refreshSummaryBtns()},__getPanelBar:function(){var t=$("#"+this._options.selectedSoFarPanelBar),n=null;return t.length==0?n=null:(n=t.data("kendoPanelBar"),typeof n=="undefined"&&(n=null)),n},__getTotalValues:function(){var i=$(".totalValues"),t,n;return i.length==0?null:(t=_.max(i,function(n){return $(n).data("created")}),typeof t=="undefined"||t==null)?null:(n=$(t).data(),{onRequestSubtotalPrice:n.onrequestsubtotalprice,toPayNowSubtotalPrice:n.topaynowsubtotalprice,totalPrice:n.totalprice,servicesTotalPrice:n.servicestotalprice})},__onContinueBooking:function(n){var t,i;n.preventDefault();t=this;this._options.processStep!=ProcessSteps.SELECTPRODUCT||this.hasAnySelectedInCurrentStep()?(this.showPreloading(this._continueBookingBtn,!0),this.addServices()):(i=this.hasNextProduct()?CommonMessages.CONFIRM_NEXT_PRODUCT_TYPE:CommonMessages.CONFIRM_NO_PRODUCT_SELECTED,ConfirmDlg(CommonMessages.CONFIRM_TITLE,i,"czConfirm",[CommonMessages.YES,CommonMessages.NO],".item-video",function(n){n==CommonMessages.YES&&(t.showPreloading(t._continueBookingBtn,!0),t.addServices())}.$bind(this)))},__goCheckOut:function(){Showloading(!0);window.location.href=this._options.checkOutURL},__goToCheckout:function(n){n.preventDefault();this.showPreloading(this._goToCheckoutBtn,!0);this.addServices(this._goToCheckOutAddServiceComplete.$bind(this))},__addMoreServices:function(n){n.preventDefault();this.showPreloading(this._continueBookingBtn,!0);this.__askForAnotherProduct(ProductType.UNDEFINED,!1)},__addFinallyServices:function(n){n.preventDefault();this.__askForAnotherProduct(ProductType.UNDEFINED,!1)},__useFinallySearchBox:function(){return typeof this._options.useFinallySearchBox=="undefined"?!0:this._options.useFinallySearchBox},__askForAnotherProduct:function(n,t){var i="";switch(n){case"":case ProductType.UNDEFINED:this.__useFinallySearchBox()?i=this._options.finallySearchBoxActionURL:this.__goCheckOut();break;case ProductType.FLIGHT:i=this._options.flightSearchBoxActionURL;break;case ProductType.HOTEL:i=this._options.hotelSearchBoxActionURL;break;case ProductType.CAR:i=this._options.carSearchBoxActionURL;break;case ProductType.PROGRAM:i=this._options.programSearchBoxActionURL;break;case ProductType.EXCURSION:i=this._options.excursionSearchBoxActionURL;break;default:this.__goCheckOut()}if(i==""&&t){this.__goCheckOut();return}$.ajax({type:"POST",data:{bid:this._options.reservationId,boxId:1201,programType:this._options.currProgramType},context:this,url:i,success:function(n){this.showPreloading(this._addAnotherProductBtn,!1);this.showPreloading(this._continueBookingBtn,!1);this.__showDialogContent(n,t)},error:function(){this.showPreloading(this._addAnotherProductBtn,!1);this.showPreloading(this._continueBookingBtn,!1);t&&this.__goCheckOut()}})},__showDialogContent:function(n,t){var r=this,i;$("<div />",{id:"dialogSearchBox"}).appendTo("body");$("#dialogSearchBox").kendoWindow({width:"700px",title:!1,actions:["Close"],visible:!1,resizable:!1,modal:!0});$("#dialogSearchBox").parent().addClass("dlg");$("#dialogSearchBox").parent().addClass("dlgBackColorSearchBox");i=$("#dialogSearchBox").data("kendoWindow");i.bind("deactivate",function(){$(".item-video").show();i.destroy();$("#dialogSearchBox").length>0&&$("#dialogSearchBox").remove();t&&(this._options.nextProductType==""||this._options.nextProductType==null?this.__goCheckOut():$.ajax({type:"POST",data:{bid:this._options.reservationId,productType:this._options.nextProductType},context:this,url:this._options.removeProductTypeRequestActionURL,success:function(n){this._options.nextProductType=n.NextProductType;this.__askForAnotherProduct(this._options.nextProductType,!0)},error:function(){this.__goCheckOut()}}))}.$bind(this));i.bind("close",function(){}.$bind(this));i.bind("open",function(){$(".item-video").hide()}.$bind(this));i.bind("activate",function(){$("#headerCloseBtn").length>0&&$("#headerCloseBtn").click(function(){i.close()});var n=$("#close-add");n.length>0&&(n.replaceWith("<a id='close-add' href='#' style='position: absolute; top: 6px; right: 26px;color: black'>"+SelectedSoFar.skipLabel+"<\/a>"),$("#close-add").click(function(n){n.preventDefault();i.close()}));$(".no-thanks-button").length>0&&$(".no-thanks-button").click(function(){i.close()})}.$bind(this));i.content(n);r.__useFinallySearchBox()&&($("#dialogSearchBox").css("cssText","background-color: #ffffff !important; overflow:auto;"),$("div.NoThanksContainer").hide());$("#form-container-form").css("padding-bottom","20px");i.center();i.open()},_onAddServicesComplete:function(n){if(!n.result){this.showPreloading(this._continueBookingBtn,!1);this.showPreloading(this._addAnotherProductBtn,!1);n.errorMessage!=""&&ConfirmDlg(CommonMessages.ERROR_SORRY,n.errorMessage,"czError",[CommonMessages.OK],".item-video");return}if(this._options.onAddServicesComplete!=null)this._options.onAddServicesComplete(n);this.__askForAnotherProduct(this._options.nextProductType,!0)},_goToCheckOutAddServiceComplete:function(n){if(this.showPreloading(this._goToCheckoutBtn,!1),!n.result){this.showPreloading(this._addAnotherProductBtn,!1);n.errorMessage!=""&&ConfirmDlg(CommonMessages.ERROR_SORRY,n.errorMessage,"czError",[CommonMessages.OK],".item-video");return}if(this._options.onAddServicesComplete!=null)this._options.onAddServicesComplete(n);this.__goCheckOut()},__getDataForRequest:function(){for(var t=[],i,n=0;n<this._items.length;n++)i=this._items[n].getDataForRequest(),i.services.length>0&&(t=t.concat(this._items[n].getDataForRequest()));return t},__removeCurrentOptionIfUnused:function(){this._options.currRequestId!="-1"&&this.__getItemsAddedByRequestId(this._options.currRequestId).length==0&&$.ajax({type:"POST",context:this,contentType:"application/json",dataType:"json",async:!1,url:this._options.removeOptionActionURL})},addServices:function(n){this.__addedServices=this.__getDataForRequest();var t=this;if(t.__addedServices.length==0){typeof n=="function"?n({result:!0,errorMessage:""}):t._onAddServicesComplete({result:!0,errorMessage:""});return}t.__countAddedServices=t.__addedServices.length;t.__currentServiceIdx=0;t.__currentServiceDataIdx=0;t.__errorSavingService=!1;t.__addServiceCompleteCallback=typeof n=="function"?n:null;t.__addServices()},__addServices:function(){if(this.__currentServiceIdx>=this.__countAddedServices){this.__addServiceCompleteCallback!=null?this.__addServiceCompleteCallback({result:!0,errorMessage:""}):this._onAddServicesComplete({result:!0,errorMessage:""});return}var n=this.__addedServices[this.__currentServiceIdx];if(this.__currentServiceDataIdx>=n.services.length){if(this.__currentServiceDataIdx=0,this.__currentServiceIdx++,this.__currentServiceIdx>=this.__countAddedServices){this.__addServiceCompleteCallback!=null?this.__addServiceCompleteCallback({result:!0,errorMessage:""}):this._onAddServicesComplete({result:!0,errorMessage:""});return}n=this.__addedServices[this.__currentServiceIdx]}try{$.ajax({type:"POST",context:this,contentType:"application/json",dataType:"json",url:n.url,data:JSON.stringify(n.services[this.__currentServiceDataIdx]),success:function(n){if(n!=null&&n.Result)this.__currentServiceDataIdx++,setTimeout(this.__addServices.$bind(this),100);else{this.__addServiceCompleteCallback!=null?this.__addServiceCompleteCallback({result:!1,errorMessage:n!=null?n.ErrorMessage:CommonMessages.ALERT_TECH_ERROR}):this._onAddServicesComplete({result:!1,errorMessage:n!=null?n.ErrorMessage:CommonMessages.ALERT_TECH_ERROR});return}},error:function(n,t,i){this.__addServiceCompleteCallback!=null?this.__addServiceCompleteCallback({result:!1,errorMessage:"status: "+t+", error: "+i}):this._onAddServicesComplete({result:!1,errorMessage:"status: "+t+", error: "+i});return}})}catch(t){this.__addServiceCompleteCallback!=null?this.__addServiceCompleteCallback({result:!1,errorMessage:CommonMessages.ALERT_TECH_ERROR}):this._onAddServicesComplete({result:!1,errorMessage:CommonMessages.ALERT_TECH_ERROR})}},__onAddAnotherProduct:function(n){n.preventDefault();this.showPreloading(this._addAnotherProductBtn,!0);this.__askForAnotherProduct(this._options.currProductType,!1)},__refreshSummaryBtns:function(n){var t=this.__hasItemsAdded(),i=this.__hasItemsService(),r;if(typeof n=="boolean"&&n&&(t||i||this._options.goToIndexOnDeleteAll!=1||(window.location.href=this._options.indexURL)),this._addAnotherProductBtn!=null&&this._orLabel!=null&&(r=this.__hasItemsAdded(!0),r?(this._addAnotherProductBtn.show(),this._orLabel.show()):(this._addAnotherProductBtn.hide(),this._orLabel.hide())),this._continueBookingBtn!=null){if((t||i)&&this.__someDataIsValid()?(this._continueBookingBtn.removeClass(this._options.disableContinueBookingBtnClass),this._options.fromBookingProcess?this._continueBookingBtn.unbind().click(this.__addMoreServices.$bind(this)):this._continueBookingBtn.unbind().click(this.__onContinueBooking.$bind(this))):t||i||this._options.nextProductType==null||this._options.nextProductType!=""&&this._options.nextProductType!=ProductType.UNDEFINED?(this._continueBookingBtn.removeClass(this._options.disableContinueBookingBtnClass),this._options.fromBookingProcess?this._continueBookingBtn.unbind().click(this.__addMoreServices.$bind(this)):this._continueBookingBtn.unbind().click(this.__onContinueBooking.$bind(this))):(this._continueBookingBtn.addClass(this._options.disableContinueBookingBtnClass),this._continueBookingBtn.unbind().click(this.__disabledLink)),this._continueBookingBtn.data("tooltipster")!="undefined")try{this._continueBookingBtn.tooltipster("destroy")}catch(u){}this._continueBookingBtn!=null&&this._continueBookingBtn.tooltipster({content:this._continueBookingBtn.data("hint"),position:"top",timer:1e3,maxWidth:200,theme:"tooltipster-ctn-style",trigger:"hover"})}},__refreshTotals:function(){var n=this.__getTotalValues();n!=null&&(this._onRequestSubtotalValue!=null&&this._onRequestSubtotalValue.text(n.onRequestSubtotalPrice),this._toPayNowSubtotalValue!=null&&this._toPayNowSubtotalValue.text(n.toPayNowSubtotalPrice),this._totalValue!=null&&this._totalValue.text(n.totalPrice),this._servicesTotalValue!=null&&this._servicesTotalValue.text(n.servicesTotalPrice))},__disabledLink:function(n){n.preventDefault()},__hideTooltip:function(){for(var n=0;n<this._items.length;n++)this._items[n].hideNotifications()},refreshBinding:function(){if(typeof $(".close-ssf-item").data("tooltipster")!="undefined")try{$(".close-ssf-item").tooltipster("destroy")}catch(n){}$(".close-ssf-item").tooltipster({position:"top",theme:"tooltipster-ctn-style",trigger:"hover",offsetY:-5,timer:800,content:CommonMessages.REMOVE_SERVICE})},__getItems:function(){for(var t=[],n=0;n<this._items.length;n++)t=t.concat(this._items[n].getAllItemsData());return t},__hasItemsAdded:function(n){var t,i,r;if(typeof n=="undefined"){for(t=0;t<this._items.length;t++)if(this._items[t].hasAddedData())return!0;return!1}if(typeof n=="boolean"&&n)if(i=this.getCurrentSysStep(),i!=SystemSteps.UNDEFINED){if(r=this.__getController(i),r!=null)return r.hasAddedData()}else return!1;return!1},__hasItemsService:function(){for(var n=0;n<this._items.length;n++)if(this._items[n].hasServiceData())return!0;return!1},__getItemsAdded:function(){var n=this.__getItems();return _.filter(n,function(n){var t=n;return t.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS||t.selectedSoFarItemType==SelectedSoFarItemType.ONREQUEST})},__getItemsAddedByRequestId:function(n){var t=this.__getItems();return _.filter(t,function(t){var i=t;return i.requestId==n&&(i.selectedSoFarItemType==SelectedSoFarItemType.INPROCESS||i.selectedSoFarItemType==SelectedSoFarItemType.ONREQUEST)})},__getItemsService:function(){var n=this.__getItems();return _.filter(n,function(n){var t=n;return t.selectedSoFarItemType!=SelectedSoFarItemType.INPROCESS&&t.selectedSoFarItemType!=SelectedSoFarItemType.ONREQUEST})},__destroyItems:function(){_.each(this._items,function(n){n.destroy()});this._items=[]},__onItemCreated:function(){this.refreshBinding();this.__refreshSummaryBtns();this.__refreshTotals();this.__updateTopBorders()},__onItemDeleted:function(n){typeof n!="undefined"&&n!=null&&(this._onRequestSubtotalValue!=null&&this._onRequestSubtotalValue.text(n.OnRequestSubTotalPrice),this._toPayNowSubtotalValue!=null&&this._toPayNowSubtotalValue.text(n.ToPayNowSubTotalPrice),this._totalValue!=null&&this._totalValue.text(n.TotalPrice),this._servicesTotalValue!=null&&this._servicesTotalValue.text(n.ServicesTotalPrice));this.__refreshSummaryBtns(!0);this.__updateTopBorders()},__errorSavindServices:!1,__initSteps:function(){if(typeof this._options.steps!="undefined"){this.__destroyItems();var t,n,i=$.parseJSON(this._options.steps);_.each(i,function(i){n={reservationId:this._options.reservationId,behavior:this._options.behavior,removeSelectedSoFarActionURL:this._options.removeSelectedSoFarActionURL,deleteServiceActionURL:this._options.deleteServiceActionURL,isCurrentStep:i.isCurrentStep,onItemCreated:this.__onItemCreated.$bind(this),onItemDeleted:this.__onItemDeleted.$bind(this)};switch(i.name){case SystemSteps.FLIGHTS:n.addSelectedFlightSoFarActionURL=this._options.addSelectedFlightSoFarActionURL;n.addServiceURL=this._options.addServiceFlightURL;t=new FlightSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.HOTELS:n.addSelectedHotelSoFarActionURL=this._options.addSelectedHotelSoFarActionURL;n.addServiceURL=this._options.addServiceHotelURL;t=new HotelSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.CARS:n.addSelectedCarSoFarActionURL=this._options.addSelectedCarSoFarActionURL;n.addServiceURL=this._options.addServiceCarURL;n.updateCarLocationsActionURL=this._options.updateCarLocationsActionURL;t=new CarSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.EXCURSIONS:n.addSelectedExcursionSoFarActionURL=this._options.addSelectedExcursionSoFarActionURL;n.addServiceURL=this._options.addServiceExcursionURL;n.updateExcursionPickupPointLanguageActionURL=this._options.updateExcursionPickupPointLanguageActionURL;n.getHotelsFromFareOptionActionURL=this._options.getHotelsFromFareOptionActionURL;t=new ExcursionsSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.PROGRAMS:n.addSelectedProgramSoFarActionURL=this._options.addSelectedProgramSoFarActionURL;n.addServiceURL=this._options.addServiceProgramURL;n.updatePackageHourLanguageActionURL=this._options.updatePackageHourLanguageActionURL;t=new ProgramsSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.TOURS:n.addSelectedProgramSoFarActionURL=this._options.addSelectedProgramSoFarActionURL;n.addServiceURL=this._options.addServiceProgramURL;n.updatePackageHourLanguageActionURL=this._options.updatePackageHourLanguageActionURL;t=new ToursSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.TRANSFERS:n.addSelectedTransferSoFarActionURL="";n.addServiceURL="";t=new TransferSelectedSoFarItemsController(n);t.setToolTipFunction(this.__hideTooltip.$bind(this));this._items.push(t);break;case SystemSteps.MISCELANY:t=new MiscelanySelectedSoFarItemsController(n);this._items.push(t)}}.$bind(this))}},__someDataIsValid:function(){for(var n=0;n<this._items.length;n++)if(this._items[n].hasData()&&this._items[n].isValid())return!0;return!1},__allDataIsValid:function(){for(var n=0;n<this._items.length;n++)if(!this._items[n].isValid())return!1;return!0},__getController:function(n){var t=_.find(this._items,function(t){switch(n){case SystemSteps.CARS:return dejavu.instanceOf(t,CarSelectedSoFarItemsController);case SystemSteps.HOTELS:return dejavu.instanceOf(t,HotelSelectedSoFarItemsController);case SystemSteps.FLIGHTS:return dejavu.instanceOf(t,FlightSelectedSoFarItemsController);case SystemSteps.EXCURSIONS:return dejavu.instanceOf(t,ExcursionsSelectedSoFarItemsController);case SystemSteps.PROGRAMS:return dejavu.instanceOf(t,ProgramsSelectedSoFarItemsController)&&t.getProgramType()==ProgramType.SPECIAL_PROGRAM;case SystemSteps.TOURS:return dejavu.instanceOf(t,ToursSelectedSoFarItemsController)&&t.getProgramType()==ProgramType.TOUR;case SystemSteps.TRANSFERS:return dejavu.instanceOf(t,TransferSelectedSoFarItemsController);case SystemSteps.MISCELANY:return dejavu.instanceOf(t,MiscelanySelectedSoFarItemsController);default:return null}});return typeof t=="undefined"?null:t},getServiceItemAddedByServiceId:function(n,t){var i=this.__getController(n);return i!=null?i.getServiceItemAddedByServiceId(t):null},getServiceItemAddedByResultItemId:function(n,t,i){var r=this.__getController(n);return r!=null?r.getServiceItemAddedByResultItemId(t,i):null},getCurrentSysStep:function(){switch(this._options.currProductType){case"":case ProductType.UNDEFINED:return SystemSteps.UNDEFINED;case ProductType.FLIGHT:return SystemSteps.FLIGHTS;case ProductType.HOTEL:return SystemSteps.HOTELS;case ProductType.CAR:return SystemSteps.CARS;case ProductType.PROGRAM:return this._options.currProgramType==ProgramType.SPECIAL_PROGRAM?SystemSteps.PROGRAMS:this._options.currProgramType==ProgramType.TOUR?SystemSteps.TOURS:SystemSteps.UNDEFINED;case ProductType.EXCURSION:return SystemSteps.EXCURSIONS;default:return SystemSteps.UNDEFINED}},InitController:function(n,t){var i=this.__getController(n);i!=null&&(i.addOptions(t),i.setIsCurrentStep(!0),this.expandSection(n),this.__updateTopBorders(),typeof t.addAnotherLabel!="undefined"&&this.__updateAddAnotherBtn(t.addAnotherLabel,t.addAnotherHint),this.__refreshSummaryBtns())},expandSection:function(n){var i=this.__getController(n),r=this.__getPanelBar(),t;r!=null&&i!=null&&(t=i.getOwnerSelector(),typeof t!="undefined")&&r.expand("#"+t)},__updateTopBorders:function(){for(var i=$("li.ssf-panel"),r=!1,u=!0,t,n=0;n<i.length;n++)t=$(i[n]),t.is(":visible")&&(u?(r=!0,u=!1,t.addClass("NoTopBorder")):r&&t.removeClass("NoTopBorder"))},__updateAddAnotherBtn:function(n,t){if(this._addAnotherProductBtn.text(htmlEncode(n)),typeof this._addAnotherProductBtn.data("tooltipster")!="undefined")try{this._addAnotherProductBtn.tooltipster("destroy")}catch(i){}this._addAnotherProductBtn.tooltipster({content:htmlEncode(t),position:"top",timer:1e3,maxWidth:200,theme:"tooltipster-ctn-style",trigger:"hover"})},showPreloading:function(n,t){typeof n!="undefined"&&n!=null&&(t?(n.after("<div id='preloadingOptionImage' style='width:202px;display:none;text-align:center;'><img style='float:right;display:block;margin: 0 auto;float:none;' src='"+SelectedSoFar.preloadingImage+"' /><\/div>"),n.hide(),$("#preloadingOptionImage").show()):($("#preloadingOptionImage").remove(),n.show()))},showContinueBookingButton:function(n){this._continueBookingBtn!=null&&(typeof n=="undefined"||n?this._continueBookingBtn.show():this._continueBookingBtn.hide())},showEditLinks:function(n){n?($(".ssf-edit-info-link").show(),$(".close-ssf-item").show()):($(".ssf-edit-info-link").hide(),$(".close-ssf-item").hide())},changeBtnLabel:function(n){this._continueBookingBtn!=null&&typeof n!="undefined"&&n!=""&&n!=null&&this._continueBookingBtn.text(n)},hasNextProduct:function(){return typeof this._options.nextProductType!="undefined"?this._options.nextProductType!=null&&this._options.nextProductType!=""&&this._options.nextProductType!=ProductType.UNDEFINED:!1},hasAnySelectedInCurrentStep:function(){var t=this.getCurrentSysStep(),n,i;return t==SystemSteps.UNDEFINED?!1:(n=this.__getController(t),n==null||n.getListController()==null)?!1:(i=n.getListController(),i.hasAnySelected())},CheckOut:function(){this.__goCheckOut()},AddHotelRoom:function(n,t,i,r){var u=this.__getController(SystemSteps.HOTELS);u!=null&&(this.expandSection(SystemSteps.HOTELS),u.AddHotelRoom(n,t,i,r))},AddHotel:function(n,t,i,r){var u=this.__getController(SystemSteps.HOTELS);u!=null&&(this.expandSection(SystemSteps.HOTELS),u.AddHotel(n,t,i,r))},verifyHotelRoomOptions:function(n){var t=this.__getController(SystemSteps.HOTELS);return t!=null?t.verifyHotelRoomOptions(n):[]},checkIfRoomWasInserted:function(n,t,i){var r=this.__getController(SystemSteps.HOTELS);return r!=null?r.checkIfWasInserted(n,t,i)!=null:!1},AddFlight:function(n,t,i){var r=this.__getController(SystemSteps.FLIGHTS);r!=null&&(this.expandSection(SystemSteps.FLIGHTS),r.AddFlight(n,t,i))},checkIfFlightWasInserted:function(n){var t=this.__getController(SystemSteps.FLIGHTS);return t!=null?t.checkIfWasInserted(n)!=null:!1},getOutboundFlightlegId:function(n){var t=this.__getController(SystemSteps.FLIGHTS);return t!=null?t.getOutboundFlightlegId(n):-1},removeFlight:function(n){var t=this.__getController(SystemSteps.FLIGHTS);t!=null&&t.deleteItem(n)},AddCar:function(n,t,i){var r=this.__getController(SystemSteps.CARS);r!=null&&(this.expandSection(SystemSteps.CARS),r.AddCar(n,t,i))},checkIfCarWasInserted:function(n){var t=this.__getController(SystemSteps.CARS);return t!=null?t.checkIfWasInserted(n)!=null:!1},AddExcursion:function(n,t,i){var r=this.__getController(SystemSteps.EXCURSIONS);r!=null&&(this.expandSection(SystemSteps.EXCURSIONS),r.AddExcursion(n,t,i))},checkIfExcursionWasInserted:function(n){var t=this.__getController(SystemSteps.EXCURSIONS);return t!=null?t.checkIfWasInserted(n)!=null:!1},AddProgram:function(n,t,i){var r=this.__getController(SystemSteps.PROGRAMS);r!=null&&(this.expandSection(SystemSteps.PROGRAMS),r.AddProgram(n,t,i))},checkIfProgramWasInserted:function(n){var t=this.__getController(SystemSteps.PROGRAMS);return t!=null?t.checkIfWasInserted(n)!=null:!1},AddTour:function(n,t,i){var r=this.__getController(SystemSteps.TOURS);r!=null&&(this.expandSection(SystemSteps.TOURS),r.AddProgram(n,t,i))},checkIfTourWasInserted:function(n){var t=this.__getController(SystemSteps.TOURS);return t!=null?t.checkIfWasInserted(n)!=null:!1}})