(function(){window.SKYSALES={};SKYSALES=window.SKYSALES;SKYSALES.Json=window.JSON;SKYSALES.Resource={};SKYSALES.Util={};SKYSALES.Class={};SKYSALES.Instance={};SKYSALES.Instance.index=0;SKYSALES.Instance.getNextIndex=function(){SKYSALES.Instance.index+=1;return SKYSALES.Instance.index};window.__doPostBack=function(g,b){var f=document,h=f.SkySales,e=f.getElementById("eventTarget"),d=f.getElementById("eventArgument"),c=f.getElementById("viewState");if(!h.onsubmit||(h.onsubmit()!==false)){e.value=g||e.value;e.name="__EVENTTARGET";if(b!==null){d.value=b}d.name="__EVENTARGUMENT";c.name="__VIEWSTATE";h.submit()}};SKYSALES.Class.LocaleCurrency=function(){var o=new SKYSALES.Class.SkySales(),e=SKYSALES.Util.extendObject(o),f=SKYSALES.Util.getResource(),n=0,l="",c="",g="",j=true,d=f.currencyCultureInfo,b=function(){var q=d.positivePattern;if(!j){q=d.negativePattern}return q},h=function(w){var t=d.groupSizes||[],r=d.groupSeparator,u=0,y=0,v=3,C=0,D="",z=[],A=[],q=[],B=null,s="";if(u>t.length){v=t[u]}C=v-1;n=Math.floor(w);D=n.toString();z=D.split("");A=z.reverse();q=[];B=function(){var E=3;if(u<=t.length-2){u+=1;E=t[u]}else{E=v}C+=E;return E};for(y=0;y<A.length;y+=1){if(y>C){v=B();q.push(r)}q.push(A[y])}z=q.reverse();s=z.join("");return s},k=function(t){var r=t-n,q=r.toFixed(d.decimalDigits),s=q.substring(2);return s},p=function(){var r=b()||"",q=r.replace("n",g);return q},m=function(){e.currency=e.num.toString();j=e.num>=0;e.num=Math.abs(e.num);l=h(e.num);c=k(e.num);g=l;if(0<d.decimalDigits){g+=d.decimalSeparator+c}e.integerPart=l;e.currency=p()};e.num=null;e.localeCurrency=null;e.integerPart="";e.init=function(q){this.setSettingsByObject(q);if(null!==this.num){m()}};return e};SKYSALES.Class.Resource=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.carLocationInfo={};b.carLocationArray=[];b.carLocationHash={};b.activityLocationInfo={};b.activityLocationArray=[];b.activityLocationHash={};b.hotelLocationInfo={};b.hotelLocationArray=[];b.hotelLocationHash={};b.countryInfo={};b.provinceStateInfo={};b.stationInfo={};b.macInfo={};b.marketInfo={};b.macHash={};b.stationHash={};b.marketHash={};b.sourceInfo={};b.clientHash={};b.dateCultureInfo={};b.currencyCultureInfo={};b.carrierInfo={};b.carrierHash={};b.datePickerInfo={};b.passengerInfo={};b.passengerHash={};b.titleInfo={};b.carInfo={};b.externalRateInfo={};b.currencyInfo={};b.currencyHash={};b.populateMacHash=function(){var e=0,f=[],g={},h=null,d=-1;if(b.macInfo&&b.macInfo.MacList){f=b.macInfo.MacList;d=f.length;for(e=0;e<d;e+=1){h=f[e];g[h.code]=h}}b.macHash=g};b.populateStationHash=function(){var e=0,g=[],h={},f=null,d=-1;if(b.stationInfo&&b.stationInfo.StationList){g=b.stationInfo.StationList;d=g.length;for(e=0;e<d;e+=1){f=g[e];h[f.code]=f}}b.stationHash=h};b.populatePassengerHash=function(){var f=0,h=[],e={},g=null,d=-1;if(b.passengerInfo&&b.passengerInfo.PassengerList){h=b.passengerInfo.PassengerList;d=h.length;for(f=0;f<d;f+=1){g=h[f];e[g.PassengerNumber]=g}}b.passengerHash=e};b.populateCarrierHash=function(){var e=0,d=[],j=0,h={},f=null,g=this.carrierInfo;if(g){d=g.carrierList;if(d){j=d.length;if(j>0){for(e=0;e<j;e+=1){f=d[e];h[f.code]=f}}}b.carrierHash=h}};b.populateMarketHash=function(){var g=0,j=[],e={},h={},d="",f={},k=b.stationHash;if(b.marketInfo&&b.marketInfo.MarketList){f=b.marketInfo.MarketList;for(d in f){if(f.hasOwnProperty(d)){j=f[d];for(g=j.length-1;g>=0;g-=1){e=j[g];h=k[e.code];if(h){e.name=h.name}else{j.splice(g,1)}}}}b.marketHash=f}};b.populateClientHash=function(){var j=window.document.cookie,f=[],h=0,e="",g="",k="",l=-1,d=-1;if(j){f=document.cookie.split("; ");d=f.length;for(h=0;h<d;h+=1){e=f[h];l=e.indexOf("=");if(l>-1){g=e.substring(0,l);k=e.substring(l+1,e.length);if(g){k=SKYSALES.Util.decodeUriComponent(k);b.clientHash[g]=k}}}}};b.populateCurrencyHash=function(){var h=0,g=[],f={},e=null,d=-1;if(b.currencyInfo&&b.currencyInfo.CurrencyList){g=b.currencyInfo.CurrencyList;d=g.length;for(h=0;h<d;h+=1){e=g[h];f[e.code]=e}}b.currencyHash=f};b.populateAOSLocationInfoArray=function(k,j){var h=0,g=[],e=0,f=null,d="",l=null;k=k||{};g=k.LocationList||[];e=g.length;for(h=0;h<e;h+=1){f=g[h];d=f.parent;if(d){l=j[d];if(l){f.name="\xa0\xa0\xa0\xa0"+l.name+" - "+f.name;f.optionClass="subLocation"}}}return g};b.getAOSLocationHash=function(k){var g=0,f=null,j={},d=0,e=null,h=k||{};f=h.LocationList||[];d=f.length;for(g=0;g<d;g+=1){e=f[g];j[e.code]=e}j=j||{};return j};b.setSettingsByObject=function(d){c.setSettingsByObject.call(this,d);SKYSALES.datepicker=this.datePickerInfo;this.populateStationHash();this.populateCarrierHash();this.populateMacHash();this.populateMarketHash();this.populateClientHash();this.populatePassengerHash();this.populateCurrencyHash();b.carLocationHash=this.getAOSLocationHash(this.carLocationInfo);b.carLocationArray=this.populateAOSLocationInfoArray(this.carLocationInfo,this.carLocationHash);b.activityLocationHash=this.getAOSLocationHash(this.activityLocationInfo);b.activityLocationArray=this.populateAOSLocationInfoArray(this.activityLocationInfo,this.activityLocationHash);b.hotelLocationHash=this.getAOSLocationHash(this.hotelLocationInfo);b.hotelLocationArray=this.populateAOSLocationInfoArray(this.hotelLocationInfo,this.hotelLocationHash)};return b};SKYSALES.Util.createObjectArray=[];SKYSALES.Util.createObject=function(b,f,d,e){e=e||"ready";var c=SKYSALES.Util.createObjectArray;c[c.length]={objNameBase:b,objType:f,json:d,createEvent:e}};SKYSALES.Util.initObjects=function(h){h=h||"ready";var f=0,d=SKYSALES.Util.createObjectArray,g="",c="",e=null,b=null;for(f=0;f<d.length;f+=1){b=d[f];if(b.createEvent===h){g=b.objNameBase+SKYSALES.Instance.getNextIndex();c=b.objType;e=b.json||{};if(SKYSALES.Class[c]){SKYSALES.Instance[g]=new SKYSALES.Class[c]();SKYSALES.Instance[g].init(e)}}}};SKYSALES.Util.decodeUriComponent=function(b){b=b||"";if(window.decodeURIComponent){b=window.decodeURIComponent(b)}b=b.replace(/\+/g," ");return b};SKYSALES.Util.encodeUriComponent=function(b){b=b||"";if(window.encodeURIComponent){b=window.encodeURIComponent(b)}return b};SKYSALES.Util.getTime=function(b,c,f){var e="",d=0;b=Number(b);d=b;c=Number(c);f=Number(f);if(isNaN(b)===false){if(b>12){b=b-12}else{if(b===0){b=12}else{if(b.toString().length===1){b="0"+b}}}e=b;if(isNaN(c)===false){if(c.toString().length===1){c="0"+c}e=e+":"+c;if(isNaN(f)===false){if(f.toString().length===1){f="0"+f}e=e+":"+f}}if(d>11&&d<24){e=e+" PM"}else{e=e+" AM"}}return e};SKYSALES.Util.getResource=function(){return SKYSALES.Resource};SKYSALES.Util.getAttributeValue=function(f,d){var c=d+".validation",b=f.data(c);return b};SKYSALES.Util.setAttribute=function(f,c,d){var b=c+".validation";f.data(b,d)};SKYSALES.Util.removeAttribute=function(d,c){var b=c+".validation";d.removeData(b)};SKYSALES.Util.setRequiredAttribute=function(d,h){var g="required",b="requirederror",f="true",c=SKYSALES.Util.setAttribute;c(d,g,f);if(h){c(d,b,h)}SKYSALES.Util.formatInputLabel(d)};SKYSALES.Util.removeRequiredAttribute=function(d){var f="required",c="requirederror",b=SKYSALES.Util.removeAttribute;b(d,f);b(d,c);SKYSALES.Util.formatInputLabel(d)};SKYSALES.Util.extendObject=function(c){var b=function(){};b.prototype=c;return new b()};SKYSALES.Util.supplant=function(c,b){var d=/\[(\w+)\]/g;if(c&&c.replace&&b){return c.replace(d,function(g,f){var e=null;if(b.hasOwnProperty(f)){e=b[f]}if(e===null){e=""}else{if(e===undefined){e=f}}return e})}else{return""}};SKYSALES.Util.parseIsoDate=function(d){var c=/^(\d{4})-([0-3]\d)-(\d{2})/,b=null,e=c.exec(d);if(e){b=new Date(+e[1],e[2]-1,+e[3])}return b};SKYSALES.Util.dateToIsoString=function(d){var e=d.getFullYear(),f=(d.getMonth()+1).toString(),c=d.getDate().toString(),b="";if(f.length===1){f="0"+f}if(c.length===1){c="0"+c}b=e+"-"+f+"-"+c;return b};SKYSALES.Util.parseIsoDate=function(d){var c=/^(\d{4})-(\d{2})-(\d{2})/,b=null,e=c.exec(d);if(e){b=new Date(+e[1],e[2]-1,+e[3])}return b};SKYSALES.Util.dateToIsoString=function(d){var e=d.getFullYear(),f=(d.getMonth()+1).toString(),c=d.getDate().toString(),b="";if(f.length===1){f="0"+f}if(c.length===1){c="0"+c}b=e+"-"+f+"-"+c;return b};SKYSALES.Util.populateSelect=function(c){c=c||{};var b=c.selectedItem||null,g=c.objectArray||[],f=c.selectBox||null,o=c.showCode||false,t=c.clearOptions||false,n="",p="",k=null,l=null,r=0,s=0,j="",q=Option,e=c.codeName||"code",d=c.nameProperty||"name",h=null,m=false;if(f.length>0){k=f[0];if(k&&k.options){h=k.options;if(t){h.length=0}else{if(!k.originalOptionLength){k.originalOptionLength=k.options.length}h.length=k.originalOptionLength}s=g.length;if($.browser.msie&&$.browser.version<7){m=true}for(r=0;r<s;r+=1){l=g[r]||{};n=l[d]||"";p=l[e];if(!p&&p!==0){p=""}if(o){n+=" ("+p+")"}if(m){j=new q(n,p,false,false);if(l.optionClass){$(j).addClass(l.optionClass)}h[h.length]=j}else{j+='<option value="'+p+'"';if(l.optionClass){j+=' class"="'+l.optionClass+'"'}j+=">"+n+"</option>"}}if(!m){f.append(j)}if(b!==null){f.val(b)}}}};SKYSALES.Util.populate=function(c){c=c||{};var b=c.input||$([]);if(b&&b[0]&&b[0].options){c.selectBox=b;SKYSALES.Util.populateSelect(c)}else{if(b){c.options=c.objectArray||[];SKYSALES.Class.DropDown.getDropDown(c)}}};SKYSALES.Util.cloneArray=function(b){return b.concat()};SKYSALES.Util.convertToLocaleCurrency=function(b){var c={num:b},d=new SKYSALES.Class.LocaleCurrency();d.init(c);return d.currency};SKYSALES.Util.convertToLocaleInteger=function(b){var c={num:b},d=new SKYSALES.Class.LocaleCurrency();d.init(c);return d.integerPart};SKYSALES.Util.formatAmount=function(e,d,g,b){var f="",c=(d==="0"||d==="");if(e!==""&&!c){f=d+" "+g+" "+b+" "+e}else{if(e!==""&&c){f=e}else{if(e===""&&!c){f=d+" "+g}}}return f};SKYSALES.Class.SkySales=function(){var b=this;b.containerId="";b.container=null;b.init=SKYSALES.Class.SkySales.prototype.init;b.getById=SKYSALES.Class.SkySales.prototype.getById;b.setSettingsByObject=SKYSALES.Class.SkySales.prototype.setSettingsByObject;b.addEvents=SKYSALES.Class.SkySales.prototype.addEvents;b.setVars=SKYSALES.Class.SkySales.prototype.setVars;b.hide=SKYSALES.Class.SkySales.prototype.hide;b.show=SKYSALES.Class.SkySales.prototype.show;return b};SKYSALES.Class.SkySales.prototype.init=function(b){this.setSettingsByObject(b);this.setVars()};SKYSALES.Class.SkySales.prototype.getById=function(d,b){var c=null;if(d&&b){c=$("#"+d,b)}else{if(d){c=window.document.getElementById(d);if(c){c=$(c)}}}if(!c){c=$([])}return c};SKYSALES.Class.SkySales.prototype.setSettingsByObject=function(b){var c="";for(c in b){if(b.hasOwnProperty(c)){if(this[c]!==undefined){this[c]=b[c]}}}};SKYSALES.Class.SkySales.prototype.addEvents=function(){};SKYSALES.Class.SkySales.prototype.setVars=function(){this.container=this.getById(this.containerId)};SKYSALES.Class.SkySales.prototype.hide=function(){this.container.hide()};SKYSALES.Class.SkySales.prototype.show=function(){this.container.show("slow")};SKYSALES.Class.BaseToggleView=function(){var b=SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.toggleViewIdArray=[];c.toggleViewArray=[];c.addToggleView=function(g){if(g.toggleViewIdArray){g=g.toggleViewIdArray}var e=g||[],d=null,f=0,h=null;if(e.length===undefined){e=[];e[0]=g}for(f=0;f<e.length;f+=1){d=e[f];h=new SKYSALES.Class.ToggleView();h.init(d);c.toggleViewArray[c.toggleViewArray.length]=h}};return c};SKYSALES.Class.FlightSearch=function(){var d=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(d),c=[];b.marketArray=[];b.flightTypeInputIdArray=[];b.countryInputIdArray=[];b.countryInputArray=[];b.init=function(e){this.setSettingsByObject(e);this.setVars();this.addEvents();this.initFlightTypeInputIdArray();this.initCountryInputIdArray();this.populateFlightType()};b.setSettingsByObject=function(f){d.setSettingsByObject.call(this,f);var e=0,g=this.marketArray||[],h=null;for(e=0;e<g.length;e+=1){h=new SKYSALES.Class.FlightSearchMarket();h.flightSearch=this;h.index=e;h.init(g[e]);this.marketArray[e]=h}};b.initCountryInputIdArray=function(){var f=0,e=null,h={},g=this.countryInputIdArray||[];for(f=0;f<g.length;f+=1){e=g[f];h=new SKYSALES.Class.CountryInput();h.init(e);b.countryInputArray[this.countryInputArray.length]=h}};b.initFlightTypeInputIdArray=function(){var f=0,h=null,e={},g=this.flightTypeInputIdArray||[];for(f=0;f<g.length;f+=1){h=g[f];e=new SKYSALES.Class.FlightTypeInput();e.flightSearch=this;e.index=f;e.init(h);c[c.length]=e}};b.populateFlightType=function(){var e=0,g=null,f=null;for(e=0;e<c.length;e+=1){g=c[e];f=$(g.input);if(f.attr("checked")){f.click();break}}};b.updateFlightType=function(h){var f=0,k=null,g=null,e,j=null;for(f=0;f<c.length;f+=1){k=c[f];j=k.hideInputArray;for(e=0;e<j.length;e+=1){g=$(j[e]);g.show()}}j=h.hideInputArray;for(e=0;e<j.length;e+=1){g=$(j[e]);g.hide()}};return b};SKYSALES.Class.FlightSearchMarket=function(){var d=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(d),b=[],e=[],g=[],f=[];c.flightSearch=null;c.index=-1;c.validationMessageObject={};c.validationObjectIdArray=[];c.stationInputIdArray=[];c.stationDropDownIdArray=[];c.marketInputIdArray=[];c.macInputIdArray=[];c.marketDateIdArray=[];c.lowFareAvailabilityArray=[];c.marketDateArray=[];c.init=function(h){this.setSettingsByObject(h);this.setVars();this.addEvents();this.initMarketInputIdArray();this.initStationInputIdArray();this.initStationDropDownIdArray();this.initMacInputIdArray();this.initMarketDateIdArray();this.initLowFareAvailabilityArray();this.initValidationObjectRedirect()};c.initMacInputIdArray=function(){var j=0,l=null,h={},k=this.macInputIdArray||[];for(j=0;j<k.length;j+=1){l=k[j];h=new SKYSALES.Class.MacInput();h.init(l);f[f.length]=h;h.showMac.call(h.stationInput)}};c.initMarketDateIdArray=function(){var h=0,k=null,l={},j=this.marketDateIdArray||[];for(h=0;h<j.length;h+=1){k=j[h];l=new SKYSALES.Class.MarketDate();l.init(k);this.marketDateArray[this.marketDateArray.length]=l}};c.initMarketInputIdArray=function(){var j=0,h=null,l={},k=this.marketInputIdArray||[];for(j=0;j<k.length;j+=1){h=k[j];l=new SKYSALES.Class.MarketInput();l.init(h);b[b.length]=l}};c.initStationInputIdArray=function(){var h=0,j=null,l={},k=this.stationInputIdArray;for(h=0;h<k.length;h+=1){j=k[h];l=new SKYSALES.Class.StationInput();l.init(j);e[e.length]=l}};c.initStationDropDownIdArray=function(){var j=0,l=null,h={},k=this.stationDropDownIdArray;for(j=0;j<k.length;j+=1){l=k[j];h=new SKYSALES.Class.StationDropDown();h.init(l);g[g.length]=h}};c.initLowFareAvailabilityArray=function(){var k=0,l=null,j=this.lowFareAvailabilityArray,h=j.length,m={};for(k=0;k<h;k+=1){l=new SKYSALES.Class.LowFareAvailability();m=j[k];m.datePickerManager=this.marketDateArray[0].datePickerManager;l.init(m);j[j.length]=l}};c.initValidationObjectRedirect=function(){var q=this.validationObjectIdArray||[],h=0,p="",o="",n="",j=null,m=null,k=null,l="";for(h=0;h<q.length;h+=1){p=q[h];o=p.key||"";n=p.value||"";j=$("object.metaobject>param[value*='"+o+"']");if(j.length>0){m=$(":input#"+n);if(m.length>0){k=j[0];if("value" in k){l=k.value;l=l.replace(o,n);k.value=l}}}}};return c};SKYSALES.Class.LowFareAvailability=function(){var e=new SKYSALES.Class.SkySales(),d=SKYSALES.Util.extendObject(e),c="",b="",f="";d.request={};d.url="TripPlannerLowFareSelectAjax-resource.aspx";d.containerId="lowFareAvailabilityContainerId";d.container={};d.showId="";d.show=null;d.flightSearch={};d.tripPlannerSearchFlight={};d.originId="";d.destinationId="";d.marketDateId="";d.marketDateObject={};d.datePickerManager={};d.requestStartDate=null;d.requestEndDate=null;d.lowFareAvailabilityMisconfiguredErrorDivId="lowFareAvailabilityMisconfiguredErrorText";d.lowFareAvailabilityMisconfiguredErrorText="";d.updateShow=function(){this.tripPlannerSearchFlight.tripPlannerSearchFlights.dontRequireOriginAndDestinationOnFlights();this.tripPlannerSearchFlight.requireOriginAndDestination();var g=this.validate();if(g){this.populateRequest();this.sendLowFareAvailabilityRequest()}};d.updateShowHandler=function(){d.updateShow()};d.validate=function(){return SKYSALES.Util.validate(this.show[0])};d.addEvents=function(){this.show.click(this.updateShowHandler)};d.populateRequest=function(){var v=this.flightSearch.countryInputArray[0].input.val(),m=this.tripPlannerSearchFlight.tripPlannerSearchFlights.tripPlannerSearch,h=m.preferredFareDropDown.val(),z=m.passengerDiscountDropDown.val(),F={},C=m.passengerTypeDropDowns.passengerTypeDropDownArray||[],w=C.length,A=0,G="",p="",y="",j=c.val(),s=b.val(),g=f.val(),n=g.split("-"),E=n[0],o=n[1]-1,q=n[2],l={},t={},D=new Date(),u=new Date(),r=new Date(),k=new Date(),B=new Date();d.marketDateObject=new Date(E,o,q);d.request={"Search.ResidentCountry":v,"Search.PreferredFare":h,"Search.DiscountCode":z};for(A=0;A<w;A+=1){F=C[A];G=F.attr("name");y=F.val();d.request[G]=y}u=new Date(D.getFullYear(),D.getMonth(),D.getDate()-1);r=new Date(this.marketDateObject);r.setDate(r.getDate()-7);if(u>r){k=u}else{k=r}B=new Date(this.marketDateObject);B.setDate(B.getDate()+7);d.requestStartDate=k;d.requestEndDate=B;p="Search.DateMarkets[0].";d.request[p+"OriginStation.MarketCode"]=j;d.request[p+"DestinationStation.MarketCode"]=s;l=SKYSALES.Util.dateToIsoString(k);d.request[p+"DepartureDate"]=l;t=SKYSALES.Util.dateToIsoString(B);d.request[p+"ArrivalDate"]=t;this.tripPlannerSearchFlight.hideTripIsUnavailable();this.tripPlannerSearchFlight.hideTripHasNoFares()};d.sendLowFareAvailabilityRequest=function(){$.post(this.url,this.request,this.responseHandler)};d.availabilityExists=function(h){h=h||[];var l=false,g=h.length||0,k=0,j=[];while((k<g)&&!l){j=h[k].JourneyDateMarketList;if(j.length>0){l=true}k+=1}return l};d.makeDateMarketHash=function(k){k=k||[];var A={},G=0,B=0,s=k.length,H={},y=[],r=0,z=0,u,q={},m=0,t=[],C=[],o=[],w=[],p=[],L={},D=0,I=0,h=0,K=0,F=0,E=0,J=0,n=0,l=0,j=0,g=0,v=0,M="";for(G=0;G<s;G+=1){H=k[G];y=H.JourneyDateMarketList;r=y.length;for(z=0;z<r;z+=1){u=y[z];q=u.DepartureDate;m=q.Month-1;M="date_0_"+q.Year+"_"+m+"_"+q.Day;t=u.Journeys||[];D=0;if(t.length){C=t[0].Segments||[];if(C.length){o=C[0].Fares||[];if(o.length){w=o[0].PaxFares||[];if(w.length){p=w[0].ServiceCharges||[];if(p.length){L=p[0]||{};D=L.Amount||0;D=parseFloat(D,10)}}}}}A[M]={year:q.Year,month:m,day:q.Day,containerId:M,price:D}}}return A};d.processResponse=function(q){var o=$(q),k=o.html(),y=SKYSALES.Json.parse(k),n={containerId:"lowFareAvailabilityContainerId",templateId:"tripPlannerCalendar",totalTemplateId:"totalTemplateId",totalId:"totalId",marketArray:[],requestStartDate:this.requestStartDate,requestEndDate:this.requestEndDate},l=[],m={},s=y.TripAvailabilityResponse||{},p=s.Schedules||[],r=null,v=null,w=[],g=0,u=0,j={},t={},h={};v=this.availabilityExists(p);if(!v){this.tripPlannerSearchFlight.showTripIsUnavailable();this.container.hide()}else{if(p.length>0){r=p[0];w=r.JourneyDateMarketList||[];g=w.length;if(g>0){j=w[0];m={departureStation:j.DepartureStation,arrivalStation:j.ArrivalStation,selectedDate:this.marketDateObject,startYear:j.DepartureDate.Year,startMonth:j.DepartureDate.Month-1,startDay:j.DepartureDate.Day};u=w.length;if(u>0){t=w[u-1];m.endYear=t.DepartureDate.Year;m.endMonth=t.DepartureDate.Month-1;m.endDay=t.DepartureDate.Day}}m.dateMarketHash=this.makeDateMarketHash(p);m.datePickerManager=this.datePickerManager;l.push(m);n.marketArray=l;h=new SKYSALES.Class.TripPlannerCalendarAvailabilityInput();h.init(n);this.container.show()}}};d.validateResponse=function(h){var g=true;if(h===""){g=false}else{if(!$(h)[0].innerHTML){g=false}}return g};d.validateAndProcessResponse=function(j){var h=$(j),g=this.validateResponse(h);if(g){this.processResponse(h)}else{alert(d.lowFareAvailabilityMisconfiguredErrorText)}};d.responseHandler=function(g){d.validateAndProcessResponse(g)};d.ajaxErrorHandler=function(g){d.ajaxError(g)};d.setVars=function(){var g=this.getById(this.lowFareAvailabilityMisconfiguredErrorDivId);if(g.length>0){d.lowFareAvailabilityMisconfiguredErrorText=g.text()}d.show=this.getById(this.showId);d.container=this.getById(this.containerId);c=this.getById(this.originId);b=this.getById(this.destinationId);f=this.getById(this.marketDateId);d.flightSearch=this.tripPlannerSearchFlight.tripPlannerSearchFlights.tripPlannerSearch.flightSearch};d.init=function(g){this.setSettingsByObject(g);this.setVars();this.addEvents()};return d};SKYSALES.Class.MacInput=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.macHash=SKYSALES.Util.getResource().macHash;c.stationHash=SKYSALES.Util.getResource().stationHash;c.stationInputId="";c.macContainerId="";c.macLabelId="";c.macInputId="";c.macContainer={};c.stationInput={};c.macInput={};c.macLabel={};c.showMac=function(){var f=$(this).val(),d=null,e="",h="",g=null;f=f||"";f=f.toUpperCase();c.macInput.removeAttr("checked");c.macContainer.hide();d=c.stationHash[f];if(d){e=d.macCode;g=c.macHash[e];if((g)&&(g.stations.length>0)){h=g.stations.join();c.macLabel.html(h);c.macContainer.show()}}};c.addEvents=function(){c.stationInput.change(c.showMac)};c.setVars=function(){c.stationInput=this.getById(c.stationInputId);c.macContainer=this.getById(c.macContainerId);c.macLabel=this.getById(c.macLabelId);c.macInput=this.getById(c.macInputId)};c.init=function(d){b.init.call(this,d);c.macContainer.hide();this.addEvents()};return c};SKYSALES.Class.MarketDate=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.dateFormat=SKYSALES.datepicker.datePickerFormat;b.dateDelimiter=SKYSALES.datepicker.datePickerDelimiter;b.marketDateId="";b.marketDate=null;b.marketDayId="";b.marketDay=null;b.marketMonthYearId="";b.marketMonthYear=null;b.useJQueryDatePicker=true;b.datePickerManager={};b.fullDateFormatString="mm/dd/yy";b.parseDate=function(g){var m="",k="",l="",f=new Date(),e="",n="",h=[],j=0,d=SKYSALES.Util.parseIsoDate(g);if(d){f=d}else{if(g.indexOf(b.dateDelimiter)>-1){h=g.split(this.dateDelimiter);for(j=0;j<this.dateFormat.length;j+=1){e=h[j];if(e.charAt(0)==="0"){e=e.substring(1)}n=this.dateFormat.charAt(j);switch(n){case"m":k=e;break;case"d":m=e;break;case"y":l=e;break}}f=new Date(l,k-1,m)}}return f};b.addEvents=function(){var d={isAOS:false,yearMonth:this.marketMonthYear,day:this.marketDay,linkedDate:this.marketDate,useJQueryDatePicker:this.useJQueryDatePicker,fullDateFormatString:this.fullDateFormatString};b.datePickerManager=new SKYSALES.Class.DatePickerManager();this.datePickerManager.init(d)};b.setVars=function(){b.marketDate=this.getById(this.marketDateId);b.marketDay=this.getById(this.marketDayId);b.marketMonthYear=this.getById(this.marketMonthYearId)};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.datesInOrder=function(f){var g=true,e=null,d=null;e=this.parseDate(f[0]);d=this.parseDate(f[1]);if(e>d){g=false}return g};return b};SKYSALES.Class.CountryInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.countryInfo=SKYSALES.Util.getResource().countryInfo;b.countryInputId="";b.input={};b.defaultValue=null;b.showCode=true;b.populateCountryInput=function(){var f={},e=this.countryInfo||{},d=this.defaultValue,g=e.CountryList||[];if(d===null){d=e.DefaultValue}f={input:this.input,objectArray:g,selectedItem:d,showCode:this.showCode};SKYSALES.Util.populate(f)};b.setVars=function(){b.input=this.getById(this.countryInputId)};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.populateCountryInput();this.addEvents()};return b};SKYSALES.Class.FlightTypeInput=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.flightSearch=null;c.index=-1;c.flightTypeId="";c.hideInputIdArray=[];c.hideInputArray=[];c.input={};c.updateFlightTypeHandler=function(){c.flightSearch.updateFlightType(c)};c.addEvents=function(){b.addEvents.call(this);this.input.click(this.updateFlightTypeHandler)};c.setVars=function(){b.setVars.call(this);var d=0,e=null,f=[];c.input=this.getById(this.flightTypeId);for(d=0;d<this.hideInputIdArray.length;d+=1){e=c.getById(this.hideInputIdArray[d]);if(e){f[f.length]=e}}c.hideInputArray=$(f)};c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};return c};SKYSALES.Class.MarketInput=function(){var d=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(d),g=SKYSALES.Util.getResource()||{};b.marketHash=g.marketHash;b.stationList=g.stationInfo.StationList||[];ResourceNewMarket={};ResourceNewMarket=g.marketHash;MarketList={};MarketList=g.stationInfo.StationList||[];MarketListAdd={};MarketListAdd=g.stationInfo.StationList||[];if((document.getElementById("HAB")==null)&&(document.getElementById("CulturaDrop").value!="0_US")){for(i=0;i<=MarketList.length-1;i++){var c=MarketList[i].code;var f=MarketList[i].name;var h=0;for(x=0;x<=MarketListAdd.length-1;x++){try{if(c!="TLC"&&c!="MEX"){if(MarketListAdd[x].code!=c&&MarketListAdd[x].code!="QRO"){if((c=="MID"||c=="LMM"||c=="HUX"||c=="HMO"||c=="GUA"||c=="CUL"||c=="CUU"||c=="CZM"||c=="CEN"||c=="CJS"||c=="CME"||c=="VSA"||c=="VER"||c=="TGZ"||c=="TAM"||c=="TIJ"||c=="MEX"||c=="TLC")&&(MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="MEX")){if((c=="HMO"||c=="TAM"||c=="TGZ"||c=="TIJ"||c=="VER"||c=="VSA"||c=="CME"||c=="CJS"||c=="CEN"||c=="CZM"||c=="CUU"||c=="CUL"||c=="GUA"||c=="HUX"||c=="LMM"||c=="MID")&&MarketListAdd[x].code=="MEX"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}else{ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}}catch(e){}}}}if((document.getElementById("HAB")==null)&&(document.getElementById("CulturaDrop").value=="0_US")){for(i=0;i<=MarketList.length-1;i++){var c=MarketList[i].code;var f=MarketList[i].name;var h=0;for(x=0;x<=MarketListAdd.length-1;x++){try{if(c=="SAT"){if(MarketListAdd[x].code!=c&&MarketListAdd[x].code!="QRO"){if((c=="MID"||c=="LMM"||c=="HUX"||c=="HMO"||c=="GUA"||c=="CUL"||c=="CUU"||c=="CZM"||c=="CEN"||c=="CJS"||c=="CME"||c=="VSA"||c=="VER"||c=="TGZ"||c=="TAM"||c=="TIJ"||c=="MEX"||c=="TLC")&&(MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="MEX")){if((c=="HMO"||c=="SAT"||c=="TGZ"||c=="TIJ"||c=="VER"||c=="VSA"||c=="CME"||c=="CJS"||c=="CEN"||c=="CZM"||c=="CUU"||c=="CUL"||c=="GUA"||c=="HUX"||c=="LMM"||c=="MID"||c=="SAT")&&MarketListAdd[x].code=="MEX"){if(MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="GDL"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}else{if(MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="GDL"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}}if(c=="GDL"){if(MarketListAdd[x].code!=c&&MarketListAdd[x].code!="QRO"){if((c=="MID"||c=="LMM"||c=="HUX"||c=="HMO"||c=="GUA"||c=="CUL"||c=="CUU"||c=="CZM"||c=="CEN"||c=="CJS"||c=="CME"||c=="VSA"||c=="VER"||c=="TGZ"||c=="TAM"||c=="TIJ"||c=="MEX"||c=="TLC")&&(MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="MEX")){if((c=="HMO"||c=="SAT"||c=="TGZ"||c=="TIJ"||c=="VER"||c=="VSA"||c=="CME"||c=="CJS"||c=="CEN"||c=="CZM"||c=="CUU"||c=="CUL"||c=="GUA"||c=="HUX"||c=="LMM"||c=="MID"||c=="SAT")&&MarketListAdd[x].code=="MEX"){if(MarketListAdd[x].code=="CUN"||MarketListAdd[x].code=="HMO"||MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="MTY"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="TIJ"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="SAT"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}else{if(MarketListAdd[x].code=="CUN"||MarketListAdd[x].code=="HMO"||MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="MTY"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="TIJ"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="SAT"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}}}catch(e){}}}}if((document.getElementById("HAB")!=null)&&((document.getElementById("CulturaDrop").value=="0_MX")||(document.getElementById("CulturaDrop").value=="0_US"))){for(i=0;i<=MarketList.length-1;i++){var c=MarketList[i].code;var f=MarketList[i].name;var h=0;for(x=0;x<=MarketListAdd.length-1;x++){try{if(c=="SAT"){if(MarketListAdd[x].code!=c&&MarketListAdd[x].code!="QRO"){if((c=="MID"||c=="LMM"||c=="HUX"||c=="HMO"||c=="GUA"||c=="CUL"||c=="CUU"||c=="CZM"||c=="CEN"||c=="CJS"||c=="CME"||c=="VSA"||c=="VER"||c=="TGZ"||c=="TAM"||c=="TIJ"||c=="MEX"||c=="TLC")&&(MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="MEX")){if((c=="HMO"||c=="SAT"||c=="TGZ"||c=="TIJ"||c=="VER"||c=="VSA"||c=="CME"||c=="CJS"||c=="CEN"||c=="CZM"||c=="CUU"||c=="CUL"||c=="GUA"||c=="HUX"||c=="LMM"||c=="MID"||c=="SAT")&&MarketListAdd[x].code=="MEX"){if(MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="GDL"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}else{if(MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="GDL"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}}if(c=="GDL"){if(MarketListAdd[x].code!=c&&MarketListAdd[x].code!="QRO"){if((c=="MID"||c=="LMM"||c=="HUX"||c=="HMO"||c=="GUA"||c=="CUL"||c=="CUU"||c=="CZM"||c=="CEN"||c=="CJS"||c=="CME"||c=="VSA"||c=="VER"||c=="TGZ"||c=="TAM"||c=="TIJ"||c=="MEX"||c=="TLC")&&(MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="MEX")){if((c=="HMO"||c=="SAT"||c=="TGZ"||c=="TIJ"||c=="VER"||c=="VSA"||c=="CME"||c=="CJS"||c=="CEN"||c=="CZM"||c=="CUU"||c=="CUL"||c=="GUA"||c=="HUX"||c=="LMM"||c=="MID"||c=="SAT")&&MarketListAdd[x].code=="MEX"){if(MarketListAdd[x].code=="CUN"||MarketListAdd[x].code=="HMO"||MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="MTY"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="TIJ"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="SAT"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}else{if(MarketListAdd[x].code=="CUN"||MarketListAdd[x].code=="HMO"||MarketListAdd[x].code=="MEX"||MarketListAdd[x].code=="MTY"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="SJD"||MarketListAdd[x].code=="TIJ"||MarketListAdd[x].code=="TLC"||MarketListAdd[x].code=="SAT"){ResourceNewMarket[c][h]=new Array();ResourceNewMarket[c][h].code=MarketListAdd[x].code;ResourceNewMarket[c][h].name=MarketListAdd[x].name;h++}}}}}catch(e){}}}}b.marketHash=ResourceNewMarket;b.stationList=g.stationInfo.StationList||[];b.containerId="";b.container=null;b.disableInputId="";b.disableInput=null;b.originId="";b.origin=null;b.destinationId="";b.destination=null;b.toggleMarketCount=0;b.toggleMarketHandler=function(){b.toggleMarket()};b.toggleMarket=function(){if((this.toggleMarketCount%2)===0){$(":input",this.container).attr("disabled","disabled")}else{$(":input",this.container).removeAttr("disabled")}b.toggleMarketCount+=1};b.updateMarketOriginHandler=function(){var j=$(this).val();b.updateMarketOrigin(j)};b.updateMarketOrigin=function(j){var l=[],k={};j=j.toUpperCase();l=this.marketHash[j];l=l||[];k={input:this.destination,objectArray:l,showCode:true};SKYSALES.Util.populate(k)};b.addEvents=function(){this.origin.change(this.updateMarketOriginHandler);this.disableInput.click(this.toggleMarketHandler)};b.setVars=function(){b.container=this.getById(this.containerId);b.disableInput=this.getById(this.disableInputId);b.origin=this.getById(this.originId);b.destination=this.getById(this.destinationId)};b.populateMarketInput=function(j){var k={};k={input:j,objectArray:this.stationList,showCode:true};SKYSALES.Util.populate(k)};b.init=function(j){this.setSettingsByObject(j);this.setVars();this.addEvents();this.populateMarketInput(this.origin);this.populateMarketInput(this.destination);this.disableInput.click();this.disableInput.removeAttr("checked")};return b};SKYSALES.Class.StationInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.stationInputId="";b.stationInput=null;b.setVars=function(){c.setVars.call(this);b.stationInput=this.getById(this.stationInputId)};b.init=function(d){c.init.call(this,d);this.addEvents()};return b};SKYSALES.Class.StationDropDown=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.selectBoxId="";b.selectBox=null;b.inputId="";b.input=null;b.updateStationDropDown=function(){var d=$(this).val();if(d){b.selectBox.val(d)}};b.updateStationInput=function(){var d=$(this).val();b.input.val(d);b.input.change()};b.addEvents=function(){b.input.change(b.updateStationDropDown);b.selectBox.change(b.updateStationInput)};b.setVars=function(){b.selectBox=this.getById(b.selectBoxId);b.input=this.getById(b.inputId)};b.init=function(d){c.init.call(this,d);this.addEvents();b.input.change()};return b};SKYSALES.Class.TravelDocumentInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.instanceName="";b.delimiter="_";b.travelDocumentInfoId="";b.travelDocumentInfo=null;b.documentNumberId="";b.documentNumber=null;b.documentTypeId="";b.documentType=null;b.documentIssuingCountryId="";b.documentIssuingCountry=null;b.documentBirthCountryId="";b.documentBirthCountry=null;b.documentExpYearId="";b.documentExpYear=null;b.documentExpMonthId="";b.documentExpMonth=null;b.documentExpDayId="";b.documentExpDay=null;b.actionId="";b.action=null;b.travelDocumentKey="";b.missingDocumentText="";b.missingDocumentTypeText="";b.invalidExpDateText="";b.emptyExpDateText="";b.invalidDaysOfMonthTextPre="";b.invalidDaysOfMonthTextMid="";b.invalidDaysOfMonthTextPost="";b.missingDocumentNumberText="";b.missingDocumentCountryText="";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){b.travelDocumentInfo=this.getById(this.travelDocumentInfoId);b.documentType=this.getById(this.documentTypeId);b.documentNumber=this.getById(this.documentNumberId);b.documentIssuingCountry=this.getById(this.documentIssuingCountryId);b.documentBirthCountry=this.getById(this.documentBirthCountryId);b.documentExpYear=this.getById(this.documentExpYearId);b.documentExpMonth=this.getById(this.documentExpMonthId);b.documentExpDay=this.getById(this.documentExpDayId);b.action=this.getById(this.actionId)};b.setTravelDocumentInfo=function(){var h="",d=this.documentType.val(),e=this.documentNumber.val(),f=this.documentIssuingCountry.val(),g=this.documentBirthCountry.val();if(d&&e&&f){h=this.delimiter+d+this.delimiter+e+this.delimiter+f+this.delimiter+g;this.travelDocumentInfo.val(h)}return true};b.validateTravelDocumentHandler=function(){var d=b.validateTravelDocument();return d};b.validateTravelDocument=function(){this.setTravelDocumentInfo();var e=this.action[0],d=SKYSALES.Util.validate(e)&&this.validateInput();return d};b.addEvents=function(){this.action.click(this.validateTravelDocumentHandler)};b.validateInput=function(){var d=true,e="",l="",p=this.documentNumber.val()||"",k=this.documentExpYear.val()||"",f=this.documentExpMonth.val()||"",g=this.documentExpDay.val()||"",o=this.documentType.val()||"",m=this.documentIssuingCountry.val()||"",h=false,j=false,n="";if(p||o||m||k||f||g){if(!p){e=e+this.missingDocumentNumberText+"\n"}if(!o){e=e+this.missingDocumentTypeText+"\n"}if(!m){e=e+this.missingDocumentCountryText+"\n"}j=this.checkDaysOfMonth(g,f,k);h=this.isPastDate(g,f,k);if(g&&f&&k){if(!j){n=this.documentExpMonth.find(":selected").text();l=this.invalidDaysOfMonthTextPre+g;l+=this.invalidDaysOfMonthTextMid+n+this.invalidDaysOfMonthTextPost;e=e+l+"\n"}else{if(!h){e=e+this.invalidExpDateText+"\n"}}}else{e=e+this.emptyExpDateText+"\n"}if(e){window.alert(this.missingDocumentText+"\n"+e);d=false}}return d};b.checkDaysOfMonth=function(f,k,g){g=window.parseInt(g,10);k=window.parseInt(k,10);f=window.parseInt(f,10);var j=false,h=null,d=-1,e=null;if(g&&k&&f){k-=1;h=new Date();h.setMonth(2);h.setDate(1);h.setDate(h.getDate()-1);d=h.getDate();e=[31,d,31,30,31,30,31,31,30,31,30,31];if(f<=e[k]){j=true}}return j};b.isPastDate=function(e,j,g){g=window.parseInt(g,10);j=window.parseInt(j,10);e=window.parseInt(e,10);var h=false,d=null,f=null;if(g&&j&&e){j-=1;d=new Date();f=new Date(g,j,e);if(f>d){h=true}}return h};return b};SKYSALES.Class.ControlGroup=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.actionId="SkySales";b.action=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){c.setVars.call(this);b.action=this.getById(this.actionId)};b.addEvents=function(){c.addEvents.call(this);this.action.click(this.validateHandler)};b.validateHandler=function(){var d=b.validate();return d};b.validate=function(){var d=this.action[0],e=SKYSALES.Util.validate(d);return e};return b};SKYSALES.Class.ControlGroupRegister=function(){var c=new SKYSALES.Class.ControlGroup(),b=SKYSALES.Util.extendObject(c);b.travelDocumentInput=null;b.setSettingsByObject=function(d){c.setSettingsByObject.call(this,d);var e=new SKYSALES.Class.TravelDocumentInput();e.init(this.travelDocumentInput);b.travelDocumentInput=e};b.validateHandler=function(){var d=b.validate();return d};b.validate=function(){var d=false;d=(this.travelDocumentInput.setTravelDocumentInfo()&&this.travelDocumentInput.validateExpDate());if(d){d=c.validate.call(this)}return d};return b};SKYSALES.Class.PersonInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c),d=SKYSALES.Util.getResource();b.countryInputId="";b.countryInput=null;b.stateInputId="";b.stateInput=null;b.emptyStateSelect="";b.defaultProvinceStateCode="";b.defaultCountryCode="";b.countryStateHash=null;b.clientHash=d.clientHash;b.countryArray=d.countryInfo.CountryList;b.allStateArray=d.provinceStateInfo.ProvinceStateList;b.init=function(e){this.setSettingsByObject(e);this.setVars();this.addEvents();this.initCountryInput();this.initStateInput()};b.initCountryInput=function(){var e={},f=this.countryArray||[];e={selectedItem:this.defaultCountryCode,input:this.countryInput,objectArray:f,showCode:false};SKYSALES.Util.populate(e)};b.initStateInput=function(){var j={},g=this.allStateArray||[],k,h=0,e=g.length,f=this.defaultCountryCode+"|"+this.defaultProvinceStateCode;if(this.defaultProvinceStateCode.indexOf("|")>-1){f=this.defaultProvinceStateCode}for(h=0;h<e;h+=1){k=g[h];k.code=k.ccode+"|"+k.scode}j={selectedItem:f,input:this.stateInput,objectArray:g,showCode:false};SKYSALES.Util.populate(j)};b.getCountryStateHash=function(){var m=0,f=0,h=[],e=null,g=null,k={},l=0,n=0,o=this.countryArray,j=this.allStateArray;l=o.length;for(m=0;m<l;m+=1){g=o[m];h=[];h.push({name:this.emptyStateSelect,code:"",ccode:"",scode:""});n=j.length;for(f=0;f<n;f+=1){e=j[f];if(e.ccode===g.code){h.push(e)}}k[g.code]=h}return k};b.updateCountryHandler=function(){b.updateCountry()};b.updateCountry=function(){var e=this.stateInput.val(),f=e.split("|"),g="";if(f.length===2){g=f[0];this.countryInput.val(g)}};b.updateStateHandler=function(){b.updateState()};b.updateState=function(){var l=this.countryInput.val(),f=[],h={},m=[],g=0,e=0,j=this.getCountryStateHash(),k={};f=j[l];f=f||[];if(f.length===0){m.push({name:this.emptyStateSelect,code:"",ccode:"",scode:""});f=this.allStateArray}e=f.length;for(g=0;g<e;g+=1){h=f[g];m.push(h)}k={objectArray:m,input:this.stateInput,showCode:false,clearOptions:true};SKYSALES.Util.populate(k)};b.addEvents=function(){this.countryInput.change(this.updateStateHandler);this.stateInput.change(this.updateCountryHandler)};b.setVars=function(){b.countryInput=this.getById(this.countryInputId);b.stateInput=this.getById(this.stateInputId)};return b};SKYSALES.Class.AgencyInput=function(){var b=new SKYSALES.Class.PersonInput(),c=SKYSALES.Util.extendObject(b);c.updateCountryHandler=function(){c.updateCountry()};c.updateStateHandler=function(){c.updateState()};c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initCountryInput();this.initStateInput()};return c};SKYSALES.Class.ContactInput=function(){var c=new SKYSALES.Class.PersonInput(),b=SKYSALES.Util.extendObject(c);b.clientId="";b.keyIdArray=[];b.keyArray=[];b.clientStoreIdHash=null;b.imContactId="";b.imContact=null;b.currentContactData={};b.logOutButton=null;b.clearCurrentContactHandler=function(){b.clearCurrentContact()};b.clearCurrentContact=function(){var d=this.clientId;this.getById(d+"_DropDownListTitle").val("");this.getById(d+"_TextBoxFirstName").val("");this.getById(d+"_TextBoxMiddleName").val("");this.getById(d+"_TextBoxLastName").val("");this.getById(d+"_TextBoxAddressLine1").val("");this.getById(d+"_TextBoxAddressLine2").val("");this.getById(d+"_TextBoxAddressLine3").val("");this.getById(d+"_TextBoxCity").val("");this.getById(d+"_DropDownListStateProvince").val("");this.getById(d+"_DropDownListCountry").val("");this.getById(d+"_TextBoxPostalCode").val("");this.getById(d+"_TextBoxHomePhone").val("");this.getById(d+"_TextBoxWorkPhone").val("");this.getById(d+"_TextBoxOtherPhone").val("");this.getById(d+"_TextBoxFax").val("");this.getById(d+"_TextBoxEmailAddress").val("")};b.populateCurrentContactHandler=function(){b.populateCurrentContact()};b.populateCurrentContact=function(){if(this.currentContactData){if(this.imContact.attr("checked")===true){this.populateContactFields()}else{this.clearCurrentContact()}}};b.populateContactFields=function(){var d=this.clientId,e=this.currentContactData;this.getById(d+"_DropDownListTitle").val(e.title);this.getById(d+"_TextBoxFirstName").val(e.firstName);this.getById(d+"_TextBoxMiddleName").val(e.middleName);this.getById(d+"_TextBoxLastName").val(e.lastName);this.getById(d+"_TextBoxAddressLine1").val(e.streetAddressOne);this.getById(d+"_TextBoxAddressLine2").val(e.streetAddressTwo);this.getById(d+"_TextBoxAddressLine3").val(e.streetAddressThree);this.getById(d+"_TextBoxCity").val(e.city);this.getById(d+"_DropDownListStateProvince").val(e.country+"|"+e.stateProvince);this.getById(d+"_DropDownListCountry").val(e.country);this.getById(d+"_TextBoxPostalCode").val(e.postalCode);this.getById(d+"_TextBoxHomePhone").val(e.eveningPhone);this.getById(d+"_TextBoxWorkPhone").val(e.dayPhone);this.getById(d+"_TextBoxOtherPhone").val(e.mobilePhone);this.getById(d+"_TextBoxFax").val(e.faxPhone);this.getById(d+"_TextBoxEmailAddress").val(e.email)};b.updateCountryHandler=function(){b.updateCountry()};b.updateStateHandler=function(){b.updateState()};b.getKey=function(){var h=0,e=this.keyArray,f=null,g="",d=e.length;for(h=0;h<d;h+=1){f=e[h];g+=f.val()}g=this.clientId+"_"+(g.toLowerCase());return g};b.populateClientStoreIdHash=function(){var l=this.clientHash,h=0,g="",e=[],d="",k=-1,f=this.getKey(),j=null;b.clientStoreIdHash={};if(f&&l&&l[f]){b.clientStoreIdHash=this.clientStoreIdHash||{};g=l[f];e=g.split("&");for(h=0;h<e.length;h+=1){d=e[h];k=d.indexOf("=");if(k>-1){f=d.substring(0,k);j=d.substring(k+1,d.length);if(f){b.clientStoreIdHash[f]=j}}}}};b.autoPopulateFormHandler=function(){b.autoPopulateForm()};b.autoPopulateForm=function(){var d=this.clientStoreIdHash,e="",f="";this.populateClientStoreIdHash();for(e in d){if(d.hasOwnProperty(e)){f=d[e];this.getById(e).val(f)}}};b.addEvents=function(){var g=0,e=this.keyArray,f=null,d=e.length;c.addEvents.call(this);for(g=0;g<d;g+=1){f=e[g];f.change(this.autoPopulateFormHandler)}this.imContact.click(this.populateCurrentContactHandler);this.logOutButton.click(this.clearCurrentContactHandler)};b.setVars=function(){var e=0,f=this.keyIdArray,d=this.keyArray,g="";c.setVars.call(this);for(e=0;e<f.length;e+=1){g=f[e];d[d.length]=this.getById(g)}b.imContact=this.getById(this.imContactId);b.logOutButton=this.getById("MemberLoginContactView_ButtonLogOut")};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initCountryInput();this.initStateInput()};return b};SKYSALES.Class.ToggleView=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.showId="";b.hideId="";b.elementId="";b.show=null;b.hide=null;b.element=null;b.setVars=function(){c.setVars.call(this);b.show=this.getById(this.showId);b.hide=this.getById(this.hideId);b.element=this.getById(this.elementId)};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.updateShowHandler=function(){b.updateShow()};b.updateHideHandler=function(){b.updateHide()};b.updateShow=function(){this.element.show("slow")};b.updateHide=function(){this.element.hide()};b.updateToggleHandler=function(){b.updateToggle()};b.updateToggle=function(){if(this.element.is(":visible")){this.updateHide()}else{this.updateShow()}};b.addEvents=function(){c.addEvents.call(this);if(this.showId===this.hideId){this.show.click(this.updateToggleHandler)}else{this.show.click(this.updateShowHandler);this.hide.click(this.updateHideHandler)}};return b};SKYSALES.Class.PaymentInputBase=function(){var c=SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.paymentInputCreditCardTypeId="";b.paymentInputCreditCardType={};b.paymentInputCreditCardNumberId="";b.paymentInputCreditCardNumber={};b.paymentInputCreditCardExpirationMonthId="";b.paymentInputCreditCardExpirationMonth={};b.paymentInputCreditCardExpirationYearId="";b.paymentInputCreditCardExpirationYear={};b.paymentInputCreditCardHolderNameId="";b.paymentInputCreditCardHolderName={};b.paymentInputCreditCardAmountId="";b.paymentInputCreditCardAmount={};b.paymentInputCreditCardCvvId="";b.paymentInputCreditCardCvv={};b.init=function(d){this.setSettingsByObject(d);this.setVars()};b.setVars=function(){this.paymentInputCreditCardAmount=this.getById(this.paymentInputCreditCardAmountId);this.paymentInputCreditCardCvv=this.getById(this.paymentInputCreditCardCvvId);this.paymentInputCreditCardExpirationMonth=this.getById(this.paymentInputCreditCardExpirationMonthId);this.paymentInputCreditCardExpirationYear=this.getById(this.paymentInputCreditCardExpirationYearId);this.paymentInputCreditCardHolderName=this.getById(this.paymentInputCreditCardHolderNameId);this.paymentInputCreditCardNumber=this.getById(this.paymentInputCreditCardNumberId);this.paymentInputCreditCardType=this.getById(this.paymentInputCreditCardTypeId)};return b};SKYSALES.Class.PaymentInput=function(){var b=SKYSALES.Class.PaymentInputBase(),c=SKYSALES.Util.extendObject(b);c.inlineDCCOfferKeyInputId="";c.cultureCode="";c.foreignAmountId="";c.foreignCurrencyNameId="";c.foreignCurrencySymbolId="";c.ownCurrencyAmountId="";c.ownCurrencyNameId="";c.ownCurrencySymbolId="";c.rejectInlineDccRadioButtonId="";c.acceptInlineDccRadioButtonId="";c.doubleOptOutId="";c.inlineDCCAjaxSucceededId="";c.dccId="";c.inlineDCCConversionLabelId="";c.paymentMethodInputId="";c.amountInputId="";c.accountNumberInputId="";c.inlineDCCActive=false;c.currencyCode="";c.feeAmt=null;c.setVars=function(){c.dcc=this.getById(this.dccId);c.inlineDCCConversionLabel=this.getById(this.inlineDCCConversionLabelId);c.paymentMethodInput=this.getById(this.paymentMethodInputId);c.accountNoTextBox=this.getById(this.accountNumberInputId);c.amountTextBox=this.getById(this.amountInputId);c.inlineDCCAjaxSucceeded=this.getById(this.inlineDCCAjaxSucceededId)};c.inlineDCCAjaxRequestHandler=function(){c.getInlineDCC()};c.addEvents=function(){this.amountTextBox.change(this.inlineDCCAjaxRequestHandler);this.accountNoTextBox.change(this.inlineDCCAjaxRequestHandler)};c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};c.getInlineDCC=function(e,g){var f={},d="";if(true===this.inlineDCCActive){d=this.paymentMethodInput.val();if(!g){g=this.accountNoTextBox.val()}if(!e){e=this.amountTextBox.val()}f={amount:e,paymentFee:this.feeAmt,currencyCode:this.currencyCode,accountNumber:g,paymentMethod:d,cultureCode:this.cultureCode};if(this.currencyCode&&e&&g&&(0<parseFloat(e))&&(12<=g.length)){this.inlineDCCAjaxSucceeded.val("false");$.get("DccOffer-rest.aspx",f,this.inlineDCCResponseHandler)}}};c.setVarsAfterAjaxResponse=function(d){c.foreignAmount=d.foreignCurrencyAmount;c.foreignCurrencyName=d.foreignCurrencyName;c.foreignCurrencySymbol=d.foreignCurrencySymbol;c.ownCurrencyAmount=d.ownCurrencyAmount;c.ownCurrencyName=d.ownCurrencyName;c.ownCurrencySymbol=d.ownCurrencySymbol;c.rejectInlineDccRadioButton=this.getById(this.rejectInlineDccRadioButtonId);c.acceptInlineDccRadioButton=this.getById(this.acceptInlineDccRadioButtonId)};c.foreignUpdateConversionLabel=function(){this.inlineDCCConversionLabel.text("( "+this.foreignAmount+" "+this.foreignCurrencyName+")")};c.ownUpdateConversionLabel=function(){this.inlineDCCConversionLabel.text("")};c.noThanks=function(){this.getById("dccCont").show("slow")};c.noShowThanks=function(){this.getById("dccCont").hide("slow")};c.updateAcceptRadioBtn=function(d){this.acceptInlineDccRadioButton.attr("checked",d);this.rejectInlineDccRadioButton.attr("checked",!d);this.foreignUpdateConversionLabel()};c.updateInlineDCCOffer=function(h){var g={},d=this.getById(this.inlineDCCOfferKeyInputId),f=this.dcc,j="",e="";if(h){g=SKYSALES.Json.parse(h);if(g){if(g.paymentMethodCode){this.inlineDCCAjaxSucceeded.val("true")}d.val(h);f.empty();if(g.applicable===true){e=$("#inlineDccTemplate").html();e=e.replace("<!--","");e=e.replace("-->","");j=SKYSALES.Util.supplant(e,g);f.append(j)}this.setVarsAfterAjaxResponse(g);this.updateAcceptRadioBtn(g.acceptByDefault)}}};c.inlineDCCResponseHandler=function(d){c.updateInlineDCCOffer(d)};return c};SKYSALES.Class.PriceDisplay=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.toggleViewIdArray=null;c.init=function(f){this.setSettingsByObject(f);var d=this.toggleViewIdArray||[],e=0,g=null;for(e=0;e<d.length;e+=1){g=new SKYSALES.Class.ToggleView();g.init(d[e]);c.toggleViewIdArray[e]=g}};return c};SKYSALES.Class.FlightDisplay=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.toggleViewIdArray=null;b.init=function(f){this.setSettingsByObject(f);var d=this.toggleViewIdArray||[],e=0,g=null;for(e=0;e<d.length;e+=1){g=new SKYSALES.Class.ToggleView();g.init(d[e]);b.toggleViewIdArray[e]=g}};return b};SKYSALES.Class.UpgradeAvailabilityInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.cabinUpgradeSegmentArray=[];b.init=function(d){this.setSettingsByObject(d);this.initCabinUpgradeSegmentArray()};b.initCabinUpgradeSegmentArray=function(){var g=0,f=this.cabinUpgradeSegmentArray||[],e=f.length,d=null;for(g=0;g<e;g+=1){d=new SKYSALES.Class.CabinUpgradeSegment();d.init(f[g]);b.cabinUpgradeSegmentArray[g]=d}};return b};SKYSALES.Class.CabinUpgradeSegment=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.segmentInputId="";b.segmentInput=null;b.cabinUpgradeOptionsArray=[];b.init=function(d){this.setSettingsByObject(d);this.setVars();this.initCabinUpgradeOptionsArray()};b.initCabinUpgradeOptionsArray=function(){var f=0,e=this.cabinUpgradeOptionsArray||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.CabinUpgrade();g.init(e[f]);g.cabinUpgradeSegment=this;b.cabinUpgradeOptionsArray[f]=g}};b.setVars=function(){b.segmentInput=this.getById(this.segmentInputId)};return b};SKYSALES.Class.CabinUpgrade=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.upgradeOptionId="";b.upgradeOption=null;b.optionValue="";b.cabinUpgradeSegment=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){b.upgradeOption=this.getById(this.upgradeOptionId)};b.addEvents=function(){this.upgradeOption.click(this.updateDataHandler)};b.updateDataHandler=function(){b.updateData()};b.updateData=function(){var e=this.cabinUpgradeSegment||{},d=e.segmentInput;d.val(this.optionValue)};return b};SKYSALES.Class.RandomImage=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.imageUriArray=[];c.init=function(d){this.setSettingsByObject(d);this.setVars();this.setAsBackground()};c.getRandomNumber=function(){var d=this.imageUriArray.length,e=Math.floor(Math.random()*d);return e};c.setAsBackground=function(){var e=this.getRandomNumber(),d="url("+this.imageUriArray[e]+")";this.container.css("background-image",d)};return c};SKYSALES.Class.DropDown=function(d){d=d||{};var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.container={};b.name="";b.showCode=true;b.options=[];b.dropDownContainer=null;b.dropDownContainerInput=null;b.document=null;b.optionList=null;b.optionActiveClass="optionActive";b.timeOutObj=null;b.timeOut=225;b.minCharLength=2;b.optionMax=100;b.html='<div></div><div class="dropDownContainer"></div>';b.autoComplete=true;b.getOptionHtml=function(o){o=o||"";o=o.toLowerCase();var k={},e="",l="",m=0,j=this.options,n=this.showCode,f="",g="",h="";if(o.length<b.minCharLength){l=""}else{for(e in j){if(j.hasOwnProperty(e)){k=j[e];f=k.name||"";f=f.toLowerCase();g=k.code||"";g=g.toLowerCase();if((f.indexOf(o)>-1)||(g.indexOf(o)>-1)){if(k.optionClass){h=' class="'+k.optionClass+'"'}else{h=""}l+="<div"+h+"><span>"+k.code+"</span>"+k.name;if(n){l+=" ("+k.code+")"}l+="</div>";m+=1}}}}return l};b.close=function(){if(b.timeOutObj){window.clearTimeout(b.timeOutObj)}b.document.unbind("click",b.close);if(b.optionList){b.optionList.unbind("hover");b.optionList.unbind("click")}b.optionList=null;b.dropDownContainer.html("")};b.getActiveOptionIndex=function(){var f=-1,e=$("."+b.optionActiveClass,b.dropDownContainer);if(b.optionList&&(e.length>0)){f=b.optionList.index(e[0])}return f};b.arrowDown=function(){var e=b.getActiveOptionIndex();if(b.optionList){if((e===-1)&&(b.optionList.length>0)){b.optionActive.call(b.optionList[0])}else{if(b.optionList.length>e+1){b.optionInActive.call(b.optionList[e]);b.optionActive.call(b.optionList[e+1])}else{b.arrowDownOpen()}}}else{b.arrowDownOpen()}};b.arrowDownOpen=function(){var e=b.minCharLength;b.minCharLength=0;b.open();b.minCharLength=e};b.arrowUp=function(){var e=b.getActiveOptionIndex();if(b.optionList){if((e===-1)&&(b.optionList.length>0)){b.optionActive.call(b.optionList[0])}else{if((e>0)&&(b.optionList.length>0)){b.optionInActive.call(b.optionList[e]);b.optionActive.call(b.optionList[e-1])}}}};b.selectButton=function(){var f=b.getActiveOptionIndex(),e=b.optionMax;if(f>-1){b.selectOption.call(b.optionList[f])}else{if(b.autoComplete===true){b.optionMax=1;b.open();if(b.optionList&&(b.optionList.length>0)){b.selectOption.call(b.optionList[0])}b.optionMax=e}}};b.keyEvent=function(e){var g=true,f=e.which;if(f===40){b.arrowDown();b.autoComplete=true;g=false}else{if(f===38){b.arrowUp();b.autoComplete=true;g=false}else{if(f===9){b.selectButton();b.inputBlur()}else{if(f===13){b.selectButton();b.autoComplete=false;g=false}else{b.autoComplete=true}}}}return g};b.inputKeyEvent=function(e){var g=true,f=e.which;if((f!==40)&&(f!==38)&&(f!==9)&&(f!==13)){if(b.timeOutObj){window.clearTimeout(b.timeOutObj)}b.timeOutObj=window.setTimeout(b.open,b.timeOut);g=false}return g};b.catchEvent=function(){return false};b.open=function(){var k="",h=null,f=b.dropDownContainerInput.val(),g=b.getOptionHtml(f),e=0,j=0;b.dropDownContainer.html(g);b.addOptionEvents();b.dropDownContainer.click(b.catchEvent);b.document.click(b.close);b.dropDownContainer.show();if(b.optionList&&(b.optionList.length>0)&&b.optionActive){b.optionActive.call(b.optionList[0])}j=b.dropDownContainer.width();if($.browser.msie){e=b.dropDownContainer.height();k='<iframe src="#"></iframe>';b.dropDownContainer.prepend(k);h=$("iframe",b.dropDownContainer);h.width(j);h.height(e)}};b.optionActive=function(){var e=$(this);b.optionList.removeClass(b.optionActiveClass);e.addClass(b.optionActiveClass)};b.optionInActive=function(){var e=$(this);e.removeClass(b.optionActiveClass)};b.selectOption=function(){var e=$("span",this).text();b.dropDownContainerInput.val(e);b.close();b.dropDownContainerInput.change()};b.addOptionEvents=function(){b.optionList=$("div",b.dropDownContainer);b.optionList.hover(b.optionActive,b.optionInActive);b.optionList.click(b.selectOption)};b.inputBlur=function(){b.close()};b.addEvents=function(e){b.dropDownContainerInput=e.input;b.dropDownContainer=$("div.dropDownContainer",b.container);b.document=$(document);b.dropDownContainerInput.keyup(b.inputKeyEvent);b.dropDownContainerInput.keydown(b.keyEvent)};b.init=function(f){b.setSettingsByObject(f);var e=b.html;f.input.attr("autocomplete","off");f.input.wrap('<span class="dropDownOuterContainer"></span>');f.input.after(e);b.container=f.input.parent("span.dropDownOuterContainer");b.addEvents(f);SKYSALES.Class.DropDown.dropDownArray[SKYSALES.Class.DropDown.dropDownArray.length]=b};b.init(d);return b};SKYSALES.Class.DropDown.dropDownArray=[];SKYSALES.Class.DropDown.getDropDown=function(e){var g=null,d=0,f=null,h=SKYSALES.Class.DropDown.dropDownArray,c=null,b=e.input[0];for(d=0;d<h.length;d+=1){f=h[d];c=f.dropDownContainerInput[0];if((c)&&(b)&&(c===b)){g=h[d];if(e.options){g.options=e.options}}}if(!g){g=new SKYSALES.Class.DropDown(e)}return g};SKYSALES.Class.DatePickerManager=function(){var g=new SKYSALES.Class.SkySales(),j=SKYSALES.Util.extendObject(g),b=[],d="-",h="yy-mm",e="first",f=new RegExp("\\d{4}-\\d{2}"),c=new Date();j.isAOS=false;j.yearMonth=null;j.day=null;j.linkedDate=null;j.useJQueryDatePicker=true;j.yearMonthOptionArray=[];j.fullDateFormatString="mm/dd/yy";j.beginDateBound=new Date();j.endDateBound=new Date();j.currentDate=new Date();j.setBeginDateBound=function(k){j.beginDateBound=k;j.yearMonthOptionArray=[]};j.setEndDateBound=function(k){j.endDateBound=k;j.yearMonthOptionArray=[]};j.getDaysInMonth=function(l){var m=new Date(l.getFullYear(),l.getMonth(),32),k=m.getDate();return 32-k};j.validateDay=function(k){k=k||"";return k.match(/\d{2}/)};j.validateYearMonth=function(k){k=k||"";return k.match(f)};j.getDate=function(n,k){var q=null,p=0,r=1,o=[],m=0,l=0;n=n||this.yearMonth.val();k=k||this.day.val();if(n&&k){o=n.split(d);if(true===this.isAOS){p=1;r=0}m=o[p];l=o[r]-1;q=new Date(m,l,k)}else{q=this.currentDate}return q};j.parseDate=function(o,k){var q=new Date(),m=this.validateDay(k),r=this.validateYearMonth(o),l={},n=31,p=1;if(m&&r){l=this.getDate(o,k);n=this.getDaysInMonth(l);p=k;if(k>n){p=n}q=new Date(l.getFullYear(),l.getMonth(),p)}else{q=new Date()}return q};j.readLinked=function(){var k=this.parseDate(this.yearMonth.val(),this.day.val()),l=SKYSALES.Util.dateToIsoString(k);this.linkedDate.val(l);return{}};j.readLinkedHandler=function(){return j.readLinked()};j.trimDaysBeforeBeginDateBound=function(k){var r=this.beginDateBound.getFullYear(),q=this.beginDateBound.getMonth(),p=this.beginDateBound.getDate(),m=parseInt(k[0].code,10),o=0,l=this.currentDate.getFullYear(),n=this.currentDate.getMonth();if((n===q)&&(l===r)){if(m<p){o=p-m;k.splice(0,o)}}return k};j.dayArrayIndexOf=function(n,k){var m=k.length,l=0,q={},p=-1,o;for(l=0;l<m;l+=1){q=k[l];o=parseInt(q.code,10);if(o===n){p=l;break}}return p};j.trimDaysAfterEndDateBound=function(l){var r=this.endDateBound.getFullYear(),s=this.endDateBound.getMonth(),q=this.endDateBound.getDate(),t=l.length,m=l[t-1].code,p=0,k=0,n=this.currentDate.getFullYear(),o=this.currentDate.getMonth();if((o===s)&&(n===r)){if(m>q){k=this.dayArrayIndexOf(q,l)+1;if(k>=0){p=m-q;l.splice(k,p)}}}return l};j.removeDaysOutsideOfBounds=function(k){k=this.trimDaysBeforeBeginDateBound(k);k=this.trimDaysAfterEndDateBound(k);return k};j.dayPopulate=function(l){var n=l.getDate(),m=this.getDaysInMonth(l),p=31-m,k=SKYSALES.Util.cloneArray(b),q=31,o={};if(p>0){q=31-p;k.splice(q,p)}k=this.removeDaysOutsideOfBounds(k);o={selectedItem:n,objectArray:k,input:this.day,clearOptions:true};SKYSALES.Util.populate(o)};j.getYearMonthOptionArray=function(){var s=this.yearMonthOptionArray,u=0,r="0",q=2009,p=0,v={},k="",l="",o=this.beginDateBound,t=this.endDateBound,m={},w={},n=31;if(s.length===0){u=o.getMonth();q=o.getFullYear();v=SKYSALES.Resource.dateCultureInfo.monthNamesShort;for(p=0;p<12;p+=1){m=new Date(q,u,1);n=this.getDaysInMonth(m);w=new Date(q,u,n);if((w>=o)&&(m<=t)){k=v[u];if(u<9){r="0"}else{r=""}l=q+"-"+r+(u+1);s[p]={name:k,code:l}}else{if(w>this.endDateBound){break}}u+=1;if(u>11){u=0;q+=1}}}return s};j.yearMonthPopulate=function(k){var l=this.getYearMonthOptionArray(),n=$.datepicker.formatDate(h,k),m={};m={selectedItem:n,objectArray:l,input:this.yearMonth,clearOptions:true};SKYSALES.Util.populate(m)};j.datePopulate=function(k){if(!k){k=this.currentDate}else{j.currentDate=k}this.yearMonthPopulate(k);this.dayPopulate(k);this.copyDayAndYearMonthInputToLinkedDate()};j.repopulateDayInputAndUpdateLinkedDate=function(){var m=this.day.val(),k=this.getDate(this.yearMonth.val(),1),l=this.getDaysInMonth(k),n="";if(m>l){m=l}k=new Date(k.getFullYear(),k.getMonth(),m);if(k<this.beginDateBound){k=this.beginDateBound}j.currentDate=k;this.dayPopulate(k);n=SKYSALES.Util.dateToIsoString(k);this.linkedDate.val(n)};j.repopulateDayInputAndUpdateLinkedDateHandler=function(){j.repopulateDayInputAndUpdateLinkedDate()};j.setYearMonthAndDayInput=function(l){var m="",k=SKYSALES.Util.parseIsoDate(l);if(k){m=$.datepicker.formatDate(h,k);this.yearMonth.val(m);this.repopulateDayInputAndUpdateLinkedDate();this.dayPopulate(k);this.readLinked()}j.currentDate=k};j.setYearMonthAndDayInputHandler=function(k){j.setYearMonthAndDayInput(k)};j.copyDayAndYearMonthInputToLinkedDate=function(){var l=this.yearMonth.val(),m=this.day.val(),k=this.parseDate(l,m),n=SKYSALES.Util.dateToIsoString(k);this.linkedDate.val(n);j.currentDate=k};j.copyDayAndYearMonthInputToLinkedDateHandler=function(){j.copyDayAndYearMonthInputToLinkedDate()};j.createAllDayOptionArray=function(){var k=[],m=1,l={};for(m=1;m<=31;m+=1){l={};l.name=m;if(m<=9){l.code="0"+m}else{l.code=m}k[m-1]=l}return k};j.dateLastDayOfMonthOneYearFromToday=function(){var m=c.getFullYear()+1,k=c.getMonth(),l=new Date(m,k,0);return l};j.setVars=function(){this.beginDateBound.setDate(c.getDate());this.endDateBound=this.dateLastDayOfMonthOneYearFromToday();if(true===this.isAOS){d="/";h="m/yy";f=new RegExp("\\d{1,2}\\/\\d{4}");e="eq(1)"}b=this.createAllDayOptionArray()};j.initInputs=function(){var k=new Date();if(this.isAOS){k=new Date(this.linkedDate.val())}else{k=this.getDate(this.yearMonth.val(),this.day.val())}if(k!==null){j.currentDate=k;this.dayPopulate(k);j.currentDate=k;if(!this.isAOS){this.copyDayAndYearMonthInputToLinkedDate()}}};j.getMaxDate=function(){var k=null,m=new Date(),l=31;if(this.yearMonth.val()!==null){k=$("option:last",this.yearMonth).val();m=this.getDate(k,1);l=this.getDaysInMonth(m);m=new Date(m.getFullYear(),m.getMonth(),l)}else{m.setYear(m.getFullYear()+1)}return m};j.addEventsToJQueryDatePicker=function(){var o=new Date(),p={},n=SKYSALES.Util.getResource(),l=n.dateCultureInfo,k=SKYSALES.datepicker,m={};o.setDate(o.getDate()-1);p=this.getMaxDate();if(this.useJQueryDatePicker){m={beforeShow:this.readLinkedHandler,onSelect:this.setYearMonthAndDayInputHandler,minDate:o,maxDate:p,showOn:"both",buttonImageOnly:true,buttonImage:"images/InterJet/calendar-up.gif",buttonText:"Calendar",numberOfMonths:1,mandatory:true,monthNames:l.monthNames,monthNamesShort:l.monthNamesShort,dayNames:l.dayNames,dayNamesShort:l.dayNamesShort,dayNamesMin:l.dayNamesMin,closeText:k.closeText,prevText:k.prevText,nextText:k.nextText,currentText:k.currentText,dateFormat:"yy-mm-dd"};this.linkedDate.datepicker(m)}};j.addEvents=function(){this.yearMonth.change(this.repopulateDayInputAndUpdateLinkedDateHandler);this.day.change(this.copyDayAndYearMonthInputToLinkedDateHandler);this.addEventsToJQueryDatePicker()};j.init=function(k){this.setSettingsByObject(k);this.setVars();this.initInputs();this.addEvents()};return j};SKYSALES.initializeSkySalesForm=function(){var b=document.forms.SkySales};SKYSALES.getSkySalesForm=function(){var b=$("SkySales")[0];return b};SKYSALES.Common=function(){var c=this,b=null;c.allInputObjects=null;c.initializeCommon=function(){var d=new SKYSALES.Hint();c.addKeyDownEvents();c.addSetAndEraseEvents();c.setValues();d.addHintEvents()};c.setValues=function(){var d=function(e){if((this.jsvalue!==null)&&(this.jsvalue!==undefined)){this.value=this.jsvalue}};c.getAllInputObjects().each(d)};c.stopSubmit=function(){return false};c.resetSubmit=function(){var d=$("form");d.unbind("submit",c.stopSubmit)};c.addKeyDownEvents=function(){var d=function(g){var f=$("form");if(g.keyCode===13){f.submit(c.stopSubmit);g.preventDefault();g.stopPropagation();setTimeout(c.resetSubmit,25);return false}return true};this.getAllInputObjects().keydown(d)};c.getAllInputObjects=function(){if(c.allInputObjects===null){c.allInputObjects=$(":input")}return c.allInputObjects};c.addSetAndEraseEvents=function(){var f=null,d=null,e=null;f=function(){var h=$(this),g=SKYSALES.Util.getAttributeValue(h,"requiredempty");c.eraseElement(this,g)};d=function(){var h=$(this),g=SKYSALES.Util.getAttributeValue(h,"requiredempty");c.setElement(this,g);h.change()};e=function(j){var h=$(this),g=null;g=SKYSALES.Util.getAttributeValue(h,"requiredempty");if((g!==null)&&(g!==undefined)){if(h.is(":text")&&(h.is(":hidden")===false)){h.focus(f);h.blur(d)}}};c.getAllInputObjects().each(e)};c.eraseElement=function(e,d){if(e.value===d){e.value=""}};c.setElement=function(e,d){if(e.value===""){e.value=d}};c.getCountryInfo=function(){if(b===null){b=window.countryInfo}return b};c.setCountryInfo=function(d){b=d;return c};c.isEmpty=function(e,d){var g=null,f=false;if((e)&&(d===undefined)){if(e.requiredempty){d=e.requiredempty}else{d=""}}g=SKYSALES.Common.getValue(e);if((g===null)||(g===undefined)||(g.length===0)||(g===d)){f=true}return f};c.stripeTables=function(){$(".stripeMe tr:even").addClass("alt");return c}};SKYSALES.Common.addEvent=function(d,b,c){$(d).bind(b,c)};SKYSALES.Common.getValue=function(b){var c=null;if(b){c=$(b).val();return c}return null};SKYSALES.Util.getRequiredFlag=function(){return"*"};SKYSALES.Util.formatInputLabel=function(g){var k=g.attr("id"),c=SKYSALES.Util.getRequiredFlag(),b=null,f="",j="",h=-1;var d=g.attr("class");array=d.split(" ");if(k){b=$("label[for="+k+"]");f=b.text();if(f){j=SKYSALES.Util.getAttributeValue(g,"required");j=j||"";j=j.toString().toLowerCase();h=f.indexOf(c);if(h===0){f=f.substring(1)}if(j==="true"){if(array[0]!="noAsterisk"){f=f+c}else{f=f}}b.text(f)}}};SKYSALES.Dhtml=function(){var b=this;b.getX=function(c){var d=0;if(c.x){d+=c.x}else{if(c.offsetParent){while(c.offsetParent){d+=c.offsetLeft;c=c.offsetParent}}}return d};b.getY=function(c){var d=0;if(c.y){d+=c.y}else{if(c){while(c){d+=c.offsetTop;c=c.offsetParent}}}return d};return b};SKYSALES.Hint=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.addHintEvents=function(){var d=function(e){var f=SKYSALES.Util.getAttributeValue($(this),"hint");if(f){if(this.tagName&&(this.tagName.toString().toLowerCase()==="input")){c.addHintFocusEvents(this)}else{c.addHintHoverEvents(this)}}};SKYSALES.common.getAllInputObjects().each(d)};c.addHintFocusEvents=function(g,e){var f=null,d=null;f=function(){c.showHint(g,e)};d=function(){c.hideHint(g,e)};if($(g).is(":hidden")===false){$(g).focus(f);$(g).blur(d)}};c.addHintHoverEvents=function(f,d){var e=null,g=null;e=function(){c.showHint(f,d)};g=function(){c.hideHint(f,d)};$(f).hover(e,g)};c.getHintDivId=function(){return"cssHint"};c.showHint=function(j,q,l,g,d){var t=c.getHintDivId(),k=this.getById(t),p=0,n=0,s=0,m=0,h=SKYSALES.Util.getAttributeValue($(j),"hint"),r=null,o=null,f=0,e=0;if(l===undefined){l=j.hintxoffset}if(g===undefined){g=j.hintyoffset}if(d===undefined){d=j.hintReferenceid}r=this.getById(d)[0];o=new SKYSALES.Dhtml();if(!r){p=o.getX(j);n=o.getY(j);if(l===undefined){p+=j.offsetWidth+5}}else{p=o.getX(r);n=o.getY(r);if(l===undefined){p+=r.offsetWidth+5}}if(!q&&h){q=h}k.html(q);k.show();l=(l!==undefined)?l:s;g=(g!==undefined)?g:m;f=parseInt(l,10)+parseInt(p,10);e=parseInt(g,10)+parseInt(n,10);k.css("left",f+"px");k.css("top",e+"px")};c.hideHint=function(e){var d=c.getHintDivId();this.getById(d).hide()};return c};SKYSALES.ValidationErrorReadAlong=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.objId="";c.obj=null;c.errorMessage="";c.isError=false;c.hasBeenFixed=false;c.hasValidationEvents=false;c.getValidationErrorHtml=function(){var d='<iframe id="validationErrorContainerReadAlongIFrame" class="hidden" ></iframe> <div id="validationErrorContainerReadAlong" > <p class="close"> <input id="validationErrorContainerReadAlongCloseButton" type="button" class="closeBtn" value="Close" /> </p> <div id="validationErrorContainerReadAlongContent" > <h3 class="error">ERROR</h3> <div id="validationErrorContainerReadAlongList" > </div> </div> </div>';return d};c.getValidationErrorCloseId=function(){return"validationErrorContainerReadAlongCloseButton"};c.getValidationErrorListId=function(){return"validationErrorContainerReadAlongList"};c.getValidationErrorIFrameId=function(){return"validationErrorContainerReadAlongIFrame"};c.getValidationErrorDivId=function(){return"validationErrorContainerReadAlong"};c.getFixedClass=function(){return"fixedValidationError"};c.addCloseEvent=function(){var e=c.getValidationErrorCloseId(),d=null;d=function(){c.hide()};this.getById(e).click(d)};c.addValidationErrorDiv=function(){var d=this.getById("mainContent");if(d.length===0){d=this.getById("mainContentExpanded")}d.append(c.getValidationErrorHtml())};c.hide=function(){var e=c.getValidationErrorIFrameId(),d=c.getValidationErrorDivId();this.getById(e).hide();this.getById(d).hide()};c.addFocusEvent=function(d){var f={obj:this},e=null;e=function(g){var k=g.data.obj,h=null,q=null,j=0,o=0,n=0,l=0,m=null,p=null;if(k.isError===true){h=new SKYSALES.Hint();h.hideHint();q=c.getById(c.getValidationErrorDivId());j=parseInt(q.width(),10)+5;o=parseInt(q.height(),10)+5;m=new SKYSALES.Dhtml();n=m.getX(k.obj);l=m.getY(k.obj);n=n+this.offsetWidth+5;l=l-72;if($.browser.msie){p=c.getById(c.getValidationErrorIFrameId());p.css("position","absolute");p.show();p.width(j-25);p.height(o-5);p.css("left",n+16);p.css("top",l)}q.css("left",n);q.css("top",l);q.css("position","absolute");q.show("slow");return false}};if($(this.obj).is(":hidden")===false){$(this.obj).bind("focus",f,e)}};c.addBlurEvent=function(d){var f={obj:this},e=null;e=function(g){var m=g.data.obj,q=new SKYSALES.Validate(null,"","",null),o="",k=false,l=true,n="",h=null,j="",p=null;q.validateSingleElement(this);o=q.errors;if(q.validationErrorArray.length>0){if(q.validationErrorArray[0].isError===false){k=true}}n=m.getValidationErrorListId();h=c.getById(n).find("li").eq(d);j=m.getFixedClass();p=function(){if((l===true)&&($(this).attr("class").indexOf("hidden")===-1)&&($(this).attr("class").indexOf(j)===-1)){l=false}};if(k===true){m.hasBeenFixed=true;h.addClass(j);l=true;c.getById(n).find("li").each(p);if(l===true){c.hide()}}else{m.hasBeenFixed=false;h.removeClass(j);h.removeClass("hidden");m.isError=true;m.errorMessage=o;h.text(o)}return false};$(this.obj).bind("blur",f,e)};return c};SKYSALES.errorsHeader="Please correct the following.\n\n";SKYSALES.Validate=function(f,e,b,h){var d=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(d),g=null;if(b===undefined){b=SKYSALES.errorsHeader}c.form=f;c.namespace=e;c.errors="";c.validationErrorArray=[];c.setfocus=null;c.clickedObj=null;c.errorDisplayMethod="read_along";c.errorsHeader=b;c.namedErrors=[];c.dateRangeArray=[];if(h){c.regexElementIdFilter=h}c.requiredAttribute="required";c.requiredEmptyAttribute="requiredempty";c.validationTypeAttribute="validationtype";c.regexAttribute="regex";c.minLengthAttribute="minlength";c.numericMinLengthAttribute="numericminlength";c.maxLengthAttribute="maxlength";c.numericMaxLengthAttribute="numericmaxlength";c.minValueAttribute="minvalue";c.maxValueAttribute="maxvalue";c.equalsAttribute="equals";c.dateRangeAttribute="daterange";c.dateRange1HiddenIdAttribute="date1hiddenid";c.dateRange2HiddenIdAttribute="date2hiddenid";c.defaultErrorAttribute="error";c.requiredErrorAttribute="requirederror";c.validationTypeErrorAttribute="validationtypeerror";c.regexErrorAttribute="regexerror";c.minLengthErrorAttribute="minlengtherror";c.maxLengthErrorAttribute="maxlengtherror";c.minValueErrorAttribute="minvalueerror";c.maxValueErrorAttribute="maxvalueerror";c.equalsErrorAttribute="equalserror";c.dateRangeErrorAttribute="daterangeerror";c.defaultError="{label} is invalid.";c.defaultRequiredError="{label} is required.";c.defaultValidationTypeError="{label} is invalid.";c.defaultRegexError="{label} is invalid.";c.defaultMinLengthError="{label} is too short in length.";c.defaultMaxLengthError="{label} is too long in length.";c.defaultMinValueError="{label} must be greater than {minValue}.";c.defaultMaxValueError="{label} must be less than {maxValue}.";c.defaultEqualsError="{label} is not equal to {equals}";c.defaultNotEqualsError="{label} cannot equal {equals}";c.defaultValidationErrorClass="validationError";c.defaultValidationErrorLabelClass="validationErrorLabel";c.run=function(){var k=$(":input",SKYSALES.getSkySalesForm()).get(),l=null,j=0;for(j=0;j<k.length;j+=1){l=k[j];if(!this.isExemptFromValidation(l)){c.validateSingleElement(l)}}return c.outputErrors()};c.runBySelector=function(m){var l=$(m).find(":input").get(),k=null,j=0;for(j=0;j<l.length;j+=1){k=l[j];c.validateSingleElement(k)}return false};c.validateSingleElement=function(l){$(l).removeClass(c.defaultValidationErrorClass);$("label[for="+l.id+"]").eq(0).removeClass(this.defaultValidationErrorLabelClass);var k=new SKYSALES.ValidationErrorReadAlong(),j;k.objId=l.id;k.obj=l;this.validationErrorArray[c.validationErrorArray.length]=k;this.validateRequired(l);j=c.getValue(l);if((c.errors.length<1)&&(j!==null)&&(j!=="")){c.validateType(l);c.validateRegex(l);c.validateMinLength(l);c.validateMaxLength(l);c.validateMinValue(l);c.validateMaxValue(l);c.validateEquals(l);c.validateDateRange(l)}};c.outputErrors=function(){var j=this.errorDisplayMethod.toString().toLowerCase(),m="",k=[],l=0,n=true;if(this.errors){k=c.errors.split("\n");m+='<ul class="validationErrorList" >';for(l=0;l<k.length;l+=1){if(k[l]!==""){m+='<li class="validationErrorListItem" >'+k[l]+"</li>"}}m+="</ul>";if(j.indexOf("read_along")>-1){c.outputErrorsReadAlong(m);n=false}if(j.indexOf("alert")>-1){alert(c.errorsHeader+c.errors)}if(n===true){alert(c.errorsHeader+c.errors)}if(c.setfocus){if($(c.setfocus).is(":hidden")===false){c.setfocus.blur();c.setfocus.focus()}}return false}else{return true}};c.outputErrorsReadAlong=function(l){var k=0,j="",m=null,o=this,n=null;n=function(p){this.hasValidationEvents=true;this.addFocusEvent(p);this.addBlurEvent(p)};o.validationErrorReadAlong=new SKYSALES.ValidationErrorReadAlong();o.readAlongDivId=this.getById(this.validationErrorReadAlong.getValidationErrorDivId()).attr("id");if(o.readAlongDivId===undefined){o.validationErrorReadAlong.addValidationErrorDiv();o.validationErrorReadAlong.addCloseEvent()}j+='<ul class="validationErrorList" >';for(k=0;k<o.validationErrorArray.length;k+=1){m=this.validationErrorArray[k];if(m.isError===true){j+='<li class="validationErrorListItem" >'+m.errorMessage+"</li>"}else{j+='<li class="validationErrorListItem hidden" >'+m.errorMessage+"</li>"}}this.getById(o.validationErrorReadAlong.getValidationErrorListId()).html(j);$(o.validationErrorArray).each(n)};c.checkFocus=function(j){if(!c.setfocus){c.setfocus=j}};c.setError=function(r,m,l){var k="",s="",q="",p=0,j=null,o,n="";if(r.type==="radio"){k=r.getAttribute("name");if(k.length>0){if(c.namedErrors[k]!==undefined){return}c.namedErrors[k]=k}}s=this.attributeValue(r,m);if(!s){s=this.attributeValue(r,this.defaultErrorAttribute);if(!s){if(l){s=l}else{s=this.defaultError}}}o=s.match(/\{\s*(\w+)\s*\}/g);if(o){for(p=0;p<o.length;p+=1){q=o[p].replace(/\{\s*(\w+)\s*\}/,"$1");s=s.replace(/\{\s*\w+\s*\}/,c.cleanAttributeForErrorDisplay(r,q))}}$(r).addClass(this.defaultValidationErrorClass);$("label[for="+r.id+"]").eq(0).addClass(c.defaultValidationErrorLabelClass);this.errors+=s+"\n";n=r.id;for(p=0;p<c.validationErrorArray.length;p+=1){j=c.validationErrorArray[p];if(j.objId===n){j.errorMessage=s;j.isError=true;break}}this.checkFocus(r)};c.cleanAttributeForErrorDisplay=function(n,p){var o="",r=SKYSALES.Util.getRequiredFlag(),k="",l=/^(minvalue|maxvalue)$/i,q=new RegExp("[^\\d.,]","g"),m=$(n),j="";if(!p){p=""}p=p.toLowerCase();if(p==="label"){k=$("label[for="+m.attr("id")+"]").text();o=r;j=k.replace(o,"")}if(!j){j=this.attributeValue(n,p)}if(!j){j=p}else{if(p.match(l)){j=j.replace(q,"")}}return j};c.attributeValue=function(l,j){l=$(l);var k=SKYSALES.Util.getAttributeValue(l,j);if(typeof k!=="string"){k=""}return k};c.validateRequired=function(n){var q=c.requiredAttribute,l=c.requiredEmptyAttribute,p=this.attributeValue(n,q),o=this.attributeValue(n,l),m=null,k="",j=false;c.radioGroupHash={};if(p!==undefined){p=p.toString().toLowerCase();if(o){o=o.toString().toLowerCase()}if(p==="true"){m=c.getValue(n);if((n.type==="checkbox")&&(n.checked===false)){m=""}else{if(n.type==="radio"){k=n.getAttribute("name");if(c.radioGroupHash[k]===undefined){c.radioGroupHash[k]=$("input[name='"+k+"']")}j=c.radioGroupHash[k].is(":checked");if(!j){m=""}}}if((m===undefined)||(m===null)||(m==="")||(m.toLowerCase()===o)){c.setError(n,c.requiredErrorAttribute,c.defaultRequiredError)}}}};c.validateType=function(l){var j=this.attributeValue(l,this.validationTypeAttribute),k=this.getValue(l);if((j)&&(k!==null)){j=j.toLowerCase();if((j==="address")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}else{if((j==="alphanumeric")&&(!k.match(c.alphaNumericPattern))){c.setValidateTypeError(l)}else{if((j==="amount")&&(!c.validateAmount(k))){c.setValidateTypeError(l)}else{if((j==="country")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}else{if((j==="email")&&(!k.match(c.emailPattern))){c.setValidateTypeError(l)}else{if((j==="mod10")&&(!c.validateMod10(k))){c.setValidateTypeError(l)}else{if((j==="name")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}else{if((j==="numeric")&&(!c.validateNumeric(k))){c.setValidateTypeError(l)}else{if((j.indexOf("date")===0)&&(!c.validateDate(l,j,k))){c.setValidateTypeError(l)}else{if((j==="state")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}else{if((j==="string")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}else{if((j==="uppercasestring")&&(!k.match(c.upperCaseStringPattern))){c.setValidateTypeError(l)}else{if((j==="zip")&&(!k.match(c.stringPattern))){c.setValidateTypeError(l)}}}}}}}}}}}}}}};c.validateRegex=function(l){var j=this.attributeValue(l,c.regexAttribute),k=c.getValue(l);if((k!==null)&&(j)&&(!k.match(j))){this.setError(l,c.regexErrorAttribute,c.defaultRegexError)}};c.validateMinLength=function(m){var j=this.attributeValue(m,c.minLengthAttribute),l=this.attributeValue(m,c.numericMinLengthAttribute),k=this.getValue(m);if((0<j)&&(k!==null)&&(k.length<j)){c.setError(m,c.minLengthErrorAttribute,c.defaultMinLengthError)}else{if((0<l)&&(0<k.length)&&(k.replace(c.numericStripper,"").length<l)){c.setError(m,c.minLengthErrorAttribute,c.defaultMinLengthError)}}};c.validateMaxLength=function(m){var j=this.attributeValue(m,c.maxLengthAttribute),l=this.attributeValue(m,c.numericMaxLengthAttribute),k=this.getValue(m);if((0<j)&&(k!==null)&&(j<k.length)){c.setError(m,c.maxLengthErrorAttribute,c.defaultMaxLengthError)}else{if((0<l)&&(0<k.length)&&(l<k.replace(c.numericStripper,"").length)){c.setError(m,c.maxLengthErrorAttribute,c.defaultMaxLengthError)}}};c.validateMinValue=function(l){var j=this.attributeValue(l,c.minValueAttribute),k=c.getValue(l);if((k!==null)&&(j!==undefined)&&(0<j.length)){if((5<j.length)&&(j.substring(0,5)==="&gt;=")){if(k<parseFloat(j.substring(5,j.length))){c.setError(l,c.minValueErrorAttribute,c.defaultMinValueError)}}else{if((4<j.length)&&(j.substring(0,4)==="&gt;")){if(k<=parseFloat(j.substring(4,j.length))){c.setError(l,c.minValueErrorAttribute,c.defaultMinValueError)}}else{if(k<parseFloat(j)){c.setError(l,c.minValueErrorAttribute,c.defaultMinValueError)}}}}};c.validateMaxValue=function(l){var j=this.attributeValue(l,this.maxValueAttribute),k=this.getValue(l);if((k!==null)&&(j!==undefined)&&(0<j.length)){if((5<j.length)&&(j.substring(0,5)==="&lt;=")){if(k>parseFloat(j.substring(5,j.length))){c.setError(l,c.maxValueErrorAttribute,c.defaultMaxValueError)}}else{if((4<j.length)&&(j.substring(0,4)==="&lt;")){if(k>=parseFloat(j.substring(4,j.length))){c.setError(l,c.maxValueErrorAttribute,c.defaultMaxValueError)}}else{if(parseFloat(k)>j){c.setError(l,c.maxValueErrorAttribute,c.defaultMaxValueError)}}}}};c.validateEquals=function(l){var j=this.attributeValue(l,c.equalsAttribute),k=c.getValue(l);if((k!==null)&&(j!==undefined)&&(0<j.length)){if((2<j.length)&&(j.substring(0,2)==="!=")){if(k===j.substring(2,j.length)){c.setError(l,c.equalsErrorAttribute,c.defaultEqualsError)}}}};g=function(o){var m=o.parent(),j=m.parent(),l=m.is(":hidden"),k=j.is(":hidden"),n=!(l||k);return n};c.checkIfValidateDateRangeNeeded=function(p){var l=this.attributeValue(p,c.dateRangeAttribute),k=this.attributeValue(p,c.dateRange1HiddenIdAttribute),q=this.attributeValue(p,c.dateRange2HiddenIdAttribute),t="",m="",j=p.id,s=false,n=false,r=null,o=null;if((l!==undefined)&&(0<l.length)){t=j.charAt(j.length-1);if(this.validateNumeric(t)){m=t}if(("1"===m)||(""===m)){o=this.getById(q);n=g(o);if(n){s=true;r=this.getById(k);c.dateRangeArray[0]=r.val();c.dateRangeArray[1]=o.val()}}}return s};c.validateDateRange=function(l){var m=null,k=false,j=false;j=c.checkIfValidateDateRangeNeeded(l);if(j){m=new SKYSALES.Class.MarketDate();k=m.datesInOrder(this.dateRangeArray);if(!k){this.setError(l,this.dateRangeErrorAttribute,this.defaultError)}}};c.isExemptFromValidation=function(j){if(j.id.indexOf(this.namespace)!==0){return true}if(this.regexElementIdFilter&&(!j.id.match(this.regexElementIdFilter))){return true}return false};c.setValidateTypeError=function(j){this.setError(j,this.validationTypeErrorAttribute,this.defaultValidationTypeError)};c.validateAmount=function(j){if((!j.match(this.amountPattern))||(j===0)){return false}return true};c.validateDate=function(n,k,l){var m="",j=new Date();if(k){m=k.toLowerCase()}if((m==="dateyear")&&((l<j.getFullYear())||(!l.match(c.dateYearPattern)))){return false}else{if((m==="datemonth")&&(!l.match(c.dateMonthPattern))){return false}else{if((m==="dateday")&&(!l.match(c.DateDayPattern))){return false}}}return true};c.validateMod10=function(o){var n=/\D/,l=o.replace(/ /g,""),m,k=0,p=0,j=0;if(!n.test(l)){while(l.length<16){l="0"+l}for(j=l.length-1;0<=j;j-=2){k+=parseInt(l.charAt(j),10);m=(l.charAt(j-1)*2);m+="";for(p=0;p<m.length;p+=1){k+=parseInt(m.charAt(p),10)}}return(k%10===0)}return false};c.validateNumeric=function(j){j=j.replace(/\s/g,"");if(!j.match(c.numericPattern)){return false}return true};c.getValue=function(j){return SKYSALES.Common.getValue(j)};c.stringPattern=new RegExp("^.+$");c.upperCaseStringPattern=/^[A-Z]([A-Z|\s])*$/;c.numericPattern=/^\d+$/;c.numericStripper=/\D/g;c.alphaNumericPattern=/^\w+$/;c.amountPattern=/^(\d+((\.|,|\s|\xA0)\d+)*)$/;c.dateYearPattern=/^\d{4}$/;c.dateMonthPattern=/^\d{2}$/;c.dateDayPattern=/^\d{2}$/;c.emailPattern=/^\w+([\.\-\']?\w+)*@\w+([\.\-\']?\w+)*(\.\w{1,8})$/;return c};SKYSALES.Util.validateBySelector=function(c){var d=null,b=null;if(c!==undefined){d=new SKYSALES.Validate(null,"",SKYSALES.errorsHeader,null);d.clickedObj=b;d.runBySelector(c);return d.outputErrors()}return true};SKYSALES.Util.validateDates=function(){var d=document.getElementById("completeDepartureDate").value;var b=document.getElementById("completeArrivalDate").value;var c=document.getElementById("flightTypeNumber").value;document.getElementById("divErrorInDates").style.display="none";document.getElementById("EmptyDates").style.display="none";document.getElementById("EmptyDate").style.display="none";document.getElementById("BiggerThan").style.display="none";if(d!=""){arrayDeparture=d.split("-");d=new Date(arrayDeparture[0],arrayDeparture[1],arrayDeparture[2])}if(b!=""){arrayArrival=b.split("-");b=new Date(arrayArrival[0],arrayArrival[1],arrayArrival[2])}if(c==1&&d==""){document.getElementById("divErrorInDates").style.display="block";document.getElementById("EmptyDate").style.display="block";return false}if(c==2){if(b==""||d==""){document.getElementById("divErrorInDates").style.display="block";document.getElementById("EmptyDates").style.display="block";return false}else{if(d>b){document.getElementById("divErrorInDates").style.display="block";document.getElementById("BiggerThan").style.display="block";return false}}}return true};SKYSALES.Util.validate=function(f,b,d){var c=null,h=null,g=null;if(document.getElementById&&document.createTextNode){if(f.getAttribute){c=f;f=f.getAttribute("id").replace(/_[a-zA-Z0-9]+$/,"")}h=new SKYSALES.Validate(SKYSALES.getSkySalesForm(),f+"_",SKYSALES.errorsHeader,d);h.clickedObj=c;if(b){g=b;if(!b.getAttribute){g=document.getElementById(f+"_"+b)}h.validateSingleElement(g);return h.outputErrors()}return h.run()}return true};SKYSALES.Util.displayPopUpConverter=function(){var b="CurrencyConverter.aspx",c=window.converterWindow;if(!window.converterWindow||c.closed){c=window.open(b,"converter","width=360,height=220,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0")}else{c.open(b,"converter","width=360,height=220,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0");if($(c).is(":hidden")===false){c.focus()}}};SKYSALES.toggleAtAGlanceEvent=function(){$(this).next().toggle()};SKYSALES.toggleAtAGlance=function(){$("div.atAGlanceDivHeader").click(SKYSALES.toggleAtAGlanceEvent)};SKYSALES.initializeTime=function(){var b=0,c="";for(b=0;b<23;b+=1){c+="<option value="+b+">"+b+"</option>"}if(c!==""){$("select.Time").append(c)}};SKYSALES.aosAvailabilityShow=function(){$(this).parent().find("div.hideShow").show("slow");return false};SKYSALES.aosAvailabilityHide=function(){$(this).parent().parent(".hideShow").hide("slow");return false};SKYSALES.dropDownMenuEvent=function(){$("div.slideDownUp").toggle("fast");return false};SKYSALES.faqHideShow=function(){$(this).parent("dt").next(".accordianSlideContent").slideToggle("slow")};SKYSALES.equipHideShow=function(){$("div#moreSearchOptions").slideToggle("slow");return false};SKYSALES.initializeAosAvailability=function(){$(".hideShow").hide();$(".showContent").click(SKYSALES.aosAvailabilityShow);$(".hideContent").click(SKYSALES.aosAvailabilityHide);$(".toggleSlideContent").click(SKYSALES.dropDownMenuEvent);$(".accordian").click(SKYSALES.faqHideShow);$(".showEquipOpt").click(SKYSALES.equipHideShow);$(".hideEquipOpt").click(SKYSALES.equipHideShow)};SKYSALES.common=new SKYSALES.Common();SKYSALES.Util.sendAspFormFields=function(){var f=document.SkySales,c=null,e=window.document.getElementById("eventTarget"),d=window.document.getElementById("eventArgument"),b=window.document.getElementById("viewState");if(!f.onsubmit||(f.onsubmit()!==false)){e.name="__EVENTTARGET";d.name="__EVENTARGUMENT";b.name="__VIEWSTATE";if(f.checkValidity){c=function(){$(this).removeAttr("required")};SKYSALES.common.getAllInputObjects().each(c)}}return true};SKYSALES.Util.initStripeTable=function(){$(".hotelResult").hide();var b=function(){$(".stripeMe tr").removeClass("over");$(this).parent().parent().addClass("over")};$(".stripeMe input").click(b)};SKYSALES.initTableSorter=function(){$("table.sortMe").tablesorter({sortList:[[0,0]],widgets:["zebra"],headers:{5:{sorter:false}}})};SKYSALES.Util.ready=function(){$("form").submit(SKYSALES.Util.sendAspFormFields);SKYSALES.Util.initObjects("ready");SKYSALES.initializeSkySalesForm();SKYSALES.Util.initStripeTable();SKYSALES.initializeAosAvailability()};SKYSALES.Util.load=function(){SKYSALES.Util.initObjects("load");SKYSALES.common.initializeCommon();SKYSALES.toggleAtAGlance();SKYSALES.initTableSorter()};SKYSALES.Class.CalendarAvailabilityInputBase=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.containerId="availabilityInputContainerId";c.container=null;c.templateId="availabilityInputTemplateId";c.template=null;c.totalTemplateId="totalTemplateId";c.totalTemplate=null;c.totalId="totalId";c.total=null;c.marketArray=[];c.marketClass="";c.requestStartDate=null;c.requestEndDate=null;c.pointsLabelAppend="";c.pointsSuffix="";c.flightTypeNumber="";c.init=function(d){this.setSettingsByObject(d);this.initMarketArray();this.setVars();this.draw();this.setVarsAfterDraw();this.addEvents();this.selectInitialDateMarkets()};c.setVars=function(){c.container=this.getById(this.containerId);c.template=this.getById(this.templateId);c.totalTemplate=this.getById(this.totalTemplateId)};c.initMarketArray=function(){var e=0,f=this.marketArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=new SKYSALES.Class[this.marketClass]();g.availabilityInput=this;g.marketIndex=e;g.containerId="market_"+e;g.selectedDateContainerId="selectedDate_"+e;g.requestStartDate=this.requestStartDate;g.requestEndDate=this.requestEndDate;g.init(f[e]);f[e]=g}};c.setVarsAfterDraw=function(){c.total=this.getById(this.totalId);var e=0,f=this.marketArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.setVarsAfterDraw()}};c.addEvents=function(){var e=0,f=this.marketArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.addEvents()}};c.selectInitialDateMarkets=function(){var e=0,f=this.marketArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.selectInitialDateMarket()}};c.getHtml=function(){var g=this.template.text(),e="",f=0,h=this.marketArray||[],d=h.length,j=null;for(f=0;f<d;f+=1){j=h[f];e+=j.getHtml()}g=g.replace(/\[marketArray\]/,e);return g};c.draw=function(){var d=this.getHtml();this.container.html(d)};c.updateTotalAmount=function(){var e=this.totalTemplate.text(),d=new SKYSALES.Class.CalendarAvailabilityTotals();d.marketArray=this.marketArray;d.getTotals();e=e.replace(/\[totalAmount\]/,SKYSALES.Util.formatAmount(d.totalPrice,d.totalPoints,this.pointsLabelAppend,this.pointsSuffix));this.total.html(e)};return c};SKYSALES.Class.CalendarAvailabilityTotals=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.totalPoints=0;c.totalPrice=0;c.marketArray=[];c.init=function(d){this.setSettingsByObject(d)};c.getFormattedPrice=function(e){var d="";if(e!==null&&e>0){d=SKYSALES.Util.convertToLocaleCurrency(e);if(d===""){d=e.toString()}}return d};c.getTotals=function(){var f=0,d=this.marketArray||[],g=d.length,e=null,j=null,k=0,m=0,l=0,h=0;for(f=0;f<g;f+=1){e=d[f];j=e.selectedDateMarket||{};m=j.price||0;k=j.points||0;l+=m;h+=k}c.totalPoints=SKYSALES.Util.convertToLocaleInteger(h);c.totalPrice=this.getFormattedPrice(l)};return c};SKYSALES.Class.CalendarAvailabilityInput=function(){var b=new SKYSALES.Class.CalendarAvailabilityInputBase(),c=SKYSALES.Util.extendObject(b);c.init=function(d){this.setSettingsByObject(d);b.marketClass="CalendarAvailabilityMarket";this.initMarketArray();this.setVars();this.draw();this.setVarsAfterDraw();this.addEvents();this.selectInitialDateMarkets()};return c};SKYSALES.Class.TripPlannerCalendarAvailabilityInput=function(){var c=new SKYSALES.Class.CalendarAvailabilityInputBase(),b=SKYSALES.Util.extendObject(c);b.datePickerManager={};b.init=function(d){this.setSettingsByObject(d);c.marketClass="TripPlannerCalendarAvailabilityMarket";this.initMarketArray();this.setVars();this.draw();this.setVarsAfterDraw();this.addEvents();this.selectInitialDateMarkets()};return b};SKYSALES.Class.CalendarAvailabilityMarketBase=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="";b.container=null;b.selectedDateContainerId="";b.selectedDateContainer=null;b.templateId="marketTemplateId";b.template=null;b.selectedDateTemplateId="selectedDateTemplateId";b.selectedDateTemplate=null;b.noFlightsTemplateId="noFlightsTemplateId";b.noFlightsTemplate=null;b.availabilityInput=null;b.dateMarketHash={};b.marketIndex=-1;b.departureStation="";b.arrivalStation="";b.selectedDateMarket=null;b.selectedDate="";b.selectedClass="selected";b.dateMarketPrefix="date_";b.inputDayId="";b.inputDay=null;b.inputMonthId="";b.inputMonth=null;b.startYear="";b.startMonth="";b.startDay="";b.startDate="";b.firstBlockDate="";b.endYear="";b.endMonth="";b.endDay="";b.endDate="";b.lastBlockDate="";b.requestStartDate=null;b.requestEndDate=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.initStartDate();this.initEndDate();this.initFirstBlockDate();this.initLastBlockDate();this.initDateMarketHash()};b.setVars=function(){b.template=this.getById(this.templateId);b.inputDay=this.getById(this.inputDayId);b.inputMonth=this.getById(this.inputMonthId);b.noFlightsTemplate=this.getById(this.noFlightsTemplateId)};b.setVarsAfterDraw=function(){b.container=this.getById(this.containerId);b.selectedDateContainer=this.getById(this.selectedDateContainerId);b.selectedDateTemplate=this.getById(this.selectedDateTemplateId);var d=this.dateMarketHash||{},f="",e=null;for(f in d){if(d.hasOwnProperty(f)){e=d[f];if(e){e.setVarsAfterDraw()}}}};b.addEvents=function(){this.container.click(this.updateFareHandler)};b.getDateMarketKey=function(e){var f=e.target,d=f.id;if(d===""){d=$(f).parent("div.day").attr("id")||""}return d};b.updateFareEvent=function(e){var d=this.getDateMarketKey(e);this.updateFare(d);this.updateSummary(d)};b.updateSummary=function(af){var Z=this.dateMarketHash[af],G="",J=0,F=0,aa=0,I=0,j=0,M=0,A=0,e=0,O=0,s=0,X=0,ag=0,N=0,q=0,r=0;J=Z.price;F=Z.priceSRC;aa=Z.baseFare;e=Z.taxes;O=Z.taxesSRC;s=Z.taxesADT;X=Z.taxesCHD;ag=Z.taxesFREE;I=Z.discountBaseFareSRC;j=Z.discountBaseFareADT;M=Z.discountBaseFareCHD;A=Z.discountBaseFareFREE;r=Z.marketIndex;var E=DataCulture;var n="";var D="";var l="";var Q="";var ah="";var p="";var g=parseInt(Z.month,10)+1;var Y=Z.year+"-"+g+"-"+Z.day;if(r==0){document.getElementById("completeDepartureDate").value=Y}if(r==1){document.getElementById("completeArrivalDate").value=Y}var W=document.getElementById("StepConexion").value;if(W!="Conexion"){if(J>0||J!=null){if(E=="es-MX"||E=="es-GT"){n="tarifa base";l="ADT";Q="ADTM";ah="MEN";p="GRATIS"}if(E=="en-US"){n="Base Fare";l="ADT";Q="SRC";ah="CHD";p="FREE"}if(E=="es-MX"||E=="es-GT"){D="dscto"}if(E=="en-US"){D="Discount"}if(E=="es-MX"||E=="es-GT"){taxesLabel="Impuestos"}if(E=="en-US"){taxesLabel="Taxes and Fees"}var o;var k="<table>";var w="<tr><td>&nbsp</td>";var ad='<tr><td class="label">'+n+"</td>";var T='<tr><td class="label"><span style="color:#6CAEDF">'+D+"</span></td>";var ab='<tr><td class="label">'+taxesLabel+"</td>";var V='<tr><td class="label">Total</td>';var ac=document.getElementById("totalPaxSRC").value;var z=document.getElementById("totalPaxADT").value;var f=document.getElementById("totalPaxCHD").value;var t=document.getElementById("totalPaxFREE");var ae=0;var C=0;var h=0;var B=0;var v=0;if(ac>0){w=w+'<th class="iconSRC">'+ac+"<br/>"+Q+"</th>";ad=ad+"<td>"+Z.getFormattedAnyPrice(ac*aa)+"</td>";T=T+"<td>"+Z.getFormattedAnyPrice((ac*I))+"</td>";ab=ab+"<td>"+Z.getFormattedAnyPrice((ac*O))+"</td>";ae=ac*F;V=V+"<td>"+Z.getFormattedAnyPrice(ae)+"</td>"}if(z>0){w=w+'<th class="iconADT">'+z+"<br/>"+l+"</th>";ad=ad+"<td>"+Z.getFormattedAnyPrice((z*aa))+"</td>";T=T+"<td>"+Z.getFormattedAnyPrice((z*j))+"</td>";ab=ab+"<td>"+Z.getFormattedAnyPrice((z*s))+" </td>";C=z*J;V=V+"<td>"+Z.getFormattedAnyPrice(C)+" </td>"}if(f>0){w=w+'<th class="iconCHD">'+f+"<br/>"+ah+"</th>";ad=ad+"<td>"+Z.getFormattedAnyPrice((f*aa))+"</td>";T=T+"<td>"+Z.getFormattedAnyPrice((z*M))+"</td>";ab=ab+"<td>"+Z.getFormattedAnyPrice((f*X))+"</td>";h=f*J;V=V+"<td>"+Z.getFormattedAnyPrice(h)+"</td>"}if(t!=null){t=t.value;if(t>0){if(ac>0&&z>0&&f>0){document.getElementById("summaryHeader").style.background="#1B4298";document.getElementById("summaryFooter").style.background="#1B4298";document.getElementById("detailsPriceContainer").style.position="relative";document.getElementById("detailsPriceContainer").style.left="-70px";document.getElementById("detailsPriceContainer").style.width="320px"}w=w+'<th class="iconFREE">'+t+"<br/>"+p+"</th>";ad=ad+"<td>"+Z.getFormattedAnyPrice(t*aa)+"</td>";T=T+"<td>"+Z.getFormattedAnyPrice(t*A)+"</td>";ab=ab+"<td>"+Z.getFormattedAnyPrice((t*ag))+"</td>";B=t*ag;V=V+"<td>"+Z.getFormattedAnyPrice(B)+"</td>"}}w=w+"</tr>";ad=ad+"</tr>";T=T+"</tr>";ab=ab+"</tr>";V=V+"</tr>";o=w+ad+T+ab+V;var m=ae+C+h+B;var H=null;var y=null;k=k+o+"</table>";var u=document.getElementById("departureTable");var U=document.getElementById("arrivalTable");var R=document.getElementById("totalMarket_0");var d=document.getElementById("totalMarketAux_0");var P=document.getElementById("totalMarket_1");var ai=document.getElementById("totalMarketAux_1");document.getElementById("detailsPriceContainer").style.display="block";if(this.marketIndex==0){document.getElementById("divMarket_0").style.display="block";document.getElementById("departureStation_0").innerHTML=this.departureStation;document.getElementById("arrivalStation_0").innerHTML=this.arrivalStation;u.innerHTML=k;d.innerHTML=m}else{document.getElementById("divMarket_1").style.display="block";document.getElementById("departureStation_1").innerHTML=this.departureStation;document.getElementById("arrivalStation_1").innerHTML=this.arrivalStation;U.innerHTML=k;ai.innerHTML=m}var S=0;var L=0;var K=0;if(d.innerHTML!=null){L=Number(d.innerHTML);R.innerHTML=Z.getFormattedAnyPrice(L)}if(ai.innerHTML!=null){K=Number(ai.innerHTML);P.innerHTML=Z.getFormattedAnyPrice(K)}S=L+K;document.getElementById("grandTotal").innerHTML=Z.getFormattedAnyPrice(S);fadeIn("detailsPriceContainer",10)}}};b.updateFareHandler=function(d){b.updateFareEvent(d)};b.updateFare=function(f){var e=this.dateMarketHash[f],h="",k=",",j=",",g="",d=-1,l=-1;if(e&&(e.price>0||e.points>0)){this.deactivateAllDateMarkets();e.activate();b.selectedDateMarket=e;h=this.selectedDateTemplate.text();h=h.replace(/\[formattedDate\]/,e.formattedDate);k=e.getFormattedPrice();j=SKYSALES.Util.convertToLocaleInteger(e.points);g=SKYSALES.Util.formatAmount(k,j,e.pointsLabelAppend,e.pointsSuffix);h=h.replace(/\[amount\]/,g);this.selectedDateContainer.html(h);l=parseInt(e.month,10)+1;this.inputMonth.val(l);d=parseInt(e.day,10);this.inputDay.val(d);this.availabilityInput.updateTotalAmount()}};b.selectInitialDateMarket=function(){var d=this.dateMarketPrefix+this.marketIndex+"_"+this.selectedDate;this.updateFare(d)};b.deactivateAllDateMarkets=function(){var g=this.selectedClass,d=this.dateMarketHash||{},f="",e=null;for(f in d){if(d.hasOwnProperty(f)){e=d[f];e.deactivate(g)}}};b.initStartDate=function(){b.startDate=new Date(this.startYear,this.startMonth,this.startDay)};b.initEndDate=function(){b.endDate=new Date(this.endYear,this.endMonth,this.endDay)};b.initFirstBlockDate=function(){var d=this.startDate,g,f=d.getDay(),e=new Date();g=this.addDays(d,f*-1);e.setTime(g);b.firstBlockDate=e};b.initLastBlockDate=function(){var g=7,j=this.endDate,e=j.getDay(),f=g-e,h=0,d=new Date();h=this.addDays(j,f);d.setTime(h);b.lastBlockDate=d};b.getMarketHashKey=function(d){d=d||new Date();var e=this.dateMarketPrefix+this.marketIndex+"_"+d.getFullYear()+"_"+d.getMonth()+"_"+d.getDate();return e};b.initDateMarketHash=function(){var g=new Date(),d=this.lastBlockDate,e=this.dateMarketHash||{},h="",j=0,f=null;g.setTime(this.firstBlockDate.getTime());while(g<d){h=this.getMarketHashKey(g);f=new SKYSALES.Class.CalendarAvailabilityDateMarket();f.market=this;e[h]=e[h]||{};f.init(e[h]);f.date=new Date(g.getFullYear(),g.getMonth(),g.getDate());f.availableClass=this.availableClass;e[h]=f;DaysToAdd=((g.getMonth()+1)==10&&g.getDate()==30)?1.1:1;j=this.addDays(g,DaysToAdd);g.setTime(j)}};b.getMonthName=function(g){g=parseInt(g,10);var d="",f=null,e=null;f=SKYSALES.Util.getResource();e=f.dateCultureInfo.monthNames;if(e.length>g){d=e[g]}return d};b.getDayNameArray=function(){var d=null,e=null;d=SKYSALES.Util.getResource();e=d.dateCultureInfo.dayNames||[];return e};b.supplantDayNames=function(h){var f=this.getDayNameArray(),g=0,e=f.length,j=null,k="",d="";for(g=0;g<e;g+=1){d=f[g];k="\\[daysOfWeek"+g+"\\]";j=new RegExp(k);h=h.replace(j,d)}return h};b.supplantNotesMarket=function(d,g){var e;if(g==10){var h=document.getElementById("noteGoingOutTLCNOV");if(h!=null){e=document.getElementById("noteGoingOutTLCNOV").innerHTML}}else{var f=document.getElementById("noteGoingOutTLC");if(f!=null){e=document.getElementById("noteGoingOutTLC").innerHTML}}if(this.departureStation=="Toluca"&&!(this.arrivalStation=="San Antonio"||this.arrivalStation=="San Antonio International Airport")){d=d.replace(/\[noteDepTLC\]/,e)}else{d=d.replace(/\[noteDepTLC\]/,"")}return d};b.supplantHeaderMarkets=function(g,f,e){var d=document.getElementById("headerMarket"+g);if(d!=null){d.innerHTML=f+"-"+e}};b.getHtml=function(){var d="";if(this.startYear){d=this.template.text()}else{d=this.noFlightsTemplate.text()}d=this.supplant(d);return d};b.supplant=function(f){f=f||"";var e=this.getMonthName(this.startMonth),d="";FlightTypeNumber=document.getElementById("flightTypeNumber").value;f=f.replace(/\[startDateMonth\]/,e);f=f.replace(/\[startDateYear\]/,this.startYear);f=f.replace(/\[marketIndex\]/g,this.marketIndex);f=f.replace(/\[departureStation\]/,this.departureStation);f=f.replace(/\[arrivalStation\]/,this.arrivalStation);f=f.replace(/\[flightTypeNumber\]/,FlightTypeNumber);this.supplantHeaderMarkets(this.marketIndex,this.departureStation,this.arrivalStation);f=this.supplantDayNames(f);f=this.supplantNotesMarket(f,this.startMonth);d=this.getMarketHtml();f=f.replace(/\[dateMarketHash\]/,d);return f};b.getMarketHtml=function(){var h="",m=[],e=new Date(),d=this.lastBlockDate,f=this.dateMarketHash||{},l="",k=0,j=null,g="";e.setTime(this.firstBlockDate.getTime());while(e<d){l=this.getMarketHashKey(e);j=f[l];g=j.getHtml();m.push(g);DaysToAdd=((e.getMonth()+1)==10&&e.getDate()==30)?1.1:1;k=this.addDays(e,DaysToAdd);e.setTime(k)}h=m.join("");return h};b.addDays=function(e,d){var f=e.getTime()+(d*24*60*60*1000);return f};b.getDateMarketArray=function(){var d=this.dateMarketHash||{},f="",e=null,g=[];for(f in d){if(d.hasOwnProperty(f)){e=d[f];g.push(e)}}return g};return b};SKYSALES.Class.CalendarAvailabilityMarket=function(){var c=new SKYSALES.Class.CalendarAvailabilityMarketBase(),b=SKYSALES.Util.extendObject(c);b.availableClass="";b.updateFareHandler=function(d){b.updateFareEvent(d)};return b};SKYSALES.Class.TripPlannerCalendarAvailabilityMarket=function(){var b=new SKYSALES.Class.CalendarAvailabilityMarketBase(),c=SKYSALES.Util.extendObject(b);c.datePickerManager={};c.availableClass="available";c.updateDateDropDowns=function(g){var e=this.getDateMarketKey(g),d=this.dateMarketHash[e],f=d.price,h=d.date;if(f){this.datePickerManager.datePopulate(h);this.availabilityInput.container.hide()}};c.updateDateDropDownsHandler=function(d){c.updateDateDropDowns(d)};c.addEvents=function(){this.container.click(this.updateDateDropDownsHandler)};return c};SKYSALES.Class.CalendarAvailabilityDateMarket=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.market=null;c.marketIndex=null;c.date=null;c.containerId="";c.container=null;c.templateId="dateMarketTemplateId";c.template=null;c.defaultJourneyTemplateId="dateMarketJourneyDefaultTemplateId";c.defaultJourneyTemplate=null;c.price=null;c.baseFare=null;c.discountBaseFareSRC=null;c.discountBaseFareADT=null;c.discountBaseFareCHD=null;c.discountBaseFareFREE=null;c.priceSRC=null;c.taxes=null;c.taxesSRC=null;c.taxesADT=null;c.taxesCHD=null;c.taxesFREE=null;c.discountPorcent=null;c.classOfService=null;c.fareBasis=null;c.formattedDate="";c.year=-1;c.month=-1;c.monthName="";c.day=-1;c.points=null;c.pointsSuffix="pts";c.flightTypeNumber="";c.pointsLabelAppend=" & ";c.classElement=null;c.totalADT=0;c.availableClass="available";c.init=function(d){this.setSettingsByObject(d);this.setVars()};c.setVars=function(){c.template=this.getById(this.templateId)};c.setVarsAfterDraw=function(){c.container=this.getById(this.containerId)};c.getFormattedPrice=function(){var e=this.price,d="";if(e!==null&&e>0){d=SKYSALES.Util.convertToLocaleCurrency(e);if(d===""){d=e.toString()}}return d};c.getFormattedAnyPrice=function(e){var d="";if(e!==null&&e>0){d=SKYSALES.Util.convertToLocaleCurrency(e);if(d===""){d=e.toString()}}return d};c.getFormattedPriceSRC=function(){var e=this.priceSRC,d="";if(e!==null&&e>0){d=SKYSALES.Util.convertToLocaleCurrency(e);if(d===""){d=e.toString()}}return d};c.getHtml=function(){var d=this.template.text();d=this.supplant(d);return d};c.daySupplantValue=function(){var j=this.market,d="&nbsp;",g=j.requestStartDate,f=j.requestEndDate,h=this.date,e=h.getDate();if(g&&f){if(g&&f){if(h<g||h>f){e=d}}}return e};c.supplant=function(n){var q=this.price,t=this.discountPorcent,p=this.classOfService,d=this.fareBasis,m=this.getFormattedPrice(),j=this.date,o=j.getFullYear().toString(),e="",u=j.getMonth(),k=0,g=this.getMonthName(u),s=this.daySupplantValue(),h=this.market,v="",r=SKYSALES.Util.convertToLocaleInteger(this.points);k=u+1;e=o.charAt(2)+o.charAt(3);n=n.replace(/\[day\]/g,s);n=n.replace(/\[month\]/g,u);n=n.replace(/\[showMonthName\]/g,g);n=n.replace(/\[year\]/g,o);n=n.replace(/\[twoDigitYear\]/g,e);n=n.replace(/\[marketIndex\]/g,h.marketIndex);n=n.replace(/\[classElement\]/g,this.classElement);if(q>0){v=this.availableClass}if(t!=null){var l=t;l=l.replace("*SRC",'<span class="discountSRC">');l=l.replace("SRC*","</span>");l=l.replace("*ADT",'<span class="discountADT">');l=l.replace("ADT*","</span>");l=l.replace("*CHD",'<span class="discountCHD">');l=l.replace("CHD*","</span>");if(p=="Q"||d=="W2"||d=="Y2"||d=="N2"||d=="R2"||d=="V2"||d=="U"){t="PROMO";if(d=="W2"){t="60%"}if(d=="Y2"){t="50%"}if(d=="N2"){t="40%"}if(d=="R2"){t="15%"}if(d=="V2"){t="10%"}if(l.search(/-50/i)>0){t="50%"}}else{if(l.search(/-47/i)<0){t=l}else{t="PROMO"}}n=n.replace(/\[discountPorcent\]/,t)}else{n=n.replace(/\[discountPorcent\]/,"")}if(q>0){if(h.departureStation=="Toluca"&&!(h.arrivalStation=="San Antonio"||h.arrivalStation=="San Antonio International Airport")){n=n.replace(/\[iconDiscPorcent\]/,"iconDiscPorcent")}else{n=n.replace(/\[iconDiscPorcent\]/,"noIconDiscPorc")}}n=n.replace(/\[amount\]/g,SKYSALES.Util.formatAmount(m,r,this.pointsLabelAppend,this.pointsSuffix));var f=SKYSALES.Util.formatAmount(m,r,this.pointsLabelAppend,this.pointsSuffix);var w=f.replace("$","").replace(",","");if(w!=""){n=n.replace(/\[amount2\]/g,"$ "+parseInt(w))}else{n=n.replace(/\[amount2\]/g,"")}n=n.replace(/\[availableClass\]/g,v);return n};c.activate=function(){var d=this.market.selectedClass,e=this.availableClass;this.container.removeClass(e);this.container.addClass(d)};c.deactivate=function(){var d=this.market.selectedClass,e=this.availableClass;this.container.removeClass(d);this.container.addClass(e)};c.getMonthName=function(g){g=parseInt(g,10);var d="",f=null,e=null;f=SKYSALES.Util.getResource();e=f.dateCultureInfo.monthNamesShort;if(e.length>g){d=e[g]}return d};return c};SKYSALES.Class.HotelDescriptions=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.hotelDescriptionsArray=[];b.addLongDescriptions=function(e){var d=new SKYSALES.Class.ToggleView();d.init(e)};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initHotelDescriptionsArray()};b.initHotelDescriptionsArray=function(){var e=0,f=this.hotelDescriptionsArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=new SKYSALES.Class.HotelDescription();g.init(f[e]);f[e]=g}};return b};SKYSALES.Class.HotelDescription=function(){var b=new SKYSALES.Class.ToggleView(),c=SKYSALES.Util.extendObject(b);c.contentType="";c.detailsAvailable=false;c.longDescription="";c.noDescriptionAvailableMessage="";c.messageDivId="";c.messageDiv=null;c.hotelKey="";c.getHotelDescriptionUri="GetHotelDescriptionAjax-resource.aspx";c.ajaxParams="";c.addressId="";c.addressDom=null;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};c.setVars=function(){b.setVars.call(this);c.messageDiv=this.getById(this.messageDivId);c.ajaxParams={hotelKey:this.hotelKey};c.longDescription=SKYSALES.Util.decodeUriComponent(c.longDescription);c.addressDom=this.getById(this.addressId)};c.updateShowHandler=function(){c.updateShow()};c.updateShow=function(){var e="",f="",d="";if(this.longDescription.length===0&&this.detailsAvailable===true){this.sendHotelDescriptionRequest()}else{if(this.longDescription.length>0){e=this.longDescription}else{e=this.noDescriptionAvailableMessage}if(e.length>0){this.updateElement(e)}b.updateShow.call(this)}f="GetHotelAddressAjax-resource.aspx";d=this.addressDom.text();if(!d){$.get(f+"?hotelKey="+this.hotelKey,this.updateAddressHandler)}};c.sendHotelDescriptionRequest=function(){var d="GetHotelDescriptionAjax-resource.aspx";window.open(d+"?hotelKey="+this.hotelKey,"mywindow","status=1,resizable=1,scrollbars=1,location=1,width=500,height=500")};c.updateAddressHandler=function(d){c.updateAddress(d)};c.updateAddress=function(d){this.addressDom.html(d)};c.updateElement=function(d){if(d.length>0){this.messageDiv.html(d)}else{this.messageDiv.html(c.noDescriptionAvailableMessage)}};c.getHotelDescriptionHandler=function(d){if(d.length>0){d=SKYSALES.Util.decodeUriComponent(d);c.longDescription=d}c.updateElement(d);b.updateShow.call(c)};return c};SKYSALES.taxAndFeeInclusiveDisplayDataRequestHandler=function a(e,c){var h=",",g={flightKeys:e.join(h),numberOfMarkets:c,keyDelimeter:h},j=null,b=null,d=null,f=null;j=function(){if(SKYSALES.common){SKYSALES.common.stripeTables()}b=new SKYSALES.Class.ToggleView();d={elementId:"allUpPricing",hideId:"closeTotalPrice",showId:"taxAndFeeInclusiveTotal"};b.init(d)};f=function(k){k="<div>"+k+"</div>";if(window.$){$("#taxAndFeeInclusiveDivBody").remove();$("#taxAndFeeInclusiveDivHeader").after($(k).find("#taxAndFeeInclusiveDivBody"));if(c===1){$("table#taxesAndFeesInclusiveDisplay_2").hide()}}j()};$.get("TaxAndFeeInclusiveDisplayAjax-resource.aspx",g,f)};SKYSALES.Class.AvailabilityInput=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.detailsLinks=null;c.journeyInfoArray=[];c.journeyInfoList=[];c.dateMarketLowestFareList=[];c.dateMarketLowestFareArray=[];c.getPriceItineraryInfo=function(){if(SKYSALES.taxAndFeeInclusiveDisplayDataRequestHandler){var d=$("#selectMainBody .availabilityTable tr td[class^='fareCol'] :radio[checked]"),e=[];$(d).each(function(f){e[f]=$(this).val()});SKYSALES.taxAndFeeInclusiveDisplayDataRequestHandler(e,d.length)}};c.showPreselectedFares=function(d){var e=0;for(e=0;e<d.length;e+=1){if(d[e]!==null){this.getById(d[e]).click()}}};c.updateFareSelectedHandler=function(){var d=this.id||"";c.updateFareSelected(d)};c.updateFareSelected=function(d){this.getPriceItineraryInfo();this.updateFareRules(d)};c.updateFareRuleSelected=function(d){this.updateFareRules(d)};c.updateFareRules=function(f){var l=/(RadioButtonMkt[0-9]+Fare[0-9]+)$/,n=[],g="",q="",e=this.journeyInfoArray||[],d=0,j=e.length,m=null,p=null,k=0,r=0,h=null,o=SKYSALES.Util.getFareRuleContainer();if(o&&f){n=l.exec(f)||[];if(n.length>1){g=n[1];journeyLoop:for(d=0;d<j;d+=1){m=e[d];p=m.fareArray||[];r=p.length;for(k=0;k<r;k+=1){h=p[k];if(g===h.fareId){q=h.fareRuleKey;if(q){o.updateFareRule(m.marketIndex,q)}break journeyLoop}}}}}};c.addGetPriceItineraryInfoEvents=function(){$("#selectMainBody tr td[class^='fareCol'] :radio").click(this.updateFareSelectedHandler)};c.ajaxEquipmentProperties=function(){};c.addEquipmentPropertiesAjaxEvent=function(){$(this).click(c.ajaxEquipmentProperties)};c.addEquipmentPropertiesAjaxEvents=function(){c.detailsLinks.each(c.addEquipmentPropertiesAjaxEvent)};c.addEvents=function(){c.addGetPriceItineraryInfoEvents();c.addEquipmentPropertiesAjaxEvents()};c.setVars=function(){c.detailsLinks=$(".showContent")};c.initJourneyInfoContainers=function(){var d=0,e=this.journeyInfoList,f=null;for(d=0;d<e.length;d+=1){f=new SKYSALES.Class.JourneyInfo();f.init(e[d]);c.journeyInfoArray[c.journeyInfoArray.length]=f}};c.initLowestPriceSelection=function(){var d=null,f=this.dateMarketLowestFareList,e=0;for(e=0;e<f.length;e+=1){d=new SKYSALES.Class.LowestFareInfo();d.init(f[e]);c.dateMarketLowestFareArray[c.dateMarketLowestFareArray.length]=d}};c.init=function(d){this.setSettingsByObject(d);this.initJourneyInfoContainers();if(SKYSALES.taxAndFeeInclusiveDisplayDataRequestHandler){this.setVars();this.addEvents()}this.initLowestPriceSelection();if(SKYSALES.taxAndFeeInclusiveDisplayDataRequestHandler){this.getPriceItineraryInfo()}};return c};SKYSALES.Class.LowestFareInfo=function(c){var d=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(d);b.tripMarketIndex="";b.marketIndex="";b.dateMarketIndex="";b.lowestFareControlId="";b.lowestFareControl=null;b.init=function(e){this.setSettingsByObject(e);this.setVars();this.addEvents();this.selectDateMarketLowestFare()};b.setVars=function(){b.lowestFareControl=this.getById(this.lowestFareControlId)};b.selectDateMarketLowestFare=function(){var e=this.lowestFareControl||{};if(e){e.attr("checked","true")}};return b};SKYSALES.Class.JourneyInfo=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.equipmentInfoUri="EquipmentPropertiesDisplayAjax-resource.aspx";b.key="";b.journeyContainerId="";b.activateJourneyId="";b.activateJourney=null;b.deactivateJourneyId="";b.deactivateJourney=null;b.journeyContainer=null;b.legInfoArray=[];b.clientName="EquipmentPropertiesDisplayControlAjax";b.fareArray={};b.marketIndex=-1;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){b.journeyContainer=this.getById(b.journeyContainerId);b.activateJourney=this.getById(b.activateJourneyId);b.deactivateJourney=this.getById(b.deactivateJourneyId)};b.addEvents=function(){b.activateJourney.click(b.show);b.deactivateJourney.click(b.hide)};b.showWithDataHandler=function(d){b.showWithData(d)};b.showWithData=function(j){var l=$(j).html(),f=SKYSALES.Json.parse(l),k=f.legInfo,g=null,e="",o=null,m="",d=null,h=0,n=null;for(e in k){if(k.hasOwnProperty(e)){m="";g=k[e];if(g.legIndex!==undefined){o=this.getById("propertyContainer_"+b.key);d=g.equipmentPropertyArray;for(h=0;h<d.length;h+=1){n=d[h];m+="<div>"+n.name+": "+n.value+"</div>"}o.html(m)}}}this.journeyContainer.show("slow")};b.show=function(){var e=b.legInfoArray,g=null,d={},j="",f=0,h=b.clientName;for(f=0;f<e.length;f+=1){g=e[f];for(j in g){if(g.hasOwnProperty(j)){d[h+"$legInfo_"+j+"_"+f]=g[j]}}}$.post(b.equipmentInfoUri,d,b.showWithDataHandler)};b.hide=function(){b.journeyContainer.hide()};return b};SKYSALES.Util.getFareRuleContainer=function(){var b=SKYSALES.common.fareRuleContainer;return b};SKYSALES.Class.FareRuleContainer=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.fareRuleArray=[];b.containerId="";b.init=function(d){this.setSettingsByObject(d);SKYSALES.common.fareRuleContainer=this};b.updateFareRule=function(f,l){f=parseInt(f,10);f+=1;var d=this.fareRuleArray||[],g=0,h=d.length,j=null,k="",e="default_"+f,m=null;for(g=0;g<h;g+=1){j=d[g];if(j.key===l.toLowerCase()){k=j.rule;break}}if(!k){for(g=0;g<h;g+=1){j=d[g];if(j.key===e){k=j.rule;break}}}m=this.getById("fareRule"+f);m.html(k)};return b};SKYSALES.Class.SsrPassengerInput=function(){var c=SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.ssrFormArray=null;b.ssrFeeArray=null;b.errorMsgOverMaxPerPassenger="There has been an error";b.ssrButtonIdArray=null;b.ssrButtonArray=null;b.buttonTrackId="";b.buttonTrack=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();$("table.ssrSoldContainer :input",this.container).attr("disabled","disabled")};b.setVars=function(){b.buttonTrack=this.getById(this.buttonTrackId);b.ssrButtonIdArray=this.ssrButtonIdArray||[];var g=[],e=0,d=null,f="";for(e=0;e<this.ssrButtonIdArray.length;e+=1){f=this.ssrButtonIdArray[e];d=this.getById(f);if(d.length>0){g[g.length]=d}}b.ssrButtonArray=g};b.addEvents=function(){this.addButtonClickedEvents()};b.addButtonClickedEvents=function(){var e=0,d=null;for(e=0;e<this.ssrButtonArray.length;e+=1){d=this.ssrButtonArray[e];d.click(this.updateButtonTrackHandler)}};b.updateButtonTrackHandler=function(){b.buttonTrack.val(this.id)};b.setSettingsByObject=function(h){c.setSettingsByObject.call(this,h);var g=0,f=this.ssrFormArray||[],j=null,e=this.ssrFeeArray||[],d=null;for(g=0;g<f.length;g+=1){j=new SKYSALES.Class.SsrForm();j.index=g;j.ssrPassengerInput=this;j.init(f[g]);f[g]=j}for(g=0;g<e.length;g+=1){d=new SKYSALES.Class.SsrFormFee();d.index=g;d.ssrPassengerInput=this;d.init(e[g]);e[g]=d}};b.deactivateSsrFormNotes=function(){var e=0,d=this.ssrFormArray,f=null;for(e=0;e<d.length;e+=1){f=d[e];f.deactivateNoteDiv()}};return b};SKYSALES.Class.SsrForm=function(){var b=SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.maximumDropDownLimit=0;c.ssrPassengerId="";c.ssrPassenger=null;c.ssrCodeId="";c.ssrCode=null;c.ssrQuantityId="";c.ssrQuantity=null;c.ssrNoteId="";c.ssrNote=null;c.ssrNoteIframeId="";c.ssrNoteIframe=null;c.ssrNoteCloseId="";c.ssrNoteClose=null;c.ssrNoteDivId="";c.ssrNoteDiv=null;c.ssrNoteImageId="";c.ssrNoteImage=null;c.ssrNoteCancelId="";c.ssrNoteCancel=null;c.ssrFlightId="";c.ssrFlight=null;c.ssrAmountId="";c.ssrAmount=null;c.ssrCurrencyId="";c.ssrCurrency=null;c.index=-1;c.ssrPassengerInput=null;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.updateSsrAmount()};c.setVars=function(){c.ssrNote=this.getById(this.ssrNoteId);c.ssrNoteDiv=this.getById(this.ssrNoteDivId);c.ssrNoteClose=this.getById(this.ssrNoteCloseId);c.ssrNoteCancel=this.getById(this.ssrNoteCancelId);c.ssrNoteImage=this.getById(this.ssrNoteImageId);c.ssrNoteIframe=this.getById(this.ssrNoteIframeId);c.ssrQuantity=this.getById(this.ssrQuantityId);c.ssrPassenger=this.getById(this.ssrPassengerId);c.ssrCode=this.getById(this.ssrCodeId);c.ssrCurrency=this.getById(this.ssrCurrencyId);c.ssrFlight=this.getById(this.ssrFlightId);c.ssrAmount=this.getById(this.ssrAmountId)};c.addEvents=function(){this.addNoteEvents();this.addQuantityEvents();this.addSSRCodeEvents();this.addFlightEvents()};c.addFlightEvents=function(){this.ssrFlight.change(this.updateSsrAmountHandler)};c.updateSsrQuantityHandler=function(){c.updateSsrQuantity()};c.updateSsrAmountHandler=function(){c.updateSsrAmount()};c.addSSRCodeEvents=function(){this.ssrCode.change(this.updateSsrQuantityHandler);this.ssrCode.change(this.updateSsrAmountHandler)};c.addQuantityEvents=function(){this.ssrQuantity.change(this.updateSsrAmountHandler);this.ssrQuantity.blur(this.updateSsrAmountHandler)};c.updateSsrAmount=function(){var m=this.ssrAmount,p=SKYSALES.Util.convertToLocaleCurrency("0.00"),o=this.ssrPassenger.val(),k=this.ssrCode.val(),g=this.ssrQuantity.val(),q=/^[0-9]+$/,h=0,n=this.ssrPassengerInput,d=n.ssrFeeArray,e=null,f="",l=0;m.val(p);g=$.trim(g);if(q.test(g)){f=this.ssrFlight.val();for(h=0;h<d.length;h+=1){e=d[h];if((f==="all")||(f===e.segmentKey)){if((o===e.passengerNumber)&&(k===e.ssrCode)){l+=(e.amount*g)}}}p=SKYSALES.Util.convertToLocaleCurrency(l);m.val(p)}else{this.ssrQuantity.val(0)}};c.updateSsrQuantity=function(){var q=this.maximumDropDownLimit,p=this.ssrPassenger.val(),m=this.ssrCode.val(),k=this.ssrFlight.val(),n=0,l=0,o=this.ssrPassengerInput,e=o.ssrFeeArray,f=null,h=this.ssrQuantity.val(),r=0,d=null,g=this.ssrQuantity[0];q=window.parseInt(q,10);h=parseInt(h,10);for(n=0;n<e.length;n+=1){f=e[n];if((k==="all")||(k===f.segmentKey)){if((p===f.passengerNumber)&&(m===f.ssrCode)){r=parseInt(f.maxPerPassenger,10);if(r===0){r=q;r=parseInt(r,10);if(h>=r){r=h;r=r+1}}if(g.options){while(g.options.length>0){g.options[0]=null}for(l=0;l<=r;l+=1){d=new window.Option(l,l);g.options[l]=d;if(h===l){this.ssrQuantity.val(l)}}}if(h>r){this.ssrQuantity.val(r);alert(this.getErrorMsgOverMaxPerPassenger())}else{this.ssrQuantity.val(h)}}}}};c.getErrorMsgOverMaxPerPassenger=function(){var d="";d=this.ssrPassengerInput.errorMsgOverMaxPerPassenger;return d};c.clearAndDeactivateNoteDiv=function(){var e=this.ssrNote,d=e.is(":disabled");if(d===false){e.val("")}this.deactivateNoteDiv()};c.deactivateNoteDiv=function(){this.ssrNoteDiv.hide();this.ssrNoteIframe.hide()};c.activateNoteDiv=function(){this.ssrPassengerInput.deactivateSsrFormNotes();var g=this.ssrNoteImage[0],h=SKYSALES.Dhtml(),f=h.getX(g),e=h.getY(g),d=false;this.ssrNoteDiv.css("left",f+"px");this.ssrNoteDiv.css("top",e+"px");this.ssrNoteDiv.show();this.ssrNoteIframe.css("left",f+"px");this.ssrNoteIframe.css("top",e+"px");this.ssrNoteIframe.show();d=this.ssrNote.is(":disabled");if(d===false){this.ssrNote.click()}};c.ssrNoteCancelHandler=function(){c.clearAndDeactivateNoteDiv()};c.ssrNoteCloseHandler=function(){c.deactivateNoteDiv()};c.ssrNoteImageHandler=function(){c.activateNoteDiv()};c.addNoteEvents=function(){this.ssrNoteCancel.mouseup(this.ssrNoteCancelHandler);this.ssrNoteClose.mouseup(this.ssrNoteCloseHandler);this.ssrNoteImage.mouseup(this.ssrNoteImageHandler)};return c};SKYSALES.Class.SsrFormFee=function(){var c=SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.journeyIndex=-1;b.segmentIndex=-1;b.segmentKey="";b.passengerNumber=-1;b.ssrCode="";b.feeCode="";b.amount=0;b.currencyCode="";b.maxPerPassenger=0;b.index=-1;b.ssrPassengerInput=null;return b};SKYSALES.Class.PassengerApis=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.toggleViewIdArray=[];c.init=function(f){this.setSettingsByObject(f);var d=this.toggleViewIdArray||[],e=0,g=null;for(e=0;e<d.length;e+=1){g=new SKYSALES.Class.ToggleView();g.init(d[e])}};return c};SKYSALES.Class.ContactData=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.passengerContactDataArray=[];b.title="";b.gender="";b.firstName="";b.middleName="";b.lastName="";b.customerNumber="";b.birthDay="";b.birthMonth="";b.birthYear="";b.nationality="";b.residentCountry="";b.programCode="";b.programNumber="";b.init=function(d){this.setSettingsByObject(d);this.initPassengerContactDataArray();this.setVars();this.addEvents()};b.initPassengerContactDataArray=function(){var g=0,e={},f=this.passengerContactDataArray||[],d=f.length;for(g=0;g<d;g+=1){e=new SKYSALES.Class.PassengerContactData();e.contactData=this;e.init(f[g]);f[g]=e}};return b};SKYSALES.Class.PassengerContactData=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.actionId="";b.action=null;b.passengerNumber=-1;b.contactData=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){b.action=this.getById(this.actionId)};b.addEvents=function(){this.action.click(this.populatePassengerHandler)};b.populatePassengerHandler=function(){b.populatePassenger(this,b.passengerNumber)};b.populatePassenger=function(f,e){var j=null,h=null,k=false,d=this.contactData,g=-1;if(d){g=e-1;j=$("#passengerInputContent>fieldset:eq("+e+")");h=[{name:"DropDownListTitle",value:d.title},{name:"TextBoxFirstName",value:d.firstName},{name:"TextBoxMiddleName",value:d.middleName},{name:"TextBoxLastName",value:d.lastName},{name:"TextBoxCustomerNumber",value:d.customerNumber},{name:"DropDownListBirthDateDay",value:d.birthDay},{name:"DropDownListBirthDateMonth",value:d.birthMonth},{name:"DropDownListBirthDateYear",value:d.birthYear},{name:"DropDownListGender",value:d.gender},{name:"DropDownListNationality",value:d.nationality},{name:"DropDownListResidentCountry",value:d.residentCountry},{name:"TextBoxProgramNumber",value:d.programNumber},{name:"DropDownListProgram",value:d.programCode}];k=$("#"+f.id).is(":checked");if(k){$.map(h,function(l){if(l){$(":input[id*="+l.name+"]",j).val(l.value)}})}else{$.map(h,function(l){if(l){$(":input[id*="+l.name+"]",j).val("")}})}}};return b};SKYSALES.Class.CityText=function(b){this.textNode=b;this.x=b.getAttribute("x");this.y=b.getAttribute("y");this.stringLength=0;this.endX=0;this.endY=0;this.errorCount=0;this.svgImage=document.getElementById("flightStatusImageId");this.svgImageWidth=this.svgImage.getAttribute("width");this.svgImageHeight=this.svgImage.getAttribute("height");this.midX=0;this.moveText=function(){if(this.errorCount===0){this.alignCenter();this.placeRelativeToCity();this.nudgeIntoPlace()}else{this.handleError()}};this.alignCenter=function(){this.midX=this.getStringLength()/2;this.setX((this.getX()-this.midX));this.textNode.setAttribute("x",(this.getX()))};this.nudgeIntoPlace=function(){while((this.getEndX()+165)>=this.svgImageWidth){this.setX((this.getX()-1));this.textNode.setAttribute("x",this.getX())}while((this.getX())<=1){this.setX((this.getX()+1));this.textNode.setAttribute("x",this.getX())}while((this.getY())<=10){this.setY((this.getY()+1));this.textNode.setAttribute("y",this.getY())}while((this.getY()+165)>=this.svgImageHeight){this.setY((this.getY()-1));this.textNode.setAttribute("y",this.getY())}};this.placeRelativeToCity=function(){var c="top";if((this.getY())<=10){c="bottom"}if(c==="bottom"){this.setY((this.getY()+3))}else{this.setY((this.getY()-3))}this.textNode.setAttribute("y",this.getY())};this.setY=function(c){this.y=c};this.getY=function(){return parseInt(this.y,10)};this.setX=function(c){this.x=c};this.getX=function(){return parseInt(this.x,10)};this.getEndX=function(){if(this.errorCount===0){this.endX=this.getX()+this.getStringLength();if(this.endX===this.getX()){this.handleError()}return this.endX}this.handleError()};this.getY=function(){return parseInt(this.y,10)};this.getStringLength=function(){if(this.errorCount===0){if(!this.stringLength){this.stringLength=this.textNode.getComputedTextLength();if(this.stringLength===0){this.handleError()}}return this.stringLength}this.handleError()};this.handleError=function(){if(this.errorCount===0){this.x=parseInt(this.x,10)-20;b.setAttribute("x",this.x)}this.errorCount+=1}};SKYSALES.Class.FlightPath=function(b,e,c,d){this.objectId=b;this.object=document.getElementById(b);this.rotateId=e;this.rotate=document.getElementById(e);this.currentLeg=c.toLowerCase();this.currentLegArray=this.currentLeg.split("_");this.origin=document.getElementById(this.currentLegArray[0]);this.destination=document.getElementById(this.currentLegArray[1]);this.originX=parseInt(this.origin.getAttribute("cx"),10);this.originY=parseInt(this.origin.getAttribute("cy"),10);this.destinationX=parseInt(this.destination.getAttribute("cx"),10);this.destinationY=parseInt(this.destination.getAttribute("cy"),10);this.percentageComplete=d;this.distance=null;this.distanceTraveled=null;this.slope=null;this.positionX=null;this.positionY=null;this.moveToCurrentPosition=function(){var f=this.getObject();f.setAttributeNS(null,"transform","translate("+this.getPositionX()+","+this.getPositionY()+")")};this.moveToCurrentRotation=function(){var g=this.destinationX-this.originX,f=this.destinationY-this.originY,k=0,j=0,h="";if(g<0){k=Math.atan(this.getSlope())+Math.PI}else{if(f<0){k=Math.atan(this.getSlope())+(2*Math.PI)}else{k=Math.atan(this.getSlope())}}j=(k*180)/Math.PI;j=j+180;h="rotate("+((j))+")";this.rotate.setAttributeNS(null,"transform",h)};this.getCurrentPosition=function(){var j=0,h=this.originX,g=this.originY,f=0;if(this.percentageComplete>0){while(j<=this.getDistanceTraveled()){f=g-(this.getSlope()*h);if(this.originX>this.destinationX){h=h-1}else{h=h+1}g=(h*this.getSlope())+f;j=Math.sqrt(Math.pow((h-this.originX),2)+Math.pow((g-this.originY),2))}this.positionX=h;this.positionY=g}else{this.positionX=this.originX;this.positionY=this.originY}};this.getObject=function(){if(!this.object){this.object=document.getElementById(b)}return this.object};this.getRotate=function(){if(!this.rotate){this.rotate=document.getElementById(e)}return this.rotate};this.getPositionX=function(){if(this.percentageComplete<=0){this.positionX=this.destinationX}return this.positionX};this.getPositionY=function(){if(this.percentageComplete<=0){this.positionY=this.destinationY}return this.positionY};this.getSlope=function(){if(!this.slope){this.slope=((this.destinationY-this.originY)/(this.destinationX-this.originX))}return this.slope};this.getDistance=function(){if(!this.distance){this.distance=Math.sqrt(Math.pow((this.destinationX-this.originX),2)+Math.pow((this.destinationY-this.originY),2))}return this.distance};this.getDistanceTraveled=function(){if(!this.distanceTraveled){this.distanceTraveled=this.distance*(this.percentageComplete*0.01)}return this.distanceTraveled};this.setCurrentPosition=function(f,h,g,k,j,l){this.getDistance();this.getDistanceTraveled();this.getSlope();this.getCurrentPosition()};this.setCurrentPosition()};SKYSALES.Util.calculatePosition=function(b,f,d,e){var c=new SKYSALES.Class.FlightPath(b,f,d,e);c.moveToCurrentPosition();c.moveToCurrentRotation()};SKYSALES.Class.ControlGroupBookingRetrieve=function(){var c=new SKYSALES.Class.ControlGroup(),b=SKYSALES.Util.extendObject(c);b.bookingRetrieve=null;b.init=function(d){this.setSettingsByObject(d);var e=new SKYSALES.Class.BookingRetrieve();e.init(d);b.bookingRetrieve=e;this.setVars();this.addEvents()};b.validateHandler=function(){var d=b.validate();return d};b.validate=function(){var e=false,d=this.bookingRetrieve;e=d.isOneSectionPopulated();if(e){e=c.validate.call(this)}return e};return b};SKYSALES.Class.BookingRetrieve=function(){var c=new SKYSALES.Class.FlightSearch(),b=SKYSALES.Util.extendObject(c);b.marketArray=[];b.missingInformation="";b.sectionValidation={};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){c.setVars.call(this);var f=0,d=0,h=this.sectionValidation,e=[],j="",g=null;for(j in h){if(h.hasOwnProperty(j)){e=h[j]||[];d=e.length;for(f=0;f<d;f+=1){g=e[f];g.input=this.getById(g.id)}}}};b.isOneSectionPopulated=function(){var h=0,j=0,o=this.sectionValidation,l=[],d="",k=null,m=null,f=false,n="",g="",e=true;for(d in o){if(o.hasOwnProperty(d)){l=o[d]||[];j=l.length;e=true;for(h=0;h<j;h+=1){k=l[h];m=k.input[0];if(m){n=m.value;g=n.requiredempty||"";if(n===g){n=""}if(!n){e=false;break}}}if(e){f=true;break}}}if(!f){alert(this.missingInformation)}return f};return b};SKYSALES.Class.CheckInPassengerInput=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.checkInPassengerJourneyArray=[];b.init=function(d){this.setSettingsByObject(d);this.initCheckInPassengerJourneyArray()};b.initCheckInPassengerJourneyArray=function(){var f=0,e=this.checkInPassengerJourneyArray||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.CheckInPassengerJourney();g.init(e[f]);e[f]=g}};return b};SKYSALES.Class.CheckInPassengerJourney=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.checkInInputId="";c.checkInInput=null;c.baggageInputId="";c.baggageInput=null;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.checkInInputUpdate()};c.setVars=function(){c.checkInInput=this.getById(this.checkInInputId);c.baggageInput=this.getById(this.baggageInputId)};c.addEvents=function(){this.checkInInput.click(this.checkInInputUpdateHandler)};c.checkInInputUpdateHandler=function(){c.checkInInputUpdate()};c.checkInInputUpdate=function(){var d=this.checkInInput.is(":checked");if(d){this.baggageInput.removeAttr("disabled")}else{this.baggageInput.attr("disabled","disabled")}};return c};SKYSALES.Class.AosBase=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.addOptions=SKYSALES.Class.AosBase.prototype.addOptions;return b};SKYSALES.Class.AosBase.prototype.addOptions=function(c,d){var b=0;if(c&&c.options){for(b=0;b<d.length;b+=1){c.options[c.options.length]=d[b]}}};SKYSALES.Class.Page=function(){var e=new SKYSALES.Class.AosBase(),d=SKYSALES.Util.extendObject(e),b=null,c="$";d.pageNumber=1;d.pageSize=10;d.totalCount=50;d.pageContainerId="";d.pageContainer=null;d.previous="Previous";d.next="Next";d.pageNodeId="";d.pageNode=null;d.currentPageClass="buttonSelected";d.pageNumberId="";d.pageInputClass="pageInput";d.pageEventClass="pageEvent";d.hoverClass="hover";d.clientName="";d.buttonPrefix="";d.inputPrefix="";d.buttonSubmitName="UpdatePage";d.pageMin=function(j){var h=1,g=1,f=1;if(d.pageNumber>=5){g=j-9;f=d.pageNumber-4;if(g>f){h=f}else{if(g<1){h=1}else{h=g}}}return h};d.pageMax=function(f,h){var g=f+9;if(g>h){g=h}return g};d.drawPage=function(){var n=this.pageSize||1,p=this.pageNode.html(),k="",j=0,h=/-pageNumber-/g,m=/-pageNumberValue-/g,o=Math.ceil(this.totalCount/n),l="",f=this.pageMin(o),g=this.pageMax(f,o);if(o>1){if(d.pageNumber>1){k=p.replace(h,this.previous);k=k.replace(m,this.pageNumber-1)}for(j=f;j<=g;j+=1){l=p.replace(h,j);if(d.pageNumber===j){l=l.replace(/-activeClass-/g,this.currentPageClass)}else{l=l.replace(/-activeClass-/g,"")}l=l.replace(m,j);k+=l}if(this.pageNumber<o){k+=p.replace(h,this.next);k=k.replace(m,this.pageNumber+1)}this.pageContainer.html(k)}};d.setVars=function(f){e.setVars.call(this);d.pageContainer=this.getById(this.pageContainerId);d.pageNode=this.getById(this.pageNodeId);b=this.getById(this.pageNumberId)};d.update=function(h){var j=h.id.replace(this.buttonPrefix,this.inputPrefix),f=this.getById(j),g=f.val();b.val(g);this.sendRequest()};d.updateHandler=function(){d.update(this)};d.sendRequest=function(){var f=this.clientName+c+this.buttonSubmitName;window.__doPostBack(f)};d.addEvents=function(){var f=$("."+this.pageEventClass,this.pageContainer);f.click(this.updateHandler)};d.init=function(f){this.setSettingsByObject(f);this.setVars();this.drawPage();this.addEvents()};return d};SKYSALES.Class.AosSearch=function(){var c=new SKYSALES.Class.AosBase(),b=SKYSALES.Util.extendObject(c),d=SKYSALES.Util.getResource();b.availabilityRequest={};b.locationArray=[];b.locationHash={};b.location=null;b.locationId="";b.locationDropDownId="";b.locationDropDown=null;b.subLocationId="";b.subLocation=null;b.sourceCodeInfo=d.sourceInfo;b.sourceCodeId="";b.sourceCodeDropDownId="";b.startDateId="";b.startDate="";b.startDayId="";b.startDay="";b.startMonthYearId="";b.startMonthYear=null;b.startMonthCount=1;b.endDateId="";b.endDate=null;b.endDayId="";b.endDay=null;b.endMonthYearId="";b.endMonthYear=null;b.endMonthCount=1;b.dateDelimiter="-";b.sourceCodeArray=[];b.sourceCode="";b.sourceCodeDropDown="";b.sortBy=null;b.sortByDropDown=null;b.sortByDropDownId="";b.sortById="";b.addEvents=function(){this.startDay.change(this.setTextValuesHandler);this.startMonthYear.change(this.setTextValuesHandler);this.startDate.change(this.setDropDownValuesHandler);this.endDay.change(this.setTextValuesHandler);this.endMonthYear.change(this.setTextValuesHandler);this.endDate.change(this.setDropDownValuesHandler);this.locationDropDown.change(this.setTextValuesHandler);this.location.change(this.setDropDownValuesHandler);this.sourceCodeDropDown.change(this.setTextValuesHandler);this.sourceCode.change(this.setDropDownValuesHandler);this.sortBy.change(this.setDropDownValuesHandler);this.sortByDropDown.change(this.setTextValuesHandler);this.subLocation.change(this.setLocationHandler)};b.setLocationHandler=function(){b.setLocation()};b.setLocation=function(){var e=this.subLocation.val();this.location.val(e)};b.getSubLocationArray=function(j){var k=[],g=this.locationArray||[],f=null,h=0,e=g.length,m="",l=this.locationHash;if(j){f=l[j];if(f){m=f.parent||"";if(m){f=l[m];k.push(f);for(h=0;h<e;h+=1){f=g[h];if(m===f.parent){k.push(f)}}}else{k.push(f);for(h=0;h<e;h+=1){f=g[h];m=f.parent||"";if(m===j){k.push(f)}}}}}if(k.length===0){k=g}return k};b.populate=function(){var h=this.locationArray||[],l=this.location||{},e=l.val(),n=this.getSubLocationArray(e),p="",o,j,q,f=0,m="",k="",g=[];o={input:l,objectArray:h,showCode:false};SKYSALES.Util.populate(o);o={input:this.subLocation,objectArray:n,showCode:false};SKYSALES.Util.populate(o);p=l.val();this.subLocation.val(p);g=[];for(f=1;f<32;f+=1){m=f;k=f;if(k<10){k="0"+k}g[f]={code:k,name:m}}o={input:this.startDay,objectArray:g};SKYSALES.Util.populate(o);o={input:this.endDay,objectArray:g};SKYSALES.Util.populate(o);q=this.getMonthYearOptions(this.startMonthCount);this.addOptions(this.startMonthYear[0],q);q=this.getMonthYearOptions(this.endMonthCount);this.addOptions(this.endMonthYear[0],q);j={sourceCode:this.sourceCodeDropDown,sortBy:this.sortByDropDown};this.populateFromAvailabilityRequest(j)};b.populateFromAvailabilityRequest=function(e){e=e||{};var g=this.availabilityRequest||{},h,l,f,k,m,j=SKYSALES.Util.populate;for(m in e){if(e.hasOwnProperty(m)){k=e[m];l=g[m]||{};f=l.options;if(f){h={input:k,objectArray:f};j(h)}}}};b.getMonthYearOptions=function(g){g=g||12;g=parseInt(g,10);var e=[],r=new Date(),q=this.dateDelimiter,j=0,o,p,n,m,l,k,f=Option,h=d.dateCultureInfo.monthNames||[];r.setDate(1);for(j=0;j<g;j+=1){n=r.getFullYear();m=r.getMonth();l=m+1;if(l<10){l="0"+l}o=n+q+l;p=h[m]+" "+n;k=new f(p,o);e.push(k);r.setMonth(m+1)}return e};b.setTextValuesHandler=function(){b.setTextValues()};b.setTextValues=function(){var e,j,h,g,f;h=this.startMonthYear.val();g=this.startDay.val();f=h+this.dateDelimiter+g;e=SKYSALES.Util.parseIsoDate(f);if(e){e=SKYSALES.Util.dateToIsoString(e);this.startDate.val(e)}h=this.endMonthYear.val();g=this.endDay.val();f=h+this.dateDelimiter+g;j=SKYSALES.Util.parseIsoDate(f);if(j){j=SKYSALES.Util.dateToIsoString(j);this.endDate.val(j)}this.location.val(this.locationDropDown.val());this.sourceCode.val(this.sourceCodeDropDown.val());this.sortBy.val(this.sortByDropDown.val())};b.setDropDownValuesHandler=function(){b.setDropDownValues()};b.setDropDownValues=function(){var f,h,m,g,k,j,l,e,n=this.dateDelimiter;e=this.startDate.val();f=SKYSALES.Util.parseIsoDate(e);if(f){m=f.getDate();g=m;if(g<10){g="0"+g}k=f.getMonth();j=k;j+=1;if(j<10){j="0"+j}l=f.getFullYear();this.startDay.val(g);this.startMonthYear.val(l+n+j)}e=this.endDate.val();h=SKYSALES.Util.parseIsoDate(e);if(h){m=h.getDate();g=m;if(g<10){g="0"+g}k=h.getMonth();j=k;j+=1;if(j<10){j="0"+j}l=h.getFullYear();this.endDay.val(g);this.endMonthYear.val(l+n+j)}this.locationDropDown.val(this.location.val());this.sourceCodeDropDown.val(this.sourceCode.val());this.sortByDropDown.val(this.sortBy.val())};b.setVars=function(){b.location=this.getById(this.locationId);b.locationDropDown=this.getById(this.locationDropDownId);b.subLocation=this.getById(this.subLocationId);b.sourceCodeArray=this.sourceCodeInfo.SourceList||[];b.sourceCode=this.getById(this.sourceCodeId);b.sourceCodeDropDown=this.getById(this.sourceCodeDropDownId);b.startDate=this.getById(this.startDateId);b.startDay=this.getById(this.startDayId);b.startMonthYear=this.getById(this.startMonthYearId);b.endDate=this.getById(this.endDateId);b.endDay=this.getById(this.endDayId);b.endMonthYear=this.getById(this.endMonthYearId);b.sortBy=this.getById(this.sortById);b.sortByDropDown=this.getById(this.sortByDropDownId)};b.init=function(e){this.setSettingsByObject(e);this.setVars();this.populate();this.addEvents();this.setDropDownValues()};return b};SKYSALES.Class.Aos=function(){var e=new SKYSALES.Class.AosBase(),d=SKYSALES.Util.extendObject(e),b=null,f="",c="";d.showText="";d.hideText="";d.showHideTextEventId="";d.showHideImgEventId="";d.showHideImgUp="";d.showHideImgDown="";d.aosKey="";d.itemArray=[];d.aosAvailability=null;d.showHandler=function(){d.show()};d.hideHandler=function(){d.hide()};d.show=function(){b.show();c.html(this.hideText);f.attr("src",this.showHideImgUp)};d.hide=function(){b.hide();c.html(this.showText);f.attr("src",this.showHideImgDown)};d.addEvents=function(){f.attr("src",this.showHideImgDown);c.html(this.showText);b.hide();c.toggle(this.showHandler,this.hideHandler);f.toggle(this.showHandler,this.hideHandler)};d.setVars=function(){e.setVars.call(this);b=this.getById(this.containerId);f=this.getById(this.showHideImgEventId);c=this.getById(this.showHideTextEventId)};d.initItemArray=function(){var l,j=this.itemArray||[],h=j.length,m,g,k;for(l=0;l<h;l+=1){g=j[l];k={aosKey:this.aosKey,itemKeyId:g.itemKeyId,inputId:g.inputId,aos:this};m=new SKYSALES.Class.AosItem();m.init(k);j[l]=m}};d.updateKeyValues=function(g){this.aosAvailability.updateKeyValues(this,g)};d.init=function(g){this.setSettingsByObject(g);this.setVars();this.initItemArray();this.addEvents()};return d};SKYSALES.Class.AosItem=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.aosKey="";b.aos=null;b.inputId="";b.input=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){b.input=this.getById(this.inputId)};b.addEvents=function(){this.input.change(this.updateKeyValuesHandler)};b.updateKeyValuesHandler=function(){b.updateKeyValues()};b.updateKeyValues=function(){this.aos.updateKeyValues(this)};return b};SKYSALES.Class.TermsAndConditionsBase=function(){var e=new SKYSALES.Class.AosBase(),c=SKYSALES.Util.extendObject(e),b={},d="$";c.showHideId="";c.showHide=null;c.inputId="";c.input=null;c.url="";c.clientName="";c.setVars=function(){e.setVars.call(this);c.showHide=this.getById(c.showHideId);c.input=this.getById(c.inputId)};c.sendRequest=function(){$.post(c.url,b,c.updateDom)};c.updateDom=function(f){if(c.container){c.container.html(f);c.show("slow")}};c.showTermsAndConditions=function(){var f=c.input.attr("name");f=c.clientName+d+f;b[f]=1;b[c.clientName+d+"AjaxControlPrefix"]=c.clientName;b.__EVENTTARGET=c.clientName+d+"OnTermsAndConditions";c.sendRequest()};c.addEvents=function(){e.addEvents.call(this);c.showHide.click(c.showTermsAndConditions)};c.init=function(f){e.init.call(this,f);c.addEvents()};return c};SKYSALES.Class.Cancel=function(){var c=new SKYSALES.Class.AosBase(),b=SKYSALES.Util.extendObject(c);b.cancelLinkId="";b.cancelInputId="";b.cancelButtonName="";b.container=null;b.cancelLink="";b.cancelInput="";b.policiesToggleViewParams=null;b.policiesToggleView=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){var e=this.getById(this.cancelLinkId),d=this.getById(this.cancelInputId),f=null;if(this.policiesToggleViewParams){f=new SKYSALES.Class.ToggleView();f.init(this.policiesToggleViewParams);b.policiesToggleView=f}if(e){b.cancelLink=$(e)}if(d){b.cancelInput=$(d)}};b.addEvents=function(){c.addEvents.call(this);if(this.cancelLink){this.cancelLink.click(this.cancelDataHandler)}if(this.cancelInput){this.cancelInput.click(this.cancelDataHandler)}};b.cancelDataHandler=function(){b.cancel()};b.cancel=function(){this.cancelInput.val("1");window.__doPostBack(this.cancelButtonName)};return b};SKYSALES.Class.ActivitySearch=function(){var b=new SKYSALES.Class.AosSearch(),c=SKYSALES.Util.extendObject(b);c.init=function(d){this.setSettingsByObject(d);this.setVars();this.populate();this.addEvents();this.setDropDownValues()};c.setVars=function(){b.setVars.call(this);var d=SKYSALES.Util.getResource();c.locationHash=d.activityLocationHash||{};c.locationArray=d.activityLocationArray||[]};return c};SKYSALES.Class.ActivityAvailability=function(){var b=new SKYSALES.Class.AosAvailability(),c=SKYSALES.Util.extendObject(b);c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initActivityArray()};c.initActivityArray=function(){var f,j=this.aosArray||[],d=j.length,h,g,e;for(f=0;f<d;f+=1){g=j[f];e={showText:this.showText,hideText:this.hideText,showHideImgUp:this.imgUp,showHideImgDown:this.imgDown,containerId:g.aosId,showHideTextEventId:g.textId,showHideImgEventId:g.imgId,groupArray:g.groupArray,aosAvailability:this};h=new SKYSALES.Class.Activity();h.init(e);j[f]=h}};return c};SKYSALES.Class.Activity=function(){var c=new SKYSALES.Class.Aos(),b=SKYSALES.Util.extendObject(c);b.groupArray=[];b.hideAllGroups=function(){var f=0,g=null,e=this.groupArray||[],d=e.length;for(f=0;f<d;f+=1){g=e[f];g.hide()}};b.initGroupArray=function(){var h,f=this.groupArray||[],d=f.length,j,e,g;for(h=0;h<d;h+=1){e=f[h];g={containerId:e.containerId,inputId:e.inputId,itemArray:e.itemArray,aos:this};j=new SKYSALES.Class.AosGroup();j.init(g);f[h]=j}};b.showHandler=function(){b.show()};b.hideHandler=function(){b.hide()};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initGroupArray();this.hideAllGroups()};return b};SKYSALES.Class.AosGroup=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.aos=null;c.itemArray=[];c.inputId="";c.input=null;c.updateGroupHandler=function(){c.updateGroup()};c.updateGroup=function(){this.aos.hideAllGroups();var d=this.input.val();this.getById(d).show()};c.show=function(){var f,e=this.itemArray||[],d=e.length,g;for(f=0;f<d;f+=1){g=e[f];g.input.val(0)}b.show.call(this);this.updateGroup()};c.addEvents=function(){b.addEvents.call(this);this.input.change(this.updateGroupHandler)};c.setVars=function(){b.setVars.call(this);c.input=this.getById(this.inputId)};c.initItemArray=function(){var h,f=this.itemArray||[],e=f.length,j,d,g;for(h=0;h<e;h+=1){d=f[h];g={aosKey:this.aosKey,itemKeyId:d.itemKeyId,inputId:d.inputId,quantityId:d.quantityId,quantityMax:d.quantityMax,soldOutId:d.soldOutId,group:this,aos:this.aos};j=new SKYSALES.Class.ActivityItem();j.init(g);f[h]=j}};c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.initItemArray()};return c};SKYSALES.Class.ActivityItem=function(){var c=new SKYSALES.Class.AosItem(),b=SKYSALES.Util.extendObject(c);b.group=null;b.quantityMax=5;b.quantityId="";b.quantity=null;b.soldOutId="";b.soldOut=null;b.getQuantityOptions=function(){var f=0,g=null,d=[],e=this.quantityMax;for(f=1;f<=e;f+=1){g={name:f,code:f};d.push(g)}return d};b.populateQuantity=function(){var d=this.getQuantityOptions(),e={input:this.quantity,objectArray:d};SKYSALES.Util.populate(e)};b.setVars=function(){c.setVars.call(this);b.quantity=this.getById(this.quantityId);b.soldOut=this.getById(this.soldOutId)};b.showSoldOut=function(){this.soldOut.hide();if(this.quantityMax===0){this.quantity.hide();this.soldOut.show()}};b.updateKeyValuesHandler=function(){};b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.populateQuantity();this.showSoldOut()};return b};SKYSALES.Class.PaxTypeControl=function(){var b=new SKYSALES.Class.AosBase(),c=SKYSALES.Util.extendObject(b);c.controlId="";c.control=null;c.paxTypeDropDownControl="";c.dropDownControlId="";c.paxInfoMaxQuantity="";c.paxInfoQuantity="";c.childAgesContainerId="";c.childAgesContainer=null;c.childAgesDropDownsContainerId="";c.childAgesDropDownsContainer=null;c.childAgesDropDownTemplateId="";c.childAgesDropDownTemplate=null;c.childLabelTemplateId="";c.childLabelTemplate=null;c.childDropDownBaseId="";c.clientId="";c.selectedAges="";c.minChildAge=1;c.maxChildAge=18;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.initializeDropDowns(0,this.paxInfoMaxQuantity,this.paxInfoQuantity,this.paxTypeDropDownControl);this.addEvents();this.setTextValues();if(this.dropDownControlId.indexOf("CHD")>-1){this.initializeSelectedChildAgeDropDowns();this.paxTypeDropDownControl.change()}};c.setVars=function(){b.setVars.call(this);c.control=this.getById(this.controlId);c.paxTypeDropDownControl=this.getById(this.dropDownControlId);if(this.dropDownControlId.indexOf("CHD")>-1){c.childAgesContainer=this.getById(this.childAgesContainerId);c.childAgesDropDownsContainer=this.getById(this.childAgesDropDownsContainerId);c.childAgesDropDownTemplate=this.getById(this.childAgesDropDownTemplateId);c.childLabelTemplate=this.getById(this.childLabelTemplateId)}};c.initializeDropDowns=function(g,h,f,k){var e=0,j={},d=[];if(h<g||!k){return}f+="";for(e=g;e<=h;e+=1){d[e]={code:e,name:e}}j={input:k,objectArray:d,selectedItem:f};SKYSALES.Util.populate(j)};c.setTextValuesHandler=function(){c.setTextValues()};c.setTextValues=function(){this.control.val(this.paxTypeDropDownControl.val())};c.setDropDownValuesHandler=function(){c.setDropDownValues()};c.setDropDownValues=function(){this.paxTypeDropDownControl.val(this.control.val())};c.addEvents=function(){b.addEvents.call(this);this.control.change(this.setDropDownValuesHandler);this.paxTypeDropDownControl.change(this.setTextValuesHandler);if(this.dropDownControlId.indexOf("CHD")>-1){this.paxTypeDropDownControl.change(this.addChildDropDownListsHandler)}};c.initializeSelectedChildAgeDropDowns=function(){var j=this.selectedAges.split(",")||[],d=j.length,f=0,e=this.childLabelTemplate.text(),g=null,h="";for(f=0;f<d;f+=1){if(j[f]>0&&j[f].toString().length>0){e+=this.getChildAgeHtml(f)}}if(d&&j[0]){this.childAgesDropDownsContainer.html(e)}for(f=0;f<d;f+=1){h=this.childDropDownBaseId+f;g=this.getById(h);if(g){this.initializeDropDowns(this.minChildAge,this.maxChildAge,j[f],g);SKYSALES.Util.setRequiredAttribute(g);this.addChildDropDownEvents(g)}}this.updateChildAges()};c.addChildDropDownListsHandler=function(){var d=this.value;c.addChildDropDownLists(d)};c.addChildDropDownLists=function(d){var f=0,e=this.childLabelTemplate.text(),h="",g={};d=d||0;d=parseInt(d,10);for(f=0;f<d;f+=1){e+=this.getChildAgeHtml(f)}if(d){this.childAgesDropDownsContainer.html(e)}else{this.childAgesDropDownsContainer.html("")}for(f=0;f<d;f+=1){h=this.childDropDownBaseId+f;g=this.getById(h)||{};this.initializeDropDowns(this.minChildAge,this.maxChildAge,g.val(),g);SKYSALES.Util.setRequiredAttribute(g);this.addChildDropDownEvents(g)}this.childAgesContainer.val("")};c.getChildAgeHtml=function(d){var e="";e=this.childAgesDropDownTemplate.text();e=e.replace(/\[childAgeDropDownLabel\]/,d);e=e.replace(/\[childAgedropDownId\]/g,d);e=e.replace(/\[childAgedropDownName\]/,d);e=e.replace(/\[childIndex\]/,d+1);e=e.replace(/\[clientId\]/g,this.clientId);return e};c.addChildDropDownEvents=function(d){d.change(this.updateChildAgesHandler)};c.updateChildAgesHandler=function(d){c.updateChildAges(d)};c.updateChildAges=function(e){var g=0,f=null,h="",d=[],j=0;d=$("[id^='"+this.childDropDownBaseId+"'] option:selected");j=d.length;for(g=0;g<j;g+=1){f=d[g];if(g===j-1){h+=f.text}else{h+=f.text+","}}this.childAgesContainer.val(h)};return c};SKYSALES.Class.HotelSearch=function(){var c=new SKYSALES.Class.AosSearch(),b=SKYSALES.Util.extendObject(c);b.rooms="";b.roomsDropDown="";b.roomsDropDownId="";b.roomCount=1;b.roomsId="";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.populate();this.addEvents();this.setDropDownValues()};b.populate=function(){c.populate.call(this);var d=this.populateOptions(this.roomCount,1);this.addOptions(this.roomsDropDown[0],d)};b.setVars=function(){c.setVars.call(this);var d=SKYSALES.Util.getResource();b.locationHash=d.hotelLocationHash||{};b.locationArray=d.hotelLocationArray||[];b.rooms=this.getById(this.roomsId);b.roomsDropDown=this.getById(this.roomsDropDownId)};b.populateOptions=function(d,h){h=h||0;d=d||10;var f=[],g=h,j,e=Option;for(g=h;g<=d;g+=1){j=new e(g,g);f.push(j)}return f};b.setTextValuesHandler=function(){b.setTextValues()};b.setTextValues=function(){c.setTextValues.call(this);this.rooms.val(this.roomsDropDown.val())};b.setDropDownValuesHandler=function(){b.setDropDownValues()};b.setDropDownValues=function(){c.setDropDownValues.call(this);this.roomsDropDown.val(this.rooms.val())};b.addEvents=function(){c.addEvents.call(this);this.rooms.change(this.setDropDownValuesHandler);this.roomsDropDown.change(this.setTextValuesHandler)};return b};SKYSALES.Class.TermsAndConditions=function(){var c=new SKYSALES.Class.TermsAndConditionsBase(),b=SKYSALES.Util.extendObject(c);return b};SKYSALES.Class.CarSearch=function(){var c=new SKYSALES.Class.AosSearch(),b=SKYSALES.Util.extendObject(c);b.categoryId="";b.categoryDropDownId="";b.category=null;b.categoryDropDown=null;b.doorId="";b.doorDropDownId="";b.door=null;b.doorDropDown=null;b.sizeId="";b.sizeDropDownId="";b.size=null;b.sizeDropDown=null;b.transmissionId="";b.transmissionDropDownId="";b.transmission=null;b.transmissionDropDown=null;b.vendorsId="";b.vendorSelectId="";b.vendors=null;b.vendorSelect=null;b.vendorEventTarget="";b.locationDropOffId="";b.locationDropOffDropDownId="";b.subLocationDropOffId="";b.locationDropOff=null;b.locationDropOffDropDown=null;b.subLocationDropOff=null;b.pickUpTimeId="";b.pickUpTimeDropDownId="";b.pickUpTime=null;b.pickUpTimeDropDown=null;b.dropOffTimeId="";b.dropOffTimeDropDownId="";b.dropOffTime=null;b.dropOffTimeDropDown=null;b.air=null;b.airDropDown=null;b.airDropDownId="";b.airId="";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.populate();this.addEvents();this.setDropDownValues()};b.populateVendors=function(){var j=SKYSALES.Util.getResource()||{},g=j.carInfo||{},k=g.vendors||[],h=[],f={},e=0,d=k.length,l=null;for(e=0;e<d;e+=1){l=k[e];if(l.name){h.push(l)}}f={objectArray:h,input:this.vendorSelect,clearOptions:false};SKYSALES.Util.populate(f)};b.populate=function(){c.populate.call(this);var e=this.locationArray||[],h,d,j=this.locationDropOff,f=j.val(),l=this.subLocationDropOff,g=this.getSubLocationArray(f),k="";h={input:j,objectArray:e,showCode:false};SKYSALES.Util.populate(h);h={input:l,objectArray:g,showCode:false};SKYSALES.Util.populate(h);k=j.val();l.val(k);this.populateVendors();d={air:this.airDropDown,door:this.doorDropDown,category:this.categoryDropDown,transmission:this.transmissionDropDown,size:this.sizeDropDown,pickUpTime:this.pickUpTimeDropDown,dropOffTime:this.dropOffTimeDropDown};this.populateFromAvailabilityRequest(d)};b.setVars=function(){c.setVars.call(this);var d=SKYSALES.Util.getResource();b.locationHash=d.carLocationHash||{};b.locationArray=d.carLocationArray||[];b.locationDropOff=this.getById(this.locationDropOffId);b.locationDropOffDropDown=this.getById(this.locationDropOffDropDownId);b.subLocationDropOff=this.getById(this.subLocationDropOffId);b.category=this.getById(this.categoryId);b.categoryDropDown=this.getById(this.categoryDropDownId);b.door=this.getById(this.doorId);b.doorDropDown=this.getById(this.doorDropDownId);b.size=this.getById(this.sizeId);b.sizeDropDown=this.getById(this.sizeDropDownId);b.transmission=this.getById(this.transmissionId);b.transmissionDropDown=this.getById(this.transmissionDropDownId);b.vendors=this.getById(this.vendorsId);b.vendorSelect=this.getById(this.vendorSelectId);b.pickUpTime=this.getById(this.pickUpTimeId);b.pickUpTimeDropDown=this.getById(this.pickUpTimeDropDownId);b.dropOffTime=this.getById(this.dropOffTimeId);b.dropOffTimeDropDown=this.getById(this.dropOffTimeDropDownId);b.air=this.getById(this.airId);b.airDropDown=this.getById(this.airDropDownId)};b.setTextValuesHandler=function(){b.setTextValues()};b.setTextValues=function(){c.setTextValues.call(this);this.locationDropOff.val(this.locationDropOffDropDown.val());this.category.val(this.categoryDropDown.val());this.door.val(this.doorDropDown.val());this.size.val(this.sizeDropDown.val());this.transmission.val(this.transmissionDropDown.val());this.vendors.val(this.vendorSelect.val());this.pickUpTime.val(this.pickUpTimeDropDown.val());this.dropOffTime.val(this.dropOffTimeDropDown.val());this.sourceCode.val(this.sourceCodeDropDown.val());this.air.val(this.airDropDown.val())};b.setDropDownValuesHandler=function(){b.setDropDownValues()};b.setDropDownValues=function(){c.setDropDownValues.call(this);this.locationDropOffDropDown.val(this.locationDropOff.val());this.categoryDropDown.val(this.category.val());this.doorDropDown.val(this.door.val());this.sizeDropDown.val(this.size.val());this.transmissionDropDown.val(this.transmission.val());this.vendorSelect.val(this.vendors.val());this.pickUpTimeDropDown.val(this.pickUpTime.val());this.dropOffTimeDropDown.val(this.dropOffTime.val());this.sourceCodeDropDown.val(this.sourceCode.val());this.airDropDown.val(this.air.val());this.sortByDropDown.val(this.sortBy.val())};b.setVendorsHandler=function(){b.setVendors()};b.setVendors=function(){this.setTextValues();this.doPostBack()};b.addEvents=function(){c.addEvents.call(this);this.locationDropOff.change(this.setDropDownValuesHandler);this.locationDropOffDropDown.change(this.setTextValuesHandler);this.subLocationDropOff.change(this.setLocationHandler);this.category.change(this.setDropDownValuesHandler);this.categoryDropDown.change(this.setTextValuesHandler);this.door.change(this.setDropDownValuesHandler);this.doorDropDown.change(this.setTextValuesHandler);this.size.change(this.setDropDownValuesHandler);this.sizeDropDown.change(this.setTextValuesHandler);this.transmission.change(this.setDropDownValuesHandler);this.transmissionDropDown.change(this.setTextValuesHandler);this.vendors.change(this.setDropDownValuesHandler);this.vendorSelect.change(this.setVendorsHandler);this.pickUpTime.change(this.setDropDownValuesHandler);this.pickUpTimeDropDown.change(this.setTextValuesHandler);this.dropOffTime.change(this.setDropDownValuesHandler);this.dropOffTimeDropDown.change(this.setTextValuesHandler);this.air.change(this.setDropDownValuesHandler);this.airDropDown.change(this.setTextValuesHandler);this.subLocationDropOff.change(this.setLocationDropOffHandler)};b.setLocationDropOffHandler=function(){b.setLocationDropOff()};b.setLocationDropOff=function(){var d=this.subLocationDropOff.val();this.locationDropOff.val(d)};b.doPostBack=function(){var d=this.vendorEventTarget;window.__doPostBack(d,"")};b.getVendorOptions=function(j){j=j||[];var f=[],h,e=Option,g,d=j.length,k;for(g=0;g<d;g+=1){k=j[g];h=new e(k.description,k.vendorCode);f.push(h)}return f};return b};SKYSALES.Class.AosAvailability=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.showText="";b.hideText="";b.imgUp="";b.imgDown="";b.aosKeyId="";b.aosKey="";b.aosItemId="";b.aosItem="";b.seperator="";b.aosArray=[];b.init=function(d){this.setSettingsByObject(d);this.setVars();this.initAosArray()};b.setVars=function(d){b.aosKey=this.getById(this.aosKeyId);b.aosItem=this.getById(this.aosItemId)};b.initAosArray=function(){var h,j=this.aosArray||[],d=j.length,g,f,e;for(h=0;h<d;h+=1){f=j[h];e={showText:this.showText,hideText:this.hideText,showHideImgUp:this.imgUp,showHideImgDown:this.imgDown,containerId:f.aosId,showHideTextEventId:f.textId,showHideImgEventId:f.imgId,itemArray:f.itemArray,aosAvailability:this};g=new SKYSALES.Class.Aos();g.init(e);j[h]=g}};b.updateKeyValues=function(h,e){var g=e.input.val()||"",f=g.split(this.seperator)||[],d=f.length;if(d>0){this.aosKey.val(f[0])}if(d>1){this.aosItem.val(f[1])}};return b};SKYSALES.Class.PassengerTypeDropDowns=function(){var d=new SKYSALES.Class.SkySales(),e=SKYSALES.Util.extendObject(d),f,c,b;e.passengerTypes={};e.maximumPassengersPerType=7;e.passengerTypeDropDownArray=[];e.passengerTypesCountHash={};e.setVars=function(g){f=this.getById("tripPlannerPassengerTypeTemplateId");c=this.getById("tripPlannerPassengerTypesContainer")};e.getHtml=function(){var h=f.text(),m="",g="",k=this.passengerTypes,j="",l="",n={};for(l in k){if(k.hasOwnProperty(l)){n=k[l];j=n.name;m=h.replace(/\[key\]/g,l);m=m.replace(/\[name\]/g,j);g+=m}}return g};e.getPassengerTypeArray=function(){var g=[],h=0,j=this.maximumPassengersPerType;for(h=0;h<=j;h+=1){g[h]={code:h,name:h}}return g};e.populatePassengerTypeDropDown=function(h,j){var k=$("#paxTypeCountDictionary_"+h),g={input:k,objectArray:b,selectedItem:j};SKYSALES.Util.populate(g);e.passengerTypeDropDownArray.push(k)};e.populatePassengerTypeDropDowns=function(){var g=this.passengerTypes,l=this.passengerTypesCountHash,k=0,h="",j={};b=this.getPassengerTypeArray();for(h in g){if(g.hasOwnProperty(h)){j=g[h];k=l[h];e.populatePassengerTypeDropDown(h,k)}}};e.draw=function(){var g="";g=this.getHtml();c.html(g)};e.init=function(g){this.setSettingsByObject(g);this.setVars();this.draw();this.populatePassengerTypeDropDowns()};return e};SKYSALES.Class.TripPlannerSearchFlight=function(){var h=new SKYSALES.Class.SkySales(),f=SKYSALES.Util.extendObject(h),d="tripFlight_0",b="tripIsUnavailable_0",l="tripHasNoFares_0",k="",c="",j="",e="",g="";f.index=0;f.tripFlightTemplateHtml="";f.tripPlannerSearchFlights={};f.market={};f.flightDate=new Date();f.container={};f.fullDateFormatString="yy-mm-dd";f.tripIsUnavailable={};f.tripHasNoFares={};f.datePickerManager={};f.lowFare={};f.lowFareDom={};f.origin="";f.originInput={};f.originInputDom={};f.destination="";f.destinationInput={};f.destinationInputDom={};f.dayInput={};f.yearMonthInput={};f.flightLabel={};f.closeButton={};f.selectedClass="tpSelectedFlight";f.journeyFareSellKey="";f.setVars=function(){var o=this.tripPlannerSearchFlights.tripPlannerSearch,r=o.flightContainerIdFormat,m=o.tripIsUnavailableIdFormat,p=o.tripHasNoFaresIdFormat,q=o.lowFareIdFormat,n=o.originStationIdFormat,t=o.destinationStationIdFormat,u=o.flightLabelIdFormat,s=o.closeFlightButtonIdFormat;d=r.replace("[index]",this.index);b=m.replace("[index]",this.index);l=p.replace("[index]",this.index);j=q.replace("[index]",this.index);k=n.replace("[index]",this.index);c=t.replace("[index]",this.index);e=u.replace("[index]",this.index);g=s.replace("[index]",this.index)};f.getHtml=function(){var n=this.tripFlightTemplateHtml.replace(/\[index\]/g,this.index),m=this.index+1;n=n.replace(/\[oneBasedIndex\]/g,m);return n};f.draw=function(){var m=this.tripPlannerSearchFlights.tripFlightsContainer,n=this.getHtml();m.append(n)};f.setVarsAfterDrawAndInitMarket=function(){f.container=this.getById(d);f.tripIsUnavailable=this.getById(b);f.tripHasNoFares=this.getById(l);f.lowFare=this.getById(j);f.lowFareDom=this.lowFare[0];f.originInput=this.getById(k);f.originInputDom=this.originInput[0];f.flightLabel=this.getById(e);this.originInput.val(this.origin);f.destinationInput=this.getById(c);f.destinationInputDom=this.destinationInput[0];this.destinationInput.val(this.destination);f.closeButton=this.getById(g)};f.populateFromDom=function(){var m=null,p=this.market||{},o=p.marketDateArray||[],n=null;f.destination=this.destinationInput.val()||"";f.origin=this.originInput.val()||"";if(o.length){n=o[0].marketDate||$([]);m=n.val()||"";m=SKYSALES.Util.parseIsoDate(m)}if(m){f.flightDate=m}};f.initMarket=function(){var s=this.index,r=this.tripPlannerSearchFlights.tripPlannerSearch,m=r.flightSearch,v=r.marketDateIdFormat,t=r.marketDayIdFormat,q=r.marketMonthYearIdFormat,o=v.replace("[index]",s),n=t.replace("[index]",s),w=q.replace("[index]",s),u={},p={marketInputIdArray:[{originId:k,destinationId:c}],stationInputIdArray:[k,c],lowFareAvailabilityArray:[{showId:j,tripPlannerSearchFlight:this,marketDateId:o,originId:k,destinationId:c}],marketDateIdArray:[{marketDateId:o,marketDayId:n,marketMonthYearId:w,useJQueryDatePicker:false,fullDateFormatString:this.fullDateFormatString}]};f.market=new SKYSALES.Class.FlightSearchMarket();f.market.flightSearch=m;f.market.index=s;this.market.init(p);u=this.market.marketDateArray[0].datePickerManager;f.datePickerManager=u;u.datePopulate(this.flightDate);f.dayInput=u.day;f.yearMonthInput=u.yearMonth};f.selectFlight=function(){this.container.addClass(this.selectedClass)};f.unselectFlight=function(){this.container.removeClass(this.selectedClass)};f.selectCurrentFlight=function(){this.tripPlannerSearchFlights.unselectAll();this.selectFlight()};f.focusOrigin=function(){this.originInput.focus()};f.selectCurrentFlightHandler=function(){f.selectCurrentFlight()};f.removeCurrentFlightHandler=function(){f.removeCurrentFlight()};f.reapplyDateBoundsHandler=function(){f.tripPlannerSearchFlights.reapplyDateBounds()};f.removeCurrentFlight=function(){var m=this.tripPlannerSearchFlights,n=m.tripPlannerSearch;if(m){m.removeSelectedFlight(this);n.updateRetainedJourneyFareSellKeys()}};f.requireOriginAndDestination=function(){var m=SKYSALES.Util.setRequiredAttribute;m(this.originInput);m(this.destinationInput)};f.dontRequireOriginAndDestination=function(){var m=SKYSALES.Util.removeRequiredAttribute;m(this.originInput);m(this.destinationInput)};f.validate=function(){this.tripPlannerSearchFlights.dontRequireOriginAndDestinationOnFlights();this.requireOriginAndDestination();return SKYSALES.Util.validate(this.lowFareDom)};f.validateHandler=function(){return f.validate()};f.setNextFlightDestinationToThisFlightOrigin=function(){this.tripPlannerSearchFlights.setNextFlightDestinationToThisFlightOrigin(this)};f.setNextFlightDestinationToThisFlightOriginHandler=function(){f.setNextFlightDestinationToThisFlightOrigin()};f.addEvents=function(){this.container.click(this.selectCurrentFlightHandler);this.closeButton.click(this.removeCurrentFlightHandler);this.originInput.focus(this.selectCurrentFlightHandler);this.yearMonthInput.focus(this.selectCurrentFlightHandler);this.destinationInput.blur(this.setNextFlightDestinationToThisFlightOriginHandler)};f.init=function(m){this.setSettingsByObject(m);this.setVars();this.draw();this.initMarket();this.setVarsAfterDrawAndInitMarket();this.addEvents()};f.reinitializeFlight=function(m){this.setSettingsByObject(m);this.setVars();this.initMarket();this.setVarsAfterDrawAndInitMarket();this.addEvents()};f.showTripIsUnavailable=function(){this.tripIsUnavailable.show()};f.hideTripIsUnavailable=function(){this.tripIsUnavailable.hide()};f.showTripHasNoFares=function(){this.tripHasNoFares.show()};f.hideTripHasNoFares=function(){this.tripHasNoFares.hide()};f.show=function(){this.container.show()};f.hide=function(){this.container.hide()};f.setOrigin=function(m){f.origin=m;this.originInput.val(m)};f.clearStationPair=function(){var m=this.destinationInput.val(),n=this.originInput.val();if(m===""){this.originInput.val("")}if(n===""){this.destinationInput.val("")}};return f};SKYSALES.Class.TripPlannerSearchFlights=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.flightSearch={};c.tripFlightsContainer={};c.tripFlightTemplateHtml="";c.flights=[];c.tripPlannerSearch={};c.numberOfDaysApart=3;c.firstDisplayedFlightIndex=0;c.addFlightId="addFlight";c.removeFlightId="removeFlight";c.scrollLeftArrowId="tpLeftMove";c.scrollRightArrowId="tpRightMove";c.addFlightLink={};c.removeFlightLink={};c.setVars=function(){c.tripFlightsContainer=$("#tripFlightsContainer");c.tripFlightTemplateHtml=$("#tripFlightTemplate").text();c.addFlightLink=this.getById(this.addFlightId);c.removeFlightLink=this.getById(this.removeFlightId);c.scrollLeftArrow=this.getById(this.scrollLeftArrowId);c.scrollRightArrow=this.getById(this.scrollRightArrowId)};c.getPreviousFlightDate=function(e){var d=new Date(),f={};if(e>0){f=this.flights[e-1];d=f.datePickerManager.getDate()}return d};c.setJsonOriginToPreviousFlightDestination=function(d,f){var e,g="";if(d>0){e=this.flights[d-1];g=e.destinationInput.val();if(g!==""){f.origin=g}}return f};c.setNextFlightDestinationToThisFlightOrigin=function(f){var e=f.index,d={};if(e<(this.flights.length-1)){d=this.flights[e+1];d.setOrigin(f.destinationInput.val())}};c.addFlightWithIndex=function(e){var f=new SKYSALES.Class.TripPlannerSearchFlight(),d=this.getPreviousFlightDate(e),g=d,h={},j=this.tripPlannerSearch.controlGroupId||"";g.setDate(d.getDate()+this.numberOfDaysApart);h={tripFlightTemplateHtml:this.tripFlightTemplateHtml.replace(/\[controlGroupId\]/g,j),tripPlannerSearchFlights:this,index:e,flightDate:g};h=this.setJsonOriginToPreviousFlightDestination(e,h);f.init(h);c.flights[e]=f};c.toggleAddRemoveLinks=function(){var d=this.flights.length;if(d===1){this.removeFlightLink.hide();this.addFlightLink.show()}else{if(d===12){this.removeFlightLink.show();this.addFlightLink.hide()}else{this.removeFlightLink.show();this.addFlightLink.show()}}};c.addFlight=function(){var d=this.flights.length;this.addFlightWithIndex(d);this.showLast4Flights();this.toggleAddRemoveLinks();this.toggleRemoveFlightLabel();this.toggleScrollArrows()};c.removeFlight=function(){var e=this.tripPlannerSearch,f=this.flights.length-1,d=this.flights[f];d.container.remove();this.flights.splice(f,1);if(e){e.updateRetainedJourneyFareSellKeys()}this.showLast4Flights();this.toggleAddRemoveLinks();this.toggleRemoveFlightLabel();this.toggleScrollArrows()};c.removeSelectedFlight=function(d){var f=this.flights,g=0,e=0;if(d){e=d.index;d.container.remove();f.splice(d.index,1);g=f.length;this.tripFlightsContainer.hide();this.reinitializeAndRedrawFlights();if(g-e<=4){this.showLast4Flights()}else{if(e<4){this.show4FlightsFromIndex(0)}else{this.show4FlightsFromIndex(e)}}this.tripFlightsContainer.show();this.toggleScrollArrows();this.toggleRemoveFlightLabel();this.toggleAddRemoveLinks();this.flights=f}};c.reinitializeAndRedrawFlights=function(){var g=0,e=this.flights,d={},j=e.length,h=[],k={},f="",l=this.tripPlannerSearch.controlGroupId||"";for(g=0;g<j;g+=1){d=e[g];d.index=g;d.populateFromDom();k={destination:d.destination,flightDate:d.flightDate,index:d.index,origin:d.origin,tripFlightTemplateHtml:d.tripFlightTemplateHtml.replace(/\[controlGroupId\]/g,l),tripPlannerSearchFlights:d.tripPlannerSearchFlights,journeyFareSellKey:d.journeyFareSellKey};h.push(k);f=f+d.getHtml()}this.tripFlightsContainer.html(f);for(g=0;g<j;g+=1){d=e[g];d.reinitializeFlight(h[g]);e[g]=d}this.flights=e};c.toggleRemoveFlightLabel=function(){var e=this.flights,f=e.length,d={};if(f>1){d=e[0];d.closeButton.show()}if(f===1){d=e[0];d.closeButton.hide()}};c.addFlightHandler=function(){c.addFlight()};c.removeFlightHandler=function(){c.removeFlight()};c.unselectAll=function(){var f=this.flights.length,e=0,d={};for(e=0;e<f;e+=1){d=this.flights[e];d.unselectFlight()}};c.parseDate=function(j){var f=j.split("-"),d=f[0],e=f[1],h=f[2],g=new Date(d,e-1,h);return g};c.addFlightFromViewModel=function(e,d){var f=new SKYSALES.Class.TripPlannerSearchFlight(),k=this.tripPlannerSearch.controlGroupId||"",g=d.departureDate,h=this.parseDate(g),j={tripFlightTemplateHtml:this.tripFlightTemplateHtml.replace(/\[controlGroupId\]/g,k),tripPlannerSearchFlights:this,index:e,flightDate:h,origin:d.originStation,destination:d.destinationStation,journeyFareSellKey:this.tripPlannerSearch.originalJourneyFareSellKeys[e]||""};f.init(j);c.flights[e]=f};c.selectFirstFlight=function(){var d=this.flights[0];d.selectCurrentFlight();d.focusOrigin()};c.initFlights=function(){var e=0,g=this.tripPlannerSearch.dateMarkets,f=g.length,d={};for(e=0;e<f;e+=1){d=g[e];this.addFlightFromViewModel(e,d)}this.show4FlightsFromIndex(0);this.toggleAddRemoveLinks();this.toggleScrollArrows();this.selectFirstFlight()};c.toggleScrollArrows=function(){var d=this.flights.length,e=this.firstDisplayedFlightIndex;if(d<=4){this.scrollLeftArrow.hide();this.scrollRightArrow.hide()}else{if(e===0){this.scrollLeftArrow.hide();this.scrollRightArrow.show()}else{if(e===d-4){this.scrollLeftArrow.show();this.scrollRightArrow.hide()}else{this.scrollLeftArrow.show();this.scrollRightArrow.show()}}}};c.scrollLeft=function(){this.show4FlightsFromIndex(this.firstDisplayedFlightIndex-1);this.toggleScrollArrows()};c.scrollRight=function(){var d=this.flights.length;this.show4FlightsFromIndex(this.firstDisplayedFlightIndex+1,d);this.toggleScrollArrows()};c.scrollLeftHandler=function(){c.scrollLeft()};c.scrollRightHandler=function(){c.scrollRight()};c.addEvents=function(){this.addFlightLink.click(this.addFlightHandler);this.removeFlightLink.click(this.removeFlightHandler);this.scrollLeftArrow.click(this.scrollLeftHandler);this.scrollRightArrow.click(this.scrollRightHandler)};c.init=function(d){this.setSettingsByObject(d);this.setVars();this.initFlights();this.toggleRemoveFlightLabel();this.addEvents()};c.show4FlightsFromIndex=function(e,h){var g=h||this.flights.length,f=e+3,d=0;for(d=0;d<g;d+=1){if((d>=e)&&(d<=f)){this.flights[d].show()}else{this.flights[d].hide()}}c.firstDisplayedFlightIndex=e};c.showLast4Flights=function(){var e=this.flights.length,d=0;if(e>3){d=e-4;this.show4FlightsFromIndex(d,e)}};c.validateDateBounds=function(){var j=0,n=this.flights,k=n.length,h=k-1,q={},o=new Date(),g=new Date(),p=new Date(),f={},m={},d={},e={},l={};g.setDate(o.getDate()-1);p.setYear(o.getFullYear()+1);f=g;for(j=0;j<k;j+=1){q=n[j];if(j>0){d=n[j-1];f=d.datePickerManager.getDate()}if(j===h){m=p}else{e=n[j+1];m=e.datePickerManager.getDate()}l=q.datePickerManager;l.setBeginDateBound(f);l.setEndDateBound(m);l.datePopulate()}};c.dontRequireOriginAndDestinationOnFlights=function(){var f=this.flights||[],g=f.length,e=0,d={};for(e=1;e<g;e+=1){d=f[e];d.dontRequireOriginAndDestination()}};c.firstFlightRequireOriginAndDestination=function(){var e=this.flights,d=e[0];this.dontRequireOriginAndDestinationOnFlights();d.requireOriginAndDestination()};c.clearIncompleteFlights=function(){var d={},f=this.flights,g=f.length,e=0;for(e=0;e<g;e+=1){d=f[e];d.clearStationPair()}};return c};SKYSALES.Class.TripPlannerSearch=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.controlGroupId="";b.flightSearchJson={};b.flightSearch={};b.tripPlannerSearchDataJson={};b.preferredFareDropDownId="preferredFareDropDown";b.passengerDiscountDropDownId="passengerDiscountDropDown";b.flightContainerIdFormat="tripFlight_[index]";b.tripIsUnavailableIdFormat="tripIsUnavailable_[index]";b.tripHasNoFaresIdFormat="tripHasNoFares_[index]";b.originStationIdFormat="";b.destinationStationIdFormat="";b.lowFareIdFormat="";b.submitButtonId="";b.submitButton={};b.marketDateIdFormat="marketDate_[index]";b.marketDayIdFormat="marketDay_[index]";b.marketMonthYearIdFormat="marketMonthYear_[index]";b.addFlightId="addFlight";b.removeFlightId="removeFlight";b.flightLabelIdFormat="flightNumber_[index]";b.closeFlightButtonIdFormat="closeFlightButton_[index]";b.tripFlights={};b.numberOfDaysApart=4;b.preferredFareDropDown={};b.passengerDiscountDropDown={};b.passengerTypes={};b.passengerTypeDropDowns={};b.fareTypes={};b.tripPlannerHelp=null;b.maximumPassengersPerType=0;b.passengerDiscounts={};b.dateMarkets=[];b.passengerTypesCount=[];b.passengerTypesCountHash={};b.discountCode="";b.preferredFare="";b.residentCountry="";b.originalJourneyFareSellKeys="";b.retainedJourneyFareSellKeysId="retainedJourneyFareSellKeys";b.retainedJourneyFareSellKeys={};b.populatePassengerTypesCountHash=function(){var e=this.passengerTypesCount,g=this.passengerTypesCountHash,d="",f={};for(d in e){if(e.hasOwnProperty(d)){f=e[d];g[d]=f}}};b.setVars=function(){this.preferredFareDropDown=this.getById(this.preferredFareDropDownId);this.passengerDiscountDropDown=this.getById(this.passengerDiscountDropDownId);this.submitButton=this.getById(this.submitButtonId);this.retainedJourneyFareSellKeys=this.getById(this.retainedJourneyFareSellKeysId);this.populatePassengerTypesCountHash();this.originalJourneyFareSellKeys=this.originalJourneyFareSellKeys.split(",")};b.initRetainedJourneyFareSellKeys=function(){var d=this.originalJourneyFareSellKeys||[];this.retainedJourneyFareSellKeys.val(d.join())};b.updateRetainedJourneyFareSellKeys=function(){var f=this.tripFlights||{},h=f.flights||{},e={},j=h.length||0,g=0,d="";for(g=0;g<j;g+=1){e=h[g];if(d===""){d=e.journeyFareSellKey}else{d=d+","+e.journeyFareSellKey}}this.retainedJourneyFareSellKeys.val(d)};b.createPreferredFareDropDownArray=function(){var f=[],e=this.fareTypes||{},d="",g={};for(d in e){if(e.hasOwnProperty(d)){g=e[d];f.push({code:d,name:g.name})}}return f};b.populatePreferredFareDropDown=function(){var e=this.createPreferredFareDropDownArray(),d={input:this.preferredFareDropDown,objectArray:e,selectedItem:this.preferredFare};SKYSALES.Util.populate(d)};b.createPassengerDiscountDropDownArray=function(){var g=[],d=this.passengerDiscounts||{},e="",f={};for(e in d){if(d.hasOwnProperty(e)){f=d[e];g.push({code:e,name:f.name})}}return g};b.populateDiscountDropDown=function(){var e=this.createPassengerDiscountDropDownArray(),d={input:this.passengerDiscountDropDown,objectArray:e,selectedItem:this.discountCode};SKYSALES.Util.populate(d)};b.initFlightSearch=function(){var e={},d=SKYSALES.Util.setRequiredAttribute;b.flightSearchJson.countryInputIdArray[0].defaultCountry=this.residentCountry;b.flightSearch=new SKYSALES.Class.FlightSearch();this.flightSearch.init(this.flightSearchJson);e=this.flightSearch.countryInputArray[0].input;d(e)};b.createAndPopulateDropDowns=function(){var d={passengerTypes:this.passengerTypes,maximumPassengersPerType:this.maximumPassengersPerType,passengerTypesCountHash:this.passengerTypesCountHash};b.passengerTypeDropDowns=new SKYSALES.Class.PassengerTypeDropDowns();this.passengerTypeDropDowns.init(d);this.populatePreferredFareDropDown();this.populateDiscountDropDown()};b.initTripFlights=function(){var d={};b.tripFlights=new SKYSALES.Class.TripPlannerSearchFlights();d={tripPlannerSearch:this,numberOfDaysApart:this.numberOfDaysApart,addFlightId:this.addFlightId,removeFlightId:this.removeFlightId};this.tripFlights.init(d)};b.validateFirstFlight=function(){this.tripFlights.firstFlightRequireOriginAndDestination();return SKYSALES.Util.validate(this.submitButton[0])};b.validate=function(){var d=null;d=this.validateFirstFlight();if(d){this.tripFlights.clearIncompleteFlights()}return d};b.validateHandler=function(){var d=b.validate();return d};b.addEvents=function(){this.submitButton.click(this.validateHandler)};b.init=function(d){this.setSettingsByObject(d);this.setSettingsByObject(this.tripPlannerSearchDataJson);this.setVars();this.createAndPopulateDropDowns();this.initRetainedJourneyFareSellKeys();this.initFlightSearch();this.initTripFlights();this.addEvents();this.tripPlannerHelp=new SKYSALES.Class.TripPlannerHelp();this.tripPlannerHelp.init()};return b};SKYSALES.Class.TripPlannerSelect=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.tripContainerId="tripContainerId";c.tripContainer=null;c.tripFlightTemplateId="tripFlightTemplateId";c.tripFlightTemplate=null;c.journeyContainerId="tpSelect";c.journeyContainer=null;c.tripJourneyInfoTemplateId="journeyTableTemplateId";c.tripJourneyInfoTemplate=null;c.itinerarySummaryContainerId="tpItinSummary";c.itinerarySummaryContainer=null;c.itineraryTableTemplateId="itineraryTableTemplateId";c.itineraryTableTemplate=null;c.TripAvailabilityResponse={};c.ErrorsOccurred=null;c.leftPageButtonId="tpLeftMove";c.leftPageButton=null;c.rightPageButtonId="tpRightMove";c.rightPageButton=null;c.tripSelectedClass="tpSelectedPanel";c.tripSelectClass="tpSelectPanel";c.radioButtonSelectedClass="checked";c.itineraryJourneyInfoTemplateId="itineraryJourneyInfoTemplate";c.itineraryJourneyInfoTemplate=null;c.itineraryJourneyInfoStripedTemplateId="itineraryJourneyInfoStripedTemplate";c.itineraryJourneyInfoStripedTemplate=null;c.selectViewPricesCurrencyInfoTemplateId="selectViewPricesCurrencyInfoTemplate";c.selectViewPricesCurrencyInfoTemplate=null;c.tripFlightHeaderInfoTemplateId="tripFlightHeaderInfoTemplateId";c.tripFlightHeaderInfoTemplate=null;c.tripFlightHeaderInfoContainerId="tripFlightHeaderInfo";c.tripFlightHeaderInfoContainer=null;c.tripPlannerHelp=null;c.sellKeysInputId="tripPlannerSellKeys";c.sellKeysInput=null;c.JourneyFareSellKeys="";c.schedulesArray=[];c.tripSellKeyArray=[];c.itinerarySummary=null;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.itinerarySummary=new SKYSALES.Class.TripPlannerItinerarySummarySelect();this.itinerarySummary.init();this.itinerarySummary.drawSelectViewItinerarySummary=this.drawItinerarySummaryInfo;this.initSchedulesArray();this.draw();this.setVarsAfterDraw();this.addEvents();this.selectAndDrawInitialTrip();this.setVarsAfterDrawSchedulesJourneyInfo();this.updateSelectedRadioButtons();this.initSellKeyArray();this.updateItinerarySummary();this.drawItinerarySummaryInfo();this.tripPlannerHelp=new SKYSALES.Class.TripPlannerHelp();this.tripPlannerHelp.init()};c.setVars=function(){c.tripContainer=this.getById(this.tripContainerId);c.tripFlightTemplate=this.getById(this.tripFlightTemplateId);c.journeyContainer=this.getById(this.journeyContainerId);c.tripJourneyInfoTemplate=this.getById(this.tripJourneyInfoTemplateId);c.itinerarySummaryContainer=this.getById(this.itinerarySummaryContainerId);c.itineraryTableTemplate=this.getById(this.itineraryTableTemplateId);c.leftPageButton=this.getById(this.leftPageButtonId);c.rightPageButton=this.getById(this.rightPageButtonId);c.itineraryJourneyInfoStripedTemplate=this.getById(this.itineraryJourneyInfoStripedTemplateId);c.itineraryJourneyInfoTemplate=this.getById(this.itineraryJourneyInfoTemplateId);c.schedulesArray=this.TripAvailabilityResponse.Schedules||[];c.sellKeysInput=this.getById(this.sellKeysInputId);c.selectViewPricesCurrencyInfoTemplate=this.getById(this.selectViewPricesCurrencyInfoTemplateId);c.tripFlightHeaderInfoTemplate=this.getById(this.tripFlightHeaderInfoTemplateId);c.tripFlightHeaderInfoContainer=this.getById(this.tripFlightHeaderInfoContainerId)};c.initSchedulesArray=function(){this.JourneyFareSellKeys=this.JourneyFareSellKeys.split(",");var e=0,f=this.TripAvailabilityResponse.Schedules||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=new SKYSALES.Class.Schedule();g.index=e;g.deactivateAllSchedules=this.deactivateAllSchedules;g.updateTripSellKeyArray=this.updateTripSellKeyArray;g.updateItinerarySummary=this.updateItinerarySummary;if(this.JourneyFareSellKeys[e]!==undefined){g.journeyFareSellKey=this.JourneyFareSellKeys[e]}g.updateTrips=this.updateTripsHandler;if(e<4){g.isShowing=true}g.init(f[e]);f[e]=g}};c.setVarsAfterDraw=function(){var e=0,f=this.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.setVarsAfterDraw()}};c.setVarsAfterDrawSchedulesJourneyInfo=function(){var e=0,f=this.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];if(g.selected===true){g.container.removeClass(this.tripSelectClass);g.container.addClass(this.tripSelectedClass)}}};c.addEvents=function(){c.addTripContainerEvents();var e=0,f=this.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.addEvents()}};c.addTripContainerEvents=function(){this.tripContainer.click(this.updateTripContainerHandler);this.leftPageButton.click(this.updateTripsLeftHandler);this.rightPageButton.click(this.updateTripsRightHandler)};c.updateTripsLeftHandler=function(){var f=0,g=-1,h=c.schedulesArray||[],e=h.length,k=null,l=-1,j=-1,d=null;if(e>4){for(f=e-1;f>-1;f-=1){k=h[f];if(k.isShowing===true){g=f}}f=0;if(g>0){d=h[g-1];if(d!==undefined&&d!==null){j=g-1;l=g+3;for(f=0;f<e;f+=1){k=h[f];k.isShowing=false;k.selected=false}for(f=j;f<l;f+=1){k=h[f];if(f===j){k.selected=true}k.isShowing=true}c.tripContainer.empty();c.drawTripsInfo();c.drawTripHeaderInfo();c.setVarsAfterDraw();c.addEvents();c.drawScheduleJourneysInfo();c.setVarsAfterDrawSchedulesJourneyInfo();c.updateSelectedRadioButtons()}}}};c.updateTripsRightHandler=function(){var f=0,e=-1,h=c.schedulesArray||[],d=h.length,k=null,l=-1,j=-1,g=null;if(d>4){for(f=0;f<d;f+=1){k=h[f];if(k.isShowing===true){e=f}}f=0;if(e<12){g=h[e+1];if(g!==undefined&&g!==null){l=e+1;j=l-3;for(f=0;f<d;f+=1){k=h[f];k.isShowing=false;k.selected=false}for(f=j;f<=l;f+=1){k=h[f];if(f===l){k.selected=true}k.isShowing=true}c.tripContainer.empty();c.drawTripsInfo();c.drawTripHeaderInfo();c.setVarsAfterDraw();c.addEvents();c.drawScheduleJourneysInfo();c.setVarsAfterDrawSchedulesJourneyInfo();c.updateSelectedRadioButtons()}}}};c.updateTripContainerHandler=function(){var e=0,f=c.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.container.removeClass(c.tripSelectedClass);g.container.addClass(c.tripSelectClass);if(g.selected===true){g.container.removeClass(c.tripSelectClass);g.container.addClass(c.tripSelectedClass);c.journeyContainer.empty();c.drawScheduleJourneysInfo();c.updateSelectedRadioButtons()}}};c.deactivateAllSchedules=function(){var e=0,f=c.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.selected=false}};c.selectAndDrawInitialTrip=function(){var e=0,f=this.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];if(e===0){g.selected=true}}c.drawScheduleJourneysInfo()};c.getTripsHeaderInfoHtml=function(){var h="",g=0,f=-1,e=-1,j=this.schedulesArray||[],d=j.length,k=null;for(g=0;g<d;g+=1){k=j[g];if(k.isShowing===true){if(f===-1){f=g+1}e=g+1}}h=this.tripFlightHeaderInfoTemplate.text();h=h.replace(/\[firstShowingFligt\]/g,f);h=h.replace(/\[lastShowingFlight\]/g,e);h=h.replace(/\[totalNumberOfFlights\]/g,d);return h};c.getTripsHtml=function(){var g="",e="",f=0,h=this.schedulesArray||[],d=h.length,j=null;for(f=0;f<d;f+=1){j=h[f];if(j.isShowing===true){g+=this.tripFlightTemplate.text();e=j.getTripsHtml();g=g.replace(/\[tripFlightInfo\]/g,e);g=g.replace(/\[index\]/g,f+1)}}return g};c.getJourneyHtml=function(){var f="",h="",e=0,g="",j=this.schedulesArray||[],d=j.length,k=null;for(e=0;e<d;e+=1){k=j[e];if(k.selected===true){f=this.tripJourneyInfoTemplate.text();h+=k.getJourneyHtml();g="trip"+e;h=h.replace(/\[radioButtonIdTrip\]/g,g);h=h.replace(/\[radioGroupName\]/g,g);f=f.replace(/\[jouneyInfoAndFares\]/,h)}}return f};c.getItineraryHtml=function(){var e=this.itineraryTableTemplate.text(),g=0,d=this.itinerarySummary.getSelectViewItineraryJourneysHtml(),f=this.selectViewPricesCurrencyInfoTemplate.text();e=e.replace(/\[itinerarySummaryBody\]/,d);if(this.itinerarySummary.Booking!==null&&this.itinerarySummary.Booking.BookingPricing!==null){g=SKYSALES.Util.convertToLocaleCurrency(this.itinerarySummary.Booking.BookingPricing.TotalBookingPrice);f=f.replace(/\[totalPrice\]/,g);f=f.replace(/\[currencyName\]/,this.itinerarySummary.Booking.BookingPricing.CurrencyDescription)}else{f=f.replace(/\[totalPrice\]/,"")}e=e.replace(/\[pricesCurrencyInfo\]/,f);return e};c.draw=function(){c.drawTripsInfo();c.drawTripHeaderInfo()};c.drawScheduleJourneysInfo=function(){var f=c.getJourneyHtml(),e=0,g=this.schedulesArray||[],d=g.length,h=null;c.journeyContainer.html(f);for(e=0;e<d;e+=1){h=g[e];h.setVarsAfterDraw("radioInput_trip"+e);h.addEventsAfterDraw()}if(SKYSALES.common){SKYSALES.common.stripeTables()}};c.drawTripHeaderInfo=function(){var d=this.getTripsHeaderInfoHtml();this.tripFlightHeaderInfoContainer.html(d)};c.drawTripsInfo=function(){var d=this.getTripsHtml();this.tripContainer.html(d)};c.drawItinerarySummaryInfo=function(){var d=c.getItineraryHtml();c.itinerarySummaryContainer.html(d);if(SKYSALES.common){SKYSALES.common.stripeTables()}};c.updateSelectedRadioButtons=function(){var f=0,g="",e=null,h=c.schedulesArray||[],d=h.length,j=null;for(f=0;f<d;f+=1){j=h[f];if(j.selected===true){g="radioInput_trip"+f+j.getSelectedTripJourneyFare();break}}e=this.getById(g);if(e!==null){e.attr(this.radioButtonSelectedClass,this.radioButtonSelectedClass)}};c.initSellKeyArray=function(){var e=0,h="",f=c.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];h=g.getSelectedJourneyFareSellKey();c.tripSellKeyArray[e]=h}c.sellKeysInput.value=this.tripSellKeyArray.toString();c.sellKeysInput.val(this.tripSellKeyArray.toString());this.itinerarySummary.sellKeys.val(this.tripSellKeyArray.toString())};c.updateItinerarySummary=function(){c.itinerarySummary.getPriceItineraryResponse(c.tripSellKeyArray.toString())};c.updateTripSellKeyArray=function(d,e){if(c.tripSellKeyArray[d]!==undefined){c.tripSellKeyArray[d]=e;c.sellKeysInput.value="";c.sellKeysInput.value=c.tripSellKeyArray.toString();c.sellKeysInput.val(c.tripSellKeyArray.toString())}};c.updateTripsHandler=function(){c.updateTrips()};c.updateTrips=function(){this.drawTripsInfo();var e=0,f=c.schedulesArray||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=f[e];g.setVarsAfterDraw();if(g.selected===true){g.container.removeClass(c.tripSelectClass);g.container.addClass(c.tripSelectedClass)}}this.addEvents()};return c};SKYSALES.Class.Schedule=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.JourneyDateMarketList=null;c.index=-1;c.selected=false;c.isShowing=false;c.containerId="";c.container=null;c.deactivateAllSchedules=null;c.journeyItinerarySummaryInfoTemplateId="journeyItinerarySummaryInfoTemplate";c.journeyItinerarySummaryInfoTemplate=null;c.updateTripSellKeyArray=null;c.updateItinerarySummary=null;c.updateTrips=null;c.journeyFareSellKey="";c.tripUnavailableTextId="tripUnavailableErrorText";c.tripUnavailableText="";c.tripHasNoFaresTextId="tripHasNoFaresErrorText";c.tripHasNoFaresText="";c.init=function(d){this.setSettingsByObject(d);this.initJourneyDateMarketListArray();this.setVars()};c.initJourneyDateMarketListArray=function(){var g=0,e=this.JourneyDateMarketList||[],d=e.length,f=null;for(g=0;g<d;g+=1){f=new SKYSALES.Class.JourneyDateMarketList();f.updateTripSellKeyArray=this.updateTripSellKeyArray;f.updateItinerarySummary=this.updateItinerarySummary;f.updateTrips=this.updateTrips;f.selectedJourneyFareSellKey=this.journeyFareSellKey;f.tripIndex=this.index;f.init(e[g]);e[g]=f}};c.setVars=function(){var e={},d={};c.journeyItinerarySummaryInfoTemplate=this.getById(this.journeyItinerarySummaryInfoTemplateId);e=this.getById(this.tripUnavailableTextId);if(e.length>0){c.tripUnavailableText=e.text()}d=this.getById(this.tripHasNoFaresTextId);if(d.length>0){c.tripHasNoFaresText=d.text()}};c.setVarsAfterDraw=function(j){var h=this.index+1,g=0,e=this.JourneyDateMarketList||[],d=e.length,f=null;c.containerId="tripFlightContainer"+h;c.container=this.getById(this.containerId);for(g=0;g<d;g+=1){f=e[g];f.setVarsAfterDraw(j)}};c.addEvents=function(){this.container.click(this.updateScheduleSelectionHandler)};c.addEventsAfterDraw=function(){var h=this.index+1,g=0,e=this.JourneyDateMarketList||[],d=e.length,f=null;c.containerId="tripFlightContainer"+h;c.container=this.getById(this.containerId);for(g=0;g<d;g+=1){f=e[g];f.addEventsAfterDraw()}};c.updateScheduleSelectionHandler=function(){if(c.deactivateAllSchedules!==null){c.deactivateAllSchedules()}c.selected=true};c.getSelectedTripJourneyFare=function(){var g=0,h="",e=this.JourneyDateMarketList||[],d=e.length,f=null;for(g=0;g<d;g+=1){f=e[g];h=f.getSelectedJourneyFare()}return h};c.getSelectedJourneyFareSellKey=function(){var g=0,h="",e=this.JourneyDateMarketList||[],d=e.length,f=null;for(g=0;g<d;g+=1){f=e[g];h=f.getSelectedJourneyFareSellKey()}return h};c.getTripsHtml=function(){var d,e=c.JourneyDateMarketList[0];if(e===undefined){d=this.tripUnavailableText}else{if(e.hasFares()){d=e.getTripsHtml()}else{d=this.tripHasNoFaresText}}return d};c.getJourneyHtml=function(){var h=0,g="",e=this.JourneyDateMarketList||[],d=e.length,f=null;for(h=0;h<d;h+=1){f=e[h];g+=f.getJourneyHtml();f.selectJourneys()}return g};c.getItineraryHtml=function(){var g=0,h="",o="",l=this.JourneyDateMarketList||[],k=l.length,m=null,e=0,f=[],n=0,d=null;for(g=0;g<k;g+=1){m=l[g];e=0;f=m.Journeys||[];n=f.length;d=null;for(e=0;e<n;e+=1){d=f[e];if(d.selected===true){h=this.journeyItinerarySummaryInfoTemplate.text();h=h.replace(/\[stationPair\]/,d.DepartureStation+" to "+d.ArrivalStation);h=h.replace(/\[deptArriveTimes\]/,d.DepartureDate.date.toTimeString()+" to "+d.ArrivalDate.date.toTimeString());h=h.replace(/\[flightDesignator\]/,d.FlightDesignator);h=h.replace(/\[journeyDate\]/,d.DepartureDate.date.toDateString());o=h}}}return o};return c};SKYSALES.Class.JourneyDateMarketList=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.ArrivalStation="";c.DepartureDate="";c.DepartureStation="";c.Journeys=[];c.journeyTableInfoTemplateId="journeyTableInfoTemplateId";c.journeyTableInfoTemplate=null;c.journeyTableInfoStripedTemplateId="journeyTableInfoStripedTemplateId";c.journeyTableInfoStripedTemplate=null;c.updateTripSellKeyArray=null;c.updateItinerarySummary=null;c.updateTrips=null;c.selectedJourneyFareSellKey="";c.selectedJourneyKey="";c.selectedFareKey="";c.tripIndex=0;c.tripFlightInfoTemplateId="tripFlightInfoTemplateId";c.tripFlightInfoTemplate={};c.init=function(d){c.setSettingsByObject(d);c.initSelectedSellKeys();c.initJourneysArray();c.setVars();c.selectJourneys()};c.initSelectedSellKeys=function(){if(this.selectedJourneyFareSellKey.length>0){this.selectedJourneyFareSellKey=this.selectedJourneyFareSellKey.split("|");if(this.selectedJourneyFareSellKey[1]!==undefined){this.selectedJourneyKey=this.selectedJourneyFareSellKey[1]}if(this.selectedJourneyFareSellKey[0]!==undefined){this.selectedFareKey=this.selectedJourneyFareSellKey[0]}}};c.initJourneysArray=function(){var e=0,g=this.Journeys||[],d=g.length,f=null;for(e=0;e<d;e+=1){f=new SKYSALES.Class.JourneyDateMarket();f.updateTripSellKeyArray=this.updateTripSellKeyArray;f.updateItinerarySummary=this.updateItinerarySummary;f.updateTrips=this.updateTrips;f.selectedFareKey=this.selectedFareKey;f.updateSelectedJourney=this.updateSelectedJourneyHandler;f.tripIndex=this.tripIndex;f.journeyIndex=e;f.init(g[e]);g[e]=f}};c.setVars=function(){c.tripFlightInfoTemplate=this.getById(this.tripFlightInfoTemplateId);c.journeyTableInfoTemplate=this.getById(this.journeyTableInfoTemplateId);c.journeyTableInfoStripedTemplate=this.getById(this.journeyTableInfoStripedTemplateId)};c.setVarsAfterDraw=function(g){var e=0,h=this.Journeys||[],d=h.length,f=null;for(e=0;e<d;e+=1){f=h[e];f.setVarsAfterDraw(g+"journey"+e)}};c.addEventsAfterDraw=function(){var e=0,g=this.Journeys||[],d=g.length,f=null;for(e=0;e<d;e+=1){f=g[e];f.addEventsAfterDraw()}};c.getTripsHtml=function(){var j=this.Journeys[0],h=0,l=this.Journeys||[],d=l.length,k=null,e=-1,g=this.tripFlightInfoTemplate.text()||"",f="";for(h=0;h<d;h+=1){k=l[h];if(k.selected===true){j=k}}if(j!==undefined&&j.Segments){e=j.Segments.length;g=g.replace(/\[departureStation\]/g,j.Segments[0].DepartureStation);g=g.replace(/\[departureTime\]/g,j.Segments[0].Std.getTime());g=g.replace(/\[arrivalStation\]/g,j.Segments[e-1].ArrivalStation);g=g.replace(/\[arrivalTime\]/g,j.Segments[e-1].Sta.getTime());f=j.Segments[0].FlightDesignator.getFlightDesignator();for(h=1;h<e;h+=1){f=f+"/"+j.Segments[h].FlightDesignator.getFlightDesignator()}g=g.replace(/\[flightNumber\]/,f);g=g.replace(/\[departureDate\]/,$.datepicker.formatDate(j.Segments[0].fullDateFormatString,j.Segments[0].Std.date));return g}};c.selectJourneys=function(){var g=0,j=false,f=-1,l=-1,k=this.Journeys||[],d=k.length,h=null,e=false;if(this.selectedJourneyKey.length>0){for(g=0;g<d;g+=1){h=k[g];if(h.SellKey===this.selectedJourneyKey){h.selected=true;h.selectedFareKey=this.selectedFareKey;e=h.selectPreselectedFare();if(e===false){h.getLowestFare()}}}}j=this.journeyIsSelected();if(j===false){for(g=0;g<d;g+=1){h=k[g];if(h.getLowestFare()<f&&h.getLowestFare()>-1){f=h.getLowestFare();l=g}else{if(f===-1&&h.getLowestFare()>-1){f=h.getLowestFare();l=g}}if(g===d-1&&f>-1){h=k[l];h.selected=true;k[l]=h}}}};c.journeyIsSelected=function(){var e=0,g=false,h=this.Journeys||[],d=h.length,f=null;for(e=0;e<d;e+=1){f=h[e];if(f.selected===true){g=true;break}}return g};c.hasFares=function(){var d=false,g=this.Journeys||[],f=g.length||0,e;for(e=0;e<f;e+=1){if(g[e].hasFares()){d=true;break}}return d};c.getSelectedJourneyFare=function(){var g=0,e=-1,f=-1,j=this.Journeys||[],d=j.length,h=null;for(g=0;g<d;g+=1){h=j[g];if(h.selected===true){f=g;e=h.getSelectedPaxFaresIndex();break}}return"journey"+f+"fare"+e};c.getSelectedJourneyFareSellKey=function(){var g=0,e="",f="",j=this.Journeys||[],d=j.length,h=null;for(g=0;g<d;g+=1){h=j[g];if(h.selected===true){e=h.SellKey;f=h.getSelectedPaxFaresSellKey();break}}return f+"|"+e};c.updateSelectedJourneyHandler=function(d){c.updateSelectedJourney(d)};c.updateSelectedJourney=function(f){this.deactivateAllJourneys();var e=0,h=this.Journeys||[],d=h.length,g=null;for(e=0;e<d;e+=1){g=h[e];if(f===e){g.selected=true;break}}};c.deactivateAllJourneys=function(){var e=0,g=this.Journeys||[],d=g.length,f=null;for(e=0;e<d;e+=1){f=g[e];f.selected=false}};c.getJourneyHtml=function(){var m=0,p="",e="",n="",r="",l=this.Journeys||[],q=l.length,f=null,h="",k="",o=[],j=-1,d="",g=this.tripIndex;for(m=0;m<q;m+=1){f=l[m];if(m%2!==0){p=this.journeyTableInfoTemplate.text()}else{p=this.journeyTableInfoStripedTemplate.text()}o=f.Segments;j=o.length;if(o&&j>0){h=f.Segments[0].Std.getTime();k=f.Segments[j-1].Sta.getTime()}p=p.replace(/\[departureTime\]/,h);p=p.replace(/\[arrivalTime\]/,k);p=p.replace(/\[flightDesignator\]/,f.FlightDesignator);p=p.replace(/\[journeyType\]/,f.JourneyType);d=f.getJourneyDetailsHtml();p=p.replace(/\[journeyDetails\]/,d);n=f.getFareInfoHtml();p=p.replace(/\[fareInfo\]/,n);p=p.replace(/\[journeySellKey\]/g,f.SellKey);p=p.replace(/\[tripIndex\]/,g);p=p.replace(/\[journeyIndex\]/,m);r="journey"+m;p=p.replace(/\[radioButtonIdJourney\]/g,r);e+=p}return e};return c};SKYSALES.Class.JourneyDateMarket=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.JourneyFares=[];b.NotForGeneralUse="";b.Segments=[];b.ArrivalStation="";b.DepartureDate="";b.ArrivalDate="";b.DepartureStation="";b.JourneyType="";b.SalesDate="";b.SellKey="";b.FlightDesignator="";b.selected=false;b.updateTripSellKeyArray=null;b.updateItinerarySummary=null;b.updateSelectedJourney=null;b.updateTrips=null;b.emptyJourneyFareInfoTemplateId="emptyJourneyFareInfoTemplateId";b.journeyDetailsTemplate={};b.journeyDetailsTemplateId="journeyDetailsTemplate";b.emptyJourneyFareInfoTemplate=null;b.selectedFareKey="";b.journeyIndex=0;b.tripIndex=0;b.init=function(d){this.setSettingsByObject(d);this.initSegmentsArray();this.initJourneyFares();this.initDates();this.setVars()};b.initJourneyFares=function(){var f=0,e=this.JourneyFares||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.JourneyPaxFares();g.updateTripSellKeyArray=this.updateTripSellKeyArray;g.updateItinerarySummary=this.updateItinerarySummary;g.updateSelectedJourney=this.updateSelectedJourney;g.updateSelectedFare=this.updateSelectedFareHandler;g.updateTrips=this.updateTrips;g.init(e[f]);e[f]=g}};b.initDates=function(){var d=SKYSALES.Class.STASTD(),e=SKYSALES.Class.STASTD();d.init(this.DepartureDate);b.DepartureDate=d;e.init(this.DepartureDate);b.ArrivalDate=e};b.initSegmentsArray=function(){var f=0,e=this.Segments||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.Segment();g.init(e[f]);e[f]=g}};b.setVarsAfterDraw=function(e){var g=0,f=this.JourneyFares||[],d=f.length,h=null;for(g=0;g<d;g+=1){h=f[g];h.setVarsAfterDraw(e+"fare"+g)}};b.journeyInfoJson=function(){var e=this.journeyIndex,l=this.tripIndex,f=[],k={},d=[],j={},h={},g={tripIndex:l,marketIndex:"0",dateMarketIndex:"0",journeyIndex:e,key:l.toString()+"_0_0_"+e.toString(),activateJourneyId:"activateJourney_"+l+"_"+e,deactivateJourneyId:"deactivateJourney_"+l+"_"+e,journeyContainerId:"journey_"+l+"_"+e};f=this.Segments;if(f&&f.length>0){k=f[0];d=k.Legs;if(d&&d.length>0){j=d[0];h=j.LegInfo;if(h){g.legInfoArray=[{legIndex:"0",equipmentType:h.EquipmentType,equipmentTypeSuffix:h.EquipmentTypeSuffix,departureStation:k.DepartureStation,arrivalStation:k.ArrivalStation,carrierCode:h.OperatingCarrier,flightNumber:h.OperatingFlightNumber,opSuffix:h.OperatingOpSuffix,marketingCode:"",marketingOverride:false}]}}}return g};b.addEventsAfterDraw=function(){var f=0,e=this.JourneyFares||[],d=e.length,h=null,j=new SKYSALES.Class.JourneyInfo(),g=this.journeyInfoJson();j.init(g);for(f=0;f<d;f+=1){h=e[f];h.addEventsAfterDraw()}};b.setVars=function(){this.emptyJourneyFareInfoTemplate=this.getById(this.emptyJourneyFareInfoTemplateId);this.journeyDetailsTemplate=this.getById(this.journeyDetailsTemplateId)};b.selectPreselectedFare=function(){var g=false,f=0,e=[],d=0,h=null;if(this.selected===true&&this.selectedFareKey.length>0){f=0;e=this.JourneyFares||[];d=e.length;h=null;for(f=0;f<d;f+=1){h=e[f];if(h.SellKey===this.selectedFareKey){h.selected=true;g=true;break}}}return g};b.hasFares=function(){var f=this.JourneyFares,h=f.length,e,g,d=false;for(e=0;e<h;e+=1){g=f[e].JourneyPaxFares||[];if(g.length>0){d=true;break}}return d};b.getLowestFare=function(){var h=0,e=-1,f=-1,g=this.JourneyFares||[],d=g.length,j=null;for(h=0;h<d;h+=1){j=g[h];if(h===0){e=j.getLowestFare();f=h}else{if(j.getLowestFare<e){e=j.getLowestFare();f=h}}if(h===d-1&&e>-1){j=g[f];j.selected=true}}return e};b.getSelectedPaxFaresIndex=function(){var g=0,e=-1,f=this.JourneyFares||[],d=f.length,h=null;for(g=0;g<d;g+=1){h=f[g];if(h.selected===true){e=g;break}}return e};b.getSelectedPaxFaresSellKey=function(){var g=0,e=-1,f=this.JourneyFares||[],d=f.length,h=null;for(g=0;g<d;g+=1){h=f[g];if(h.selected===true){e=h.SellKey;break}}return e};b.updateSelectedFareHandler=function(d){b.updateSelectedFare(d)};b.updateSelectedFare=function(g){this.deactivateAllFares();var f=0,e=this.JourneyFares||[],d=e.length,h=null;for(f=0;f<d;f+=1){h=e[f];if(f===g){h.selected=true;break}}};b.deactivateAllFares=function(){var f=0,e=this.JourneyFares||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=e[f];g.selected=false}};b.getJourneyDetailsHtml=function(){var m="",d=this.journeyDetailsTemplate.text(),j=this.Segments,k={},h=0,o=[],n={},f={},g=0,l=0,e=0;if(j){h=j.length;if(h>0){for(l=0;l<h;l+=1){k=j[l];o=k.Legs;if(o){g=o.length;if(g>0){for(e=0;e<g;e+=1){n=o[e];f=new SKYSALES.Class.Leg();f.init(n);m+=f.getLegHtml()}}}}}}d=d.replace(/\[segmentDetails\]/g,m);d=d.replace(/\[tripIndex\]/g,this.tripIndex);d=d.replace(/\[journeyIndex\]/g,this.journeyIndex);return d};b.getFareInfoHtml=function(){var g=0,f=0,m=0,d="",h="",e="",l=this.JourneyFares||[],k=l.length,n=null;for(g=0;g<k;g+=1){n=l[g];h+=n.getFareInfoHtml();e="fare"+g;h=h.replace(/\[radioButtonIdFare\]/g,e)}if(g<3){m=3-g;for(f=g;f<3;f+=1){d=this.emptyJourneyFareInfoTemplate.text();h+=d}}return h};return b};SKYSALES.Class.JourneyPaxFares=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.JourneyPaxFares=[];c.ClassOfService="";c.Amount="";c.SellKey="";c.journeyFareInfoRadioButtonTemplateId="journeyFareInfoRadioButtonTemplateId";c.journeyFareInfoRadioButtonTemplate=null;c.containerId="";c.container=null;c.selected=false;c.updateTripSellKeyArray=null;c.updateItinerarySummary=null;c.updateSelectedJourney=null;c.updateSelectedFare=null;c.updateTrips=null;c.init=function(d){c.setSettingsByObject(d);c.initJourneyPaxFares();c.setVars()};c.initJourneyPaxFares=function(){var f=0,e=this.JourneyPaxFares||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.JourneyPaxFare();g.init(e[f]);e[f]=g}};c.setVars=function(){this.journeyFareInfoRadioButtonTemplate=this.getById(this.journeyFareInfoRadioButtonTemplateId);this.emptyJourneyFareInfoTemplate=this.getById(this.emptyJourneyFareInfoTemplateId)};c.setVarsAfterDraw=function(d){this.container=this.getById(d)};c.addEventsAfterDraw=function(){this.container.click(this.fareClickHandler)};c.fareClickHandler=function(g){var h=g.target.value,f=-1,d=-1,e=-1;f=g.target.id.match(/trip[0-9]*/);f=f[0].match(/\d+/);f=f[0];f=parseInt(f,10);d=g.target.id.match(/journey[0-9]*/);d=d[0].match(/\d+/);d=d[0];d=parseInt(d,10);e=g.target.id.match(/fare[0-9]*/);e=e[0].match(/\d+/);e=e[0];e=parseInt(e,10);c.updateTripSellKeyArray(f,h);c.updateItinerarySummary();c.updateSelectedJourney(d);c.updateSelectedFare(e);c.updateTrips()};c.getLowestFare=function(){var g=0,f=-1,e=this.JourneyPaxFares||[],d=e.length,h=null;if(d>0){for(g=0;g<d;g+=1){h=e[g];if(g===0&&h.TotalFareAmount>-1){f=h.TotalFareAmount}else{if(h.TotalFareAmount<f){f=h.TotalFareAmount}}}}return f};c.getFareInfoHtml=function(){var g=0,j=0,f="",h="",e=this.JourneyPaxFares||[],d=e.length,k=null;for(g=0;g<d;g+=1){k=e[g];f=this.journeyFareInfoRadioButtonTemplate.text();j=SKYSALES.Util.convertToLocaleCurrency(k.TotalFareAmount);f=f.replace(/\[farePrice\]/,j);f=f.replace(/\[fareSellKey\]/,this.SellKey);h+=f;g=d}return h};return c};SKYSALES.Class.JourneyPaxFare=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.CurrencyCode="";b.DiscountedFareAmount="";b.Amount="";b.PaxType="";b.TotalFareAmount="";b.PublishedFareAmount="";b.PaxDiscountCode="";b.init=function(d){this.setSettingsByObject(d)};return b};SKYSALES.Class.Segment=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.ArrivalStation="";c.Sta="";c.DepartureStation="";c.Std="";c.FlightDesignator=null;c.fullDateFormatString="D, M dd, yy";c.Legs={};c.init=function(d){this.setSettingsByObject(d);this.initSta();this.initStd();this.initFlightDesignator()};c.initFlightDesignator=function(){var d=SKYSALES.Class.FlightDesignator();d.init(this.FlightDesignator);c.FlightDesignator=d};c.initSta=function(){var d=SKYSALES.Class.STASTD();d.init(this.Sta);this.Sta=d};c.initStd=function(){var d=SKYSALES.Class.STASTD();d.init(this.Std);this.Std=d};return c};SKYSALES.Class.Leg=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.legTemplateId="legDetailsTemplate";c.legTemplate=null;c.layoverTimeTemplateId="layoverTimeTemplate";c.layoverTimeTemplate=null;c.ArrivalStation="";c.DepartureStation="";c.FlightDesignator={};c.Sta={};c.Std={};c.OperationsInfo={};c.TravelTime={};c.LayoverTime={};c.fullDateFormatString="D, M dd, yy";c.init=function(d){this.setSettingsByObject(d);this.initSta();this.initStd();this.initFlightDesignator();this.setVars()};c.setVars=function(){this.legTemplate=this.getById(this.legTemplateId);this.layoverTimeTemplate=this.getById(this.layoverTimeTemplateId)};c.initFlightDesignator=function(){var d=SKYSALES.Class.FlightDesignator();d.init(this.FlightDesignator);c.FlightDesignator=d};c.initSta=function(){var d=SKYSALES.Class.STASTD();d.init(this.Sta);c.Sta=d};c.initStd=function(){var d=SKYSALES.Class.STASTD();d.init(this.Std);c.Std=d};c.getLayoverTimeHtml=function(){var f="",g=this.LayoverTime,d=g.Hours,e=g.Minutes;if(d>0||e>0){f=this.layoverTimeTemplate.text();f=f.replace(/\[layoverTimeHours\]/g,d);f=f.replace(/\[layoverTimeMinutes\]/g,e)}return f};c.getLegHtml=function(){var j=this.legTemplate.text(),l=this.FlightDesignator,e=l.CarrierCode,f=SKYSALES.Resource||{},k=f.carrierHash[e]||{},d=k.name||"",m=f.stationHash,o=this.DepartureStation,n=m[o].name,h=this.ArrivalStation,g=m[h].name;j=j.replace(/\[carrierName\]/g,d);j=j.replace(/\[flightNumber\]/g,l.FlightNumber);j=j.replace(/\[departureDate\]/,$.datepicker.formatDate(this.fullDateFormatString,this.Std.date));j=j.replace(/\[departureStation\]/g,n);j=j.replace(/\[departureTime\]/g,this.Std.getTime());j=j.replace(/\[arrivalStation\]/g,g);j=j.replace(/\[arrivalTime\]/g,this.Sta.getTime());j=j.replace(/\[travelTimeHours\]/g,this.TravelTime.Hours);j=j.replace(/\[travelTimeMinutes\]/g,this.TravelTime.Minutes);j=j.replace(/\[layoverTime\]/g,this.getLayoverTimeHtml());return j};return c};SKYSALES.Class.FlightDesignator=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.CarrierCode="";b.FlightNumber="";b.init=function(d){this.setSettingsByObject(d)};b.getFlightDesignator=function(){return this.CarrierCode+" "+this.FlightNumber};return b};SKYSALES.Class.STASTD=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.Day="";b.Month="";b.Hour="";b.Minute="";b.Second="";b.Year="";b.date=null;b.init=function(d){this.setSettingsByObject(d);this.initDateTime()};b.initDateTime=function(){this.date=new Date();this.date.setHours(this.Hour,this.Minute,this.Second,0);this.date.setFullYear(this.Year,this.Month-1,this.Day)};b.getTime=function(){var d=SKYSALES.Util.getTime(this.Hour,this.Minute);return d};return b};SKYSALES.Class.TripPlannerItinerarySummarySelect=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="";b.container=null;b.sellKeysId="summaryTripPlannerSellKeys";b.sellKeys=null;b.ErrorsOccurred="";b.Booking=null;b.itineraryResponse=null;b.drawSelectViewItinerarySummary=null;b.url="TripPlannerItinerarySummaryAjax-resource.aspx";b.init=function(d){this.setSettingsByObject(d);this.setVars()};b.setVars=function(){b.container=this.getById(this.containerId);b.sellKeys=this.getById(this.sellKeysId)};b.initBooking=function(e,d){b.Booking=new SKYSALES.Class.Booking();this.Booking.init(e);this.Booking.initBookingPricing(d)};b.addEventsAfterItinerarySummaryDraw=function(){var g=$("[id^='journeyPricingDetails_']"),h=0,k=null,j=g||[],d=j.length,f=null,e={};for(h=0;h<d;h+=1){f=j[h];k=new SKYSALES.Class.ToggleView();e={elementId:"journeyPricingDetails_"+h,hideId:"journeyTotalPrice_"+h,showId:"journeyTotalPrice_"+h};k.init(e);k.updateHide()}};b.updateItinerarySummaryInfoHandler=function(d){b.updateItinerarySummaryInfo(d)};b.updateItinerarySummaryInfo=function(g){var e=$(g),d=e.html(),f=SKYSALES.Json.parse(d);this.initBooking(f.Booking,f.BookingPricing);if(f.ErrorsOccurred===0){if(this.drawSelectViewItinerarySummary!==null){this.drawSelectViewItinerarySummary();this.addEventsAfterItinerarySummaryDraw()}}};b.getPriceItineraryResponse=function(d){this.sellKeys.val(d);$.post(this.url,{"ItinerarySummary.JourneyFareSellKeys":d},this.updateItinerarySummaryInfoHandler)};b.getSelectViewItineraryJourneysHtml=function(){if(this.Booking!==null){return this.Booking.getSelectViewItineraryJourneysHtml()}else{return""}};return b};SKYSALES.Class.TripPlannerItinerarySummaryConfirm=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.containerId="itinerarySummaryInfoContainer";c.container=null;c.ErrorsOccurred="";c.Booking=null;c.init=function(d){this.setSettingsByObject(d);this.setVars();this.initBooking(d);this.Booking.drawConfirmView()};c.setVars=function(){c.container=this.getById(this.containerId)};c.initBooking=function(d){this.Booking=new SKYSALES.Class.Booking();this.Booking.init(d.Booking);this.Booking.initBookingPricing(d.BookingPricing)};c.updateItinerarySummaryInfo=function(d){};return c};SKYSALES.Class.Booking=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="itinerarySummaryInfoContainer";b.container=null;b.itinerarySummaryLeftViewTableTemplateId="tripPlannerItinerarySummaryLeftViewTableTemplate";b.itinerarySummaryLeftViewTableTemplate=null;b.itinerarySummaryLeftViewFinalTableTemplateId="tripPlannerItinerarySummaryLeftViewFinalTableTemplate";b.itinerarySummaryLeftViewFinalTableTemplate=null;b.itineraryJourneyInfoTemplateId="itineraryJourneyInfoTemplate";b.itineraryJourneyInfoTemplate=null;b.itineraryJourneyInfoStripedTemplateId="itineraryJourneyInfoStripedTemplate";b.itineraryJourneyInfoStripedTemplate=null;b.journeyItinerarySummaryInfoTemplateId="journeyItinerarySummaryInfoTemplate";b.journeyItinerarySummaryInfoTemplate=null;b.journeyPricingHtmlTemlateId="journeyPricingHtmlTemlate";b.journeyPricingHtmlTemlate=null;b.RecordLocators=[];b.TypeOfSale=null;b.ReceivedBy=null;b.Payments=null;b.Passengers=[];b.BookingSum=null;b.BookingInfo=null;b.CurrencyCode="";b.GroupName="";b.Journeys=[];b.TotalPrice=0;b.BookingPricing=null;b.fullDateFormatString="D, M dd, yy";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.initJourneysArray();this.initPassengersArray()};b.setVars=function(){this.container=this.getById(this.containerId);this.itinerarySummaryLeftViewTableTemplate=this.getById(this.itinerarySummaryLeftViewTableTemplateId);this.itinerarySummaryLeftViewFinalTableTemplate=this.getById(this.itinerarySummaryLeftViewFinalTableTemplateId);this.itineraryJourneyInfoTemplate=this.getById(this.itineraryJourneyInfoTemplateId);this.itineraryJourneyInfoStripedTemplate=this.getById(this.itineraryJourneyInfoStripedTemplateId);this.journeyItinerarySummaryInfoTemplate=this.getById(this.journeyItinerarySummaryInfoTemplateId);this.journeyPricingHtmlTemlate=this.getById(this.journeyPricingHtmlTemlateId)};b.initJourneysArray=function(){var e=0,g=this.Journeys||[],d=g.length,f=null;for(e=0;e<d;e+=1){f=new SKYSALES.Class.JourneyDateMarket();f.init(g[e]);g[e]=f}};b.initPassengersArray=function(){var f=0,e=this.Passengers||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.Passenger();g.init(e[f]);e[f]=g}};b.initBookingSum=function(){var d=this.BookingSum;this.BookingSum=new SKYSALES.Class.BookingSum();this.BookingSum.init(d)};b.initBookingPricing=function(d){this.BookingPricing=new SKYSALES.Class.BookingPricing();this.BookingPricing.init(d)};b.getSelectViewItineraryJourneysHtml=function(){var k=0,m="",d="",r="",s="",q="",p="",t=0,o=0,j=this.Journeys||[],n=j.length,e=null,f="",h="",l=[],g=-1;for(k=0;k<n;k+=1){e=j[k];if(k%2!==0){d=this.itineraryJourneyInfoTemplate.text()}else{d=this.itineraryJourneyInfoStripedTemplate.text()}r=this.journeyItinerarySummaryInfoTemplate.text();r=r.replace(/\[journeyNumber\]/,k+1);r=r.replace(/\[journeyIndex\]/g,k);p=$.datepicker.formatDate(b.fullDateFormatString,e.DepartureDate.date);r=r.replace(/\[journeyDate\]/,p);r=r.replace(/\[stationPair\]/,e.DepartureStation+" to "+e.ArrivalStation);r=r.replace(/\[flightDesignator\]/,e.FlightDesignator);l=e.Segments;if(l&&l.length&&l.length>0){g=l.length;f=l[0].Std.getTime();h=l[g-1].Sta.getTime()}r=r.replace(/\[deptArriveTimes\]/,f+" to "+h);t=SKYSALES.Util.convertToLocaleCurrency(b.BookingPricing.JourneyPricingList[k].JourneyTotalPrice);r=r.replace(/\[journeyTotalPrice\]/,t);s=this.journeyPricingHtmlTemlate.text();q=b.BookingPricing.JourneyPricingList[k].getSelectViewPassengerPricingHtml();s=s.replace(/\[passengerPricingDetails\]/,q);o=SKYSALES.Util.convertToLocaleCurrency(b.BookingPricing.JourneyPricingList[k].TotalTaxAndFee);s=s.replace(/\[taxesAndFeesDetails\]/,o);r=r.replace(/\[pricingDetails\]/,s);d=d.replace(/\[journeyDetails\]/,r);m+=d}return m};b.drawConfirmView=function(){var m=0,q=0,r=0,g=0,o="",k=0,d="",h="",n="",f="",j="",l=this.Journeys||[],p=l.length,e=null;for(m=0;m<p;m+=1){e=l[m];if(m===p-1){f=this.itinerarySummaryLeftViewFinalTableTemplate.text()}else{f=this.itinerarySummaryLeftViewTableTemplate.text()}f=f.replace(/\[flightIndex\]/,m+1);f=f.replace(/\[deptDate\]/,e.DepartureDate.date.toDateString());f=f.replace(/\[deptStation\]/,e.DepartureStation);f=f.replace(/\[arriveStation\]/,e.ArrivalStation);f=f.replace(/\[flightDesignator\]/,e.FlightDesignator);if(e.Segments&&e.Segments.length&&e.Segments[0].Std&&e.Segments[e.Segments.length-1].Sta){o=e.Segments;k=e.Segments.length;d=e.Segments[0].Std;h=e.Segments[k-1].Sta;f=f.replace(/\[departureTime\]/,d.getTime());f=f.replace(/\[arrivalTime\]/,h.getTime())}f=f.replace(/\[classPricing\]/,e.JourneyFares[0].ClassOfService);j=b.BookingPricing.JourneyPricingList[m].getConfirmViewPassengerPricingHtml();r=SKYSALES.Util.convertToLocaleCurrency(b.BookingPricing.TotalBookingPrice);f=f.replace(/\[bookingTotalPrice\]/,r);g=SKYSALES.Util.convertToLocaleCurrency(b.BookingPricing.JourneyPricingList[m].JourneyTotalPrice);f=f.replace(/\[totalJourneyPrice\]/,g);f=f.replace(/\[passengersPricing\]/,j);q=SKYSALES.Util.convertToLocaleCurrency(b.BookingPricing.JourneyPricingList[m].TotalTaxAndFee);f=f.replace(/\[totalTaxesAndFees\]/,q);f=f.replace(/\[currencyName\]/,b.BookingPricing.CurrencyDescription);n+=f}this.container.html(n)};return b};SKYSALES.Class.BookingPricing=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.TotalBookingPrice=0;c.JourneyPricingList=[];c.CurrencyCode="";c.CurrencyDescription="";c.DisplayPrefix="";c.DisplaySuffix="";c.init=function(d){this.setSettingsByObject(d);this.initJourneyPricingListArray()};c.initJourneyPricingListArray=function(){var e=0,f=this.JourneyPricingList||[],d=f.length,g=null;for(e=0;e<d;e+=1){g=new SKYSALES.Class.JourneyPricingInfo();g.init(f[e]);f[e]=g}};return c};SKYSALES.Class.JourneyPricingInfo=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.JourneyTotalPrice=0;c.TotalTaxAndFee=0;c.JourneyPassengerPriceInfoList=[];c.journeyPassengerPricingHtmlTemplateId="journeyPassengerPricingHtmlTemplate";c.journeyPassengerPricingHtmlTemplate=null;c.confirmViewPassengerPriceInfoTemplateId="confirmViewPassengerPriceInfoTemplate";c.confirmViewPassengerPriceInfoTemplate=null;c.init=function(d){this.setSettingsByObject(d);this.setVars()};c.setVars=function(){this.journeyPassengerPricingHtmlTemplate=this.getById(this.journeyPassengerPricingHtmlTemplateId);this.confirmViewPassengerPriceInfoTemplate=this.getById(this.confirmViewPassengerPriceInfoTemplateId)};c.initJourneyPassengerPriceInfoList=function(){var f=0,e=this.JourneyPassengerPriceInfoList||[],d=e.length,g=null;for(f=0;f<d;f+=1){g=new SKYSALES.Class.JourneyPricingInfo();g.init(e[f]);e[f]=g}};c.getSelectViewPassengerPricingHtml=function(){var h=0,g="",k="",e=0,f=this.JourneyPassengerPriceInfoList||[],d=f.length,j=null;for(h=0;h<d;h+=1){j=f[h];g=this.journeyPassengerPricingHtmlTemplate.text();g=g.replace(/\[paxType\]/,j.PassengerType);e=SKYSALES.Util.convertToLocaleCurrency(j.PassengerPrice);g=g.replace(/\[passengerPrice\]/g,e);k+=g}return k};c.getConfirmViewPassengerPricingHtml=function(){var h=0,g="",k="",e=0,f=this.JourneyPassengerPriceInfoList||[],d=f.length,j=null;for(h=0;h<d;h+=1){j=f[h];g=this.confirmViewPassengerPriceInfoTemplate.text();g=g.replace(/\[paxType\]/,j.PassengerType);e=SKYSALES.Util.convertToLocaleCurrency(j.PassengerPrice);g=g.replace(/\[passengerPrice\]/g,e);k+=g}return k};return c};SKYSALES.Class.JourneyPassengerPriceInfo=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.PassengerType="";b.PassengerPrice=0;b.init=function(d){this.setSettingsByObject(d)};return b};SKYSALES.Class.BookingSum=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.BalanceDue="";b.PassiveSegmentCount=0;b.SegmentCount=0;b.TotalCost="";b.init=function(d){this.setSettingsByObject(d)};return b};SKYSALES.Class.Passenger=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.CustomerNumer=-1;c.FamilyNumber=-1;c.Infant=null;c.Name=null;c.PassengerAddresses=[];c.PassengerBags=[];c.PassengerFees=[];c.PassengerId=-1;c.PassengerInfo=null;c.PassengerNumber=-1;c.PassengerProgram=null;c.PassengerTravelDocuments=[];c.PassengerTypeInfo=null;c.init=function(d){this.setSettingsByObject(d)};return c};SKYSALES.Class.PassengerTypeInfo=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.PaxType="";c.Dob=null;c.init=function(d){this.setSettingsByObject(d)};return c};SKYSALES.Class.TripPlannerFareRules=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.containerId="tripPlannerFareRules";c.container=null;c.tripFareRuleTemplateId="tripPlannerFareRuleTemplate";c.tripFareRuleTemplate=null;c.fareRulesFormattedList=[];c.init=function(d){this.setSettingsByObject(d);this.setVars();this.draw()};c.setVars=function(){c.container=this.getById(this.containerId);c.tripFareRuleTemplate=this.getById(this.tripFareRuleTemplateId)};c.draw=function(){var f=0,e="",h="",g=this.fareRulesFormattedList||[],d=g.length,j=null;for(f=0;f<d;f+=1){j=g[f];h=this.tripFareRuleTemplate.text();h=h.replace(/\[tripNumber\]/g,f+1);h=h.replace(/\[fareRule\]/,SKYSALES.Util.decodeUriComponent(j));e+=h}this.container.html(e)};return c};SKYSALES.Class.TripPlannerHelp=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="tripPlannerHelpLink";b.container=null;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){this.container=this.getById(this.containerId)};b.addEvents=function(){this.addHelp()};b.addHelp=function(){var e=new SKYSALES.Class.ToggleView(),d={elementId:"tripPlannerHelp",hideId:"tripPlannerHelpLink",showId:"tripPlannerHelpLink"};e.init(d);e.updateHide()};return b};SKYSALES.Class.LoyaltyHistoryList=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.loyaltyTransactionList={};c.startDateId="";c.startDateDayId="";c.startDateMonthYearId="";c.startDate=null;c.startDateDay=null;c.startDateMonthYear=null;c.endDateId="";c.endDateDayId="";c.endDateMonthYearId="";c.endDate="";c.endDateDay="";c.endDateMonthYear="";c.filterButtonId="";c.filterButton=null;c.pageSizeId="";c.pageSizeDom=null;c.currentPageId="";c.currentPageDom=null;c.yearRange="";c.init=function(d){this.setSettingsByObject(d);this.setVars();this.initFilterDates();this.addEvents()};c.setVars=function(){this.startDate=this.getById(this.startDateId);this.startDateDay=this.getById(this.startDateDayId);this.startDateMonthYear=this.getById(this.startDateMonthYearId);this.endDate=this.getById(this.endDateId);this.endDateDay=this.getById(this.endDateDayId);this.endDateMonthYear=this.getById(this.endDateMonthYearId);this.pageSizeDom=this.getById(this.pageSizeId);this.currentPageDom=this.getById(this.currentPageId);this.filterButton=this.getById(this.filterButtonId)};c.addEvents=function(){this.filterButton.click(this.updateFilterHandler);this.startDateDay.change(this.updateFilterHandler);this.startDateMonthYear.change(this.updateFilterHandler);this.endDateDay.change(this.updateFilterHandler);this.endDateMonthYear.change(this.updateFilterHandler)};c.initFilterDates=function(){var d=SKYSALES.Util.parseIsoDate(this.loyaltyTransactionList.startDate),e=SKYSALES.Util.parseIsoDate(this.loyaltyTransactionList.endDate);this.populateDay(this.startDateDay,d.getDate());this.populateDay(this.endDateDay,e.getDate());this.populateMonthYear(this.startDateMonthYear,d.getFullYear(),(d.getMonth()+1));this.populateMonthYear(this.endDateMonthYear,e.getFullYear(),(e.getMonth()+1));this.populateHiddenDateFields()};c.formatDateValue=function(e){var d=e.toString();if(d.length===1){d="0"+d}return d};c.populateDay=function(f,h){var e=0,g=[],d={};for(e=1;e<=31;e+=1){g[e]={code:this.formatDateValue(e),name:e}}d={selectBox:f,objectArray:g,selectedItem:this.formatDateValue(h)};SKYSALES.Util.populateSelect(d)};c.populateMonthYear=function(j,o,f){var m=0,g=0,e=new Date(),k=e.getFullYear(),p=2,n=[],d={},h=0,l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];k=k-p;for(m=p*-1;m<=p;m+=1){for(g=1;g<=12;g+=1){n[h]={code:k+"-"+this.formatDateValue(g),name:l[g-1]+" "+k};h+=1}k+=1}d={selectBox:j,objectArray:n,selectedItem:o+"-"+this.formatDateValue(f)};SKYSALES.Util.populateSelect(d)};c.updateFilterHandler=function(){c.populateHiddenDateFields()};c.populateHiddenDateFields=function(){var e=this.startDateMonthYear.val()+"-"+this.startDateDay.val(),d=this.endDateMonthYear.val()+"-"+this.endDateDay.val();this.startDate.val(e);this.endDate.val(d);this.pageSizeDom.val(this.loyaltyTransactionList.pageSize)};return c};SKYSALES.Class.ParticipantMapping=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="PassengerToParticipant";b.container=null;b.participantInputHash={};b.dropDownInputArray=[];b.yearStart=1900;b.dayCount=31;b.birthDateId="";b.birthDate=null;b.birthDateYearId="";b.birthDateYear=null;b.birthDateMonthId="";b.birthDateMonth=null;b.birthDateDayId="";b.birthDateDay=null;b.disableFields=false;b.init=function(d){this.setSettingsByObject(d);this.setVars();this.initDropDowns();if(this.disableFields){this.disableFormFields()}else{this.addEvents()}this.updateBirthDateDropDown()};b.disableFormFields=function(){this.container.find(":input").attr("disabled","disabled")};b.setVars=function(){this.container=this.getById(this.containerId);this.birthDate=this.getById(this.birthDateId);this.birthDateYear=this.getById(this.birthDateYearId);this.birthDateMonth=this.getById(this.birthDateMonthId);this.birthDateDay=this.getById(this.birthDateDayId)};b.addEvents=function(){this.container.change(this.mapPassengerHandler);this.birthDate.change(this.updateBirthDateDropDownHandler);this.birthDateYear.change(this.updateBirthDateHandler);this.birthDateMonth.change(this.updateBirthDateHandler);this.birthDateDay.change(this.updateBirthDateHandler)};b.getDataTypeHash=function(){var h=SKYSALES.Util.getResource()||{},q=h.countryInfo.CountryList||[],n=h.provinceStateInfo.ProvinceStateList||[],j=h.titleInfo.TitleList||[],e=h.dateCultureInfo.monthNamesShort||[],u="",t={},l=[],m=[],s=[],p=0,k=0,d=this.dayCount,r=this.yearStart,g=new Date(),o=g.getFullYear(),f={};for(k=1;k<=d;k+=1){l.push({name:k,code:k})}p=e.length;for(k=0;k<p;k+=1){u=e[k];if(u){m.push({name:u,code:k})}}for(k=o;k>=r;k-=1){s.push({name:k,code:k})}p=n.length;for(k=0;k<p;k+=1){f=n[k]||{};f.code=f.scode}t={country:q,provinceState:n,title:j,dateDay:l,dateMonth:m,dateYear:s};return t};b.initDropDowns=function(){var f=0,o=this.dropDownInputArray||[],h=o.length,g=null,d="",l="",m="",j=[],k=this.getDataTypeHash()||{},n=null,e={};for(f=0;f<h;f+=1){g=o[f];d=g.id||"";l=g.dataType||"";m=g.value||"";n=this.getById(d);if(n.length&&k[l]){j=k[l];e={objectArray:j,input:n,showCode:false,clearOptions:false,selectedItem:m};SKYSALES.Util.populate(e)}}};b.mapPassengerHandler=function(){b.mapPassenger()};b.updateBirthDateHandler=function(){b.updateBirthDate()};b.updateBirthDate=function(){var g="",d=null,f=0,h=0,e=0;f=this.birthDateYear.val();h=this.birthDateMonth.val();e=this.birthDateDay.val();if(f&&h&&e){f=parseInt(f,10);h=parseInt(h,10);e=parseInt(e,10);d=new Date(f,h,e);g=SKYSALES.Util.dateToIsoString(d)}this.birthDate.val(g)};b.updateBirthDateDropDownHandler=function(){b.updateBirthDateDropDown()};b.updateBirthDateDropDown=function(){var g="",d=null,f=0,h=0,e=0;g=this.birthDate.val();d=SKYSALES.Util.parseIsoDate(g);if(d){f=d.getFullYear();h=d.getMonth();e=d.getDate();if(f!==9999){this.birthDateYear.val(f);this.birthDateMonth.val(h);this.birthDateDay.val(e)}}};b.getParticipantToPassengerMap=function(g,d){var h="",m="",f="",n="",l="",k={},j={},e={};if(d){g.Infant.Name=g.Infant.Name||{};h=g.Infant.Name.Title||"";m=g.Infant.Name.FirstName||"";f=g.Infant.Name.MiddleName||"";n=g.Infant.Name.LastName||"";l=g.Infant.Dob||""}else{g.Name=g.Name||{};h=g.Name.Title||"";m=g.Name.FirstName||"";f=g.Name.MiddleName||"";n=g.Name.LastName||"";l=g.PassengerTypeInfo.Dob||"";k=g.PassengerAddresses[0]||{};j=g.PassengerTravelDocuments[0]||{}}if(l.Year){l=new Date(l.Year,l.Month-1,l.Day);l=SKYSALES.Util.dateToIsoString(l)}e={title:h,firstName:m,middleName:f,lastName:n,birthDate:l,address1:k.AddressLine1,address2:k.AddressLine2,city:k.City,stateCode:k.ProvinceState,zipCode:k.PostalCode,countryCode:k.CountryCode,county:"",phoneHome:k.Phone,phoneWork:"",phoneFax:"",emailAddress:"",companyName:k.CompanyName,busOrRes:"",docIssuedBy:j.IssuedByCode,docNumber:j.DocNumber,docTypeCode:j.DocTypeCode,itemSequence:"",participantTypeCode:""};return e};b.mapPassenger=function(){var j=SKYSALES.Util.getResource()||{},m=j.passengerHash||{},n={},g={},f="",k=this.participantInputHash||{},q="",p=null,l="",h=[],e=-1,o=-1,d=false;l=this.container.val()||"";h=l.split("_");e=h[0]||-1;o=h[1]||-1;e=parseInt(e,10);o=parseInt(o,10);n=m[e];if(o===0){d=true}if(n){g=this.getParticipantToPassengerMap(n,d);for(f in k){if(k.hasOwnProperty(f)){q=g[f]||"";p=this.getById(k[f]);p.val(q)}}}this.updateBirthDateDropDown()};return b};SKYSALES.Class.PassThroughPayment=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.numberOfOrderItems=0;b.showNumberOfYearsFromPresent=7;b.orderItemsListJson=[];b.orderItemsArray=[];b.orderItemPaymentTypesListJson={};b.vendorsHash={};b.passThroughPaymentDataJson={};b.paymentInputContentIds={};b.paymentInputContent={};b.passThroughPaymentFieldsInformationJson={};b.passThroughPaymentContentArray=[];b.init=function(d){this.setSettingsByObject(d);this.initPropertiesFromData();this.initVendorsHash();this.initOrderItemsArray();this.initPaymentInputContentArray();this.initPassThroughPaymentContentArray()};b.initPropertiesFromData=function(){this.numberOfOrderItems=this.passThroughPaymentDataJson.numberOfOrderItems||"";this.showNumberOfYearsFromPresent=this.passThroughPaymentDataJson.showNumberOfYearsFromPresent||7;this.orderItemsListJson=this.passThroughPaymentDataJson.orderItemsListJson||[];this.orderItemPaymentTypesListJson=this.passThroughPaymentDataJson.orderItemPaymentTypesListJson||[]};b.initVendorsHash=function(){var e=0,g={},d=this.orderItemPaymentTypesListJson,f=d.length;for(e=0;e<f;e+=1){g=new SKYSALES.Class.Vendor();g.init(d[e]);b.vendorsHash[g.vendorCode]=g}};b.initOrderItemsArray=function(){var g=0,f={},d=this.orderItemsListJson||[],e=this.numberOfOrderItems;for(g=0;g<e;g+=1){f=new SKYSALES.Class.OrderItem();f.init(d[g]);this.orderItemsArray.push(f)}};b.initPaymentInputContentArray=function(){var d=new SKYSALES.Class.PaymentInputBase(),e=this.paymentInputContentIds||{};d.init(e);b.paymentInputContent=d};b.initPassThroughPaymentContentArray=function(){var g=0,h=this.numberOfOrderItems,e={},j={},d=this.passThroughPaymentFieldsInformationJson||{},f=this.orderItemsArray||[];for(g=0;g<h;g+=1){e=new SKYSALES.Class.PaymentPassThroughContent();j={index:g,vendor:this.vendorsHash[f[g].vendorCode],passThroughPaymentFieldsInformationJson:d,paymentInput:this.paymentInputContent,numberOfYearsToAdd:this.showNumberOfYearsFromPresent};e.init(j);this.passThroughPaymentContentArray.push(e)}};return b};SKYSALES.Class.PaymentPassThroughContent=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.numberOfYearsToAdd=7;b.index={};b.vendor={};b.passThroughPaymentFieldsInformationJson={};b.paymentInput={};b.useSameCardCheckId="";b.useSameCardCheck={};b.creditCardTypeId="";b.creditCardType={};b.creditCardNumberId="";b.creditCardNumber={};b.creditCardExpirationMonthId="";b.creditCardExpirationMonth={};b.creditCardExpirationYearId="";b.creditCardExpirationYear={};b.creditCardExpirationDateId="";b.creditCardExpirationDate={};b.creditCardHolderNameId="";b.creditCardHolderName={};b.creditCardCvvId="";b.creditCardCvv={};b.requiredNameErrorText="";b.requiredCvvErrorText="";b.requiredExpMonthErrorText="";b.requiredExpYearErrorText="";b.requiredCCNumErrorText="";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.populateCreditCardTypes();this.populateExpirationMonthYear();this.setPaymentPassThroughValidationFields();this.addEvents()};b.setVars=function(){var e=this.index,d=this.passThroughPaymentFieldsInformationJson||{};if(d.creditCardCvvId){this.creditCardCvvId=d.creditCardCvvId.replace(/\[index\]/g,e)}this.creditCardExpirationDateId=d.creditCardExpirationDateId.replace(/\[index\]/g,e);this.creditCardExpirationMonthId=d.creditCardExpirationMonthId.replace(/\[index\]/g,e);this.creditCardExpirationYearId=d.creditCardExpirationYearId.replace(/\[index\]/g,e);this.creditCardHolderNameId=d.creditCardHolderNameId.replace(/\[index\]/g,e);this.creditCardNumberId=d.creditCardNumberId.replace(/\[index\]/g,e);this.creditCardTypeId=d.creditCardTypeId.replace(/\[index\]/g,e);this.useSameCardCheckId=d.useSameCardCheckId.replace(/\[index\]/g,e);this.requiredCvvErrorText=d.requiredCvvErrorText;this.requiredNameErrorText=d.requiredNameErrorText;this.requiredExpMonthErrorText=d.requiredExpMonthErrorText;this.requiredExpYearErrorText=d.requiredExpYearErrorText;this.requiredCCNumErrorText=d.requiredCCNumErrorText;this.creditCardCvv=this.getById(this.creditCardCvvId);this.creditCardExpirationDate=this.getById(this.creditCardExpirationDateId);this.creditCardExpirationMonth=this.getById(this.creditCardExpirationMonthId);this.creditCardExpirationYear=this.getById(this.creditCardExpirationYearId);this.creditCardHolderName=this.getById(this.creditCardHolderNameId);this.creditCardNumber=this.getById(this.creditCardNumberId);this.creditCardType=this.getById(this.creditCardTypeId);this.useSameCardCheck=this.getById(this.useSameCardCheckId);this.updateUseSameCardVisibility()};b.updateUseSameCardVisibility=function(){var d=this.getTrimmedPaymentInputCardType(),j=this.vendor||{},h=j.acceptedPaymentTypesHash||{},f=this.useSameCardCheck||{},e=this.useSameCardCheckId||"",g=$('label[for="'+e+'"]');if(h[d]){f.show();g.show()}else{f.hide();g.hide()}};b.populateCreditCardTypes=function(){var e=this.vendor||{},d={input:this.creditCardType,objectArray:e.acceptedPaymentTypes};SKYSALES.Util.populate(d)};b.populateExpirationMonthYear=function(){var h=0,d=new Date(),j=d.getFullYear(),k=1,g=this.numberOfYearsToAdd||7,e={},f=[],m={},l=[];for(h=0;h<=g;h+=1){f[h]={code:j,name:j};j+=1}e={input:this.creditCardExpirationYear,objectArray:f};SKYSALES.Util.populate(e);for(h=0;h<9;h+=1){l[h]={code:"0"+k,name:"0"+k};k+=1}for(h=k-1;h<12;h+=1){l[h]={code:k,name:k};k+=1}m={input:this.creditCardExpirationMonth,objectArray:l};SKYSALES.Util.populate(m)};b.updatePaymentPassThroughExpirationDateHandler=function(){b.updatePaymentPassThroughExpirationDate()};b.updatePaymentPassThroughExpirationDate=function(){var e="",d="";e=this.creditCardExpirationMonth.val();d=this.creditCardExpirationYear.val();if(e&&d){this.creditCardExpirationDate.val(e+"/"+d)}};b.autoPopulateFieldsFromPaymentInputHandler=function(){if(this.checked){b.populateFieldsFromPaymentInput()}b.updatePaymentPassThroughExpirationDate();b.setPaymentPassThroughValidationFields()};b.getTrimmedPaymentInputCardType=function(){var e=this.paymentInput.paymentInputCreditCardType.val()||"",d=e.replace(/ExternalAccount:/,"");return d};b.populateFieldsFromPaymentInput=function(){var d=this.getTrimmedPaymentInputCardType(),e=this.paymentInput||{};if(d){this.creditCardType.val(d);this.creditCardNumber.val(e.paymentInputCreditCardNumber.val());this.creditCardExpirationYear.val(e.paymentInputCreditCardExpirationYear.val());this.creditCardExpirationMonth.val(e.paymentInputCreditCardExpirationMonth.val());this.creditCardHolderName.val(e.paymentInputCreditCardHolderName.val());this.creditCardCvv.val(e.paymentInputCreditCardCvv.val())}};b.setPaymentPassThroughValidationFieldsHandler=function(){b.setPaymentPassThroughValidationFields()};b.setPaymentPassThroughValidationFields=function(){var g=this.creditCardType.val()||"",o=this.creditCardNumber,h=this.creditCardHolderName,j=this.creditCardCvv,n=this.creditCardExpirationYear,k=this.creditCardExpirationMonth,m=this.vendor||{},p=m.acceptedPaymentTypesHash||{},l=p[g]||{requiresCCNum:true},e=SKYSALES.Util.setRequiredAttribute,d=SKYSALES.Util.removeRequiredAttribute,f="";d(o);if(l.requiresCCNum){f=this.requiredCCNumErrorText;e(o,f)}d(h);if(l.requiresCcName){f=this.requiredNameErrorText;e(h,f)}d(j);if(l.requiresCvv){f=this.requiredCvvErrorText;e(j,f)}d(k);if(l.requiresDate){f=this.requiredExpMonthErrorText;e(k,f)}d(n);if(l.requiresDate){f=this.requiredExpYearErrorText;e(n,f)}};b.addEvents=function(){this.creditCardExpirationMonth.change(this.updatePaymentPassThroughExpirationDateHandler);this.creditCardExpirationYear.change(this.updatePaymentPassThroughExpirationDateHandler);this.creditCardType.change(this.setPaymentPassThroughValidationFieldsHandler);this.useSameCardCheck.click(this.autoPopulateFieldsFromPaymentInputHandler)};return b};SKYSALES.Class.OrderItem=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.vendorCode="";b.init=function(d){this.setSettingsByObject(d)};return b};SKYSALES.Class.Vendor=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.vendorCode="";c.acceptedPaymentTypes=[];c.acceptedPaymentTypesHash={};c.init=function(d){this.setSettingsByObject(d);this.initAcceptedPaymentTypesHash()};c.initAcceptedPaymentTypesHash=function(){var d=0,f=this.acceptedPaymentTypes||[],g=f.length,e={};for(d=0;d<g;d+=1){e=new SKYSALES.Class.PaymentType();e.init(f[d]);c.acceptedPaymentTypesHash[e.code]=e}};return c};SKYSALES.Class.PaymentType=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.code="";c.name="";c.requiresCvv=false;c.requiresDate=false;c.requiresCcName=false;c.requiresCCNum=true;c.init=function(d){this.setSettingsByObject(d)};return c};SKYSALES.Class.Property=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.propertyFieldHash={};b.init=function(d){this.setSettingsByObject(d);this.setVars()};b.setVars=function(){var s=SKYSALES.Class.Property.validationHash||{},e="",r=null,g=this.propertyFieldHash,k="",j=null,f=[],n=0,p=0,q=null,d="",o="",m={},l={},h="";for(k in g){if(g.hasOwnProperty(k)){f=g[k]||[];p=f.length;for(n=0;n<p;n+=1){j={};q=f[n];e=q.id||"";j.id=e;r=j.input;r=this.getById(e);r=r[0];j.propertyHash={};s=q.propertyHash||{};if(r){for(d in s){if(s.hasOwnProperty(d)){o=d.toLowerCase();m=s[d];l=$(r);h=o+".validation";l.data(h,m);if(o==="required"){SKYSALES.Util.formatInputLabel(l)}}}}}}}};return b};SKYSALES.Class.Property.validationHash={};SKYSALES.Class.InsuranceTermsBase=function(){var c=new SKYSALES.Class.SkySales(),b=SKYSALES.Util.extendObject(c);b.containerId="";b.container=null;b.parentContainerId="";b.parentContainer=null;b.url="InsuranceTermsViewAjax-resource.aspx";b.termsInfo="";b.participantBaseId="";b.participant="";b.keyId="";b.key="";b.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents()};b.setVars=function(){var d={};b.container=this.getById(this.containerId);b.participant=this.getById(this.participantBaseId);d=this.getById(this.keyId);b.key=d;if(this.parentContainerId!==""){b.parentContainer=this.getById(this.parentContainerId)}};b.addEvents=function(){if(this.parentContainer!==null){this.parentContainer.click(this.parentContainerClickHandler)}};b.parentContainerClickHandler=function(){b.parentContainerClick()};b.parentContainerClick=function(){var d=this.key.val();this.ajax(d)};b.updateTermsHandler=function(d){b.updateTerms(d)};b.updateTerms=function(d){this.container.html(d)};b.ajax=function(d){if(d!==undefined&&d!==""){b.termsInfo="?key="+d;$.post(this.url+this.termsInfo,this.updateTermsHandler)}};return b};SKYSALES.Class.SingleInsuranceTerms=function(){var c=new SKYSALES.Class.InsuranceTermsBase(),b=SKYSALES.Util.extendObject(c);b.establishmentIds=[];b.establishments=[];b.setVars=function(){var e=0,d=this.establishmentIds,g=d.length,f="",h={};c.setVars.call(this);for(e=0;e<g;e+=1){f=d[e];h=this.getById(f);b.establishments[e]=h}};b.parentContainerClickHandler=function(){b.parentContainerClick()};b.parentContainerClick=function(){var e=this.key.val(),f=this.establishments,h={},g=f.length,d=0;for(d=0;d<g;d+=1){h=f[d];e=h.val();if(e){break}}c.ajax(e)};b.addEvents=function(){if(this.parentContainer!==null){this.parentContainer.click(this.parentContainerClickHandler)}};b.init=function(d){c.setSettingsByObject.call(this,d);this.setVars();this.addEvents()};return b};SKYSALES.Class.InsuranceTerms=function(){var b=new SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.singleTermsInsuranceBaseId="";c.singleTermsInsuranceArray=[];c.groupTermsInsuranceBaseId="";c.groupTermsInsuranceArray=[];c.parentSingleBaseId="";c.parentGroupBaseId="";c.participantSingleBaseId="";c.participantGroupBaseId="";c.singleCoverageKey="";c.groupCoverageKey="";c.establishmentIdsByProduct=[];c.init=function(d){this.setSettingsByObject(d);this.setVars();this.initSingleTermsInsuranceArray();this.initGroupTermsInsuranceArray()};c.setVars=function(){this.singleTermsInsuranceArray=$("[id^='"+this.singleTermsInsuranceBaseId+"']");this.groupTermsInsuranceArray=$("[id^='"+this.groupTermsInsuranceBaseId+"']")};c.initSingleTermsInsuranceArray=function(){var e=0,f=this.singleTermsInsuranceArray||[],d=f.length,h=null,g={};for(e=0;e<d;e+=1){g=this.getById(f[e].id);h=new SKYSALES.Class.SingleInsuranceTerms();h.containerId=this.singleTermsInsuranceBaseId+e;h.parentContainerId=this.parentSingleBaseId+e;h.participantBaseId=this.participantSingleBaseId+e;h.establishmentIds=this.establishmentIdsByProduct[e];h.init(g);f[e]=h}};c.initGroupTermsInsuranceArray=function(){var g=0,e=this.groupTermsInsuranceArray||[],d=e.length,h=null,f={};for(g=0;g<d;g+=1){f={};h=new SKYSALES.Class.InsuranceTermsBase();f.containerId=this.groupTermsInsuranceBaseId+g;f.parentContainerId=this.parentGroupBaseId+g;f.participantBaseId=this.participantGroupBaseId+g;f.keyId=this.groupCoverageKey+g;h.init(f);e[g]=h}};return c};SKYSALES.Class.MCCInput=function(){var b=SKYSALES.Class.SkySales(),d=SKYSALES.Util.extendObject(b),c=SKYSALES.Util.getResource();d.bookingCurrencyCode="";d.externalRateId="";d.defaultCurrencyValue="";d.dropDownListCurrencyId="";d.dropDownListCurrency=null;d.externalRateInfo=c.externalRateInfo;d.currencyHash=c.currencyHash;d.setVars=function(){d.dropDownListCurrency=this.getById(this.dropDownListCurrencyId)};d.populateCurrency=function(){var l=this.externalRateInfo.ExternalRateList,h="",k=[],g=null,f=null,e={},j="",m={};if(this.bookingCurrencyCode&&this.dropDownListCurrency){for(h in l){if(l.hasOwnProperty(h)){g=l[h];if(g.quotedCurrency===this.bookingCurrencyCode){f=this.currencyHash[g.collectedCurrency];if(f){g.name=f.name}else{g.name=g.collectedCurrency}k[k.length]=g}}}f=this.currencyHash[this.bookingCurrencyCode];if(f){j=f.name}else{j=this.bookingCurrencyCode}e={code:this.defaultCurrencyValue,name:j};k[k.length]=e;m={objectArray:k,selectBox:this.dropDownListCurrency,selectedItem:this.externalRateId,showCode:false};SKYSALES.Util.populateSelect(m)}};d.init=function(e){this.setSettingsByObject(e);this.setVars();this.addEvents();this.populateCurrency()};return d};SKYSALES.Class.SFPDPassengerInput=function(){var b=SKYSALES.Class.SkySales(),c=SKYSALES.Util.extendObject(b);c.passengerGenderIdArray=[];c.infantGenderIdArray=[];c.init=function(d){this.setSettingsByObject(d);this.setVars();this.addEvents();this.setGenderFieldsToEmpty(c.passengerGenderIdArray||[]);this.setGenderFieldsToEmpty(c.infantGenderIdArray||[])};c.setGenderFieldsToEmpty=function(e){var g="",f=null,d=0;for(d=0;d<e.length;d+=1){g=e[d];f=this.getById(g);f.val("")}};return c};$(document).ready(SKYSALES.Util.ready);$(window).load(SKYSALES.Util.load)}());
