﻿/*
This file is part of the Navitaire NewSkies application.
Copyright (C) Navitaire.  All rights reserved.
*/
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};if(!SKYSALES.Class.LocaleCurrency){SKYSALES.Class.LocaleCurrency=function(){var parent=new SKYSALES.Class.SkySales();var thisLocaleCurrency=SKYSALES.Util.extendObject(parent);thisLocaleCurrency.num=null;thisLocaleCurrency.localeCurrency=null;var resource=SKYSALES.Util.getResource();var currencyCultureInfo=resource.currencyCultureInfo;var integerPartNum=0;var integerPartString="";var decimalPartString="";var number="";var positive=true;var getCurrencyPattern=function(){var pattern=currencyCultureInfo.positivePattern;if(!positive){pattern=currencyCultureInfo.negativePattern}return pattern};var getIntegerPart=function(numVal){var groupSizes=currencyCultureInfo.groupSizes||[];var groupSeparator=currencyCultureInfo.groupSeparator;var groupSizesIndex=0;var index=0;var currentGroupSize=3;if(groupSizesIndex>groupSizes.length){currentGroupSize=groupSizes[groupSizesIndex]}var currentGroupEndIndex=currentGroupSize-1;integerPartNum=Math.floor(numVal);var localString=integerPartNum.toString();var array=localString.split("");var reverseArray=array.reverse();var reverseArrayOutput=[];var getNextGroupSize=function(){var nextGroupSize=3;if(groupSizesIndex<=groupSizes.length-2){groupSizesIndex+=1;nextGroupSize=groupSizes[groupSizesIndex]}else{nextGroupSize=currentGroupSize}currentGroupEndIndex+=nextGroupSize;return nextGroupSize};for(index=0;index<reverseArray.length;index+=1){if(index>currentGroupEndIndex){currentGroupSize=getNextGroupSize();reverseArrayOutput.push(groupSeparator)}reverseArrayOutput.push(reverseArray[index])}array=reverseArrayOutput.reverse();var outputString=array.join("");return outputString};var getDecimalPart=function(numVal){var decimalPart=numVal-integerPartNum;var decimalPartTrimmed=decimalPart.toFixed(currencyCultureInfo.decimalDigits);var decimalPartString=decimalPartTrimmed.substring(2);return decimalPartString};var applyPattern=function(){var pattern=getCurrencyPattern()||"";var replaceNumber=pattern.replace("n",number);return replaceNumber};var invariantNumberToLocaleCurrency=function(){thisLocaleCurrency.currency=thisLocaleCurrency.num.toString();positive=thisLocaleCurrency.num>=0;thisLocaleCurrency.num=Math.abs(thisLocaleCurrency.num);integerPartString=getIntegerPart(thisLocaleCurrency.num);decimalPartString=getDecimalPart(thisLocaleCurrency.num);number=integerPartString+currencyCultureInfo.decimalSeparator+decimalPartString;thisLocaleCurrency.currency=applyPattern()};thisLocaleCurrency.init=function(json){this.setSettingsByObject(json);if(null!==this.num){invariantNumberToLocaleCurrency()}};return thisLocaleCurrency}}SKYSALES.Class.Resource=function(){var parent=new SKYSALES.Class.SkySales();var thisResource=SKYSALES.Util.extendObject(parent);thisResource.locationInfo={};thisResource.countryInfo={};thisResource.stationInfo={};thisResource.macInfo={};thisResource.marketInfo={};thisResource.macHash={};thisResource.stationHash={};thisResource.marketHash={};thisResource.sourceInfo={};thisResource.clientHash={};thisResource.dateCultureInfo={};thisResource.currencyCultureInfo={};thisResource.populateMacHash=function(){var i=0;var macArray=[];var macHash={};var mac=null;if(thisResource.macInfo&&thisResource.macInfo.MacList){macArray=thisResource.macInfo.MacList;for(i=0;i<macArray.length;i+=1){mac=macArray[i];macHash[mac.code]=mac}}thisResource.macHash=macHash};thisResource.populateStationHash=function(){var i=0;var stationArray=[];var stationHash={};var station=null;if(thisResource.stationInfo&&thisResource.stationInfo.StationList){stationArray=thisResource.stationInfo.StationList;for(i=0;i<stationArray.length;i+=1){station=stationArray[i];stationHash[station.code]=station}}thisResource.stationHash=stationHash};thisResource.populateMarketHash=function(){var i=0;var marketHash={};var marketArray=[];var market={};var destinationIndex=0;var destinationArray=[];var destinationCode="";var destination={};var station={};if(thisResource.marketInfo&&thisResource.marketInfo.MarketList){marketArray=thisResource.marketInfo.MarketList;for(i=0;i<marketArray.length;i+=1){market=marketArray[i];destinationArray=market.Value;if(destinationArray){marketHash[market.Key]=destinationArray;for(destinationIndex=0;destinationIndex<destinationArray.length;destinationIndex+=1){destination=destinationArray[destinationIndex];destinationCode=destination.code;destination.name="";destination.countryCode="";station=thisResource.stationHash[destinationCode];if(station){destination.name=station.name;destination.countryCode=station.countryCode}}}}thisResource.marketHash=marketHash}};thisResource.populateClientHash=function(){var cookie=window.document.cookie;var nameValueArray=[];var i=0;var singleNameValue="";var key="";var value="";var eqIndex=-1;if(cookie){nameValueArray=document.cookie.split("; ");for(i=0;i<nameValueArray.length;i+=1){singleNameValue=nameValueArray[i];eqIndex=singleNameValue.indexOf("=");if(eqIndex>-1){key=singleNameValue.substring(0,eqIndex);value=singleNameValue.substring(eqIndex+1,singleNameValue.length);if(key){value=SKYSALES.Util.decodeUriComponent(value);thisResource.clientHash[key]=value}}}}};thisResource.setSettingsByObject=function(jsonObject){parent.setSettingsByObject.call(this,jsonObject);thisResource.populateStationHash();thisResource.populateMacHash();thisResource.populateMarketHash();thisResource.populateClientHash()};return thisResource};SKYSALES.Util.createObjectArray=[];SKYSALES.Util.createObject=function(objNameBase,objType,json){var createObjectArray=SKYSALES.Util.createObjectArray;createObjectArray[createObjectArray.length]={objNameBase:objNameBase,objType:objType,json:json}};SKYSALES.Util.initObjects=function(){var i=0;var createObjectArray=SKYSALES.Util.createObjectArray;var objName="";var objectType="";var json=null;var createObject=null;for(i=0;i<createObjectArray.length;i+=1){createObject=createObjectArray[i];objName=createObject.objNameBase+SKYSALES.Instance.getNextIndex();objectType=createObject.objType;json=createObject.json||{};if(SKYSALES.Class[objectType]){SKYSALES.Instance[objName]=new SKYSALES.Class[objectType]();SKYSALES.Instance[objName].init(json)}}SKYSALES.Util.createObjectArray=[]};SKYSALES.Util.decodeUriComponent=function(str){str=str||"";if(window.decodeURIComponent){str=window.decodeURIComponent(str)}str=str.replace(/\+/g," ");return str};SKYSALES.Util.encodeUriComponent=function(str){str=str||"";if(window.encodeURIComponent){str=window.encodeURIComponent(str)}return str};SKYSALES.Util.getResource=function(){return SKYSALES.Resource};SKYSALES.Util.extendObject=function(o){var F=function(){};F.prototype=o;return new F()};SKYSALES.Util.initializeNewObject=function(paramObject){var objName="";var defaultSetting={objNameBase:"",objType:"",selector:""};var validateParamObject=function(){var retVal=true;$().extend(defaultSetting,paramObject);var propName=null;for(propName in defaultSetting){if(defaultSetting.hasOwnProperty(propName)){if(defaultSetting[propName]===undefined){retVal=false;break}}}return retVal};var paramNodeFunction=function(index){var paramNodeValue=$(this).val();var parsedJsonObject=SKYSALES.Json.parse(paramNodeValue);var funRef=null;var refName="";var refArray=[];var i=0;var refIndex=0;var arrayRegex=/^([a-zA-Z0-9]+)\[(\d+)\]$/;var matchArray=[];if(parsedJsonObject.method!==undefined){funRef=SKYSALES.Instance[objName];if(parsedJsonObject.method.name.indexOf(".")>-1){refArray=parsedJsonObject.method.name.split(".");for(i=0;i<refArray.length;i+=1){refName=refArray[i];matchArray=refName.match(arrayRegex);if((matchArray)&&(matchArray.length>0)){refName=matchArray[1];refIndex=matchArray[2];refIndex=parseInt(refIndex,10);funRef=funRef[refName][refIndex]}else{funRef=funRef[refName]}}}else{funRef=funRef[parsedJsonObject.method.name]}if(funRef){funRef(parsedJsonObject.method.paramJsonObject)}}};var objectNodeFunction=function(){objName=paramObject.objNameBase+SKYSALES.Instance.getNextIndex();if(SKYSALES.Class[paramObject.objType]){SKYSALES.Instance[objName]=new SKYSALES.Class[paramObject.objType]();$("object.jsObject > param",this).each(paramNodeFunction)}else{alert("Object Type Not Found: "+paramObject.objType)}};var containerFunction=function(){var isValid=validateParamObject();if(isValid){$(paramObject.selector).each(objectNodeFunction)}else{alert("\nthere has been an error")}};containerFunction();return false};SKYSALES.Util.populateSelect=function(paramObj){var selectedItem=paramObj.selectedItem||null;var objectArray=paramObj.objectArray||null;var selectBox=paramObj.selectBox||null;var showCode=paramObj.showCode||false;var clearOptions=paramObj.clearOptions||false;var text="";var value="";var selectBoxObj=null;var obj=null;var prop="";if(selectBox){selectBoxObj=selectBox.get(0);if(selectBoxObj&&selectBoxObj.options){if(clearOptions){selectBoxObj.options.length=0}else{if(!selectBoxObj.originalOptionLength){selectBoxObj.originalOptionLength=selectBoxObj.options.length}selectBoxObj.options.length=selectBoxObj.originalOptionLength}if(objectArray){for(prop in objectArray){if(objectArray.hasOwnProperty(prop)){obj=objectArray[prop];if(showCode){text=obj.name+" ("+obj.code+")"}else{text=obj.name}value=obj.code;selectBoxObj.options[selectBoxObj.options.length]=new window.Option(text,value,false,false)}}if(selectedItem!==null){selectBox.val(selectedItem)}}}}};SKYSALES.Util.cloneArray=function(array){return array.concat()};SKYSALES.Util.convertToLocaleCurrency=function(num){var json={num:num};var localeCurrency=new SKYSALES.Class.LocaleCurrency();localeCurrency.init(json);return localeCurrency.currency};if(!SKYSALES.Class.SkySales){SKYSALES.Class.SkySales=function(){var thisSkySales=this;thisSkySales.containerId="";thisSkySales.container=null;thisSkySales.init=SKYSALES.Class.SkySales.prototype.init;thisSkySales.setSettingsByObject=SKYSALES.Class.SkySales.prototype.setSettingsByObject;thisSkySales.addEvents=SKYSALES.Class.SkySales.prototype.addEvents;thisSkySales.setVars=SKYSALES.Class.SkySales.prototype.setVars;thisSkySales.hide=SKYSALES.Class.SkySales.prototype.hide;thisSkySales.show=SKYSALES.Class.SkySales.prototype.show;return thisSkySales};SKYSALES.Class.SkySales.prototype.init=function(json){this.setSettingsByObject(json);this.setVars()};SKYSALES.Class.SkySales.prototype.setSettingsByObject=function(json){var propName="";for(propName in json){if(json.hasOwnProperty(propName)){if(this[propName]!==undefined){this[propName]=json[propName]}}}};SKYSALES.Class.SkySales.prototype.addEvents=function(){};SKYSALES.Class.SkySales.prototype.setVars=function(){this.container=$("#"+this.containerId)};SKYSALES.Class.SkySales.prototype.hide=function(){this.container.hide("slow")};SKYSALES.Class.SkySales.prototype.show=function(){this.container.show("slow")}}if(!SKYSALES.Class.BaseToggleView){SKYSALES.Class.BaseToggleView=function(){var parent=SKYSALES.Class.SkySales();var thisBaseToggleView=SKYSALES.Util.extendObject(parent);thisBaseToggleView.toggleViewIdArray=[];thisBaseToggleView.toggleViewArray=[];thisBaseToggleView.addToggleView=function(json){if(json.toggleViewIdArray){json=json.toggleViewIdArray}var toggleViewIdArray=json||[];var toggleViewIdObj=null;var i=0;var toggleView=null;if(toggleViewIdArray.length===undefined){toggleViewIdArray=[];toggleViewIdArray[0]=json}for(i=0;i<toggleViewIdArray.length;i+=1){toggleViewIdObj=toggleViewIdArray[i];toggleView=new SKYSALES.Class.ToggleView();toggleView.init(toggleViewIdObj);thisBaseToggleView.toggleViewArray[thisBaseToggleView.toggleViewArray.length]=toggleView}};return thisBaseToggleView}}if(!SKYSALES.Class.FlightSearch){SKYSALES.Class.FlightSearch=function(){var parent=new SKYSALES.Class.SkySales();var thisFlightSearch=SKYSALES.Util.extendObject(parent);thisFlightSearch.marketArray=null;thisFlightSearch.flightTypeInputIdArray=null;thisFlightSearch.countryInputIdArray=null;var countryInputArray=[];var flightTypeInputArray=[];thisFlightSearch.init=function(paramObject){this.setSettingsByObject(paramObject);this.setVars();this.addEvents();this.initFlightTypeInputIdArray();this.initCountryInputIdArray();this.populateFlightType()};thisFlightSearch.setSettingsByObject=function(json){parent.setSettingsByObject.call(this,json);var i=0;var marketArray=this.marketArray||[];var market=null;for(i=0;i<marketArray.length;i+=1){market=new SKYSALES.Class.FlightSearchMarket();market.flightSearch=this;market.index=i;market.init(marketArray[i]);thisFlightSearch.marketArray[i]=market}};thisFlightSearch.initCountryInputIdArray=function(){var i=0;var countryInputId=null;var countryInput={};var countryInputIdArray=this.countryInputIdArray||[];for(i=0;i<countryInputIdArray.length;i+=1){countryInputId=countryInputIdArray[i];countryInput=new SKYSALES.Class.CountryInput();countryInput.init(countryInputId);countryInputArray[countryInputArray.length]=countryInput}};thisFlightSearch.initFlightTypeInputIdArray=function(){var i=0;var flightTypeInputId=null;var flightTypeInput={};var flightTypeInputIdArray=this.flightTypeInputIdArray||[];for(i=0;i<flightTypeInputIdArray.length;i+=1){flightTypeInputId=flightTypeInputIdArray[i];flightTypeInput=new SKYSALES.Class.FlightTypeInput();flightTypeInput.flightSearch=this;flightTypeInput.index=i;flightTypeInput.init(flightTypeInputId);flightTypeInputArray[flightTypeInputArray.length]=flightTypeInput}};thisFlightSearch.populateFlightType=function(){var flightTypeIndex=0;var flightType=null;for(flightTypeIndex=0;flightTypeIndex<flightTypeInputArray.length;flightTypeIndex+=1){flightType=flightTypeInputArray[flightTypeIndex];if(flightType.input.attr("checked")){flightType.input.click();break}}};thisFlightSearch.updateFlightType=function(activeflightType){var flightTypeIndex=0;var flightType=null;for(flightTypeIndex=0;flightTypeIndex<flightTypeInputArray.length;flightTypeIndex+=1){flightType=flightTypeInputArray[flightTypeIndex];flightType.hideInputArray.show()}activeflightType.hideInputArray.hide()};return thisFlightSearch};SKYSALES.Class.FlightSearch.createObject=function(json){SKYSALES.Util.createObject("flightSearch","FlightSearch",json)}}if(!SKYSALES.Class.FlightSearchMarket){SKYSALES.Class.FlightSearchMarket=function(){var parent=new SKYSALES.Class.SkySales();var thisFlightSearchMarket=SKYSALES.Util.extendObject(parent);thisFlightSearchMarket.flightSearch=null;thisFlightSearchMarket.index=-1;thisFlightSearchMarket.validationMessageObject={};thisFlightSearchMarket.validationObjectIdArray=[];thisFlightSearchMarket.stationInputIdArray=[];thisFlightSearchMarket.stationDropDownIdArray=[];thisFlightSearchMarket.marketInputIdArray=[];thisFlightSearchMarket.macInputIdArray=[];thisFlightSearchMarket.marketDateIdArray=[];var marketInputArray=[];var stationInputArray=[];var stationDropDownArray=[];var macInputArray=[];var marketDateArray=[];thisFlightSearchMarket.init=function(json){this.setSettingsByObject(json);this.setVars();this.addEvents();this.initMarketInputIdArray();this.initStationInputIdArray();this.initStationDropDownIdArray();this.initMacInputIdArray();this.initMarketDateIdArray();this.initValidationObjectRedirect()};thisFlightSearchMarket.initMacInputIdArray=function(){var i=0;var macInputId=null;var macInput={};var macInputIdArray=this.macInputIdArray||[];for(i=0;i<macInputIdArray.length;i+=1){macInputId=macInputIdArray[i];macInput=new SKYSALES.Class.MacInput();macInput.init(macInputId);macInputArray[macInputArray.length]=macInput;macInput.showMac.call(macInput.stationInput)}};thisFlightSearchMarket.initMarketDateIdArray=function(){var i=0;var marketDateId=null;var marketDate={};var marketDateIdArray=this.marketDateIdArray||[];for(i=0;i<marketDateIdArray.length;i+=1){marketDateId=marketDateIdArray[i];marketDate=new SKYSALES.Class.MarketDate();marketDate.init(marketDateId);marketDateArray[marketDateArray.length]=marketDate}};thisFlightSearchMarket.initMarketInputIdArray=function(){var i=0;var marketInputId=null;var marketInput={};var marketInputIdArray=this.marketInputIdArray||[];for(i=0;i<marketInputIdArray.length;i+=1){marketInputId=marketInputIdArray[i];marketInput=new SKYSALES.Class.MarketInput();marketInput.init(marketInputId);marketInputArray[marketInputArray.length]=marketInput}};thisFlightSearchMarket.initStationInputIdArray=function(){var i=0;var stationInputId=null;var stationInput={};var stationInputIdArray=this.stationInputIdArray;for(i=0;i<stationInputIdArray.length;i+=1){stationInputId=stationInputIdArray[i];stationInput=new SKYSALES.Class.StationInput();stationInput.init(stationInputId);stationInputArray[stationInputArray.length]=stationInput}};thisFlightSearchMarket.initStationDropDownIdArray=function(){var i=0;var stationDropDownId=null;var stationDropDown={};var stationDropDownIdArray=this.stationDropDownIdArray;for(i=0;i<stationDropDownIdArray.length;i+=1){stationDropDownId=stationDropDownIdArray[i];stationDropDown=new SKYSALES.Class.StationDropDown();stationDropDown.init(stationDropDownId);stationDropDownArray[stationDropDownArray.length]=stationDropDown}};thisFlightSearchMarket.initValidationObjectRedirect=function(){var validationObjectIdArray=this.validationObjectIdArray||[];var i=0;var validationObjectId="";var key="";var value="";var metaObjectParamToModify=null;var dropDownListToValidate=null;var metaObjectParam=null;for(i=0;i<validationObjectIdArray.length;i+=1){validationObjectId=validationObjectIdArray[i];key=validationObjectId.key||"";value=validationObjectId.value||"";metaObjectParamToModify=$("object.metaobject>param[@value*='"+key+"']");if(metaObjectParamToModify.length>0){dropDownListToValidate=$(":input#"+value);if(dropDownListToValidate.length>0){metaObjectParam=metaObjectParamToModify[0];if("value" in metaObjectParam){var newStr=metaObjectParam.value;newStr=newStr.replace(key,value);metaObjectParam.value=newStr}}}}};return thisFlightSearchMarket}}if(!SKYSALES.Class.MacInput){SKYSALES.Class.MacInput=function(){var macInputBase=new SKYSALES.Class.SkySales();var thisMacInput=SKYSALES.Util.extendObject(macInputBase);thisMacInput.macHash=SKYSALES.Util.getResource().macHash;thisMacInput.stationHash=SKYSALES.Util.getResource().stationHash;thisMacInput.stationInputId="";thisMacInput.macContainerId="";thisMacInput.macLabelId="";thisMacInput.macInputId="";thisMacInput.macContainer={};thisMacInput.stationInput={};thisMacInput.macInput={};thisMacInput.macLabel={};thisMacInput.showMac=function(){var stationCode=$(this).val();stationCode=stationCode||"";stationCode=stationCode.toUpperCase();var station=null;var macCode="";var macText="";var mac=null;thisMacInput.macInput.removeAttr("checked");thisMacInput.macContainer.hide();station=thisMacInput.stationHash[stationCode];if(station){macCode=station.macCode;mac=thisMacInput.macHash[macCode];if((mac)&&(mac.stations.length>0)){macText=mac.stations.join();thisMacInput.macLabel.html(macText);thisMacInput.macContainer.show()}}};thisMacInput.addEvents=function(){thisMacInput.stationInput.change(thisMacInput.showMac)};thisMacInput.setVars=function(){thisMacInput.stationInput=$("#"+thisMacInput.stationInputId);thisMacInput.macContainer=$("#"+thisMacInput.macContainerId);thisMacInput.macLabel=$("#"+thisMacInput.macLabelId);thisMacInput.macInput=$("#"+thisMacInput.macInputId)};thisMacInput.init=function(paramObject){macInputBase.init.call(this,paramObject);thisMacInput.macContainer.hide();this.addEvents()};return thisMacInput}}if(!SKYSALES.Class.MarketDate){SKYSALES.Class.MarketDate=function(){var marketDateBase=new SKYSALES.Class.SkySales();var thisMarketDate=SKYSALES.Util.extendObject(marketDateBase);thisMarketDate.dateFormat=SKYSALES.datepicker.datePickerFormat;thisMarketDate.dateDelimiter=SKYSALES.datepicker.datePickerDelimiter;thisMarketDate.marketDateId="";thisMarketDate.marketDate=null;thisMarketDate.marketDayId="";thisMarketDate.marketDay=null;thisMarketDate.marketMonthYearId="";thisMarketDate.marketMonthYear=null;thisMarketDate.setSettingsByObject=function(jsonObject){marketDateBase.setSettingsByObject.call(this,jsonObject);var propName="";for(propName in jsonObject){if(thisMarketDate.hasOwnProperty(propName)){thisMarketDate[propName]=jsonObject[propName]}}};thisMarketDate.parseDate=function(dateStr){var day="";var month="";var year="";var date=new Date();var dateData="";var formatChar="";var datePickerArray=[];var i=0;if(dateStr.indexOf(thisMarketDate.dateDelimiter)>-1){datePickerArray=dateStr.split(thisMarketDate.dateDelimiter);for(i=0;i<thisMarketDate.dateFormat.length;i+=1){dateData=datePickerArray[i];if(dateData.charAt(0)==="0"){dateData=dateData.substring(1)}formatChar=thisMarketDate.dateFormat.charAt(i);switch(formatChar){case"m":month=dateData;break;case"d":day=dateData;break;case"y":year=dateData;break}}date=new Date(year,month-1,day)}return date};thisMarketDate.addEvents=function(){var datePickerManager=new SKYSALES.Class.DatePickerManager();datePickerManager.isAOS=false;datePickerManager.yearMonth=thisMarketDate.marketMonthYear;datePickerManager.day=thisMarketDate.marketDay;datePickerManager.linkedDate=thisMarketDate.marketDate;datePickerManager.init()};thisMarketDate.setVars=function(){thisMarketDate.marketDate=$("#"+thisMarketDate.marketDateId);thisMarketDate.marketDay=$("#"+thisMarketDate.marketDayId);thisMarketDate.marketMonthYear=$("#"+thisMarketDate.marketMonthYearId)};thisMarketDate.init=function(paramObject){marketDateBase.init.call(this,paramObject);this.addEvents()};thisMarketDate.datesInOrder=function(dateArray){var retVal=true;var dateA=null;var dateB=null;dateA=this.parseDate(dateArray[0]);dateB=this.parseDate(dateArray[1]);if(dateA>dateB){retVal=false}return retVal};thisMarketDate.datesIsEqual=function(dateArray,hours){var retVal=true;var difHrs;var dateA=null;var dateNow=new Date();dateA=this.parseDate(dateArray[0]);difHrs=this.GetDifhours(dateA,dateNow);if(difHrs<=hours){retVal=false}return retVal};thisMarketDate.dateNoFlights=function(dateArray){var retVal=true;var minDate=null;var maxDate=new Date();var setDayDate=new Date();maxDate.setFullYear(maxDate.getFullYear()+1);minDate=this.parseDate(dateArray[dateArray.length-1]);if(minDate>maxDate){retVal=false}return retVal};thisMarketDate.GetDifhours=function(dateA,dateB){var dayA=dateA.getDate();var dayB=dateB.getDate();var monthA=dateA.getMonth()+1;var monthB=dateB.getMonth()+1;var yearA=dateA.getFullYear();var yearB=dateB.getFullYear();var difHrs;if(monthA<=monthB&&yearA<=yearB){difHrs=(dayA-dayB)+1;difHrs=difHrs*24}return difHrs};return thisMarketDate}}if(!SKYSALES.Class.CountryInput){SKYSALES.Class.CountryInput=function(){var countryInputBase=new SKYSALES.Class.SkySales();var thisCountryInput=SKYSALES.Util.extendObject(countryInputBase);thisCountryInput.countryInfo=SKYSALES.Util.getResource().countryInfo;thisCountryInput.countryInputId="";thisCountryInput.input={};thisCountryInput.defaultCountry="";thisCountryInput.countryArray=[];thisCountryInput.populateCountryInput=function(){var selectParamObj={selectBox:thisCountryInput.input,objectArray:thisCountryInput.countryArray,selectedItem:thisCountryInput.defaultCountry,showCode:true};SKYSALES.Util.populateSelect(selectParamObj)};thisCountryInput.addEvents=function(){};thisCountryInput.setVars=function(){thisCountryInput.input=$("#"+thisCountryInput.countryInputId);var countryInfo=thisCountryInput.countryInfo;if(countryInfo){if(countryInfo.CountryList){thisCountryInput.countryArray=countryInfo.CountryList}if(countryInfo.DefaultValue){thisCountryInput.defaultCountry=countryInfo.DefaultValue}}};thisCountryInput.init=function(paramObject){countryInputBase.init.call(this,paramObject);thisCountryInput.populateCountryInput();this.addEvents()};return thisCountryInput}}if(!SKYSALES.Class.FlightTypeInput){SKYSALES.Class.FlightTypeInput=function(){var parent=new SKYSALES.Class.SkySales();var thisFlightTypeInput=SKYSALES.Util.extendObject(parent);thisFlightTypeInput.flightSearch=null;thisFlightTypeInput.index=-1;thisFlightTypeInput.flightTypeId="";thisFlightTypeInput.hideInputIdArray=[];thisFlightTypeInput.hideInputArray=[];thisFlightTypeInput.input={};thisFlightTypeInput.updateFlightTypeHandler=function(){thisFlightTypeInput.flightSearch.updateFlightType(thisFlightTypeInput);var paramOrigin=$("#ControlGroupSearchView_AvailabilitySearchInputSearchVieworiginStation2");var paramDestination=$("#ControlGroupSearchView_AvailabilitySearchInputSearchViewdestinationStation2");var selectBoxOri=paramOrigin||null;var selectBoxDes=paramDestination||null;var selectBoxObjOri=null;var selectBoxObjDes=null;if(selectBoxOri){selectBoxObjOri=selectBoxOri.get(0)}if(selectBoxDes){selectBoxObjDes=selectBoxDes.get(0)}if(this.value==="OpenJaw"){selectBoxObjOri.required="true";selectBoxObjOri.requirederror="return Origin is a required field.";selectBoxObjDes.required="true";selectBoxObjDes.requirederror="return Destination is a required field."}else{selectBoxObjOri.required="false";selectBoxObjDes.required="false"}};thisFlightTypeInput.addEvents=function(){parent.addEvents.call(this);this.input.click(this.updateFlightTypeHandler)};thisFlightTypeInput.getById=function(id){var retVal=null;if(id){retVal=window.document.getElementById(id)}return retVal};thisFlightTypeInput.setVars=function(){parent.setVars.call(this);var hideInputIndex=0;var hideInput=null;var hideInputArray=[];thisFlightTypeInput.input=$("#"+this.flightTypeId);for(hideInputIndex=0;hideInputIndex<this.hideInputIdArray.length;hideInputIndex+=1){hideInput=thisFlightTypeInput.getById(this.hideInputIdArray[hideInputIndex]);if(hideInput){hideInputArray[hideInputArray.length]=hideInput}}thisFlightTypeInput.hideInputArray=$(hideInputArray)};thisFlightTypeInput.init=function(json){this.setSettingsByObject(json);this.setVars();this.addEvents()};return thisFlightTypeInput}}if(!SKYSALES.Class.MarketInput){SKYSALES.Class.MarketInput=function(){var marketInputBase=new SKYSALES.Class.SkySales();var thisMarketInput=SKYSALES.Util.extendObject(marketInputBase);thisMarketInput.marketHash=SKYSALES.Util.getResource().marketHash;thisMarketInput.stationHash=SKYSALES.Util.getResource().stationHash;thisMarketInput.containerId="";thisMarketInput.container=null;thisMarketInput.disableInputId="";thisMarketInput.disableInput=null;thisMarketInput.originId="";thisMarketInput.origin=null;thisMarketInput.destinationId="";thisMarketInput.destination=null;thisMarketInput.toggleMarketCount=0;thisMarketInput.toggleMarket=function(){if((thisMarketInput.toggleMarketCount%2)===0){$(":input",thisMarketInput.container).attr("disabled","disabled")}else{$(":input",thisMarketInput.container).removeAttr("disabled")}thisMarketInput.toggleMarketCount+=1};thisMarketInput.useComboBox=function(input){var retVal=true;if(input&&input.get(0)&&input.get(0).options){retVal=false}return retVal};thisMarketInput.updateMarketOrigin=function(){var origin=$(this).val();origin=origin.toUpperCase();var destinationArray=thisMarketInput.marketHash[origin];destinationArray=destinationArray||[];var selectParamObj=null;var useCombo=true;useCombo=thisMarketInput.useComboBox(thisMarketInput.destination);if(useCombo){selectParamObj={input:thisMarketInput.destination,options:destinationArray};SKYSALES.Class.DropDown.getDropDown(selectParamObj)}else{selectParamObj={selectBox:thisMarketInput.destination,objectArray:destinationArray,showCode:false};var selectBox=selectParamObj.selectBox||null;var selectBoxObj=null;selectBoxObj=selectBox.get(0);thisID=selectBoxObj.id;if(thisID.substring(thisID.length-1,thisID.length-14)=="originStation"||thisID.substring(thisID.length-1,thisID.length-19)=="destinationStation"){SKYSALES.Util.populateSelectOriDestSattion(selectParamObj)}else{SKYSALES.Util.populateSelect(selectParamObj)}}};thisMarketInput.addEvents=function(){thisMarketInput.origin.change(thisMarketInput.updateMarketOrigin);thisMarketInput.disableInput.click(thisMarketInput.toggleMarket)};thisMarketInput.setVars=function(){thisMarketInput.container=$("#"+thisMarketInput.containerId);thisMarketInput.disableInput=$("#"+thisMarketInput.disableInputId);thisMarketInput.origin=$("#"+thisMarketInput.originId);thisMarketInput.destination=$("#"+thisMarketInput.destinationId)};thisMarketInput.populateMarketInput=function(input){var useCombo=true;var selectParamObj={};if((input)&&(input.length>0)){useCombo=thisMarketInput.useComboBox(input);if(useCombo){selectParamObj={input:input,options:thisMarketInput.stationHash};SKYSALES.Class.DropDown.getDropDown(selectParamObj)}else{selectParamObj={selectBox:input,objectArray:thisMarketInput.stationHash,showCode:false};var selectBox=selectParamObj.selectBox||null;var selectBoxObj=null;selectBoxObj=selectBox.get(0);thisID=selectBoxObj.id;if(thisID.substring(thisID.length-1,thisID.length-14)=="originStation"||thisID.substring(thisID.length-1,thisID.length-19)=="destinationStation"){SKYSALES.Util.populateSelectOriDestSattion(selectParamObj)}else{SKYSALES.Util.populateSelect(selectParamObj)}}}};thisMarketInput.init=function(paramObject){marketInputBase.init.call(this,paramObject);this.addEvents();thisMarketInput.populateMarketInput(thisMarketInput.origin);thisMarketInput.populateMarketInput(thisMarketInput.destination);thisMarketInput.disableInput.click();thisMarketInput.disableInput.removeAttr("checked")};return thisMarketInput}}if(!SKYSALES.Class.StationInput){SKYSALES.Class.StationInput=function(){var parent=new SKYSALES.Class.SkySales();var thisStationInput=SKYSALES.Util.extendObject(parent);thisStationInput.stationInputId="";thisStationInput.stationInput=null;thisStationInput.setVars=function(){parent.setVars.call(this);thisStationInput.stationInput=$("#"+this.stationInputId)};thisStationInput.init=function(json){parent.init.call(this,json);this.addEvents()};return thisStationInput}}if(!SKYSALES.Class.StationDropDown){SKYSALES.Class.StationDropDown=function(){var stationDropDownBase=new SKYSALES.Class.SkySales();var thisStationDropDown=SKYSALES.Util.extendObject(stationDropDownBase);thisStationDropDown.selectBoxId="";thisStationDropDown.selectBox=null;thisStationDropDown.inputId="";thisStationDropDown.input=null;thisStationDropDown.updateStationDropDown=function(){var stationCode=$(this).val();thisStationDropDown.selectBox.val(stationCode)};thisStationDropDown.updateStationInput=function(){var stationCode=$(this).val();thisStationDropDown.input.val(stationCode);thisStationDropDown.input.change();if(stationCode==""){this.options[0].selected=1}};thisStationDropDown.addEvents=function(){thisStationDropDown.input.change(thisStationDropDown.updateStationDropDown);thisStationDropDown.selectBox.change(thisStationDropDown.updateStationInput)};thisStationDropDown.setVars=function(){thisStationDropDown.selectBox=$("#"+thisStationDropDown.selectBoxId);thisStationDropDown.input=$("#"+thisStationDropDown.inputId)};thisStationDropDown.init=function(paramObject){stationDropDownBase.init.call(this,paramObject);this.addEvents();thisStationDropDown.input.change()};return thisStationDropDown}}if(!SKYSALES.Class.TravelDocumentInput){SKYSALES.Class.TravelDocumentInput=function(){var parent=new SKYSALES.Class.SkySales();var thisTravelDocumentInput=SKYSALES.Util.extendObject(parent);thisTravelDocumentInput.travelDocumentInfoId="";thisTravelDocumentInput.travelDocumentInfo=null;thisTravelDocumentInput.delimiter="_";thisTravelDocumentInput.documentTypeId="";thisTravelDocumentInput.documentType=null;thisTravelDocumentInput.documentNumberId="";thisTravelDocumentInput.documentNumber=null;thisTravelDocumentInput.documentIssuingCountryId="";thisTravelDocumentInput.documentIssuingCountry=null;thisTravelDocumentInput.documentCountryOfBirthId="";thisTravelDocumentInput.documentCountryOfBirth=null;thisTravelDocumentInput.travelDocumentKey="";thisTravelDocumentInput.init=function(json){this.setSettingsByObject(json);this.setVars();this.addEvents()};thisTravelDocumentInput.setVars=function(){parent.setVars.call(this);thisTravelDocumentInput.travelDocumentInfo=$("#"+this.travelDocumentInfoId);thisTravelDocumentInput.documentType=$("#"+this.documentTypeId);thisTravelDocumentInput.documentNumber=$("#"+this.documentNumberId);thisTravelDocumentInput.documentIssuingCountry=$("#"+this.documentIssuingCountryId);thisTravelDocumentInput.documentCountryOfBirth=$("#"+this.documentCountryOfBirthId)};thisTravelDocumentInput.setTravelDocumentInfo=function(){var travelDocumentKey="";var documentType=this.documentType.val();var documentNumber=this.documentNumber.val();var documentIssuingCountry=this.documentIssuingCountry.val();var documentCountryOfBirth=this.documentCountryOfBirth.val();if(documentType&&documentNumber&&documentIssuingCountry&&documentCountryOfBirth){travelDocumentKey=documentType+this.delimiter+documentNumber+this.delimiter+documentIssuingCountry+this.delimiter+documentCountryOfBirth;this.travelDocumentInfo.val(travelDocumentKey)}return true};return thisTravelDocumentInput}}if(!SKYSALES.Class.ControlGroup){SKYSALES.Class.ControlGroup=function(){var parent=new SKYSALES.Class.SkySales();var thisControlGroup=SKYSALES.Util.extendObject(parent);thisControlGroup.actionId="SkySales";thisControlGroup.action=null;thisControlGroup.init=function(json){this.setSettingsByObject(json);this.setVars();this.addEvents()};thisControlGroup.setVars=function(){parent.setVars.call(this);thisControlGroup.action=$("#"+this.actionId)};thisControlGroup.addEvents=function(){parent.addEvents.call(this);this.action.click(this.validateHandler)};thisControlGroup.validateHandler=function(){var retVal=thisControlGroup.validate();return retVal};thisControlGroup.validate=function(){var actionDom=this.action.get(0);var retVal=window.validate(actionDom);return retVal};return thisControlGroup};SKYSALES.Class.ControlGroup.createObject=function(json){SKYSALES.Util.createObject("controlGroup","ControlGroup",json)}}if(!SKYSALES.Class.ControlGroupRegister){SKYSALES.Class.ControlGroupRegister=function(){var parent=new SKYSALES.Class.ControlGroup();var thisControlGroupRegister=SKYSALES.Util.extendObject(parent);thisControlGroupRegister.travelDocumentInput=null;thisControlGroupRegister.setSettingsByObject=function(json){parent.setSettingsByObject.call(this,json);var travelDocumentInput=new SKYSALES.Class.TravelDocumentInput();travelDocumentInput.init(this.travelDocumentInput);thisControlGroupRegister.travelDocumentInput=travelDocumentInput};thisControlGroupRegister.validateHandler=function(){var retVal=thisControlGroupRegister.validate();return retVal};thisControlGroupRegister.validate=function(){var retVal=false;retVal=this.travelDocumentInput.setTravelDocumentInfo();if(retVal){retVal=parent.validate.call(this)}return retVal};return thisControlGroupRegister};SKYSALES.Class.ControlGroupRegister.createObject=function(json){SKYSALES.Util.createObject("controlGroupRegister","ControlGroupRegister",json)}}if(!SKYSALES.Class.ContactInput){SKYSALES.Class.ContactInput=function(){var contactInput=new SKYSALES.Class.SkySales();var thisContactInput=SKYSALES.Util.extendObject(contactInput);thisContactInput.clientId="";thisContactInput.keyIdArray=[];thisContactInput.keyArray=[];thisContactInput.clientStoreIdHash=null;thisContactInput.countryInputId="";thisContactInput.countryInput=null;thisContactInput.stateInputId="";thisContactInput.stateInput=null;thisContactInput.countryStateHash=null;thisContactInput.imContactId="";thisContactInput.imContact=null;thisContactInput.currentContactData={};thisContactInput.logOutButton=null;thisContactInput.clientHash=SKYSALES.Util.getResource().clientHash;thisContactInput.setSettingsByObject=function(jsonObject){contactInput.setSettingsByObject.call(this,jsonObject);var propName="";for(propName in jsonObject){if(thisContactInput.hasOwnProperty(propName)){thisContactInput[propName]=jsonObject[propName]}}};thisContactInput.clearCurrentContact=function(){$("#"+thisContactInput.clientId+"_DropDownListTitle").val("");$("#"+thisContactInput.clientId+"_TextBoxFirstName").val("");$("#"+thisContactInput.clientId+"_TextBoxMiddleName").val("");$("#"+thisContactInput.clientId+"_TextBoxLastName").val("");$("#"+thisContactInput.clientId+"_TextBoxAddressLine1").val("");$("#"+thisContactInput.clientId+"_TextBoxAddressLine2").val("");$("#"+thisContactInput.clientId+"_TextBoxAddressLine3").val("");$("#"+thisContactInput.clientId+"_TextBoxCity").val("");$("#"+thisContactInput.clientId+"_DropDownListStateProvince").val("");$("#"+thisContactInput.clientId+"_DropDownListCountry").val("");$("#"+thisContactInput.clientId+"_TextBoxPostalCode").val("");$("#"+thisContactInput.clientId+"_TextBoxHomePhone").val("");$("#"+thisContactInput.clientId+"_TextBoxWorkPhone").val("");$("#"+thisContactInput.clientId+"_TextBoxOtherPhone").val("");$("#"+thisContactInput.clientId+"_TextBoxFax").val("");$("#"+thisContactInput.clientId+"_TextBoxEmailAddress").val("")};thisContactInput.populateCurrentContact=function(){if(thisContactInput.currentContactData){if(thisContactInput.imContact.attr("checked")===true){$("#"+thisContactInput.clientId+"_DropDownListTitle").val(thisContactInput.currentContactData.title);$("#"+thisContactInput.clientId+"_TextBoxFirstName").val(thisContactInput.currentContactData.firstName);$("#"+thisContactInput.clientId+"_TextBoxMiddleName").val(thisContactInput.currentContactData.middleName);$("#"+thisContactInput.clientId+"_TextBoxLastName").val(thisContactInput.currentContactData.lastName);$("#"+thisContactInput.clientId+"_TextBoxAddressLine1").val(thisContactInput.currentContactData.streetAddressOne);$("#"+thisContactInput.clientId+"_TextBoxAddressLine2").val(thisContactInput.currentContactData.streetAddressTwo);$("#"+thisContactInput.clientId+"_TextBoxAddressLine3").val(thisContactInput.currentContactData.streetAddressThree);$("#"+thisContactInput.clientId+"_TextBoxCity").val(thisContactInput.currentContactData.city);$("#"+thisContactInput.clientId+"_DropDownListStateProvince").val(thisContactInput.currentContactData.stateProvince);$("#"+thisContactInput.clientId+"_DropDownListCountry").val(thisContactInput.currentContactData.country);$("#"+thisContactInput.clientId+"_TextBoxPostalCode").val(thisContactInput.currentContactData.postalCode);$("#"+thisContactInput.clientId+"_TextBoxHomePhone").val(thisContactInput.currentContactData.eveningPhone);$("#"+thisContactInput.clientId+"_TextBoxWorkPhone").val(thisContactInput.currentContactData.dayPhone);$("#"+thisContactInput.clientId+"_TextBoxOtherPhone").val(thisContactInput.currentContactData.mobilePhone);$("#"+thisContactInput.clientId+"_TextBoxFax").val(thisContactInput.currentContactData.faxPhone);$("#"+thisContactInput.clientId+"_TextBoxEmailAddress").val(thisContactInput.currentContactData.email)}else{thisContactInput.clearCurrentContact()}}};thisContactInput.populateCountryStateHash=function(){var i=0;var selectBox=thisContactInput.stateInput.get(0);var country="";var stateArray=[];var countryStateArray=[];var option=null;var state="";var stateName="";var stateObject={};var countryStateHash={};if(selectBox&&selectBox.options){thisContactInput.countryStateHash={};countryStateHash.customStates=[];countryStateHash.allStates=[];for(i=0;i<selectBox.options.length;i+=1){option=selectBox.options[i];state=option.value;stateName=option.text;stateObject={name:stateName,code:state};countryStateArray=option.value.split("|");if(countryStateArray.length===2){country=countryStateArray[0];stateArray=countryStateHash[country];stateArray=stateArray||[];stateArray[stateArray.length]=stateObject;countryStateHash[country]=stateArray;countryStateHash.allStates[countryStateHash.allStates.length]=stateObject}else{countryStateHash.customStates[countryStateHash.customStates.length]=stateObject}}thisContactInput.countryStateHash=countryStateHash}};thisContactInput.updateCountry=function(){var countryState=thisContactInput.stateInput.val();var countryStateArray=countryState.split("|");var country="";if(countryStateArray.length===2){country=countryStateArray[0];thisContactInput.countryInput.val(country)}};thisContactInput.updateState=function(){var country=thisContactInput.countryInput.val();var stateArray=[];var stateObject={};var stateObjectArray=[];var i=0;if(!thisContactInput.countryStateHash){thisContactInput.populateCountryStateHash()}stateArray=thisContactInput.countryStateHash[country];stateArray=stateArray||[];if(stateArray.length===0){stateArray=thisContactInput.countryStateHash.allStates}for(i=0;i<thisContactInput.countryStateHash.customStates.length;i+=1){stateObject=thisContactInput.countryStateHash.customStates[i];stateObjectArray[stateObjectArray.length]=stateObject}for(i=0;i<stateArray.length;i+=1){stateObject=stateArray[i];stateObjectArray[stateObjectArray.length]=stateObject}var paramObject={objectArray:stateObjectArray,selectBox:thisContactInput.stateInput,showCode:false,clearOptions:true};SKYSALES.Util.populateSelect(paramObject)};thisContactInput.getKey=function(){var i=0;var keyArray=thisContactInput.keyArray;var keyObject=null;var key="";for(i=0;i<keyArray.length;i+=1){keyObject=keyArray[i];key+=keyObject.val()}key=thisContactInput.clientId+"_"+key;return key};thisContactInput.populateClientStoreIdHash=function(){var clientHash=thisContactInput.clientHash;var i=0;var keyValueStr="";var keyValueArray=[];var singleKeyValueStr="";var eqIndex=-1;var key=thisContactInput.getKey();var value=null;thisContactInput.clientStoreIdHash={};if(key&&clientHash&&clientHash[key]){thisContactInput.clientStoreIdHash=thisContactInput.clientStoreIdHash||{};keyValueStr=clientHash[key];keyValueArray=keyValueStr.split("&");for(i=0;i<keyValueArray.length;i+=1){singleKeyValueStr=keyValueArray[i];eqIndex=singleKeyValueStr.indexOf("=");if(eqIndex>-1){key=singleKeyValueStr.substring(0,eqIndex);value=singleKeyValueStr.substring(eqIndex+1,singleKeyValueStr.length);if(key){thisContactInput.clientStoreIdHash[key]=value}}}}};thisContactInput.autoPopulateForm=function(){thisContactInput.populateClientStoreIdHash();var clientStoreIdHash=thisContactInput.clientStoreIdHash;var key="";var value="";for(key in clientStoreIdHash){if(clientStoreIdHash.hasOwnProperty(key)){value=clientStoreIdHash[key];$("#"+key).val(value)}}};thisContactInput.addEvents=function(){contactInput.addEvents.call(this);var i=0;var keyArray=thisContactInput.keyArray;var key=null;for(i=0;i<keyArray.length;i+=1){key=keyArray[i];key.change(thisContactInput.autoPopulateForm)}thisContactInput.imContact.click(thisContactInput.populateCurrentContact);thisContactInput.logOutButton.click(thisContactInput.clearCurrentContact)};thisContactInput.setVars=function(){contactInput.setVars.call(this);var i=0;var keyIdArray=thisContactInput.keyIdArray;var keyArray=thisContactInput.keyArray;var keyId="";for(i=0;i<keyIdArray.length;i+=1){keyId=keyIdArray[i];keyArray[keyArray.length]=$("#"+keyId)}thisContactInput.countryInput=$("#"+thisContactInput.countryInputId);thisContactInput.stateInput=$("#"+thisContactInput.stateInputId);thisContactInput.imContact=$("#"+thisContactInput.imContactId);thisContactInput.logOutButton=$("#MemberLoginContactView_ButtonLogOut")};thisContactInput.init=function(paramObj){this.setSettingsByObject(paramObj);this.setVars();this.addEvents()};return thisContactInput};SKYSALES.Class.ContactInput.createObject=function(json){SKYSALES.Util.createObject("contactInput","ContactInput",json)}}if(!SKYSALES.Class.ToggleView){SKYSALES.Class.ToggleView=function(){var toggleView=new SKYSALES.Class.SkySales();var thisToggleView=SKYSALES.Util.extendObject(toggleView);thisToggleView.showId="";thisToggleView.hideId="";thisToggleView.elementId="";thisToggleView.show=null;thisToggleView.hide=null;thisToggleView.element=null;thisToggleView.setVars=function(){toggleView.setVars.call(this);thisToggleView.show=$("#"+thisToggleView.showId);thisToggleView.hide=$("#"+thisToggleView.hideId);thisToggleView.element=$("#"+thisToggleView.elementId)};thisToggleView.init=function(paramObj){this.setSettingsByObject(paramObj);this.setVars();this.addEvents()};thisToggleView.updateShowHandler=function(){thisToggleView.element.show("slow")};thisToggleView.updateHideHandler=function(){thisToggleView.element.hide()};thisToggleView.addEvents=function(){toggleView.addEvents.call(this);thisToggleView.show.click(thisToggleView.updateShowHandler);thisToggleView.hide.click(thisToggleView.updateHideHandler)};return thisToggleView}}if(!SKYSALES.Class.PaymentInput){SKYSALES.Class.PaymentInput=function(){var parent=SKYSALES.Class.SkySales();var thisPaymentInput=SKYSALES.Util.extendObject(parent);thisPaymentInput.dccOfferInfoId="";thisPaymentInput.foreignAmountId="";thisPaymentInput.foreignCurrencyId="";thisPaymentInput.foreignCurrencySymbolId="";thisPaymentInput.ownCurrencyAmountId="";thisPaymentInput.ownCurrencyId="";thisPaymentInput.ownCurrencySymbolId="";thisPaymentInput.rejectRadioBtnIdId="";thisPaymentInput.acceptRadioBtnIdId="";thisPaymentInput.doubleOptOutId="";thisPaymentInput.inlineDCCAjaxSucceededId="";thisPaymentInput.dccId="";thisPaymentInput.inlineDCCConversionLabelId="";thisPaymentInput.amountInputId="";thisPaymentInput.accountNumberInputId="";thisPaymentInput.inlineDCCOffer=null;thisPaymentInput.currencyCode=null;thisPaymentInput.feeAmt=null;thisPaymentInput.setSettingsByObject=function(json){parent.setSettingsByObject.call(this,json)};thisPaymentInput.setVars=function(){thisPaymentInput.dcc=$("#"+this.dccId);thisPaymentInput.inlineDCCConversionLabel=$("#"+this.inlineDCCConversionLabelId);thisPaymentInput.accountNoTextBox=$("#"+this.accountNumberInputId);thisPaymentInput.amountTextBox=$("#"+this.amountInputId);thisPaymentInput.inlineDCCAjaxSucceeded=$("#"+this.inlineDCCAjaxSucceededId)};thisPaymentInput.inlineDCCAjaxRequestHandler=function(){thisPaymentInput.getInlineDCC()};thisPaymentInput.addEvents=function(){this.amountTextBox.change(this.inlineDCCAjaxRequestHandler);this.accountNoTextBox.change(this.inlineDCCAjaxRequestHandler)};thisPaymentInput.init=function(json){this.setSettingsByObject(json);this.setVars();this.addEvents()};thisPaymentInput.getInlineDCC=function(amount,acctNumber){var params={};if("True"===this.inlineDCCOffer){if(!acctNumber){acctNumber=this.accountNoTextBox.val()}if(!amount){amount=this.amountTextBox.val()}params={amount:amount,paymentFee:this.feeAmt,currencyCode:this.currencyCode,accountNumber:acctNumber};if(this.currencyCode&&amount&&acctNumber&&(0<parseFloat(amount))&&(12<=acctNumber.length)){this.inlineDCCAjaxSucceeded.val("false");$.get("DCCOfferAjax-Resource.aspx",params,this.inlineDCCResponseHandler)}}};thisPaymentInput.setVarsAfterAjaxResponse=function(jData){var offerInfo=$("#"+this.dccOfferInfoId,jData);thisPaymentInput.foreignAmount=$("#"+this.foreignAmountId,offerInfo).text();thisPaymentInput.foreignCurrency=$("#"+this.foreignCurrencyId,offerInfo).text();thisPaymentInput.foreignCurrencySymbol=$("#"+this.foreignCurrencySymbolId,offerInfo).text();thisPaymentInput.ownCurrencyAmount=$("#"+this.ownCurrencyAmountId,offerInfo).text();thisPaymentInput.ownCurrency=$("#"+this.ownCurrencyId,offerInfo).text();thisPaymentInput.ownCurrencySymbol=$("#"+this.ownCurrencySymbolId,offerInfo).text();thisPaymentInput.acceptRadioBtnID=$("#"+this.acceptRadioBtnIdId,offerInfo).text();thisPaymentInput.rejectRadioBtnID=$("#"+this.rejectRadioBtnIdId,offerInfo).text();thisPaymentInput.acceptRadioBtn=$("#"+this.acceptRadioBtnID);thisPaymentInput.doubleOptOut=$("#"+this.doubleOptOutId,offerInfo).text();thisPaymentInput.radioButtonInlineDccStatusOfferAccept=$("#"+this.acceptRadioBtnID);thisPaymentInput.radioButtonInlineDccStatusOfferReject=$("#"+this.rejectRadioBtnID)};thisPaymentInput.foreignUpdateConversionLabel=function(){this.inlineDCCConversionLabel.text("( "+this.foreignAmount+" "+this.foreignCurrency+")")};thisPaymentInput.ownUpdateConversionLabel=function(){this.inlineDCCConversionLabel.text("")};thisPaymentInput.noThanks=function(){$("#dccCont").show("slow")};thisPaymentInput.noShowThanks=function(){$("#dccCont").hide("slow")};thisPaymentInput.inlineDccStatusOfferAccept=function(){this.foreignUpdateConversionLabel();this.noShowThanks()};thisPaymentInput.inlineDccStatusOfferReject=function(){this.ownUpdateConversionLabel();this.noThanks()};thisPaymentInput.inlineDccStatusOfferAcceptHandler=function(){thisPaymentInput.inlineDccStatusOfferAccept()};thisPaymentInput.inlineDccStatusOfferRejectHandler=function(){thisPaymentInput.inlineDccStatusOfferReject()};thisPaymentInput.addEventsAfterAjaxResponse=function(){this.radioButtonInlineDccStatusOfferAccept.click(this.inlineDccStatusOfferAcceptHandler);this.radioButtonInlineDccStatusOfferReject.click(this.inlineDccStatusOfferRejectHandler)};thisPaymentInput.updateAcceptRadioBtn=function(){var acceptChecked=this.acceptRadioBtn.attr("checked");if(acceptChecked){this.foreignUpdateConversionLabel()}};thisPaymentInput.updateInlineDCCOffer=function(data){this.inlineDCCAjaxSucceeded.val("true");var responseDCCElement=null;if(data){this.dcc.empty();var jData=$(data);responseDCCElement=$("#"+this.dccId,jData);if(responseDCCElement&&responseDCCElement.length){this.dcc.prepend(responseDCCElement.children())}this.setVarsAfterAjaxResponse(jData);this.addEventsAfterAjaxResponse();this.updateAcceptRadioBtn()}};thisPaymentInput.inlineDCCResponseHandler=function(data){thisPaymentInput.updateInlineDCCOffer(data)};return thisPaymentInput};SKYSALES.Class.PaymentInput.createObject=function(json){SKYSALES.Util.createObject("paymentInput","PaymentInput",json)}}if(!SKYSALES.Class.PriceDisplay){SKYSALES.Class.PriceDisplay=function(){var parent=new SKYSALES.Class.SkySales();var thisPriceDisplay=SKYSALES.Util.extendObject(parent);thisPriceDisplay.toggleViewIdArray=null;thisPriceDisplay.init=function(json){this.setSettingsByObject(json);var toggleViewIdArray=this.toggleViewIdArray||[];var i=0;var toggleView=null;for(i=0;i<toggleViewIdArray.length;i+=1){toggleView=new SKYSALES.Class.ToggleView();toggleView.init(toggleViewIdArray[i]);thisPriceDisplay.toggleViewIdArray[i]=toggleView}};return thisPriceDisplay};SKYSALES.Class.PriceDisplay.createObject=function(json){SKYSALES.Util.createObject("priceDisplay","PriceDisplay",json)};SKYSALES.Class.PriceDisplay.initTaxesAndFees=function(){$("#priceDetails").each(function(){$(this).find("#TaxesAndFeesLink").each(function(){var link=$(this);link.hover(function(){$(this).siblings("#showTax").css({display:"block"})},function(){$(this).siblings("#showTax").css({display:"none"})})})})}}if(!SKYSALES.Class.FlightDisplay){SKYSALES.Class.FlightDisplay=function(){var parent=new SKYSALES.Class.SkySales();var thisFlightDisplay=SKYSALES.Util.extendObject(parent);thisFlightDisplay.toggleViewIdArray=null;thisFlightDisplay.init=function(json){this.setSettingsByObject(json);var toggleViewIdArray=this.toggleViewIdArray||[];var i=0;var toggleView=null;for(i=0;i<toggleViewIdArray.length;i+=1){toggleView=new SKYSALES.Class.ToggleView();toggleView.init(toggleViewIdArray[i]);thisFlightDisplay.toggleViewIdArray[i]=toggleView}};return thisFlightDisplay};SKYSALES.Class.FlightDisplay.createObject=function(json){SKYSALES.Util.createObject("flightDisplay","FlightDisplay",json)}}if(!SKYSALES.Class.RandomImage){SKYSALES.Class.RandomImage=function(){var parent=new SKYSALES.Class.SkySales();var thisRandomImage=SKYSALES.Util.extendObject(parent);thisRandomImage.imageUriArray=[];thisRandomImage.init=function(json){this.setSettingsByObject(json);this.setVars();this.setAsBackground()};thisRandomImage.getRandomNumber=function(){var randomNumberMax=this.imageUriArray.length;var randomNumber=Math.floor(Math.random()*randomNumberMax);return randomNumber};thisRandomImage.setAsBackground=function(){var randomNumber=this.getRandomNumber();var uri="url("+this.imageUriArray[randomNumber]+")";this.container.css("background-image",uri)};return thisRandomImage};SKYSALES.Class.RandomImage.createObject=function(json){SKYSALES.Util.createObject("randomImage","RandomImage",json)}}SKYSALES.Class.DropDown=function(paramObject){paramObject=paramObject||{};var thisDrop=this;thisDrop.container={};thisDrop.name="";thisDrop.options=[];thisDrop.dropDownContainer=null;thisDrop.dropDownContainerInput=null;thisDrop.document=null;thisDrop.optionList=null;thisDrop.optionActiveClass="optionActive";thisDrop.timeOutObj=null;thisDrop.timeOut=225;thisDrop.minCharLength=2;thisDrop.optionMax=100;thisDrop.html='<div></div><div class="dropDownContainer"></div>';thisDrop.autoComplete=true;thisDrop.setSettingsByObject=function(jsonObject){var prop=null;for(prop in jsonObject){if(thisDrop.hasOwnProperty(prop)){thisDrop[prop]=jsonObject[prop]}}};thisDrop.getOptionHtml=function(search){search=search||"";var option={};var prop="";var optionHtml="";var optionCount=0;var optionHash=thisDrop.options;var re=new RegExp("^"+search,"i");if(search.length<thisDrop.minCharLength){optionHtml=""}else{for(prop in optionHash){if(optionHash.hasOwnProperty(prop)){option=optionHash[prop];option.name=option.name||"";option.code=option.code||"";if(option.name.match(re)||option.code.match(re)){optionHtml+="<div><span>"+option.code+"</span>"+option.name+" ("+option.code+")</div>";optionCount+=1}if(optionCount>=thisDrop.optionMax){break}}}}return optionHtml};thisDrop.close=function(){if(thisDrop.timeOutObj){window.clearTimeout(thisDrop.timeOutObj)}thisDrop.document.unbind("click",thisDrop.close);if(thisDrop.optionList){thisDrop.optionList.unbind("hover");thisDrop.optionList.unbind("click")}thisDrop.optionList=null;thisDrop.dropDownContainer.html("")};thisDrop.getActiveOptionIndex=function(){var activeOptionIndex=-1;var activeOption=$("."+thisDrop.optionActiveClass,thisDrop.dropDownContainer);if(thisDrop.optionList&&(activeOption.length>0)){activeOptionIndex=thisDrop.optionList.index(activeOption[0])}return activeOptionIndex};thisDrop.arrowDown=function(){var activeOptionIndex=thisDrop.getActiveOptionIndex();if(thisDrop.optionList){if((activeOptionIndex===-1)&&(thisDrop.optionList.length>0)){thisDrop.optionActive.call(thisDrop.optionList[0])}else{if(thisDrop.optionList.length>activeOptionIndex+1){thisDrop.optionInActive.call(thisDrop.optionList[activeOptionIndex]);thisDrop.optionActive.call(thisDrop.optionList[activeOptionIndex+1])}else{thisDrop.arrowDownOpen()}}}else{thisDrop.arrowDownOpen()}};thisDrop.arrowDownOpen=function(){var oldMinCharLength=thisDrop.minCharLength;thisDrop.minCharLength=0;thisDrop.open();thisDrop.minCharLength=oldMinCharLength};thisDrop.arrowUp=function(){var activeOptionIndex=thisDrop.getActiveOptionIndex();if(thisDrop.optionList){if((activeOptionIndex===-1)&&(thisDrop.optionList.length>0)){thisDrop.optionActive.call(thisDrop.optionList[0])}else{if((activeOptionIndex>0)&&(thisDrop.optionList.length>0)){thisDrop.optionInActive.call(thisDrop.optionList[activeOptionIndex]);thisDrop.optionActive.call(thisDrop.optionList[activeOptionIndex-1])}}}};thisDrop.selectButton=function(){var activeOptionIndex=thisDrop.getActiveOptionIndex();var oldOptionMax=thisDrop.optionMax;if(activeOptionIndex>-1){thisDrop.selectOption.call(thisDrop.optionList[activeOptionIndex])}else{if(thisDrop.autoComplete===true){thisDrop.optionMax=1;thisDrop.open();if(thisDrop.optionList&&(thisDrop.optionList.length>0)){thisDrop.selectOption.call(thisDrop.optionList[0])}thisDrop.optionMax=oldOptionMax}}};thisDrop.keyEvent=function(key){var retVal=true;var keyNum=key.which;if(keyNum===40){thisDrop.arrowDown();thisDrop.autoComplete=true;retVal=false}else{if(keyNum===38){thisDrop.arrowUp();thisDrop.autoComplete=true;retVal=false}else{if(keyNum===9){thisDrop.selectButton();thisDrop.inputBlur()}else{if(keyNum===13){thisDrop.selectButton();thisDrop.autoComplete=false;retVal=false}else{thisDrop.autoComplete=true}}}}return retVal};thisDrop.inputKeyEvent=function(key){var retVal=true;var keyNum=key.which;if((keyNum!==40)&&(keyNum!==38)&&(keyNum!==9)&&(keyNum!==13)){if(thisDrop.timeOutObj){window.clearTimeout(thisDrop.timeOutObj)}thisDrop.timeOutObj=window.setTimeout(thisDrop.open,thisDrop.timeOut);retVal=false}return retVal};thisDrop.catchEvent=function(){return false};thisDrop.open=function(){var iframeHtml="";var iframe=null;var search=thisDrop.dropDownContainerInput.val();var optionHtml=thisDrop.getOptionHtml(search);var height=0;var containerWidth=0;thisDrop.dropDownContainer.html(optionHtml);thisDrop.addOptionEvents();thisDrop.dropDownContainer.click(thisDrop.catchEvent);thisDrop.document.click(thisDrop.close);thisDrop.dropDownContainer.show();if(thisDrop.optionList&&(thisDrop.optionList.length>0)&&thisDrop.optionActive){thisDrop.optionActive.call(thisDrop.optionList[0])}containerWidth=thisDrop.dropDownContainer.width();if($.browser.msie){height=thisDrop.dropDownContainer.height();iframeHtml='<iframe src="#"></iframe>';thisDrop.dropDownContainer.prepend(iframeHtml);iframe=$("iframe",thisDrop.dropDownContainer);iframe.width(containerWidth);iframe.height(height)}};thisDrop.optionActive=function(){var option=$(this);thisDrop.optionList.removeClass(thisDrop.optionActiveClass);option.addClass(thisDrop.optionActiveClass)};thisDrop.optionInActive=function(){var option=$(this);option.removeClass(thisDrop.optionActiveClass)};thisDrop.selectOption=function(){var text=$("span",this).text();thisDrop.dropDownContainerInput.val(text);thisDrop.close();thisDrop.dropDownContainerInput.change()};thisDrop.addOptionEvents=function(){thisDrop.optionList=$("div",thisDrop.dropDownContainer);thisDrop.optionList.hover(thisDrop.optionActive,thisDrop.optionInActive);thisDrop.optionList.click(thisDrop.selectOption)};thisDrop.inputBlur=function(){thisDrop.close()};thisDrop.addEvents=function(paramObject){thisDrop.dropDownContainerInput=paramObject.input;thisDrop.dropDownContainer=$("div.dropDownContainer",thisDrop.container);thisDrop.document=$(document);thisDrop.dropDownContainerInput.keyup(thisDrop.inputKeyEvent);thisDrop.dropDownContainerInput.keydown(thisDrop.keyEvent)};thisDrop.init=function(paramObject){thisDrop.setSettingsByObject(paramObject);var html=thisDrop.html;paramObject.input.attr("autocomplete","off");paramObject.input.wrap('<span class="dropDownOuterContainer"></span>');paramObject.input.after(html);thisDrop.container=paramObject.input.parent("span.dropDownOuterContainer");thisDrop.addEvents(paramObject);SKYSALES.Class.DropDown.dropDownArray[SKYSALES.Class.DropDown.dropDownArray.length]=thisDrop};thisDrop.init(paramObject);return thisDrop};SKYSALES.Class.DropDown.dropDownArray=[];SKYSALES.Class.DropDown.getDropDown=function(selectParamObj){var retVal=null;var i=0;var dropDown=null;var dropDownArray=SKYSALES.Class.DropDown.dropDownArray;var input=null;var inputCompare=selectParamObj.input.get(0);for(i=0;i<dropDownArray.length;i+=1){dropDown=dropDownArray[i];input=dropDown.dropDownContainerInput.get(0);if((input)&&(inputCompare)&&(input===inputCompare)){retVal=dropDownArray[i];if(selectParamObj.options){retVal.options=selectParamObj.options}}}if(!retVal){retVal=new SKYSALES.Class.DropDown(selectParamObj)}return retVal};if(SKYSALES.Class.DatePickerManager===undefined){SKYSALES.Class.DatePickerManager=function(){var thisDatePickerManager=this;thisDatePickerManager.isAOS=false;thisDatePickerManager.yearMonth=null;thisDatePickerManager.day=null;thisDatePickerManager.linkedDate=null;var allDayOptionArray=[];var yearMonthDelimiter="-";var yearMonthFormatString="yy-mm";var firstDateOption="first";var fullDateFormatString="mm/dd/yy";var validateYearMonthRegExp=new RegExp("\\d{4}-\\d{2}");var getDaysInMonth=function(dateParam){var daysNotInMonthDate=new Date(dateParam.getFullYear(),dateParam.getMonth(),32);var daysNotInMonth=daysNotInMonthDate.getDate();return 32-daysNotInMonth};var validateDay=function(dayParam){return dayParam.match(/\d{2}/)};var validateYearMonth=function(yearMonthParam){yearMonthParam=yearMonthParam||"";return yearMonthParam.match(validateYearMonthRegExp)};var getDate=function(yearMonthParam,dayParam){var retDate=new Date();var yearMonthArray=yearMonthParam.split(yearMonthDelimiter);var yearIndex=0;var monthIndex=1;if(true===thisDatePickerManager.isAOS){yearIndex=1;monthIndex=0}var yearVal=yearMonthArray[yearIndex];var monthVal=yearMonthArray[monthIndex]-1;retDate=new Date(yearVal,monthVal,dayParam);return retDate};var parseDate=function(yearMonthParam,dayParam){var retDate=new Date();var validateDayVal=validateDay(dayParam);var validateYearMonthVal=validateYearMonth(yearMonthParam);if(validateDayVal&&validateYearMonthVal){var date=getDate(yearMonthParam,dayParam);var daysInMonth=getDaysInMonth(date);var dayVal=dayParam;if(dayParam>daysInMonth){dayVal=daysInMonth}retDate=new Date(date.getFullYear(),date.getMonth(),dayVal)}else{retDate=new Date()}return retDate};var readLinked=function(){var date=parseDate(thisDatePickerManager.yearMonth.val(),thisDatePickerManager.day.val());var dateString=$.datepicker.formatDate(fullDateFormatString,date);thisDatePickerManager.linkedDate.val(dateString);return{}};var dayResizeAndSet=function(dateParam,objClone){var todayDate=new Date();var todayDay=todayDate.getDate();var todayYearMonth=todayDate.getYear()+todayDate.getMonth();var dateParamYearMonth=dateParam.getYear()+dateParam.getMonth();var monthYearIsCurrent=(todayYearMonth===dateParamYearMonth);var todayIsPastSecond=(2<todayDay);var trimInvalidDays=todayIsPastSecond&&monthYearIsCurrent;var day=dateParam.getDate();var daysInMonth=getDaysInMonth(dateParam);var daysInMonthDifference=31-daysInMonth;var dayOptionArray=SKYSALES.Util.cloneArray(allDayOptionArray);var removeDaysAfterThisIndex=31;if(daysInMonthDifference>0){removeDaysAfterThisIndex=31-daysInMonthDifference;dayOptionArray.splice(removeDaysAfterThisIndex,daysInMonthDifference)}if(trimInvalidDays){dayOptionArray.splice(0,todayDay-1)}var daySelectParams={selectedItem:day,objectArray:dayOptionArray,selectBox:thisDatePickerManager.day,clearOptions:true};if(objClone==null){SKYSALES.Util.populateSelect(daySelectParams)}else{SKYSALES.Util.populateSelectByOject(daySelectParams,objClone)}};var yearMonthUpdate=function(){var dayVal=thisDatePickerManager.day.val();var date=getDate(thisDatePickerManager.yearMonth.val(),1);var daysInMonth=getDaysInMonth(date);if(dayVal>daysInMonth){dayVal=daysInMonth}date=new Date(date.getFullYear(),date.getMonth(),dayVal);dayResizeAndSet(date);thisDatePickerManager.linkedDate.val($.datepicker.formatDate(fullDateFormatString,date));if(this.name=="ControlGroupSearchView$AvailabilitySearchInputSearchView$DropDownListMarketMonth1"&&this.tagName=="SELECT"){var myMarketMonth2=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_DropDownListMarketMonth2");myMarketMonth2.options[this.selectedIndex].selected=true;var myMarketDay2=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_DropDownListMarketDay2");dayResizeAndSet(date,myMarketDay2);for(i=0;i!=myMarketDay2.options.length;i++){if(myMarketDay2.options[i].value==dayVal){myMarketDay2.options[i].selected=true;break}}}};var dateUpdate=function(){var yearMonthVal=thisDatePickerManager.yearMonth.val();var dayVal=thisDatePickerManager.day.val();var date=parseDate(yearMonthVal,dayVal);var dateVal=$.datepicker.formatDate(fullDateFormatString,date);thisDatePickerManager.linkedDate.val(dateVal);if(this.name=="ControlGroupSearchView$AvailabilitySearchInputSearchView$DropDownListMarketDay1"&&this.tagName=="SELECT"){var myMarketDay2=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_DropDownListMarketDay2");for(i=0;i!=myMarketDay2.options.length;i++){if(myMarketDay2.options[i].value==dayVal){myMarketDay2.options[i].selected=true;break}}var date2HiddenId="date_picker_id_2";dateHidden2=$("#"+date2HiddenId);dateHidden2.val(dateVal)}};var createAllDayOptionArray=function(){var retArray=[];var optionIterator=1;var option={};for(optionIterator=1;optionIterator<=31;optionIterator+=1){option={};option.name=optionIterator;if(optionIterator<=9){option.code="0"+optionIterator}else{option.code=optionIterator}retArray[optionIterator-1]=option}return retArray};var updateLinked=function(dateString){var match=dateString.match(/\d{2}\/\d{2}\/\d{4}/);var date=new Date();var yearMonthString="";if(match){date=new Date(dateString);yearMonthString=$.datepicker.formatDate(yearMonthFormatString,date);thisDatePickerManager.yearMonth.val(yearMonthString);dayResizeAndSet(date);var dayVal=thisDatePickerManager.day.val();var daysInMonth=getDaysInMonth(date);if(dayVal>daysInMonth){dayVal=daysInMonth}if(this.id=="date_picker_id_1"&&this._calId=="0"){var myMarketMonth2=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_DropDownListMarketMonth2");for(i=0;i!=myMarketMonth2.options.length;i++){if(myMarketMonth2.options[i].value==yearMonthString){myMarketMonth2.options[i].selected=true;break}}var myMarketDay2=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_DropDownListMarketDay2");dayResizeAndSet(date,myMarketDay2);for(i=0;i!=myMarketDay2.options.length;i++){if(myMarketDay2.options[i].value==dayVal){myMarketDay2.options[i].selected=true;break}}var dateVal=$.datepicker.formatDate(fullDateFormatString,date);var date2HiddenId="date_picker_id_2";dateHidden2=$("#"+date2HiddenId);dateHidden2.val(dateVal)}}};thisDatePickerManager.setSettingsByObject=function(paramObject){var propName="";for(propName in paramObject){if(thisDatePickerManager.hasOwnProperty(propName)){thisDatePickerManager[propName]=paramObject[propName]}}};thisDatePickerManager.setVars=function(){if(true===thisDatePickerManager.isAOS){yearMonthDelimiter="/";yearMonthFormatString="m/yy";validateYearMonthRegExp=new RegExp("\\d{1,2}\\/\\d{4}");firstDateOption="eq(1)"}};var initFlight=function(){if(!thisDatePickerManager.isAOS){dateUpdate()}};thisDatePickerManager.addEvents=function(){thisDatePickerManager.yearMonth.change(yearMonthUpdate);thisDatePickerManager.day.change(dateUpdate);var minDate=new Date();var maxDate=new Date();var setDayDate=new Date();maxDate.setFullYear(maxDate.getFullYear()+1);var yearMonthFirst=$("option:"+firstDateOption,thisDatePickerManager.yearMonth).val();var yearMonthLast=$("option:last",thisDatePickerManager.yearMonth).val();allDayOptionArray=createAllDayOptionArray();var linkedDate=thisDatePickerManager.linkedDate;if(validateYearMonth(yearMonthFirst)){minDate.setDate(minDate.getDate()-1);if(thisDatePickerManager.isAOS){setDayDate=new Date(thisDatePickerManager.linkedDate.val())}else{setDayDate=getDate(thisDatePickerManager.yearMonth.val(),thisDatePickerManager.day.val())}dayResizeAndSet(setDayDate)}if(validateYearMonth(yearMonthLast)){maxDate=getDate(yearMonthLast,1);var daysInMonth=getDaysInMonth(maxDate);maxDate=new Date(maxDate.getFullYear(),maxDate.getMonth(),daysInMonth)}var resource=SKYSALES.Util.getResource();var dateCultureInfo=resource.dateCultureInfo;var datePickerSettings=SKYSALES.datepicker;initFlight();var datePickerParams={beforeShow:readLinked,onSelect:updateLinked,minDate:minDate,maxDate:maxDate,showOn:"both",buttonImageOnly:true,buttonImage:"images/CebuAir/calendaricon.gif",buttonText:"Calendar",numberOfMonths:1,mandatory:true,monthNames:dateCultureInfo.monthNames,monthNamesShort:dateCultureInfo.monthNamesShort,dayNames:dateCultureInfo.dayNames,dayNamesShort:dateCultureInfo.dayNamesShort,dayNamesMin:dateCultureInfo.dayNamesMin,closeText:datePickerSettings.closeText,prevText:datePickerSettings.prevText,nextText:datePickerSettings.nextText,currentText:datePickerSettings.currentText};linkedDate.datepicker(datePickerParams)};thisDatePickerManager.init=function(paramObject){this.setSettingsByObject(paramObject);this.setVars();this.addEvents()}}}SKYSALES.initializeSkySalesForm=function(){document.SkySales=document.forms.SkySales};SKYSALES.getSkySalesForm=function(){var skySalesForm=$("SkySales").get(0);return skySalesForm};SKYSALES.Common=function(){var thisCommon=this;var countryInfo=null;thisCommon.allInputObjects=null;thisCommon.initializeCommon=function(){var hint=new SKYSALES.Hint();var inputLabel=new SKYSALES.InputLabel();thisCommon.addKeyDownEvents();thisCommon.addSetAndEraseEvents();thisCommon.setValues();hint.addHintEvents();inputLabel.formatInputLabel();thisCommon.stripeTables()};thisCommon.setValues=function(){var setValue=function(index){if((this.jsvalue!==null)&&(this.jsvalue!==undefined)){this.value=this.jsvalue}};thisCommon.getAllInputObjects().each(setValue)};thisCommon.stopSubmit=function(){$("form").unbind("submit",thisCommon.stopSubmit);return false};thisCommon.addKeyDownEvents=function(){var keyFunction=function(e){if(e.keyCode===13){$("form").submit(thisCommon.stopSubmit);return false}return true};$(":input").keydown(keyFunction)};thisCommon.getAllInputObjects=function(){if(thisCommon.allInputObjects===null){thisCommon.allInputObjects=$(":input")}return thisCommon.allInputObjects};thisCommon.addSetAndEraseEvents=function(){var focusFunction=function(){thisCommon.eraseElement(this,this.requiredempty)};var blurFunction=function(){thisCommon.setElement(this,this.requiredempty);$(this).change()};var eventFunction=function(index){var input=$(this);if((this.requiredempty!==null)&&(this.requiredempty!==undefined)){if(input.is(":text")&&(input.is(":hidden")===false)){input.focus(focusFunction);input.blur(blurFunction)}}};thisCommon.getAllInputObjects().each(eventFunction)};thisCommon.eraseElement=function(element,defaultValue){if(element.value===defaultValue){element.value=""}};thisCommon.setElement=function(element,defaultValue){if(element.value===""){element.value=defaultValue}};thisCommon.getCountryInfo=function(){if(countryInfo===null){countryInfo=window.countryInfo}return countryInfo};thisCommon.setCountryInfo=function(arg){countryInfo=arg;return thisCommon};thisCommon.isEmpty=function(element,defaultValue){var val=null;var retVal=false;if((element)&&(defaultValue===undefined)){if(element.requiredempty){defaultValue=element.requiredempty}else{defaultValue=""}}val=SKYSALES.Common.getValue(element);if((val===null)||(val===undefined)||(val.length===0)||(val===defaultValue)){retVal=true}return retVal};thisCommon.stripeTables=function(){$(".stripeMe tr:even").addClass("alt");return thisCommon}};SKYSALES.Common.addEvent=function(obj,eventString,functionRef){$(obj).bind(eventString,functionRef)};SKYSALES.Common.getValue=function(e){var val=null;if(e){val=$(e).val();return val}return null};SKYSALES.InputLabel=function(){var thisInputLabel=this;thisInputLabel.getInputLabelRequiredFlag=function(){return"*"};thisInputLabel.getInputLabelSuffix=function(){return":"};thisInputLabel.formatInputLabel=function(){var requiredFlag=thisInputLabel.getInputLabelRequiredFlag();var suffix=thisInputLabel.getInputLabelSuffix();var eventFunction=function(index){var label=$("label[@for="+this.id+"]").eq(0);var labelText=$(label).text();var inputType="";var required=null;if(labelText!==""){inputType=$(this).attr("type");if((inputType!=="checkbox")&&(inputType!=="radio")&&labelText.indexOf(":")==-1){labelText=labelText+suffix}required=this.required;if(required===undefined){required=null}if(required===null){required=this.getAttribute("required")}if(required!==null){required=required.toString().toLowerCase();if(required==="true"&&labelText.indexOf("*")==-1){labelText=requiredFlag+labelText}}$(label).text(labelText)}};SKYSALES.common.getAllInputObjects().each(eventFunction)}};SKYSALES.Dhtml=function(){var thisDhtml=this;thisDhtml.getX=function(obj){var pos=0;if(obj.x){pos+=obj.x}else{if(obj.offsetParent){while(obj.offsetParent){pos+=obj.offsetLeft;obj=obj.offsetParent}}}return pos};thisDhtml.getY=function(obj){var pos=0;if(obj.y){pos+=obj.y}else{if(obj){while(obj){pos+=obj.offsetTop;obj=obj.offsetParent}}}return pos};return thisDhtml};SKYSALES.Hint=function(){var thisHint=this;thisHint.addHintEvents=function(){var eventFunction=function(index){if((this.hint!==null)&&(this.hint!==undefined)){if(this.tagName&&(this.tagName.toString().toLowerCase()==="input")){thisHint.addHintFocusEvents(this)}else{thisHint.addHintHoverEvents(this)}}};SKYSALES.common.getAllInputObjects().each(eventFunction)};thisHint.addHintFocusEvents=function(obj,hintText){var focusFunction=function(){thisHint.showHint(obj,hintText)};var blurFunction=function(){thisHint.hideHint(obj,hintText)};if($(obj).is(":hidden")===false){$(obj).focus(focusFunction);$(obj).blur(blurFunction)}};thisHint.addHintHoverEvents=function(obj,hintText){var showFunction=function(){thisHint.showHint(obj,hintText)};var hideFunction=function(){thisHint.hideHint(obj,hintText)};$(obj).hover(showFunction,hideFunction)};thisHint.getHintDivId=function(){return"cssHint"};thisHint.showHint=function(obj,hintHtml,xOffset,yOffset,referenceId){var hintDivId=thisHint.getHintDivId();var jQueryHintDiv=$("#"+hintDivId);var x=0;var y=0;var defaultXOffset=0;var defaultYOffset=0;if(xOffset===undefined){xOffset=obj.hintxoffset}if(yOffset===undefined){yOffset=obj.hintyoffset}if(referenceId===undefined){referenceId=obj.hintReferenceid}var referenceObject=$("#"+referenceId).get(0);var dhtml=new SKYSALES.Dhtml();if(!referenceObject){x=dhtml.getX(obj);y=dhtml.getY(obj);if(xOffset===undefined){x+=obj.offsetWidth+100}}else{x=dhtml.getX(referenceObject);y=dhtml.getY(referenceObject);if(xOffset===undefined){x+=referenceObject.offsetWidth+100}}if(hintHtml===undefined){if(obj.hint!==undefined){hintHtml=obj.hint}}jQueryHintDiv.html(hintHtml);jQueryHintDiv.show();xOffset=(xOffset!==undefined)?xOffset:defaultXOffset;yOffset=(yOffset!==undefined)?yOffset:defaultYOffset;var leftX=parseInt(xOffset,10)+parseInt(x,10);var leftY=parseInt(yOffset,10)+parseInt(y,10);jQueryHintDiv.css("left",leftX+"px");jQueryHintDiv.css("top",leftY+"px")};thisHint.hideHint=function(obj){var hintDivId=thisHint.getHintDivId();$("#"+hintDivId).hide()}};SKYSALES.ValidationErrorReadAlong=function(){var thisReadAlong=this;thisReadAlong.objId="";thisReadAlong.obj=null;thisReadAlong.errorMessage="";thisReadAlong.isError=false;thisReadAlong.hasBeenFixed=false;thisReadAlong.hasValidationEvents=false;thisReadAlong.getValidationErrorHtml=function(){var validatonErrorHtml='<div id="validationErrorContainerReadAlongList" > </div>';return validatonErrorHtml};thisReadAlong.getValidationErrorCloseId=function(){return"validationErrorContainerReadAlongCloseButton"};thisReadAlong.getValidationErrorListId=function(){return"validationErrorContainerReadAlongList"};thisReadAlong.getValidationErrorIFrameId=function(){return"validationErrorContainerReadAlongIFrame"};thisReadAlong.getValidationErrorDivId=function(){return"validationErrorContainerReadAlong"};thisReadAlong.getFixedClass=function(){return"fixedValidationError"};thisReadAlong.addCloseEvent=function(){var closeId=thisReadAlong.getValidationErrorCloseId();var closeFunction=function(){thisReadAlong.hide()};$("#"+closeId).click(closeFunction)};thisReadAlong.addValidationErrorDiv=function(){$("#errorDiv").append(thisReadAlong.getValidationErrorHtml())};thisReadAlong.hide=function(){var iFrameId=thisReadAlong.getValidationErrorIFrameId();var divId=thisReadAlong.getValidationErrorDivId();$("#"+iFrameId).hide();$("#"+divId).hide()};thisReadAlong.addFocusEvent=function(index){var data={obj:this};var eventFunction=function(event){var obj=event.data.obj;var hint=null;var readAlongDivObj=null;var readAlongDivWidth=0;var readAlongDivHeight=0;var x=0;var y=0;var dhtml=null;var iFrameObj=null;if(obj.isError===true){hint=new SKYSALES.Hint();hint.hideHint();readAlongDivObj=$("#"+thisReadAlong.getValidationErrorDivId());readAlongDivWidth=parseInt(readAlongDivObj.width(),10)+5;readAlongDivHeight=parseInt(readAlongDivObj.height(),10)+5;dhtml=new SKYSALES.Dhtml();x=dhtml.getX(obj.obj);y=dhtml.getY(obj.obj);x=x+this.offsetWidth-100;y=y-280;if($.browser.msie){iFrameObj=$("#"+thisReadAlong.getValidationErrorIFrameId());iFrameObj.css("position","absolute");iFrameObj.show();iFrameObj.width(readAlongDivWidth-25);iFrameObj.height(readAlongDivHeight-5);iFrameObj.css("left",x+16);iFrameObj.css("top",y)}readAlongDivObj.css("left",x);readAlongDivObj.css("top",y);readAlongDivObj.css("position","absolute");readAlongDivObj.show("slow");return false}};if($(this.obj).is(":hidden")===false){$(this.obj).bind("focus",data,eventFunction)}};thisReadAlong.addBlurEvent=function(index){var data={obj:this};var eventFunction=function(event){var obj=event.data.obj;var validateObj=new SKYSALES.Validate(null,"","",null);validateObj.validateSingleElement(this);var errorMessage=validateObj.errors;var isFixed=false;var allFixed=true;if(validateObj.validationErrorArray.length>0){if(validateObj.validationErrorArray[0].isError===false){isFixed=true}}var listId=obj.getValidationErrorListId();var listObj=$("#"+listId).find("li").eq(index);var fixedClass=obj.getFixedClass();var fixedFunction=function(){if((allFixed===true)&&($(this).attr("class").indexOf("hidden")===-1)&&($(this).attr("class").indexOf(fixedClass)===-1)){allFixed=false}};if(isFixed===true){obj.hasBeenFixed=true;listObj.addClass(fixedClass);allFixed=true;$("#"+listId).find("li").each(fixedFunction);if(allFixed===true){thisReadAlong.hide()}}else{obj.hasBeenFixed=false;listObj.removeClass(fixedClass);listObj.removeClass("hidden");obj.isError=true;obj.errorMessage=errorMessage;listObj.text(errorMessage)}return false};$(this.obj).bind("blur",data,eventFunction)}};SKYSALES.errorsHeader="Please correct the following.\n\n";SKYSALES.Validate=function(form,controlID,errorsHeader,regexElementIdFilter){var thisValidate=this;if(errorsHeader===undefined){errorsHeader=SKYSALES.errorsHeader}thisValidate.form=form;thisValidate.namespace=controlID;thisValidate.errors="";thisValidate.validationErrorArray=[];thisValidate.setfocus=null;thisValidate.clickedObj=null;thisValidate.errorDisplayMethod="read_along";thisValidate.errorsHeader=errorsHeader;thisValidate.namedErrors=[];thisValidate.dateRangeArray=[];if(regexElementIdFilter){thisValidate.regexElementIdFilter=regexElementIdFilter}thisValidate.requiredAttribute="required";thisValidate.requiredEmptyAttribute="requiredempty";thisValidate.validationTypeAttribute="validationtype";thisValidate.regexAttribute="regex";thisValidate.minLengthAttribute="minlength";thisValidate.numericMinLengthAttribute="numericminlength";thisValidate.maxLengthAttribute="maxlength";thisValidate.numericMaxLengthAttribute="numericmaxlength";thisValidate.minValueAttribute="minvalue";thisValidate.maxValueAttribute="maxvalue";thisValidate.equalsAttribute="equals";thisValidate.dateRangeAttribute="daterange";thisValidate.dateRange1HiddenIdAttribute="date1hiddenid";thisValidate.dateRange2HiddenIdAttribute="date2hiddenid";thisValidate.dateCheckAttribute="datecheck";thisValidate.contactCheckAttribute="checkcontact";thisValidate.checkINSAttribute="checkinsurance";thisValidate.checkEnableTxtBoxAttribute="enabletxtbox";thisValidate.checkFlightCombinationAttribute="checkflightcombination";thisValidate.checkFlightAvailabiltyAttribute="checkflightavailabilty";thisValidate.defaultErrorAttribute="error";thisValidate.requiredErrorAttribute="requirederror";thisValidate.validationTypeErrorAttribute="validationtypeerror";thisValidate.regexErrorAttribute="regexerror";thisValidate.minLengthErrorAttribute="minlengtherror";thisValidate.maxLengthErrorAttribute="maxlengtherror";thisValidate.minValueErrorAttribute="minvalueerror";thisValidate.maxValueErrorAttribute="maxvalueerror";thisValidate.equalsErrorAttribute="equalserror";thisValidate.dateRangeErrorAttribute="daterangeerror";thisValidate.dateEqualErrorAttribute="dateequalerror";thisValidate.dateNoFlightsErrorAttribute="datenoflightserror";thisValidate.dateCheckErrorAttribute="datecheckerror";thisValidate.nameCheckErrorAttribute="namecheckerror";thisValidate.dateValhoursErrorAttribute="valhours";thisValidate.defaultError="{label} is invalid.";thisValidate.defaultRequiredError="{label} is required.";thisValidate.defaultValidationTypeError="{label} is invalid.";thisValidate.defaultRegexError="{label} is invalid.";thisValidate.defaultMinLengthError="{label} is too short in length.";thisValidate.defaultMaxLengthError="{label} is too long in length.";thisValidate.defaultMinValueError="{label} must be greater than {minValue}.";thisValidate.defaultMaxValueError="{label} must be less than {maxValue}.";thisValidate.defaultEqualsError="{label} is not equal to {equals}";thisValidate.defaultNotEqualsError="{label} cannot equal {equals}";thisValidate.defaultSameNameError="Duplicate of another guest.";thisValidate.defaultInvalidFlightCombination="Flight dates you've chosen are invalid. Please select another date combination.";thisValidate.defaultNoFlightFoundError="You must select another date or station.";thisValidate.defaultValidationErrorClass="validationError";thisValidate.defaultValidationErrorLabelClass="validationErrorLabel";thisValidate.run=function(){var nodeArray=$(":input",SKYSALES.getSkySalesForm()).get();var e=null;for(var i=0;i<nodeArray.length;i+=1){e=nodeArray[i];thisValidate.checkBirthdate(e);if(!this.isExemptFromValidation(e)){thisValidate.validateSingleElement(e)}}return thisValidate.outputErrors()};thisValidate.runBySelector=function(selectorString){var nodeArray=$(selectorString).find(":input").get();var node=null;var i=0;for(i=0;i<nodeArray.length;i+=1){node=nodeArray[i];thisValidate.validateSingleElement(node)}return false};thisValidate.validateSingleElement=function(e){$(e).removeClass(thisValidate.defaultValidationErrorClass);$("label[@for="+e.id+"]").eq(0).removeClass(this.defaultValidationErrorLabelClass);var validationError=new SKYSALES.ValidationErrorReadAlong();validationError.objId=e.id;validationError.obj=e;this.validationErrorArray[thisValidate.validationErrorArray.length]=validationError;this.validateRequired(e);var value=thisValidate.getValue(e);if((thisValidate.errors.length<1)&&(value!==null)&&(value!=="")){thisValidate.validateType(e);thisValidate.validateRegex(e);thisValidate.validateMinLength(e);thisValidate.validateMaxLength(e);thisValidate.validateMinValue(e);thisValidate.validateMaxValue(e);thisValidate.validateEquals(e);thisValidate.validateInfant(e);thisValidate.validateName(e);thisValidate.validateDateRange(e);thisValidate.checkINS(e);thisValidate.validateContact(e);thisValidate.validateSeatMap(e);thisValidate.enablePassTxtBox(e);thisValidate.checkFlightAvailabilty(e);thisValidate.validateDepartureTime(e)}};thisValidate.enablePassTxtBox=function(e){var aINS=e[thisValidate.checkEnableTxtBoxAttribute];var txtbox=$("#div [@class^='medium'] :input");if(aINS){e.disabled=false}};thisValidate.checkINS=function(e){var aINS=e[thisValidate.checkINSAttribute];var foundInsuranceSelected=false;var ins=$("#objIns ul li[@class^='insCheckBox'] :input");if(aINS){$(ins).each(function(){if($(this).attr("checked")&&!($(this).attr("disabled"))){foundInsuranceSelected=true}});if(foundInsuranceSelected==true){var insOpt=$("#totalIns p").find("input");if($(insOpt).attr("checked")){return true}else{thisValidate.setError(e,thisValidate.requiredErrorAttribute,thisValidate.defaultRequiredError);return false}}}return true};thisValidate.outputErrors=function(){var errorDisplayMethod=this.errorDisplayMethod.toString().toLowerCase();var errorHtml="";var errorArray=[];var i=0;var showDefaultErrorMethod=true;if(this.errors){errorArray=thisValidate.errors.split("\n");errorHtml+='<ul class="validationErrorList" >';for(i=0;i<errorArray.length;i+=1){if(errorArray[i]!==""){errorHtml+='<li class="validationErrorListItem" >'+errorArray[i]+"</li>"}}errorHtml+="</ul>";if(errorDisplayMethod.indexOf("read_along")>-1){thisValidate.outputErrorsReadAlong(errorHtml);showDefaultErrorMethod=false}if(errorDisplayMethod.indexOf("alert")>-1){alert(thisValidate.errorsHeader+thisValidate.errors)}if(showDefaultErrorMethod===true){alert(thisValidate.errorsHeader+thisValidate.errors)}if(thisValidate.setfocus){if($(thisValidate.setfocus).is(":hidden")===false){thisValidate.setfocus.blur();thisValidate.setfocus.focus()}}return false}else{return true}};thisValidate.outputErrorsReadAlong=function(errorHtml){var i=0;var errorHtmlLocal="";var validationError=null;var validateObject=this;var addErrorEventFunction=function(index){this.hasValidationEvents=true;this.addFocusEvent(index);this.addBlurEvent(index)};validateObject.validationErrorReadAlong=new SKYSALES.ValidationErrorReadAlong();validateObject.readAlongDivId=$("#"+this.validationErrorReadAlong.getValidationErrorDivId()).attr("id");if(validateObject.readAlongDivId===undefined){validateObject.validationErrorReadAlong.addValidationErrorDiv();validateObject.validationErrorReadAlong.addCloseEvent()}errorHtmlLocal+='<ul class="validationErrorList" >';for(i=0;i<validateObject.validationErrorArray.length;i+=1){validationError=this.validationErrorArray[i];if(validationError.isError===true){errorHtmlLocal+='<li class="validationErrorListItem" >'+validationError.errorMessage+"</li>"}else{errorHtmlLocal+='<li class="validationErrorListItem hidden" >'+validationError.errorMessage+"</li>"}}$("#"+validateObject.validationErrorReadAlong.getValidationErrorListId()).html(errorHtmlLocal);$(validateObject.validationErrorArray).each(addErrorEventFunction)};thisValidate.checkFocus=function(e){if(!thisValidate.setfocus){thisValidate.setfocus=e}};thisValidate.setError=function(e,errorAttribute,defaultTypeError,focusOnError){var nameStr="";var error="";var dollarOne="";var i=0;var validationError=null;if(e.type==="radio"){nameStr=e.getAttribute("name");if(nameStr.length>0){if(thisValidate.namedErrors[nameStr]!==undefined){return}thisValidate.namedErrors[nameStr]=nameStr}}error=e[errorAttribute];if(!error){if(e[thisValidate.defaultErrorAttribute]){error=e[thisValidate.defaultErrorAttribute]}else{if(defaultTypeError){error=defaultTypeError}else{error=thisValidate.defaultError}}}var results=error.match(/\{\s*(\w+)\s*\}/g);if(results){for(i=0;i<results.length;i+=1){dollarOne=results[i].replace(/\{\s*(\w+)\s*\}/,"$1");error=error.replace(/\{\s*\w+\s*\}/,thisValidate.cleanAttributeForErrorDisplay(e,dollarOne))}}$(e).addClass(this.defaultValidationErrorClass);$("label[@for="+e.id+"]").eq(0).addClass(thisValidate.defaultValidationErrorLabelClass);this.errors+=error+"\n";var errorObjId=e.id;for(i=0;i<thisValidate.validationErrorArray.length;i+=1){validationError=thisValidate.validationErrorArray[i];if(validationError.objId===errorObjId){validationError.errorMessage=error;validationError.isError=true;break}}var setFocusOnControl=focusOnError==false?false:true;if(setFocusOnControl==true){this.checkFocus(e)}};thisValidate.cleanAttributeForErrorDisplay=function(e,attributeName){var inputLabelObj=null;var requiredString="";if(attributeName===undefined){attributeName=""}attributeName=attributeName.toLowerCase();var attribute="";if(attributeName==="label"){attribute=$("label[@for="+e.id+"]").eq(0).text();inputLabelObj=new SKYSALES.InputLabel();requiredString=inputLabelObj.getInputLabelRequiredFlag();attribute=attribute.replace(requiredString,"")}if(!attribute){attribute=e.id}if(!attribute){return attributeName}if(attributeName.match(/^(minvalue|maxvalue)$/i)){return attribute.replace(/[^\d.,]/g,"")}return attribute};thisValidate.validateRequired=function(e){var requiredAttribute=thisValidate.requiredAttribute;var requiredEmptyAttribute=thisValidate.requiredEmptyAttribute;var required=e[requiredAttribute];var requiredEmptyString=e[requiredEmptyAttribute];var value=null;thisValidate.radioGroupHash={};var radioName="";var isRadioGroupChecked=false;if(required!==undefined){required=required.toString().toLowerCase();if(requiredEmptyString){requiredEmptyString=requiredEmptyString.toString().toLowerCase()}if(required==="true"){value=thisValidate.getValue(e);if((e.type==="checkbox")&&(e.checked===false)){value=""}else{if(e.type==="radio"){radioName=e.getAttribute("name");if(thisValidate.radioGroupHash[radioName]===undefined){thisValidate.radioGroupHash[radioName]=$("input[@name='"+radioName+"']")}isRadioGroupChecked=thisValidate.radioGroupHash[radioName].is(":checked");if(!isRadioGroupChecked){value=""}}}if((value===undefined)||(value===null)||(value==="")||(value.toLowerCase()===requiredEmptyString)){thisValidate.setError(e,thisValidate.requiredErrorAttribute,thisValidate.defaultRequiredError)}}}};thisValidate.validateType=function(e){var type=e[this.validationTypeAttribute];var value=this.getValue(e);if((type)&&(value!==null)){type=type.toLowerCase();if((type==="address")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="alphanumeric")&&(!value.match(thisValidate.alphaNumericPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="amount")&&(!thisValidate.validateAmount(value))){thisValidate.setValidateTypeError(e)}else{if((type==="country")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="email")&&(!value.match(thisValidate.emailPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="mod10")&&(!thisValidate.validateMod10(value))){thisValidate.setValidateTypeError(e)}else{if((type==="name")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="numeric")&&(!thisValidate.validateNumeric(value))){thisValidate.setValidateTypeError(e)}else{if((type.indexOf("date")===0)&&(!thisValidate.validateDate(e,type,value))){thisValidate.setValidateTypeError(e)}else{if((type==="state")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="string")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="uppercasestring")&&(!value.match(thisValidate.upperCaseStringPattern))){thisValidate.setValidateTypeError(e)}else{if((type==="zip")&&(!value.match(thisValidate.stringPattern))){thisValidate.setValidateTypeError(e)}}}}}}}}}}}}}}};thisValidate.validateRegex=function(e){var regex=e[thisValidate.regexAttribute];var value=thisValidate.getValue(e);if((value!==null)&&(regex)&&(!value.match(regex))){this.setError(e,thisValidate.regexErrorAttribute,thisValidate.defaultRegexError)}};thisValidate.validateMinLength=function(e){var length=e[thisValidate.minLengthAttribute];var numericLength=e[thisValidate.numericMinLengthAttribute];var value=this.getValue(e);if((0<length)&&(value!==null)&&(value.length<length)){thisValidate.setError(e,thisValidate.minLengthErrorAttribute,thisValidate.defaultMinLengthError)}else{if((0<numericLength)&&(0<value.length)&&(value.replace(thisValidate.numericStripper,"").length<numericLength)){thisValidate.setError(e,thisValidate.minLengthErrorAttribute,thisValidate.defaultMinLengthError)}}};thisValidate.validateMaxLength=function(e){var length=e[thisValidate.maxLengthAttribute];var numericLength=e[thisValidate.numericMaxLengthAttribute];var value=this.getValue(e);if((0<length)&&(value!==null)&&(length<value.length)){thisValidate.setError(e,thisValidate.maxLengthErrorAttribute,thisValidate.defaultMaxLengthError)}else{if((0<numericLength)&&(0<value.length)&&(numericLength<value.replace(thisValidate.numericStripper,"").length)){thisValidate.setError(e,thisValidate.maxLengthErrorAttribute,thisValidate.defaultMaxLengthError)}}};thisValidate.validateMinValue=function(e){var min=e[thisValidate.minValueAttribute];var value=thisValidate.getValue(e);if((value!==null)&&(min!==undefined)&&(0<min.length)){if((5<min.length)&&(min.substring(0,5)==="&gt;=")){if(value<parseFloat(min.substring(5,min.length))){thisValidate.setError(e,thisValidate.minValueErrorAttribute,thisValidate.defaultMinValueError)}}else{if((4<min.length)&&(min.substring(0,4)==="&gt;")){if(value<=parseFloat(min.substring(4,min.length))){thisValidate.setError(e,thisValidate.minValueErrorAttribute,thisValidate.defaultMinValueError)}}else{if(value<parseFloat(min)){thisValidate.setError(e,thisValidate.minValueErrorAttribute,thisValidate.defaultMinValueError)}}}}};thisValidate.validateMaxValue=function(e){var max=e[this.maxValueAttribute];var value=this.getValue(e);if((value!==null)&&(max!==undefined)&&(0<max.length)){if((5<max.length)&&(max.substring(0,5)==="&lt;=")){if(value>parseFloat(max.substring(5,max.length))){thisValidate.setError(e,thisValidate.maxValueErrorAttribute,thisValidate.defaultMaxValueError)}}else{if((4<max.length)&&(max.substring(0,4)==="&lt;")){if(value>=parseFloat(max.substring(4,max.length))){thisValidate.setError(e,thisValidate.maxValueErrorAttribute,thisValidate.defaultMaxValueError)}}else{if(parseFloat(value)>max){thisValidate.setError(e,thisValidate.maxValueErrorAttribute,thisValidate.defaultMaxValueError)}}}}};thisValidate.validateSeatMap=function validateSeatMap(e){thisID=e.id;if(thisID.match("ControlGroupUnitMapView_UnitMapViewControl_CheckBoxAgreement")!==null){aInput=document.getElementsByTagName("input");for(var i=0;(input=aInput[i]);i++){if(input.getAttribute("type")=="text"){if(input.value.length>0){var checkboxid="ControlGroupUnitMapView_UnitMapViewControl_CheckBoxAgreement";if(document.getElementById(checkboxid).checked==false){thisValidate.setError(e,thisValidate.requiredErrorAttribute,thisValidate.defaultRequiredError);break}}}}}};thisValidate.checkBirthdate=function checkBirthdate(e){thisID=e.id;if(thisID.match("BirthDate")){if(e.description.match("Senior")){e.required="true"}else{if(e.description.match("Child")&&$("#marketCheck").find("li.marketJourney").text().match("HongKong")){e.required="true"}}}};thisValidate.checkAsterisk=function checkAsterisk(e){thisID=e.id;if(thisID.match("CONTROLGROUPGUEST")){if(e.description.match("Senior")){e.required="true"}else{if(e.description.match("Child")&&$("#marketCheck").find("li.marketJourney").text().match("HongKong")){e.required="true"}}if(e.required=true){$("#requiredBirthdate").text()="XXXX"}}};thisValidate.validateName=function validateName(e){var nameCheck=e[thisValidate.nameCheckAttribute];var value=thisValidate.getValue(e);isError=false;thisID=e.id;if(thisID.match("CONTROLGROUPGUEST_PassengerInputViewGuestView_TextBoxFirstName")!==null){currentID=thisID.substr(thisID.lastIndexOf("_")+1);strfirstName="TextBoxFirstName_";strlastName="TextBoxLastName_";var strID="CONTROLGROUPGUEST_PassengerInputViewGuestView_";var currentfirstNameID=strID+strfirstName+currentID;var currentlastNameID=strID+strlastName+currentID;var currentFullName=document.getElementById(currentfirstNameID).value+" "+document.getElementById(currentlastNameID).value;counter=parseInt(currentID)+1;var comparefirstNameID=strID+strfirstName+counter;var comparelastNameID=strID+strlastName+counter;var comparefirstName=document.getElementById(comparefirstNameID);var comparelastName=document.getElementById(comparelastNameID);while(comparefirstName!==null&&comparelastName!==null){var compareFullName=comparefirstName.value+" "+comparelastName.value;if(counter!==currentID){if(currentFullName==compareFullName){isError=true}}counter++;comparefirstNameID=strID+strfirstName+counter;comparelastNameID=strID+strlastName+counter;comparefirstName=document.getElementById(comparefirstNameID);comparelastName=document.getElementById(comparefirstNameID)}infantCtr=0;counter=parseInt(currentID)+1;var infantCompareFirstId=strID+strfirstName+infantCtr+"_"+infantCtr;var infantCompareLastId=strID+strlastName+infantCtr+"_"+infantCtr;var infantCompareFirst=document.getElementById(infantCompareFirstId);var infantCompareLast=document.getElementById(infantCompareLastId);while(infantCompareFirst!==null&&infantCompareLast!==null){var infantFullName=infantCompareFirst.value+" "+infantCompareLast.value;if(currentFullName==infantFullName){isError=true}infantCtr++;infantCompareFirstId=strID+strfirstName+infantCtr+"_"+infantCtr;infantCompareLastId=strID+strlastName+infantCtr+"_"+infantCtr;infantCompareFirst=document.getElementById(infantCompareFirstId);infantCompareLast=document.getElementById(infantCompareLastId)}if(isError){thisValidate.setError(e,thisValidate.nameCheckErrorAttribute,thisValidate.defaultSameNameError)}}};thisValidate.validateContact=function validateContact(e){var value=thisValidate.getValue(e);var contactcheck=e[thisValidate.contactCheckAttribute];checkID=e.id;string1=checkID.substr(0,checkID.lastIndexOf("TextBox"))+"TextBox";if(contactcheck!==undefined){if(checkID.match("Country")!==null){string2=checkID.substr(checkID.lastIndexOf("Country"),checkID.length);string2=string2.replace(/Country/,"");var hidden=document.getElementById(string1+string2);if(hidden.value!==""||hidden.value!==null){if(value==null||value==""){thisValidate.setError(e,thisValidate.requiredErrorAttribute,thisValidate.defaultRequiredError)}}}}};thisValidate.validateInfant=function validateInfant(e){var dateCheck=e[thisValidate.dateCheckAttribute];var value=thisValidate.getValue(e);thisID=e.id;if(thisID.match("CONTROLGROUPGUEST_PassengerInputViewGuestView")!==null){if(thisID.match("CONTROLGROUPGUEST_PassengerInputViewGuestView_DropDownListBirthDate")!==null){var description="";description=document.getElementById(thisID).attributes.getNamedItem("description").nodeValue;var checkType=description.substr(0,description.indexOf(" ",0));day=document.getElementById(thisID.replace(/DropDownListBirthDateYear/,"DropDownListBirthDateDay")).value;month=document.getElementById(thisID.replace(/DropDownListBirthDateYear/,"DropDownListBirthDateMonth")).value;year=document.getElementById(thisID).value;var myDate=new Date($("#deptBirthCompare").text());var myDate2=new Date();var two=new Date();var myToday=new Date();myDate2.setFullYear(year,month-1,day);if(checkType=="Infant"&&dateCheck!==undefined){myDate.setFullYear(myDate.getFullYear()-2);myDate2.setHours(0,0,0,0);two.setHours(two.getHours()+384);if(myDate2<=myDate){thisValidate.setError(e,thisValidate.dateCheckErrorAttribute,thisValidate.defaultEqualsError)}else{if(myDate2.getFullYear()==myToday.getFullYear()){var three=myDate;three.setFullYear(three.getFullYear()+2);three.setDate(three.getDate()-16);if(myDate2>three){thisValidate.setError(e,thisValidate.dateCheckErrorAttribute,thisValidate.defaultEqualsError)}}}}else{if(checkType=="Child"&&dateCheck!==undefined){myDate.setFullYear(myDate.getFullYear()-11);two.setFullYear(two.getFullYear()-2);if(myDate2>=two||myDate2<=myDate){thisValidate.setError(e,thisValidate.dateCheckErrorAttribute,thisValidate.defaultEqualsError)}}else{if(checkType=="Adult"&&dateCheck!==undefined){myDate.setFullYear(myDate.getFullYear()-12);if(myDate2>myDate){thisValidate.setError(e,thisValidate.dateCheckErrorAttribute,thisValidate.defaultEqualsError)}}else{if(checkType=="Senior"&&dateCheck!==undefined){myDate.setFullYear(myDate.getFullYear()-60);if(myDate2>myDate){thisValidate.setError(e,thisValidate.dateCheckErrorAttribute,thisValidate.defaultEqualsError)}}}}}}}};thisValidate.validateEquals=function validateEquals(e){var equal=e[thisValidate.equalsAttribute];var value=thisValidate.getValue(e);emailAdd=document.getElementById("CONTROLGROUPGUEST_GuestContactInputView_TextBoxEmailAddress");if(e.id=="CONTROLGROUPGUEST_GuestContactInputView_TextBoxConfirmEmail"){if(value!==emailAdd.value){thisValidate.setError(e,thisValidate.equalsErrorAttribute,thisValidate.defaultEqualsError)}}else{if((value!==null)&&(equal!==undefined)&&(0<equal.length)){if((2<equal.length)&&(equal.substring(0,2)==="!=")){if(value===equal.substring(2,equal.length)){thisValidate.setError(e,thisValidate.equalsErrorAttribute,thisValidate.defaultEqualsError)}}else{if((2<equal.length)&&(equal.substring(0,2)==="==")){if(value!==equal.substring(2,equal.length)){thisValidate.setError(e,thisValidate.equalsErrorAttribute,thisValidate.defaultEqualsError)}}else{if(equal.charAt(0)==="="){if(value!==equal.substring(1,equal.length)){thisValidate.setError(e,thisValidate.equalsErrorAttribute,thisValidate.defaultEqualsError)}}else{if(value!==equal){thisValidate.setError(e,thisValidate.equalsErrorAttribute,thisValidate.defaultEqualsError)}}}}}}};thisValidate.validateDepartureTime=function validateDepartureTime(e){var checkFlight=e[thisValidate.checkFlightCombinationAttribute];if(checkFlight=="true"){var table=$("#selectMainBody table[@id='availabilityTable']");("tr td[@class^='fareCol']");var keys=[];var marketOneId=null;var marketTwoId=null;$("#selectMainBody table[@id='availabilityTable']").each(function(){table.find("td[@class^='fareCol']").each(function(){var td=$(this);var radioId=td.find(":radio[@name$='market1'][@checked]").attr("id");if(radioId){marketOneId=radioId}radioId=td.find(":radio[@name$='market2'][@checked]").attr("id");if(radioId){marketTwoId=radioId}})});var marketOneValue=null;var marketTwoValue=null;if(marketOneId!=null&&marketOneId!=undefined){marketOneValue=document.getElementById(marketOneId).value}if(marketTwoId!=null&&marketTwoId!=undefined){marketTwoValue=document.getElementById(marketTwoId).value}if((marketOneValue!=undefined&&marketOneValue!=""&&marketOneValue!=null)&&(marketTwoValue!=undefined&&marketTwoValue!=""&&marketTwoValue!=null)){var charIndex=marketOneValue.indexOf("|")+1;var arrStreamValue=marketOneValue.substring(charIndex).split("^");var mkt1DateStream="";if(arrStreamValue.length>1){charIndex=arrStreamValue[1].indexOf("~~")+2;mkt1DateStream=arrStreamValue[1].substring(charIndex)}else{charIndex=arrStreamValue[0].indexOf("~~")+2;mkt1DateStream=arrStreamValue[0].substring(charIndex)}var arrMkt1Dates=mkt1DateStream.split("~");var mkt1DateValue=new Date(arrMkt1Dates[3]+" GMT");arrStreamValue=null;charIndex=marketTwoValue.indexOf("|")+1;arrStreamValue=marketTwoValue.substring(charIndex).split("^");var mkt2DateStream="";if(arrStreamValue.length>1){charIndex=arrStreamValue[1].indexOf("~~")+2;mkt2DateStream=arrStreamValue[1].substring(charIndex)}else{charIndex=arrStreamValue[0].indexOf("~~")+2;mkt2DateStream=arrStreamValue[0].substring(charIndex)}var arrMkt2Dates=mkt2DateStream.split("~");var mkt2DateValue=new Date(arrMkt2Dates[1]+" GMT");if(mkt1DateValue.getUTCMonth()==mkt2DateValue.getUTCMonth()&&mkt1DateValue.getUTCDate()==mkt2DateValue.getUTCDate()&&mkt1DateValue.getUTCFullYear()==mkt2DateValue.getUTCFullYear()){var mkt1DateUTCHour=mkt1DateValue.getUTCHours();var mkt1DateUTCMinutes=mkt1DateValue.getUTCMinutes();var mkt2DateUTCHour=mkt2DateValue.getUTCHours();var mkt2DateUTCMinutes=mkt2DateValue.getUTCMinutes();var minTime=2;if(((mkt2DateUTCHour-mkt1DateUTCHour)<minTime)||((mkt2DateUTCHour-mkt1DateUTCHour)==minTime&&(mkt1DateUTCMinutes>mkt2DateUTCMinutes))){thisValidate.setError(e,"",thisValidate.defaultInvalidFlightCombination,false);scrollTo(0,0)}}}}};thisValidate.checkFlightAvailabilty=function checkFlightAvailabilty(e){var checkAvailability=e[thisValidate.checkFlightAvailabiltyAttribute];if(checkAvailability=="true"){var markets=$("#selectMainBody table[@id='availabilityTable']");var table=$("#selectMainBody table[@id='availabilityTable']");("tr td[@class^='fareCol']");var marketOneId=null;var marketTwoId=null;$("#selectMainBody table[@id='availabilityTable']").each(function(){table.find("td[@class^='fareCol']").each(function(){var td=$(this);var radioId=td.find(":radio[@name$='market1'][@checked]").attr("id");if(radioId){marketOneId=radioId}radioId=td.find(":radio[@name$='market2'][@checked]").attr("id");if(radioId){marketTwoId=radioId}})});if(markets.length>=1&&marketOneId==null){thisValidate.setError(e,"",thisValidate.defaultNoFlightFoundError)}else{if(markets.length>1&&marketTwoId==null){thisValidate.setError(e,"",thisValidate.defaultNoFlightFoundError)}}}};var checkDateRangeExists=function(dateHidden2){var parent=dateHidden2.parent();var parent2=parent.parent();var noDateRangeIE=parent.is(":hidden");var noDateRangeNonIE=parent2.is(":hidden");var retVal=!(noDateRangeIE||noDateRangeNonIE);return retVal};thisValidate.checkIfValidateDateRangeNeeded=function(e){var date=e[thisValidate.dateRangeAttribute];var date1HiddenId=e[thisValidate.dateRange1HiddenIdAttribute];var date2HiddenId=e[thisValidate.dateRange2HiddenIdAttribute];var idLastChar="";var idSuffix="";var id=e.id;var startValidate=false;var dateRangeExists=false;var dateHidden1=null;var dateHidden2=null;if((date!==undefined)&&(0<date.length)){idLastChar=id.charAt(id.length-1);if(this.validateNumeric(idLastChar)){idSuffix=idLastChar}if(("1"===idSuffix)||(""===idSuffix)){dateHidden2=$("#"+date2HiddenId);dateRangeExists=checkDateRangeExists(dateHidden2);if(dateRangeExists){startValidate=true;dateHidden1=$("#"+date1HiddenId);thisValidate.dateRangeArray[0]=dateHidden1.val();thisValidate.dateRangeArray[1]=dateHidden2.val()}else{startValidate=true;dateHidden1=$("#"+date1HiddenId);thisValidate.dateRangeArray[0]=dateHidden1.val()}}}return startValidate};thisValidate.validateDateRange=function(e){var marketDate=null;var datesInOrder=false;var valhours=e.valhours;var startValidate=thisValidate.checkIfValidateDateRangeNeeded(e);if(startValidate){marketDate=new SKYSALES.Class.MarketDate();if(this.dateRangeArray[1]!==undefined){datesInOrder=marketDate.datesInOrder(this.dateRangeArray);if(!datesInOrder){this.setError(e,this.dateRangeErrorAttribute,this.defaultError);return}}if(valhours!=="0"){datesInOrder=marketDate.datesIsEqual(this.dateRangeArray,valhours);if(!datesInOrder){this.setError(e,this.dateEqualErrorAttribute,this.defaultError);return}}datesInOrder=marketDate.dateNoFlights(this.dateRangeArray);if(!datesInOrder){this.setError(e,this.dateNoFlightsErrorAttribute,this.defaultError);return}}};thisValidate.isExemptFromValidation=function(e){if(e.id.indexOf(this.namespace)!==0){return true}if(this.regexElementIdFilter&&(!e.id.match(this.regexElementIdFilter))){return true}return false};thisValidate.setValidateTypeError=function(e){this.setError(e,this.validationTypeErrorAttribute,this.defaultValidationTypeError)};thisValidate.validateAmount=function(amount){if((!amount.match(this.amountPattern))||(amount===0)){return false}return true};thisValidate.validateDate=function(e,type,value){var lowerCaseType="";var today=new Date();if(type){lowerCaseType=type.toLowerCase()}if((lowerCaseType==="dateyear")&&((value<today.getYear())||(!value.match(thisValidate.dateYearPattern)))){return false}else{if((lowerCaseType==="datemonth")&&(!value.match(thisValidate.dateMonthPattern))){return false}else{if((lowerCaseType==="dateday")&&(!value.match(thisValidate.DateDayPattern))){return false}}}return true};thisValidate.validateMod10=function(cardNumber){var ccCheckRegExp=/\D/;var cardNumbersOnly=cardNumber.replace(/ /g,"");var numberProduct;var checkSumTotal=0;var productDigitCounter=0;var digitCounter=0;if(!ccCheckRegExp.test(cardNumbersOnly)){while(cardNumbersOnly.length<16){cardNumbersOnly="0"+cardNumbersOnly}for(digitCounter=cardNumbersOnly.length-1;0<=digitCounter;digitCounter-=2){checkSumTotal+=parseInt(cardNumbersOnly.charAt(digitCounter),10);numberProduct=String((cardNumbersOnly.charAt(digitCounter-1)*2));for(productDigitCounter=0;productDigitCounter<numberProduct.length;productDigitCounter+=1){checkSumTotal+=parseInt(numberProduct.charAt(productDigitCounter),10)}}return(checkSumTotal%10===0)}return false};thisValidate.validateNumeric=function(number){number=number.replace(/\s/g,"");if(!number.match(thisValidate.numericPattern)){return false}return true};thisValidate.getValue=function(e){return SKYSALES.Common.getValue(e)};thisValidate.stringPattern=/^.+$/;thisValidate.upperCaseStringPattern=/^[A-Z]([A-Z|\s])*$/;thisValidate.numericPattern=/^\d+$/;thisValidate.numericStripper=/\D/g;thisValidate.alphaNumericPattern=/^\w+$/;thisValidate.amountPattern=/^(\d+((\.|,|\s|\xA0)\d+)*)$/;thisValidate.dateYearPattern=/^\d{4}$/;thisValidate.dateMonthPattern=/^\d{2}$/;thisValidate.dateDayPattern=/^\d{2}$/;thisValidate.emailPattern=/^\w+([\.\-\']?\w+)*@\w+([\.\-\']?\w+)*(\.\w{1,8})$/};var validateBySelector=function(selectorString){var validate=null;var clickedObj=null;if(selectorString!==undefined){validate=new SKYSALES.Validate(null,"",SKYSALES.errorsHeader,null);validate.clickedObj=clickedObj;validate.runBySelector(selectorString);return validate.outputErrors()}return true};var validate=function(controlID,elementName,filter){var clickedObj=null;var validate=null;var e=null;if(document.getElementById&&document.createTextNode){if(controlID.getAttribute){clickedObj=controlID;controlID=controlID.getAttribute("id").replace(/_\w+$/,"")}validate=new SKYSALES.Validate(SKYSALES.getSkySalesForm(),controlID+"_",SKYSALES.errorsHeader,filter);validate.clickedObj=clickedObj;if(elementName){e=elementName;if(!elementName.getAttribute){e=document.getElementById(controlID+"_"+elementName)}validate.validateSingleElement(e);return validate.outputErrors()}return validate.run()}return true};var preventDoubleClick=function(){return true};var events=[];var register=function(eventName,functionName){if(events[eventName]===undefined){events[eventName]=[]}events[eventName][events[eventName].length]=functionName};var raise=function(eventName,eventArgs){var ix=0;if(events[eventName]!==undefined){for(ix=0;ix<events[eventName].length;ix+=1){if(eval(events[eventName][ix]+"(eventArgs)")===false){return false}}}return true};var WindowInitialize=function(){var originalOnLoad=window.onload;var windowLoadFunction=function(){raise("WindowLoad",{});if(originalOnLoad){originalOnLoad()}};$(window).ready(windowLoadFunction)};SKYSALES.Util.displayPopUpConverter=function(){var url="CurrencyConverter.aspx";var converterWindow=window.converterWindow;if(!window.converterWindow||converterWindow.closed){converterWindow=window.open(url,"converter","width=360,height=220,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0")}else{converterWindow.open(url,"converter","width=360,height=220,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0");if($(converterWindow).is(":hidden")===false){converterWindow.focus()}}};var hideShow=function(hideControl,depControl){var controlHide=hideControl;var controlDepend=depControl;if(document.getElementById&&document.getElementById(hideControl)){if(document.getElementById(controlDepend).checked===true){document.getElementById(controlHide).style.display="inline"}else{document.getElementById(controlHide).style.display="none"}}};var jsLoadedCommon=true;SKYSALES.toggleAtAGlanceEvent=function(){$(this).next().toggle()};SKYSALES.toggleAtAGlance=function(){$("div.atAGlanceDivHeader").click(SKYSALES.toggleAtAGlanceEvent)};SKYSALES.initializeTime=function(){var i=0;var timeOptions="";for(i=0;i<23;i+=1){timeOptions+="<option value="+i+">"+i+"</option>"}if(timeOptions!==""){$("select.Time").append(timeOptions)}};$("a.animateMe").animate({height:"toggle",opacity:"toggle"},"slow");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();$("a.showContent").click(SKYSALES.aosAvailabilityShow);$("a.hideContent").click(SKYSALES.aosAvailabilityHide);$("a.toggleSlideContent").click(SKYSALES.dropDownMenuEvent);$("a.accordian").click(SKYSALES.faqHideShow);$("a.showEquipOpt").click(SKYSALES.equipHideShow);$("a.hideEquipOpt").click(SKYSALES.equipHideShow)};SKYSALES.initializeMetaObjects=function(){$.metaobjects({clean:false})};SKYSALES.common=new SKYSALES.Common();function formatCurrency(value){var cents=0;value=value.toString();if(isNaN(value)){value="0"}if(value.indexOf(".")>-1){cents=value.substring(value.indexOf(".")+1,value.length);value=value*100}cents=value%100;if(cents>0){value=Math.floor(value/100).toString()}if(cents<10){cents="0"+cents}for(var i=0;i<Math.floor((value.length-(1+i))/3);i+=1){value=value.substring(0,value.length-(4*i+3))+","+value.substring(value.length-(4*i+3))}return(value+"."+cents)}SKYSALES.Util.sendAspFormFields=function(){var clearAllValidity=null;var eventTargetElement=window.document.getElementById("eventTarget");var eventArgumentElement=window.document.getElementById("eventArgument");var viewStateElement=window.document.getElementById("viewState");var theForm=window.theForm;if(!theForm.onsubmit||(theForm.onsubmit()!==false)){eventTargetElement.name="__EVENTTARGET";eventArgumentElement.name="__EVENTARGUMENT";viewStateElement.name="__VIEWSTATE";if(theForm.checkValidity){clearAllValidity=function(){$(this).removeAttr("required")};SKYSALES.common.getAllInputObjects().each(clearAllValidity)}}return true};SKYSALES.Util.initStripeTable=function(){$(".hotelResult").hide();var stripeMeInputHandler=function(){$(".stripeMe tr").removeClass("over");$(this).parent().parent().addClass("over")};$(".stripeMe input").click(stripeMeInputHandler)};SKYSALES.Util.ready=function(){$("form").submit(SKYSALES.Util.sendAspFormFields);SKYSALES.initializeMetaObjects();SKYSALES.common.initializeCommon();SKYSALES.Util.initObjects();SKYSALES.initializeSkySalesForm();SKYSALES.toggleAtAGlance();SKYSALES.Util.initStripeTable();SKYSALES.initializeAosAvailability()};$(document).ready(SKYSALES.Util.ready);SKYSALES.Util.populateSelectOriDestSattion=function(paramObj){var selectedItem=paramObj.selectedItem||null;var objectArray=paramObj.objectArray||null;var selectBox=paramObj.selectBox||null;var showCode=paramObj.showCode||false;var clearOptions=paramObj.clearOptions||false;var text="";var value="";var selectBoxObj=null;var obj=null;var prop="";if(selectBox){selectBoxObj=selectBox.get(0);thisID=selectBoxObj.id;if(selectBoxObj&&selectBoxObj.options){if(clearOptions){selectBoxObj.options.length=0}else{if(!selectBoxObj.originalOptionLength){selectBoxObj.originalOptionLength=selectBoxObj.options.length}selectBoxObj.options.length=selectBoxObj.originalOptionLength;var toDD=document.getElementById(thisID);while(toDD.options.length>1){toDD.remove(1)}$("#"+thisID+" optgroup").remove();for(var a=0;a<document.getElementsByTagName("optgroup").length;a++){if(document.getElementsByTagName("optgroup")[a].parentNode.name==thisID){var childOne=document.getElementsByTagName("optgroup")[a];toDD.removeChild(childOne);a=0}}}if(objectArray){var modoriginId=thisID.substring(thisID.length,thisID.length-14);var modestinationId=thisID.substring(thisID.length,thisID.length-19);var radioVisible=document.getElementById("ControlGroupSearchView_AvailabilitySearchInputSearchView_OpenJaw");if(modoriginId=="originStation1"||(modoriginId=="originStation2"&&radioVisible!==null)){selectBoxObj.options[0]=new window.Option("Origin","",true,false);if(modoriginId=="originStation1"){selectBoxObj.required="true";selectBoxObj.requirederror="Origin is a required field."}else{if(radioVisible.checked==true){selectBoxObj.required="true";selectBoxObj.requirederror="return Origin is a required field."}}}else{if(modoriginId=="originStation2"&&radioVisible===null){selectBoxObj.options[0]=new window.Option("Origin","",true,false)}else{if(modestinationId=="destinationStation1"||(modestinationId=="destinationStation2"&&radioVisible!==null)){selectBoxObj.options[0]=new window.Option("Destination","",true,false);if(modestinationId=="destinationStation1"){selectBoxObj.required="true";selectBoxObj.requirederror="Destination is a required field."}else{if(radioVisible.checked==true){selectBoxObj.required="true";selectBoxObj.requirederror="return Destination is a required field."}}}else{if(modestinationId=="destinationStation2"&&radioVisible===null){selectBoxObj.options[0]=new window.Option("Destination","",true,false)}}}}var countryArray=new Array();var fromArray=new Array();SKYSALES.Util.ParseCitiesAndCountries(objectArray,fromArray,countryArray);fromArray=fromArray.sort();countryArray=countryArray.sort();SKYSALES.Util.ConstructDropDown(countryArray,selectBoxObj,fromArray);if(selectedItem!==null){selectBox.val(selectedItem)}}}}};SKYSALES.Util.ParseCitiesAndCountries=function(objectArray,cityArray,countryArray){for(prop in objectArray){if(objectArray.hasOwnProperty(prop)){obj=objectArray[prop];var city=obj.name;var country=obj.countryCode;var code=obj.code;if(country=="PH"){country="DOMESTIC"}else{country="INTERNATIONAL"}var countryIndex=SKYSALES.Util.IndexOfItem(countryArray,country);if(countryIndex==-1){countryIndex=countryArray.length;countryArray[countryArray.length]=[country,countryArray.length]}if(SKYSALES.Util.IndexOfItem(cityArray,city)==-1){cityArray[cityArray.length]=[city,countryIndex,code]}}}};SKYSALES.Util.IndexOfItem=function(arr,item){if(!arr||arr.length==0){return -1}var bMultiDimArr=false;if(arr[0][0]!=null){bMultiDimArr=true}for(var i=0;i<arr.length;i++){if(bMultiDimArr&&arr[i][0]==item){return i}else{if(arr[i]==item){return i}}}return -1};SKYSALES.Util.ConstructDropDown=function(countryArray,dropdown,citiesArray){for(var h=0;h<countryArray.length;h++){var cityGroup=document.createElement("optgroup");cityGroup.label=countryArray[h][0];cityGroup.className="countryGroup";for(var i=0;i<citiesArray.length;i++){if(countryArray[h][1]==citiesArray[i][1]){var cityOption=document.createElement("option");document.getElementById(dropdown.id).options.add(cityOption);cityOption.value=citiesArray[i][2];cityOption.innerHTML=citiesArray[i][0];cityOption.className="cities";cityGroup.appendChild(cityOption)}}var FirstCountryToShow=null;if(countryArray[h][0]==FirstCountryToShow&&h!=0){dropdown.insertBefore(cityGroup,dropdown.childNodes[2])}else{dropdown.appendChild(cityGroup)}}};SKYSALES.Util.populateSelectByOject=function(paramObj,objSelectBox){var selectedItem=paramObj.selectedItem||null;var objectArray=paramObj.objectArray||null;var selectBox=objSelectBox||null;var showCode=paramObj.showCode||false;var clearOptions=paramObj.clearOptions||false;var text="";var value="";var selectBoxObj=null;var obj=null;var prop="";if(selectBox){selectBoxObj=selectBox;if(selectBoxObj&&selectBoxObj.options){if(clearOptions){selectBoxObj.options.length=0}else{if(!selectBoxObj.originalOptionLength){selectBoxObj.originalOptionLength=selectBoxObj.options.length}selectBoxObj.options.length=selectBoxObj.originalOptionLength}if(objectArray){for(prop in objectArray){if(objectArray.hasOwnProperty(prop)){obj=objectArray[prop];if(showCode){text=obj.name+" ("+obj.code+")"}else{text=obj.name}value=obj.code;selectBoxObj.options[selectBoxObj.options.length]=new window.Option(text,value,false,false)}}}}}};function displayPopup(url,title,width,height){if(!window.popupWindow||popupWindow.closed){popupWindow=window.open(url,title,"width="+width+", height="+height+",toolbar=0,status=0,location=0,menubar=0,scrollbars=1,resizable=1")}else{popupWindow.open(url,title,"width="+width+", height="+height+",toolbar=0,status=0,location=0,menubar=0,scrollbars=1,resizable=1");popupWindow.focus()}};
