this.globalWlAccountNo;this.globalMicCode;this.globalMilAccountNo;this.globalResultUrl;this.globalSearchObject;this.globalSearchResponse;this.globalSearchResponsePage;this.globalBookFormData;this.globalFilterOutAQID=new Array();this.globalHtmlHolder="AFE_HOLDER";this.globalCustomSearchBoxCSS="";this.globalCustomTilesResultBoxCSS="";this.globalCustomAirfareResultBoxCSS="";this.globalCustomBookingFormCSS="";this.globalCustomBookingResultCSS="";this.globalCustomNoResultCSS="";this.globalCustomSearchingPageCSS="";this.globalMilOptIn=true;this.globalSessionID="";this.iCSS=0;this.nCSS=0;this.arrCSS=[];this.global_sid="";this.global_vsid="";this.global_aqid="";this.globalDefaultSearchFormText="city or airport code";jQuery.extend({getScript:function(url,callback){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=url;var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;if(callback){callback()}script.onload=script.onreadystatechange=null}};head.appendChild(script);return undefined}});function PrepareSearching(){objSearch.requestResult(false)}function isvalid(obj){var res=false;if((typeof(obj)!="undefined")&&(obj!="")){res=true}return res}function afslib_Stat(){afslib_Stat.prototype.buildRequestUrl=function(TrackingCode,wait,callBack){var url="";if(typeof(afe.wlAccount)!="undefined"){url="wl_account_no="+afe.wlAccount;if(typeof(afe.micCode)!="undefined"){url=url+"&mic_code="+afe.micCode}if(typeof(afe.mil_account_no)!="undefined"){url=url+"&mil="+afe.mil_account_no}url=url+"&process_id=180"}return url};afslib_Stat.prototype.SaveStats=function(TrackingCode,wait,callBack){reqUrl=this.buildRequestUrl();if(wait){callServiceAsync(TrackingCode,callBack)}else{callServiceSync(TrackingCode,callBack)}};afslib_Stat.prototype.packServiceWithMic=function(codeInit,noMic,haveMic){var retArr=[];retArr.push(codeInit);if(typeof(afe.micCode)!="undefined"&&afe.micCode!=""){retArr.push(haveMic)}else{retArr.push(noMic)}return retArr.join(",")};afslib_Stat.prototype.callServiceAsync=function(TrackingCode,callBack){var srvctrl=new affServeLib_ServiceController();var IsMultiple=(TrackingCode.indexOf(",")!=-1);var Param="trackingcode"+(IsMultiple?"s":"");var url=this.buildRequestUrl();url=url+"&"+Param+"="+TrackingCode;srvctrl.callServiceAsync(url,{onRequestCompleted:function(responseTxt){}})};afslib_Stat.prototype.callServiceSync=function(TrackingCode,callBack){var srvctrl=new affServeLib_ServiceController();var IsMultiple=(TrackingCode.indexOf(",")!=-1);var Param="trackingcode"+(IsMultiple?"s":"");var url=this.buildRequestUrl();url=url+"&"+Param+"="+TrackingCode;srvctrl.callService(url,{handleResponse:function(responseTxt){}})}}function afslib_SearchObject(){this.wlAccount;this.micCode;this.wl_account_no;this.mil_account_no;this.process_ID=10;this.product_ID;this.productName;this.themeName="";this.layoutName="";this.fromLoc1;this.fromLoc2;this.fromLoc3;this.toLoc1;this.toLoc2;this.toLoc3;this.depDate1;this.depDate2;this.depDate3;this.retDate1;this.retDate2;this.retDate3;this.adultQty=1;this.childQty=0;this.infantQty=0;this.tripType;this.sessionAirId="";this.supID;this.clickID;this.searchType;this.response="";this.TilesThemeName;this.isShowOnlyFare=false;this.ProxyFileName="afslib_proxy.php";this.TestHosting="http://localhost:56789";this.isForceShowTiles=false;this.isShowFilter=true;this.isTestMode=false;function invokeSearchCompleted(){if(typeof(stepSearchCompleted)!="undefined"){stepSearchCompleted()}}afslib_SearchObject.prototype.buildRequestUrl=function(){var url="";if(typeof(this.wlAccount)!="undefined"){url="wl_account_no="+this.wlAccount;if(typeof(this.micCode)!="undefined"){url=url+"&micCode="+this.micCode}if(typeof(this.mil_account_code)!="undefined"){url=url+"&mil="+this.mil_account_code}if(typeof(this.process_ID)!="undefined"){url=url+"&process_id="+this.process_ID;if(typeof(this.product_ID)!="undefined"){url=url+"&product_id="+this.product_ID}if(typeof(this.productName)!="undefined"){url=url+"&productName="+this.productName}if(typeof(this.fromLoc1)!="undefined"){url=url+"&fromLoc1="+this.fromLoc1}if(typeof(this.fromLoc2)!="undefined"){url=url+"&fromLoc2="+this.fromLoc2}if(typeof(this.fromLoc3)!="undefined"){url=url+"&fromLoc3="+this.fromLoc3}if(typeof(this.toLoc1)!="undefined"){url=url+"&toLoc1="+this.toLoc1}if(typeof(this.toLoc2)!="undefined"){url=url+"&toLoc2="+this.toLoc2}if(typeof(this.toLoc3)!="undefined"){url=url+"&toLoc3="+this.toLoc3}if(typeof(this.depDate1)!="undefined"){url=url+"&depDate1="+this.depDate1}if(typeof(this.depDate2)!="undefined"){url=url+"&depDate2="+this.depDate2}if(typeof(this.depDate3)!="undefined"){url=url+"&depDate3="+this.depDate3}if(typeof(this.retDate1)!="undefined"){url=url+"&retDate1="+this.retDate1}if(typeof(this.retDate2)!="undefined"){url=url+"&retDate2="+this.retDate2}if(typeof(this.retDate3)!="undefined"){url=url+"&retDate3="+this.retDate3}if(typeof(this.adultQty)!="undefined"){url=url+"&adultQty="+this.adultQty}if(typeof(this.childQty)!="undefined"){url=url+"&childQty="+this.childQty}if(typeof(this.infantQty)!="undefined"){url=url+"&infantQty="+this.infantQty}if(typeof(this.tripType)!="undefined"){url=url+"&tripType="+((this.tripType=="OW")?"1":"2")}if(typeof(this.themeName)!="undefined"){url=url+"&themeName="+this.themeName}if(typeof(this.layoutName)!="undefined"){url=url+"&layoutName="+this.layoutName}if(typeof(this.sessionAirId)!="undefined"){url=url+"&sessionAirId="+this.sessionAirId}url=url+"&widgetType=airfare_searching"}}return url};function getAirportCode(strLocation){var iOpen=-1;var iClose=-1;var res;iOpen=strLocation.indexOf("(");iClose=strLocation.indexOf(")");if(iOpen==-1){res=strLocation}else{res=strLocation.substring(iOpen+1,iClose)}return res}afslib_SearchObject.prototype.buildEZGDSRequestUrl=function(){var url="";if(typeof(this.wlAccount)!="undefined"){url="wl_account_no="+this.wlAccount;if(typeof(this.micCode)!="undefined"){url=url+"&micCode="+this.micCode}if(typeof(globalMilAccountNo)!="undefined"){url=url+"&mil="+globalMilAccountNo}if(typeof(this.process_ID)!="undefined"){url=url+"&process_id=900";if(typeof(this.product_ID)!="undefined"){url=url+"&product_id="+this.product_ID}if(typeof(this.productName)!="undefined"){url=url+"&productName="+this.productName}if(typeof(this.fromLoc1)!="undefined"){url=url+"&fromLoc1="+this.fromLoc1}if(typeof(this.fromLoc2)!="undefined"){url=url+"&fromLoc2=,"+this.fromLoc2}if(typeof(this.fromLoc3)!="undefined"){url=url+"&fromLoc3="+this.fromLoc3}if(typeof(this.toLoc1)!="undefined"){url=url+"&toLoc1="+this.toLoc1}if(typeof(this.toLoc2)!="undefined"){url=url+"&toLoc2="+this.toLoc2}if(typeof(this.toLoc3)!="undefined"){url=url+"&toLoc3="+this.toLoc3}if(typeof(this.depDate1)!="undefined"){url=url+"&depDate1="+this.depDate1}if(typeof(this.depDate2)!="undefined"){url=url+"&depDate2="+this.depDate2}if(typeof(this.depDate3)!="undefined"){url=url+"&depDate3="+this.depDate3}if(typeof(this.retDate1)!="undefined"){url=url+"&retDate1="+this.retDate1}if(typeof(this.retDate2)!="undefined"){url=url+"&retDate2="+this.retDate2}if(typeof(this.retDate3)!="undefined"){url=url+"&retDate3="+this.retDate3}if(typeof(this.adultQty)!="undefined"){url=url+"&adultQty="+this.adultQty}if(typeof(this.childQty)!="undefined"){url=url+"&childQty="+this.childQty}if(typeof(this.infantQty)!="undefined"){url=url+"&infantQty="+this.infantQty}if(typeof(this.tripType)!="undefined"){url=url+"&tripType="+this.tripType}if(typeof(this.TilesThemeName)!="undefined"){url=url+"&themeName="+this.TilesThemeName}if(this.CustomTilesResultBox!=undefined){url=url+"&cuscss_bask="+this.CustomTilesResultBox}if(this.customAirfareResultBoxCSS!=undefined){url=url+"&cuscss_airf="+this.customAirfareResultBoxCSS}url=url+"&isShowOnlyFare="+afe.isShowOnlyFare;url=url+"&moi="+afe.MilOptIn}}return url};afslib_SearchObject.prototype.handleResponse=function(response){this.response=response};afslib_SearchObject.prototype.requestPrepare=function(Async){var reqUrl="";reqUrl=this.buildRequestUrl()+"&step=preparing";var srvctrl=new affServeLib_ServiceController();if(Async){srvctrl.callServiceAsync(reqUrl,this)}else{srvctrl.callService(reqUrl,this)}};afslib_SearchObject.prototype.requestTileResult=function(Async,url){var reqUrl=url;reqUrl+="&process_id=10";reqUrl+="&product_id=10";reqUrl+="&product_name=air";var srvctrl=new affServeLib_ServiceController();if(Async){srvctrl.callServiceAsync(reqUrl,this)}else{srvctrl.callService(reqUrl,this)}alert(this.response)};afslib_SearchObject.prototype.requestResult=function(Async){var reqUrl=this.buildRequestUrl()+"&step=showResult&isShowOnlyFare="+this.isShowOnlyFare;var srvctrl=new affServeLib_ServiceController();if(Async){srvctrl.callServiceAsync(reqUrl,this)}else{srvctrl.callService(reqUrl,this)}};afslib_SearchObject.prototype.requestEzgdsResult=function(Async){var reqUrl=this.buildRequestUrl()+"&step=showResult&isShowOnlyFare="+this.isShowOnlyFare+"&isForceShowTiles="+this.isForceShowTiles+"&isShowFilter="+this.isShowFilter;var srvctrl=new affServeLib_ServiceController();if(Async){srvctrl.callServiceAsync(reqUrl,{onRequestCompleted:function(responseTxt){var objJson=eval("("+responseTxt+")");nCSS=0;arrCSS=[];if(typeof(objJson.css)!="undefined"){var strHtml=afe.cleanHtml(objJson.basketResult[0].htmlstring);var iQuote=strHtml.search('name="AirQuoteID"');if(iQuote>-1){if(globalCustomAirfareResultBoxCSS!="undefined"&&globalCustomAirfareResultBoxCSS!=""){objJson.css.push({cssFile:globalCustomAirfareResultBoxCSS})}}else{if(globalCustomTilesResultBoxCSS!="undefined"&&globalCustomTilesResultBoxCSS!=""){objJson.css.push({cssFile:globalCustomTilesResultBoxCSS})}}nCSS=objJson.css.length;for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;afe.loadSearchResultElement(strCss,objJson)}}}})}else{srvctrl.callService(reqUrl,this);afe.invokeSearchCompleted()}};afslib_Flight.prototype.loadSearchResultElement=function(url,objJson){$.ajax({url:url,dataType:"css",success:function(data){arrCSS[afe.getCssIndex(objJson,url)]=('<link rel="stylesheet" type="text/css" href="'+url+'" />');nCSS--;if(nCSS==0){for(var j=0;j<arrCSS.length;j++){$("head").append(arrCSS[j])}var strHtml=afe.cleanHtml(objJson.basketResult[0].htmlstring);$("#"+afe.divHolderName).html(strHtml);afe.loadDynamicScript(objJson.js);globalSearchResponse=strHtml;globalFilterOutAQID=new Array();globalSearchResponsePage=objJson;afe.invokeSearchCompleted()}}})};afslib_SearchObject.prototype.requestServiceResult=function(Async,RequestURL){var srvctrl=new affServeLib_ServiceController();if(Async){srvctrl.callServiceAsync(RequestURL,this)}else{srvctrl.callService(RequestURL,this)}}}function afslib_Flight(){this.searchType="air";this.defaultFromLocation="";this.defaultToLocation="";this.defaultTripType;this.defaultDepartDate;this.defaultReturnDate;this.defaultQtyAdults;this.defaultQtyChildren;this.defaultQtyInfant;this.isShowComparePrices=true;this.TilesPopunderPage="";this.TilesPopupParent="";this.isShowCompareOption=true;this.resultUrl;this.themeName="";this.layoutName="";this.micCode;this.wlAccount;this.mil_account_no;this.fromLocation1;this.fromLocation2;this.fromLocation3;this.toLocation1;this.toLocation2;this.tolocation3;this.defaultSeatClass;this.departureDate1;this.departureDate2;this.departureDate3;this.returnDate1;this.returnDate2;this.returnDate3;this.qtyAdults;this.qtyChildren;this.qtyInfant;this.sessionAirId="";this.divHolderName="AFE_HOLDER";this.tripType;this.customSearchBoxCSS="";this.CustomTilesResultBox="";this.customAirfareResultBoxCSS="";this.CustomBookingFormCSS="";this.CustomNoResultCSS="";this.CustomBookingResultCss="";this.CustomSearchingPageCSS="";this.MilOptIn=true;this.response="";this.processID="";this.isForceShowTiles=false;this.isShowFilter=true;this.resultStyle="3";this.isTestMode=false;this.isShowOnlyFare=false;this.TripType="";this.FromLocationDisplay="";this.ToLocationDisplay="";this.DepartureDateValue="";this.ReturnDateValue="";this.DepartureDate="";this.ReturnDate="";this.NoAdult=0;this.NoChild=0;this.NoInfant=0;this.defaultSiteID="";this.defaltAffiliateID="";this.defaultCampaignID="";this.paramNamePairArray={wl_account_no:"defaultSiteID",micCode:"defaultCampaign",mil:"defaltAffiliateID",fromLoc1:"defaultFromLocation",toLoc1:"defaultToLocation",depDate1:"defaultDepartDate",retDate1:"defaultReturnDate",adultQty:"defaultQtyAdults",childQty:"defaultQtyChildren",infantQty:"defaultQtyInfant",tripType:"defaultTripType"};this.requiredParamArray=["fromLoc1","toLoc1","depDate1","retDate1","adultQty","childQty","infantQty","tripType"];afslib_Flight.prototype.showOnlyFare=function(isShow){this.isShowOnlyFare=isShow};this.searchPageUrl="#";this.ProxyFileName="afslib_proxy.php";this.testHosting="http://localhost:56789";this.isHideComparePriceBanner=false;this.isStopSearchFormForTesting=false;this.isStopPreparingFormForTesting=false;afslib_Flight.prototype.StopSearchFormForTesting=function(isStop){this.isStopSearchFormForTesting=isStop};afslib_Flight.prototype.StopPreparingFormForTesting=function(isStop){this.isStopPreparingFormForTesting=isStop};afslib_Flight.prototype.HideComparePriceBanner=function(isHide){this.isHideComparePriceBanner=isHide};afslib_Flight.prototype.invokeSeachFormLoaded=function(){if(typeof(stepSearchFormLoaded)!="undefined"){stepSearchFormLoaded()}};afslib_Flight.prototype.invokeSearchFormSubmitted=function(){if(typeof(stepSearchFormSubmitted)!="undefined"){stepSearchFormSubmitted()}};afslib_Flight.prototype.invokeSearchInProgress=function(){if(typeof(stepSearchInProgress)!="undefined"){stepSearchInProgress()}};afslib_Flight.prototype.invokeSearchCompleted=function(){if(typeof(stepSearchCompleted)!="undefined"){stepSearchCompleted()}};afslib_Flight.prototype.invokeSearchingTile=function(){if(typeof(stepSearchingTile)!="undefined"){stepSearchingTile()}};afslib_Flight.prototype.invokeTileSearchCompleted=function(){if(typeof(stepTileSearchCompleted)!="undefined"){stepTileSearchCompleted()}};afslib_Flight.prototype.invokeTilesDisplayed=function(){if(typeof(stepTilesDisplayed)!="undefined"){stepTilesDisplayed()}};afslib_Flight.prototype.invokeDisplayAirfareResult=function(){if(typeof(stepDisplayAirfareResult)!="undefined"){stepDisplayAirfareResult()}};afslib_Flight.prototype.invokeNoAirfareResultDisplayed=function(){if(typeof(stepNoAirfareResultDisplayed)!="undefined"){stepNoAirfareResultDisplayed()}};afslib_Flight.prototype.invokeNoTilesResultDisplayed=function(){if(typeof(stepNoTilesResultDisplayed)!="undefined"){stepNoTilesResultDisplayed()}};afslib_Flight.prototype.invokeFlightValidationFailed=function(){if(typeof(stepFlightValidationFailed)!="undefined"){stepFlightValidationFailed()}};afslib_Flight.prototype.invokeBookingFormShown=function(){if(typeof(stepBookingFormShown)!="undefined"){stepBookingFormShown()}};afslib_Flight.prototype.invokeBookingSubmitted=function(){if(typeof(stepBookingSubmitted)!="undefined"){stepBookingSubmitted()}};afslib_Flight.prototype.invokeCallingBookingInfoValidation=function(){if(typeof(stepCallingBookingInfoValidation)!="undefined"){stepCallingBookingInfoValidation()}};afslib_Flight.prototype.invokeBookingInfoValidationFailed=function(){if(typeof(stepBookingInfoValidationFailed)!="undefined"){stepBookingInfoValidationFailed()}};afslib_Flight.prototype.invokeBookingInfoValidationPassed=function(){if(typeof(stepBookingInfoValidationPassed)!="undefined"){stepBookingInfoValidationPassed()}};afslib_Flight.prototype.invokeBooking=function(){if(typeof(stepBooking)!="undefined"){stepBooking()}};afslib_Flight.prototype.invokeBookingSuccess=function(){if(typeof(stepBookingSuccess)!="undefined"){stepBookingSuccess()}};afslib_Flight.prototype.invokeBookingFailed=function(){if(typeof(stepBookingFailed)!="undefined"){stepBookingFailed()}};afslib_Flight.prototype.ShowComparePrices=function(isShow){this.isShowComparePrices=isShow};afslib_Flight.prototype.setTilesPopunderPage=function(strPage){this.TilesPopunderPage=strPage};afslib_Flight.prototype.setTilesPopupParent=function(strPage){this.TilesPopupParent=strPage};afslib_Flight.prototype.ShowCompareOption=function(isShow){this.isShowCompareOption=isShow};afslib_Flight.prototype.checkDate=function(dateStr){var re=/\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/;return re.test(dateStr)};afslib_Flight.prototype.RequestTileResult=function(){var objSearch=new afslib_SearchObject();var url="";this.wlAccount=this.getQuerystring("wl_account_no","undefined");if(this.wlAccount!="undefined"){this.globalWlAccountNo=this.wlAccount}this.micCode=this.getQuerystring("micCode","undefined");if(this.micCode!="undefined"){this.globalMicCode=this.micCode}if(this.mil_account_no!="undefined"){this.globalMilAccountNo=this.mil_account_no}this.depDate1=this.getQuerystring("depDate1",undefined);this.product_ID="10";this.productName="air";this.fromLoc=this.getQuerystring("fromLoc1",undefined);this.toLoc1=this.getQuerystring("toLoc1",undefined);this.retDate1=this.getQuerystring("retDate1",undefined);this.adultQty=this.getQuerystring("adultQty",undefined);this.childQty=this.getQuerystring("childQty",undefined);this.infantQty=this.getQuerystring("infantQty",undefined);this.tripType=this.getQuerystring("tripType",undefined);url=url+"&process_id=20";if(this.globalWlAccountNo!="undefined"){url="wl_account_no="+this.globalWlAccountNo}if(this.globalMicCode!="undefined"){url=url+"&micCode="+this.globalMicCode}if(this.globalMilAccountNo!="undefined"){url=url+"&mil="+this.globalMilAccountNo}if(typeof(this.product_ID)!="undefined"){url=url+"&product_id="+this.product_ID}if(typeof(this.productName)!="undefined"){url=url+"&productName="+this.productName}if(typeof(this.fromLoc1)!="undefined"){url=url+"&fromLoc1="+this.fromLoc1}if(typeof(this.fromLoc2)!="undefined"){url=url+"&fromLoc2="+this.fromLoc2}if(typeof(this.fromLoc3)!="undefined"){url=url+"&fromLoc3="+this.fromLoc3}if(typeof(this.toLoc1)!="undefined"){url=url+"&toLoc1="+this.toLoc1}if(typeof(this.toLoc2)!="undefined"){url=url+"&toLoc2="+this.toLoc2}if(typeof(this.toLoc3)!="undefined"){url=url+"&toLoc3="+this.toLoc3}if(typeof(this.depDate1)!="undefined"){url=url+"&depDate1="+this.depDate1}if(typeof(this.depDate2)!="undefined"){url=url+"&depDate2="+this.depDate2}if(typeof(this.depDate3)!="undefined"){url=url+"&depDate3="+this.depDate3}if(typeof(this.retDate1)!="undefined"){url=url+"&retDate1="+this.retDate1}if(typeof(this.retDate2)!="undefined"){url=url+"&retDate2="+this.retDate2}if(typeof(this.retDate3)!="undefined"){url=url+"&retDate3="+this.retDate3}if(typeof(this.adultQty)!="undefined"){url=url+"&adultQty="+this.adultQty}if(typeof(this.childQty)!="undefined"){url=url+"&childQty="+this.childQty}if(typeof(this.infantQty)!="undefined"){url=url+"&infantQty="+this.infantQty}if(typeof(this.tripType)!="undefined"){url=url+"&tripType="+this.tripType}afe.invokeSearchingTile();objSearch.requestTileResult(false,url);afe.invokeTileSearchCompleted()};afslib_Flight.prototype.requestGEOLocation=function(strLoccation){var url="";url="wl_account_no="+afe.wlAccount;url=url+"&mil="+afe.mil_account_no;url=url+"&micCode="+afe.micCode;url=url+"&process_id=270";var strLoc=strLoccation;if((strLoc.length>0)&&(strLoc.length<4)){url=url+"&loc="+strLoccation;var objSearch=new afslib_SearchObject();objSearch.requestServiceResult(false,url)}return objSearch.response};afslib_Flight.prototype.onRequestCompleted=function(){};afslib_Flight.prototype.setIsTestMode=function(isTest){this.isTestMode=isTest};afslib_Flight.prototype.setIsShowFilter=function(isShowFilter){this.isShowFilter=isShowFilter};afslib_Flight.prototype.setTestHosting=function(TestHosting){this.testHosting=TestHosting};afslib_Flight.prototype.setProcessID=function(id){this.processID=id};afslib_Flight.prototype.setResultStyle=function(Style){this.resultStyle=Style};afslib_Flight.prototype.setSearchPageUrl=function(sUrl){this.searchPageUrl=sUrl};afslib_Flight.prototype.setEnableComparePrice=function(isShow){this.isShowTile=isShow};afslib_Flight.prototype.setCustomSearchBoxCSS=function(CssFilename){this.customSearchBoxCSS=CssFilename;globalCustomSearchBoxCSS=CssFilename};afslib_Flight.prototype.setCustomTilesResultBoxCSS=function(CssFilename){this.CustomTilesResultBoxCSS=CssFilename;globalCustomTilesResultBoxCSS=CssFilename};afslib_Flight.prototype.setCustomAirfareResultBoxCSS=function(CssFilename){this.CustomAirfareResultBoxCSS=CssFilename;globalCustomAirfareResultBoxCSS=CssFilename};afslib_Flight.prototype.setCustomBookingFormCSS=function(CssFilename){this.CustomBookingFormCSS=CssFilename;globalCustomBookingFormCSS=CssFilename};afslib_Flight.prototype.setCustomNoResultCSS=function(CssFilename){this.CustomNoResultCSS=CssFilename;globalCustomNoResultCSS=CssFilename};afslib_Flight.prototype.setCustomSearchingPageCSS=function(CssFilename){this.CustomSearchingPageCSS=CssFilename;globalCustomSearchingPageCSS=CssFilename};afslib_Flight.prototype.setCustomBookingResultCSS=function(CssFilename){this.CustomBookingResultCss=CssFilename;globalCustomBookingResultCSS=CssFilename};afslib_Flight.prototype.setMilOptIn=function(moi){this.MilOptIn=moi;globalMilOptIn=moi};afslib_Flight.prototype.setDefaultSiteID=function(siteID){this.defaultSiteID=siteID};afslib_Flight.prototype.setValSiteID=function(siteID){this.wlAccount=siteID;globalWlAccountNo=siteID};afslib_Flight.prototype.setSiteID=function(sWlAccount){this.setDefaultSiteID(sWlAccount);this.setValSiteID(sWlAccount)};afslib_Flight.prototype.setDefaultAffiliateID=function(affiliateID){this.defaltAffiliateID=affiliateID};afslib_Flight.prototype.setValAffiliateID=function(affiliateID){this.mil_account_no=affiliateID;globalMilAccountNo=affiliateID};afslib_Flight.prototype.setAffiliateID=function(sMil){this.setDefaultAffiliateID(sMil);this.setValAffiliateID(sMil)};afslib_Flight.prototype.setDefaultCampaignID=function(campaignID){this.defaultCampaign=campaignID};afslib_Flight.prototype.setValCampaignID=function(campaignID){if(typeof(campaignID)=="undefined"){campaignID=""}this.micCode=campaignID;globalMicCode=campaignID};afslib_Flight.prototype.setCampaignID=function(sMicCode){this.setDefaultCampaignID(sMicCode);this.setValCampaignID(sMicCode)};afslib_Flight.prototype.setTripType=function(sTripType){this.tripType=sTripType};afslib_Flight.prototype.setDefaultFromLocation=function(sDefaultFromLocation){this.defaultFromLocation=sDefaultFromLocation};afslib_Flight.prototype.setDefaultToLocation=function(sDefaultToLocation){this.defaultToLocation=sDefaultToLocation};afslib_Flight.prototype.setDefaultTripType=function(sDefaultTripType){sDefaultTripType=sDefaultTripType.toUpperCase();sDefaultTripType=((sDefaultTripType=="RT")||(sDefaultTripType=="OW"))?sDefaultTripType:"RT";this.defaultTripType=sDefaultTripType};afslib_Flight.prototype.setDefaultDepartureDate=function(sDefaultDeptDate){if(this.checkDate(sDefaultDeptDate)){this.defaultDepartDate=sDefaultDeptDate}};afslib_Flight.prototype.setDefaultReturnDate=function(sDefaultRetDate){if(this.checkDate(sDefaultRetDate)){this.defaultReturnDate=sDefaultRetDate}};afslib_Flight.prototype.setDefaultAdults=function(sDefaultQtyAdults){if(!isNaN(sDefaultQtyAdults)){this.defaultQtyAdults=sDefaultQtyAdults}};afslib_Flight.prototype.setDefaultChildren=function(sDefaultQtyChildren){if(!isNaN(sDefaultQtyChildren)){this.defaultQtyChildren=sDefaultQtyChildren}};afslib_Flight.prototype.setDefaultInfants=function(sDefaultQtyInfant){if(!isNaN(sDefaultQtyInfant)){this.defaultQtyInfant=sDefaultQtyInfant}};afslib_Flight.prototype.setFromLocation1=function(sFromLocation1){this.fromLocation1=fromLocation1};afslib_Flight.prototype.setFromLocation2=function(sFromLocation2){this.fromLocation2=fromLocation2};afslib_Flight.prototype.setFromLocation3=function(sFromLocation3){this.fromLocation3=sFromLocation3};afslib_Flight.prototype.setToLocation1=function(sToLocation1){this.toLocation1=sToLocation1};afslib_Flight.prototype.setToLocation2=function(sToLocation2){this.toLocation2=sToLocation2};afslib_Flight.prototype.setToLocation3=function(sToLocation3){this.toLocation3=sToLocation3};afslib_Flight.prototype.setReturnDate1=function(sReturnDate1){this.returnDate1=sReturnDate1};afslib_Flight.prototype.setReturnDate2=function(sReturnDate2){this.returnDate2=sReturnDate2};afslib_Flight.prototype.setReturnDate3=function(sReturnDate3){this.returnDate3=sReturnDate3};afslib_Flight.prototype.setQtyAdults=function(sQtyAdults){this.qtyAdults=sQtyAdults};afslib_Flight.prototype.setQtyChildren=function(sQtyChildren){this.qtyChildren=sQtyChildren};afslib_Flight.prototype.setResultUrl=function(sResultUrl){this.resultUrl=sResultUrl;globalResultUrl=sResultUrl};afslib_Flight.prototype.setThemeName=function(sThemeName){this.themeName=sThemeName};afslib_Flight.prototype.setLayoutName=function(sLayoutName){this.layoutName=sLayoutName};afslib_Flight.prototype.setSearchType=function(sSearchType){this.searchType=sSearchType};afslib_Flight.prototype.setDivHolder=function(sDivHolder){this.divHolderName=sDivHolder;globalHtmlHolder=sDivHolder};afslib_Flight.prototype.showOnlyFare=function(isShow){this.isShowOnlyFare=isShow};afslib_Flight.prototype.getQuerystring=function(key,default_){var returnValue="";if(default_==null){default_=""}key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+key+"=([^&#]*)");var qs=regex.exec(window.location.href);if(qs==null){returnValue=default_}else{returnValue=qs[1]}var defaultParam=this.paramNamePairArray[key];var defaultValue="";if(defaultParam!=undefined&&defaultParam!=null){defaultValue=eval("this."+defaultParam);if(defaultValue!=undefined&&typeof(defaultValue)!="string"){defaultValue=defaultValue.toString()}}returnValue=((defaultValue==null)||(defaultValue==undefined)||(defaultValue==""))?returnValue:defaultValue;if(key=="tripType"&&(returnValue.toString().toUpperCase()=="OW"||returnValue.toString().toUpperCase()=="RT")){returnValue=(returnValue=="OW")?"1":"2"}return unescape(returnValue)};afslib_Flight.prototype.getAndMergeSearchParameter=function(){this.wlAccount=this.getQuerystring("wl_account_no","undefined");if(this.wlAccount!="undefined"){this.globalWlAccountNo=this.wlAccount}this.micCode=this.getQuerystring("micCode","undefined");if(this.micCode!="undefined"){this.globalMicCode=this.micCode}this.mil_account_no=this.getQuerystring("mil","undefined");if(this.mil_account_no!="undefined"){this.globalMilAccountNo=this.mil_account_no}this.fromLoc1=this.getQuerystring("fromLoc1","undefined");this.toLoc1=this.getQuerystring("toLoc1","undefined");this.departureDate1=this.getQuerystring("depDate1","undefined");this.returnDate1=this.getQuerystring("retDate1","undefined");this.qtyAdults=this.getQuerystring("adultQty","undefined");this.qtyChildren=this.getQuerystring("childQty","undefined");this.qtyInfant=this.getQuerystring("infantQty","undefined");this.tripType=this.getQuerystring("tripType","undefined");if(this.tripType!="undefined"&&(this.tripType=="1"||this.tripType=="2")){this.tripType=(this.tripType=="1")?"OW":"RT"}if(this.wlAccount!="undefined"){this.setDefaultSiteID(this.wlAccount);this.setValSiteID(this.wlAccount)}if(this.micCode!="undefined"){this.setDefaultCampaignID(this.micCode);this.setValCampaignID(this.micCode)}if(this.mil_account_no!="undefined"){this.setDefaultAffiliateID(this.mil_account_no);this.setValAffiliateID(this.mil_account_no)}if(this.fromLoc1!="undefined"){this.setDefaultFromLocation(this.fromLoc1)}if(this.toLoc1!="undefined"){this.setDefaultToLocation(this.toLoc1)}if(this.departureDate1!="undefined"){this.setDefaultDepartureDate(this.departureDate1)}if(this.returnDate1!="undefined"){this.setDefaultReturnDate(this.returnDate1)}if(this.qtyAdults!="undefined"){this.setDefaultAdults(this.qtyAdults)}if(this.qtyChildren!="undefined"){this.setDefaultChildren(this.qtyChildren)}if(this.qtyInfant!="undefined"){this.setDefaultInfants(this.qtyInfant)}if(this.tripType!="undefined"){this.setDefaultTripType(this.tripType)}};afslib_Flight.prototype.getSearchParameter=function(key,default_){var urlValue=this.getQuerystring(key,default_);key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var defaultParam=this.paramNamePairArray[key];var defaultValue="";if(defaultParam!=undefined&&defaultParam!=null){defaultValue=eval("this."+defaultParam)}var retValue=((defaultValue==null)||(defaultValue==undefined)||(defaultValue==""))?urlValue:defaultValue;if(key=="tripType"){retValue=(retValue=="OW")?1:2}return retValue};afslib_Flight.prototype.RenderTilesResults=function(){afe.getAndMergeSearchParameter();var q_wlAccount=this.getQuerystring("wl_account_no","undefined");if((typeof(q_wlAccount)=="undefined")||(q_wlAccount=="undefined")||(q_wlAccount=="")){q_wlAccount=this.wlAccount}var q_mil=this.getQuerystring("mil","undefined");if((typeof(q_mil)=="undefined")||(q_mil=="undefined")||(q_mil=="")){q_mil=this.mil_account_no}var q_mic=this.getQuerystring("micCode","undefined");if((typeof(q_mic)=="undefined")||(q_mic=="undefined")||(q_mic=="")){q_mic=this.getQuerystring("mic_code","undefined");if((typeof(q_mic)=="undefined")||(q_mic=="undefined")||(q_mic=="")){q_mic=this.micCode}}var q_TripType=this.getQuerystring("tripType","undefined");if((typeof(q_TripType)=="undefined")||(q_TripType=="undefined")||(q_TripType=="")){q_TripType=this.defaultTripType}var q_From=this.getQuerystring("fromLoc1","undefined");if((typeof(q_From)=="undefined")||(q_From=="undefined")||(q_From=="")){q_From=this.defaultFromLocation}var q_To=this.getQuerystring("toLoc1","undefined");if((typeof(q_To)=="undefined")||(q_To=="undefined")||(q_To=="")){q_To=this.defaultToLocation}var q_DepDate=this.getQuerystring("depDate1","undefined");if((typeof(q_DepDate)=="undefined")||(q_DepDate=="undefined")||(q_DepDate=="")){q_DepDate=this.defaultDepartDate}var q_RetDate=this.getQuerystring("retDate1","undefined");if((typeof(q_RetDate)=="undefined")||(q_RetDate=="undefined")||(q_RetDate=="")){q_RetDate=this.defaultReturnDate}var q_Adult=this.getQuerystring("adultQty","undefined");if((typeof(q_Adult)=="undefined")||(q_Adult=="undefined")||(q_Adult=="")){q_Adult=this.defaultQtyAdults}var q_Child=this.getQuerystring("childQty","undefined");if((typeof(q_Child)=="undefined")||(q_Child=="undefined")||(q_Child=="")){q_Child=this.defaultQtyChildren}var q_Infants=this.getQuerystring("infantQty","undefined");if((typeof(q_Infants)=="undefined")||(q_Infants=="undefined")||(q_Infants=="")){q_Infants=this.defaultQtyInfant}var qry=afe.BuildRequestAirTileURL(q_wlAccount,q_mil,q_mic,q_TripType,q_From,q_To,q_DepDate,q_RetDate,q_Adult,q_Child,q_Infants);var objSearch=new afslib_SearchObject();objSearch.requestServiceResult(false,qry);this.displayTileResult(objSearch)};afslib_Flight.prototype.BuildTileRequestURL=function(q_wlAccount,q_mil,q_mic,q_TripType,q_From,q_To,q_DepDate,q_RetDate,q_Adult,q_Child,q_Infants){if((typeof(q_wlAccount)=="undefined")||(q_wlAccount=="")){q_wlAccount=this.getQuerystring("wl_account_no",this.wlAccount)}if((typeof(q_mil)=="undefined")||(q_mil=="")){q_mil=this.getQuerystring("mil",this.mil_account_no)}if((typeof(q_mic)=="undefined")||(q_mic=="")){q_mic=this.getQuerystring("micCode",this.getQuerystring("mic_code",undefined));if((typeof(q_mic)=="undefined")||(q_mic=="")){q_mic=this.micCode}}if((typeof(q_TripType)=="undefined")||(q_TripType=="")){q_TripType=this.getQuerystring("tripType",this.defaultTripType)}if((typeof(q_From)=="undefined")||(q_From=="")){q_From=this.getQuerystring("fromLoc1",this.defaultFromLocation)}if((typeof(q_To)=="undefined")||(q_To=="")){q_To=this.getQuerystring("toLoc1",this.defaultToLocation)}if((typeof(q_DepDate)=="undefined")||(q_DepDate=="")){q_DepDate=this.getQuerystring("depDate1",this.defaultDepartDate)}if((typeof(q_RetDate)=="undefined")||(q_RetDate=="")){q_RetDate=this.getQuerystring("retDate1",this.defaultReturnDate)}if((typeof(q_Adult)=="undefined")||(q_Adult=="")){q_Adult=this.getQuerystring("adultQty",this.defaultQtyAdults)}if((typeof(q_Child)=="undefined")||(q_Child=="")){q_Child=this.getQuerystring("childQty",this.defaultQtyChildren)}if((typeof(q_Infants)=="undefined")||(q_Infants=="")){q_Infants=this.getQuerystring("infantQty",this.defaultQtyInfant)}var qry=afe.BuildRequestAirTileURL(q_wlAccount,q_mil,q_mic,q_TripType,q_From,q_To,q_DepDate,q_RetDate,q_Adult,q_Child,q_Infants);return qry};afslib_Flight.prototype.BuildRequestAirTileURL=function(wlAccountNo,mil,mic,TripType,FromLoc,ToLoc,DepDate,RetDate,qAdult,qChild,qInfant){var qryStr="";qryStr+="&process_id=10";qryStr+="&product_id=10";qryStr+="&product_name=air";qryStr+="&wl_account_no="+wlAccountNo;qryStr+="&mil="+mil;qryStr+="&micCode="+mic;qryStr+="&tripType="+TripType;qryStr+="&fromLoc1="+FromLoc;qryStr+="&toLoc1="+ToLoc;qryStr+="&depDate1="+DepDate;qryStr+="&retDate1="+RetDate;qryStr+="&adultQty="+qAdult;qryStr+="&childQty="+qChild;qryStr+="&infantQty="+qInfant;return qryStr};function init(){}afslib_Flight.prototype.processRequest=function(sessionAirId){afe.getAndMergeSearchParameter();afe.handshake();this.supID=this.getQuerystring("SupID","undefined");this.clickID=this.getQuerystring("ClickID","undefined");this.searchType=this.getQuerystring("Type","undefined");this.processID=this.getQuerystring("process_id","undefined");this.isForceShowTiles=this.getQuerystring("isForceShowTiles","undefined");if(sessionAirId!=undefined){this.sessionAirId=sessionAirId}var requiredParam=[this.fromLoc1,this.toLoc1,this.departureDate1,this.returnDate1,this.qtyAdults,this.qtyChildren,this.qtyInfant,this.tripType];var isReadyForSearch=true;var param=null;for(var i=0;i<requiredParam.length;i++){param=requiredParam[i];if(param==undefined||param==null||param==""){isReadyForSearch=false;break}}if(!isReadyForSearch){this.GoBackToSearchPage()}var moi=this.getQuerystring("moi","undefined");if((this.supID!="undefined")&&(this.clickID!="undefined")){$("head").find("link").remove();$("body").empty();$("body").html("<h1>Please wait while we connect you to the selected suppliers...</h1>");var objFlight=new afslib_Flight();var _supID=objFlight.getQuerystring("SupID","undefined");var _clickID=objFlight.getQuerystring("ClickID","undefined");var _searchType=objFlight.getQuerystring("Type","undefined");this.globalWlAccountNo=objFlight.getQuerystring("wl_account_no","undefined");this.globalMicCode=objFlight.getQuerystring("micCode","undefined");this.globalMilAccountNo=objFlight.getQuerystring("mil","undefined");var deepLinkReqUrl="";var searchCriteria=objFlight.buildTileClickUrl(this.globalWlAccountNo,this.globalMicCode,20,"air",_supID,_clickID);var objSearch=new afslib_SearchObject();objSearch.requestServiceResult(false,searchCriteria);if((objSearch.response!="")&&(objSearch.response!="undefined")){window.location=objSearch.response}return}if((this.fromLoc1!=undefined)&&(this.toLoc1!=undefined)){if(this.isForceShowTiles=="true"){this.RenderTilesResults();this.displayTileResult(objSearch)}else{this.displaySearchResult()}}if(moi!="undefined"){var moiBool=(moi==="true");this.setMilOptIn(moiBool)}};afslib_Flight.prototype.buildSearchRequest=function(){var url="";url=url+"micCode="+this.micCode;url=url+"&mil="+this.mil_account_no;url=url+"&accountCode="+this.wlAccount;url=url+"&searchType="+this.searchType;if(typeof(this.themeName)!="undefined"){url=url+"&themeName="+this.themeName}if(this.searchType=="air"){if(typeof(this.tripType)!="undefined"){url=url+"&tripType="+this.tripType}if(typeof(this.mil_account_no)!="undefined"){url=url+"&mil="+this.mil_account_no}if((typeof(this.defaultFromLocation)!="undefined")&&(this.defaultFromLocation!="")){url=url+"&fromLoc1="+this.defaultFromLocation}else{}if((typeof(this.defaultToLocation)!="undefined")&&(this.defaultToLocation!="")){url=url+"&toLoc1="+this.defaultToLocation}else{}if(typeof(this.departureDate1)!="undefined"){url=url+"&depDate1="+this.departureDate1}if(typeof(this.returnDate1)!="undefined"){url=url+"&retDate1="+this.returnDate1}if(typeof(this.qtyAdults)!="undefined"){url=url+"&qtyAdults="+this.qtyAdults}if(typeof(this.qtyChildren)!="undefined"){url=url+"&qtyChildren="+this.qtyChildren}if(typeof(this.qtyInfant)!="undefined"){url=url+"&qtyInfant="+this.qtyInfant}}return url};afslib_Flight.prototype.buildSearchBoxRequest=function(){var url="";url=url+"micCode="+this.micCode;url=url+"&accountCode="+this.wlAccount;url=url+"&mil="+this.mil_account_no;if(this.isTestMode){url=url+"&mode=test"}if(this.searchType!="undefined"){url=url+"&searchType="+this.searchType}else{url=url+"&searchType=air"}if(typeof(this.themeName)!="undefined"){url=url+"&themeName="+this.themeName}url=url+"&widgetType=air";if(typeof(this.layoutName)!="undefined"){url=url+"&layoutName="+this.layoutName}if(typeof(this.mil_account_no)!="undefined"){url=url+"&mil="+this.mil_account_no}if(this.searchType=="air"){if(typeof(this.tripType)!="undefined"){url=url+"&tripType="+this.tripType}if(typeof(this.defaultFromLocation)!="undefined"){url=url+"&fromLoc1="+this.defaultFromLocation}if(typeof(this.defaultToLocation)!="undefined"){url=url+"&toLoc1="+this.defaultToLocation}if(typeof(this.departureDate1)!="undefined"){url=url+"&depDate1="+this.departureDate1}if(typeof(this.returnDate1)!="undefined"){url=url+"&retDate1="+this.returnDate1}if(typeof(this.qtyAdults)!="undefined"){url=url+"&qtyAdults="+this.qtyAdults}if(typeof(this.isShowOnlyFare)!="undefined"){url=url+"&isShowOnlyFare="+this.isShowOnlyFare}}if(this.customSearchBoxCSS!=undefined){url=url+"&cuscss_sb="+this.customSearchBoxCSS}return url};afslib_Flight.prototype.buildTileSearchUrl=function(){var url="";if(this.globalWlAccountNo!="undefined"){url="wl_account_no="+this.globalWlAccountNo;if(this.globalMicCode!="undefined"){url=url+"&micCode="+this.globalMicCode}if(typeof(this.globalMilAccountNo)!="undefined"){url=url+"&mil="+this.globalMilAccountNo}if(this.process_ID!="undefined"){url=url+"&process_id="+this.process_ID;if(this.searchType!="undefined"){if(this.searchType=="air"){url=url+"&product_id=10"}}}if(this.supID!="undefined"){url=url+"&supID="+this.supID}if(this.clickID!="undefined"){url=url+"&clickID="+this.clickID}}return url};afslib_Flight.prototype.buildTileClickUrl=function(wl_account_no,mic_code,process_id,search_type,supID,clickID){var url="";if(wl_account_no!="undefined"){url="wl_account_no="+wl_account_no;if(mic_code!="undefined"){url=url+"&micCode="+mic_code;if(process_id!="undefined"){url=url+"&process_id="+process_id;if(this.searchType!="undefined"){if(this.searchType=="air"){url=url+"&product_id=10"}}}if(this.supID!="undefined"){url=url+"&supID="+supID}if(this.clickID!="undefined"){url=url+"&clickID="+clickID}}if(typeof(this.globalMilAccountNo)!="undefined"){url=url+"&mil="+this.globalMilAccountNo}}return url};afslib_Flight.prototype.buildFlightValidationFailURL=function(wl_account_no,mic){var url="";if(wl_account_no!=undefined){url="wl_account_no="+wl_account_no;if(mic!=undefined){url=url+"&micCode="+mic}if(typeof(this.globalMilAccountNo)!="undefined"){url=url+"&mil="+this.globalMilAccountNo}url=url+"&step=flightValidationFail"}return url};afslib_Flight.prototype.buildBookingFormURL=function(wl_account_no,mic,sid,vsid,aqid,depDate,mode){var url="";if(wl_account_no!=undefined){url="wl_account_no="+wl_account_no;if(mic!=undefined){url=url+"&micCode="+mic}if(typeof(this.globalMilAccountNo)!="undefined"){url=url+"&mil="+this.globalMilAccountNo}if(sid!=undefined){url=url+"&Sid="+sid}if(vsid!=undefined){url=url+"&VisitSessionID="+vsid}if(aqid!=undefined){url=url+"&AirQuoteID="+aqid}if(depDate!=undefined){url=url+"&DepartureDate="+depDate}if(mode!=undefined){url=url+"&mode="+mode}url=url+"&step=bookingForm"}return url};afslib_Flight.prototype.buildFligthValidationURL=function(vsid,aqid){var url="";url=url+"vsid="+vsid+"&aqid="+aqid+"&step=verifyflight";if(typeof(this.mil_account_no)!="undefined"){url=url+"&mil="+this.mil_account_no}return url};afslib_Flight.prototype.buildHandshakeURL=function(mic,mil,wl_account_no){var url="";url=url+"process_id=0&micCode="+mic+"&wl_account_no="+wl_account_no+"&mil="+mil+"&step=handshake";return url};afslib_Flight.prototype.buildBookingRequest=function(wl_account_no,mic_code,step,trv_fn,trv_ln,trn_mid,trv_cat,trv_dob,trv_npf,trv_ntt,trv_em,trv_ffn,trv_gd,pm_bfn,pm_bln,pm_ba1,pm_ba2,pm_bc,pm_bs,pm_bct,pm_bcp,pm_ccb,pm_ccn,pm_ccid,pm_expd,pm_expm,pm_expy,pm_bph,pm_bbph,pm_em,aqid,vsid,mode,ains){var qry="";qry=qry+"process_id=910";if(isvalid(wl_account_no)){qry=qry+"&wl_account_no="+wl_account_no}if(typeof(this.globalMilAccountNo)!="undefined"){qry=qry+"&mil="+this.globalMilAccountNo}if(isvalid(mic_code)){qry=qry+"&mic_code="+mic_code}if(isvalid(step)){qry=qry+"&step="+step}if(isvalid(trv_fn)){qry=qry+"&trv_fn="+trv_fn}if(isvalid(trv_ln)){qry=qry+"&trv_ln="+trv_ln}if(isvalid(trn_mid)){qry=qry+"&trn_mid="+trn_mid}if(isvalid(trv_cat)){qry=qry+"&trv_cat="+trv_cat}if(isvalid(trv_dob)){qry=qry+"&trv_dob="+trv_dob}if(isvalid(trv_npf)){qry=qry+"&trv_npf="+trv_npf}if(isvalid(trv_ntt)){qry=qry+"&trv_ntt="+trv_ntt}if(isvalid(trv_em)){qry=qry+"&trv_em="+trv_em}if(isvalid(trv_ffn)){qry=qry+"&trv_ffn="+trv_ffn}if(isvalid(trv_gd)){qry=qry+"&trv_gd="+trv_gd}if(isvalid(pm_bfn)){qry=qry+"&pm_bfn="+pm_bfn}if(isvalid(pm_bln)){qry=qry+"&pm_bln="+pm_bln}if(isvalid(pm_ba1)){qry=qry+"&pm_ba1="+pm_ba1}if(isvalid(pm_ba2)){qry=qry+"&pm_ba2="+pm_ba2}if(isvalid(pm_bc)){qry=qry+"&pm_bc="+pm_bc}if(isvalid(pm_bs)){qry=qry+"&pm_bs="+pm_bs}if(isvalid(pm_bct)){qry=qry+"&pm_bct="+pm_bct}if(isvalid(pm_bcp)){qry=qry+"&pm_bcp="+pm_bcp}if(isvalid(pm_ccb)){qry=qry+"&pm_ccb="+pm_ccb}if(isvalid(pm_ccn)){qry=qry+"&pm_ccn="+pm_ccn}if(isvalid(pm_ccid)){qry=qry+"&pm_ccid="+pm_ccid}if(isvalid(pm_expd)){qry=qry+"&pm_expd="+pm_expd}if(isvalid(pm_expm)){qry=qry+"&pm_expm="+pm_expm}if(isvalid(pm_expy)){qry=qry+"&pm_expy="+pm_expy}if(isvalid(pm_bph)){qry=qry+"&pm_bph="+pm_bph}if(isvalid(pm_bbph)){qry=qry+"&pm_bbph="+pm_bbph}if(isvalid(pm_em)){qry=qry+"&pm_em="+pm_em}if(isvalid(aqid)){qry=qry+"&aqid="+aqid}if(isvalid(vsid)){qry=qry+"&vsid="+vsid}if(isvalid(mode)){qry=qry+"&mode="+mode}if(isvalid(ains)){qry=qry+"&ains="+ains}return qry};afslib_Flight.prototype.buildBookingRequest2=function(wl_account_no,mic_code,step,searchSid,bookReq){var qry="";qry=qry+"process_id=910";if(isvalid(wl_account_no)){qry=qry+"&wl_account_no="+wl_account_no}if(isvalid(this.globalMilAccountNo)){qry=qry+"&mil="+this.globalMilAccountNo}if(isvalid(mic_code)){qry=qry+"&mic_code="+mic_code}if(isvalid(searchSid)){qry=qry+"&search_sid="+searchSid}if(this.isTestMode){qry=qry+"&mode=test"}if(isvalid(step)){qry=qry+"&step="+step}if(JSON!=undefined){qry=qry+"&json="+JSON.stringify(bookReq)}return qry};afslib_Flight.prototype.buildBookingValidateRequest=function(wl_account_no,mic_code,step,bookReq){var qry="";qry=qry+"process_id=970";if(isvalid(wl_account_no)){qry=qry+"&wl_account_no="+wl_account_no}if(isvalid(this.globalMilAccountNo)){qry=qry+"&mil="+this.globalMilAccountNo}if(isvalid(mic_code)){qry=qry+"&mic_code="+mic_code}if(isvalid(step)){qry=qry+"&step="+step}if(JSON!=undefined){qry=qry+"&json="+JSON.stringify(bookReq)}return qry};afslib_Flight.prototype.buildValidationURL=function(wl_account_no,mic_code,step,bookReq){var qry="";qry=qry+"process_id=960";if(isvalid(wl_account_no)){qry=qry+"&wl_account_no="+wl_account_no}if(isvalid(this.globalMilAccountNo)){qry=qry+"&mil="+this.globalMilAccountNo}if(isvalid(mic_code)){qry=qry+"&mic_code="+mic_code}if(isvalid(step)){qry=qry+"&step="+step}if(JSON!=undefined){qry=qry+"&json="+JSON.stringify(bookReq)}return qry};afslib_Flight.prototype.getCssIndex=function(objJson,cssFile){for(i in objJson.css){if(objJson.css[i].cssFile==cssFile){return i}}return -1};afslib_Flight.prototype.loadSearchFormElement=function(url,objJson){$.ajax({url:url,dataType:"css",success:function(data){arrCSS[afe.getCssIndex(objJson,url)]=('<link rel="stylesheet" type="text/css" href="'+url+'" />');nCSS--;if(nCSS==0){for(var j=0;j<arrCSS.length;j++){$("head").append(arrCSS[j])}var strGEOJson="";var geoJSon;var strExtractedLoc="";var strGeoFrom=null;var strGeoTo=null;var sDefaultFrom="";var sDefaultTo="";if((afe.defaultFromLocation=="")||(afe.defaultFromLocation==undefined)){sDefaultFrom=unescape(globalDefaultSearchFormText)}else{sDefaultFrom=unescape(afe.defaultFromLocation)}if((afe.defaultToLocation=="")||(afe.defaultToLocation==undefined)){sDefaultTo=unescape(globalDefaultSearchFormText)}else{sDefaultTo=unescape(afe.defaultToLocation)}if((typeof(sDefaultFrom)!="undefined")&&(sDefaultFrom.length>0)&&(sDefaultFrom.length<4)&&(sDefaultFrom!=globalDefaultSearchFormText)){strGEOJson=afe.requestGEOLocation(sDefaultFrom);geoJSon=eval("("+strGEOJson+")");strGeoFrom=geoJSon.geo}if((typeof(sDefaultTo)!="undefined")&&(sDefaultTo.length>0)&&(sDefaultTo.length<4)&&(sDefaultTo!=globalDefaultSearchFormText)){strGEOJson=afe.requestGEOLocation(sDefaultTo);geoJSon=eval("("+strGEOJson+")");strGeoTo=geoJSon.geo}var strHtml=afe.cleanHtml(objJson.searchBox[0].htmlstring);$("#"+afe.divHolderName).html(strHtml);$("#from_location1").val(sDefaultFrom);$("#to_location1").val(sDefaultTo);if(strGeoFrom!=null){$("#from_location1").val(strGeoFrom)}if(strGeoTo!=null){$("#to_location1").val(strGeoTo)}afe.loadDynamicScript(objJson.js);afe.invokeSeachFormLoaded()}}})};afslib_Flight.prototype.callRenderSearchBox=function(){afe.getAndMergeSearchParameter();afe.handshake();var objController=new affServeLib_ServiceController();var s=this.buildSearchBoxRequest();objController.callService(this.buildSearchBoxRequest(),this);var strJson=this.response;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");if(typeof(objJson.moi)!="undefined"){afe.setMilOptIn(objJson.moi)}nCSS=0;arrCSS=[];if(typeof(objJson.css)!="undefined"){if(globalCustomSearchBoxCSS!="undefined"&&globalCustomSearchBoxCSS!=""){objJson.css.push({cssFile:globalCustomSearchBoxCSS})}nCSS=objJson.css.length;for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;this.loadSearchFormElement(strCss,objJson)}}else{var strHtml=afe.cleanHtml(objJson.searchBox[0].htmlstring);$("#"+afe.divHolderName).html(strHtml)}};afslib_Flight.prototype.callSearchResult=function(Async,objSearchInfo,params){var objController=new affServeLib_ServiceController();var s=params;if(Async){objController.callServiceAsync(params)}else{objController.callService(params,this)}var strJson=this.response};afslib_Flight.prototype.callFlightValidation=function(vsid,aqid){var objController=new affServeLib_ServiceController();var result=false;var url=this.buildFligthValidationURL(vsid,aqid);objController.callService(url,{handleResponse:function(responseText){if(responseText=="true"){result=true}else{result=false}}});return result};afslib_Flight.prototype.handshake=function(){if(this.globalSessionID==undefined||this.globalSessionID==""){var mic=this.micCode;var mil=this.mil_account_no;var wl_account_no=this.wlAccount;var objController=new affServeLib_ServiceController();var result=false;var url=this.buildHandshakeURL(mic,mil,wl_account_no);objController.callService(url,{handleResponse:function(responseText){var respObj=eval("("+responseText+")");if(respObj.ssid[0].ssid!=undefined){this.globalSessionID=respObj.ssid[0].ssid;result=true}}})}else{result=true}return result};afslib_Flight.prototype.cleanHtml=function(sHTML){var strHtml=sHTML;strHtml=strHtml.replace(/@sq@/g,"'");strHtml=strHtml.replace(/@dq@/g,'"');strHtml=strHtml.replace(/@brc@/g,"}");strHtml=strHtml.replace(/@bro@/g,"{");return strHtml};afslib_Flight.prototype.showFlightValidationFail=function(Async){var objController=new affServeLib_ServiceController();var url=this.buildFlightValidationFailURL(globalWlAccountNo,globalMicCode);if(Async){objController.callServiceAsync(url)}else{objController.callService(url,this)}var strJson=this.response;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");var strHtml=afe.cleanHtml(objJson.preparePage[0].htmlstring);$("#"+this.divHolderName).html(strHtml)};afslib_Flight.prototype.callFlightBookingForm=function(Async,sid,vsid,aqid,depDate){var objController=new affServeLib_ServiceController();global_sid=sid;global_vsid=vsid;global_aqid=aqid;var mode=(afe.isTestMode)?"test":"";var url=this.buildBookingFormURL(globalWlAccountNo,globalMicCode,sid,vsid,aqid,depDate,mode);if(Async){objController.callServiceAsync(url)}else{objController.callService(url,this)}var strJson=this.response;this.displayBookingForm(strJson)};afslib_Flight.prototype.displayBookingForm=function(InputStrJson){var strJson=InputStrJson;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");nCSS=0;arrCSS=[];if(typeof(objJson.css)!="undefined"){if(globalCustomBookingFormCSS!="undefined"&&globalCustomBookingFormCSS!=""){objJson.css.push({cssFile:globalCustomBookingFormCSS})}nCSS=objJson.css.length;for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;this.loadBookingFormElement(strCss,objJson)}}};afslib_Flight.prototype.loadBookingFormElement=function(url,objJson){$.ajax({url:url,dataType:"css",success:function(data){arrCSS[afe.getCssIndex(objJson,url)]=('<link rel="stylesheet" type="text/css" href="'+url+'" />');nCSS--;if(nCSS==0){for(var j=0;j<arrCSS.length;j++){$("head").append(arrCSS[j])}var strHtml=afe.cleanHtml(objJson.bookingForm[0].htmlstring);$("#"+afe.divHolderName).html(strHtml);afe.loadDynamicScript(objJson.js)}}})};afslib_Flight.prototype.displayPreparePage=function(objSearchInfo){objSearchInfo.requestPrepare(false);var strJson=objSearchInfo.response;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}for(var i=0;i<objJson.js.length;i++){var strJS=objJson.js[i].jsFile;strJS='<script src="'+strJS+'" type="text/javascript"><\/script>';$("head").append(strJS)}if(globalCustomSearchingPageCSS!=""){strCss='<link href="'+globalCustomSearchingPageCSS+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}var strHtml=afe.cleanHtml(objJson.preparePage[0].htmlstring);$("#"+this.divHolderName).html(strHtml);afe.FromLocationDisplay=$("#FromLocationDisplay").val();afe.ToLocationDisplay=$("#ToLocationDisplay").val();afe.DepartureDateValue=$("#DepartureDateValue").val();afe.ReturnDateValue=$("#ReturnDateValue").val();afe.DepartureDate=$("#DepartureDate").val();afe.ReturnDate=$("#ReturnDate").val();afe.NoAdult=$("#NoAdult").val();afe.NoChild=$("#NoChild").val();afe.NoInfant=$("#NoInfant").val();afe.TripType=$("#TripType").val();afe.invokeSearchInProgress();objSearchInfo.requestEzgdsResult(true)};afslib_Flight.prototype.sleep=function(milliseconds){var start=new Date().getTime();for(var i=0;i<10000000;i++){if((new Date().getTime()-start)>milliseconds){break}}};afslib_Flight.prototype.displayTileResult=function(objSearchInfo){if(typeof(objSearchInfo)=="undefined"){return false}var strJson=objSearchInfo.response;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}var strHtml=afe.cleanHtml(objJson.basketResult[0].htmlstring);$("#"+this.divHolderName).html(strHtml);afe.loadDynamicScript(objJson.js)};afslib_Flight.prototype.loadPreparingFormElement=function(url,objJson){$.ajax({url:url,dataType:"css",success:function(data){arrCSS[afe.getCssIndex(objJson,url)]=('<link rel="stylesheet" type="text/css" href="'+url+'" />');nCSS--;if(nCSS==0){for(var j=0;j<arrCSS.length;j++){$("head").append(arrCSS[j])}var strHtml=afe.cleanHtml(objJson.preparePage[0].htmlstring);$("#"+afe.divHolderName).html(strHtml);afe.loadDynamicScript(objJson.js)}}})};afslib_Flight.prototype.displaySearchResult=function(){var objSearch=new afslib_SearchObject();objSearch.wlAccount=this.wlAccount;objSearch.micCode=this.micCode;objSearch.product_ID=10;objSearch.fromLoc1=this.fromLoc1;objSearch.toLoc1=this.toLoc1;objSearch.depDate1=this.departureDate1;objSearch.retDate1=this.returnDate1;objSearch.adultQty=this.qtyAdults;objSearch.childQty=this.qtyChildren;objSearch.infantQty=this.qtyInfant;objSearch.tripType=this.tripType;objSearch.process_ID=this.processID;objSearch.TilesThemeName=this.themeName;objSearch.isShowOnlyFare=afe.isShowOnlyFare;objSearch.isForceShowTiles=this.isForceShowTiles;objSearch.isShowFilter=this.isShowFilter;objSearch.themeName=this.themeName;objSearch.layoutName=this.layoutName;objSearch.sessionAirId=this.sessionAirId;if(((typeof(objSearch.fromLoc1)=="undefined")||(objSearch.fromLoc1==""))||((typeof(objSearch.toLoc1)=="undefined")||(objSearch.toLoc1==""))||((typeof(objSearch.depDate1)=="undefined")||(objSearch.depDate1==""))||((typeof(objSearch.retDate1)=="undefined")||(objSearch.retDate1==""))||((typeof(objSearch.adultQty)=="undefined")||(objSearch.adultQty==""))||((typeof(objSearch.childQty)=="undefined")||(objSearch.childQty==""))||((typeof(objSearch.infantQty)=="undefined")||(objSearch.infantQty==""))||((typeof(objSearch.tripType)=="undefined")||(objSearch.tripType==""))){objsearch.response=""}else{this.displayPreparePage(objSearch);this.globalSearchObject=objSearch;if(afe.isStopPreparingFormForTesting){return -1}}};afslib_Flight.prototype.reloadSearchResultPage=function(failedAQID,sessionAirId){var afsStat=new afslib_Stat();if((typeof(globalSearchResponsePage)!="undefined")&&(sessionAirId==undefined)){if((typeof(globalFilterOutAQID)!="undefined")&&(typeof(failedAQID)!="undefined")){afsStat.callServiceAsync(afsStat.packServiceWithMic("100305","100306","100307"),null);globalFilterOutAQID.push(failedAQID)}var objJson=globalSearchResponsePage;var strHtml=afe.cleanHtml(objJson.basketResult[0].htmlstring);this.loadDynamicScript(objJson.js);for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}var iQuote=strHtml.search('name="AirQuoteID"');if(iQuote>-1){if(globalCustomAirfareResultBoxCSS!=""){strCss='<link href="'+globalCustomAirfareResultBoxCSS+'" rel="stylesheet" type="text/css" />';$("body").append(strCss)}}else{if(globalCustomTilesResultBoxCSS!=""){strCss='<link href="'+globalCustomTilesResultBoxCSS+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}}$("#"+this.divHolderName).html(strHtml)}else{if(sessionAirId!=undefined){afsStat.callServiceAsync(afsStat.packServiceWithMic("100305","100306","100307"),null);afe.processRequest(sessionAirId)}}};afslib_Flight.prototype.displaySearchResult_ItSelf=function(objSearchInfo){var objSearch=objSearchInfo;if(((typeof(objSearch.fromLoc1)=="undefined")||(objSearch.fromLoc1==""))||((typeof(objSearch.toLoc1)=="undefined")||(objSearch.toLoc1==""))||((typeof(objSearch.depDate1)=="undefined")||(objSearch.depDate1==""))||((typeof(objSearch.retDate1)=="undefined")||(objSearch.retDate1==""))||((typeof(objSearch.adultQty)=="undefined")||(objSearch.adultQty==""))||((typeof(objSearch.childQty)=="undefined")||(objSearch.childQty==""))||((typeof(objSearch.infantQty)=="undefined")||(objSearch.infantQty==""))||((typeof(objSearch.tripType)=="undefined")||(objSearch.tripType==""))){objsearch.response=""}else{this.displayPreparePage(objSearch);objSearch.requestResult(false)}var strJson=objSearch.response;strJSon=strJson.replace(/\n/g,'"');var objJson=eval("("+strJson+")");for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}var iQuote=strHtml.search('name="AirQuoteID"');if(iQuote>-1){if(globalCustomAirfareResultBoxCSS!=""){strCss='<link href="'+globalCustomAirfareResultBoxCSS+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}}else{if(globalCustomTilesResultBoxCSS!=""){strCss='<link href="'+globalCustomTilesResultBoxCSS+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}}var strHtml=afe.cleanHtml(objJson.basketResult[0].htmlstring);$("#"+this.divHolderName).html(strHtml);this.loadDynamicScript(objJson.js);globalSearchResponse=objSearch.strHtml};afslib_Flight.prototype.loadDynamicScript=function(jsArr){var strJs="";var loadNextScript=function(idx){if(idx<jsArr.length){strJs=jsArr[idx].jsFile;idx++;$.getScript(strJs,function(){loadNextScript(idx)})}};loadNextScript(0)};afslib_Flight.prototype.GoBackToSearchPage=function(){var isPopupWindow=(window.name=="pop");var sfUrl=this.buildSearchFormUrl();if(isPopupWindow){var wOpener=window.opener;var mainWin=null;if(wOpener!=undefined&&wOpener!=null){try{mainWin=wOpener;mainWin.location=sfUrl}catch(e){mainWin=window.open(sfUrl,"")}}else{mainWin=window.open(sfUrl,"")}mainWin.focus()}else{window.location=sfUrl}};afslib_Flight.prototype.buildSearchFormUrl=function(){var sfUrl=afe.rewriteTargetURL(afe.searchPageUrl);if(sfUrl.charAt(sfUrl.length)!="?"){sfUrl+="?"}var paramNameArr=["wl_account_no","micCode","mil","fromLoc1","toLoc1","depDate1","retDate1","adultQty","childQty","infantQty","tripType"];var paramValueArr=[this.wlAccount,this.micCode,this.defaltAffiliateID,this.fromLoc1,this.toLoc1,this.departureDate1,this.returnDate1,this.qtyAdults,this.qtyChildren,this.qtyInfant,this.tripType];var pValue=null;for(var i=0;i<paramNameArr.length;i++){pValue=paramValueArr[i];if(pValue==undefined||pValue==null||pValue==""){pValue=""}sfUrl+=paramNameArr[i]+"="+pValue+((i<(paramNameArr.length-1))?"&":"")}return sfUrl};afslib_Flight.prototype.testcall=function(){window.location=afe.searchPageUrl+"&micCode="+afe.micCode};afslib_Flight.prototype.testAlert=function(){};afslib_Flight.prototype.handleResponse=function(response){this.response=response};afslib_Flight.prototype.booking=function(){var bookReq=this.createBookingFormJSON();var searchSid=$("#qSID").val();var req=this.buildBookingRequest2(this.globalWlAccountNo,afe.micCode,"booking",searchSid,bookReq);afe.invokeBooking();this.StoreBookData();this.CallBookingReq(true,req)};afslib_Flight.prototype.bookingValidate=function(){$("label.error").remove();var bookReq=this.createBookingFormJSON();var req=this.buildBookingValidateRequest(this.globalWlAccountNo,afe.micCode,"booking",bookReq);afe.invokeCallingBookingInfoValidation();return this.CallBookingValidationReq(false,req,bookReq)};afslib_Flight.prototype.createBookingFormJSON=function(){var bookReq=new Object();bookReq.passengers=new Array();var str="";$("table.person","#TravelerForm").each(function(i,n){var p=i+1;var pTmp={cate:$(this).attr("title"),fn:{id:"pfn"+p,val:$("#pfn"+p).val(),desc:"First Name - "+p},mn:{id:"pmd"+p,val:$("#pmd"+p).val(),desc:"Middle Name - "+p},ln:{id:"pln"+p,val:$("#pln"+p).val(),desc:"Last Name - "+p},gd:{id:"pgd"+p,val:$("#pgd"+p).val(),desc:"Gender - "+p},ffn:{id:"pff"+p,val:$("#pff"+p).val(),desc:"Frequently Flight No - "+p},rdn:{id:"prd"+p,val:$("#prd"+p).val(),desc:"Redress Number - "+p},dob:{id:"pdob"+p,val:$("#pdob"+p).val(),desc:"Date of Birth - "+p},mob:{id:"pmob"+p,val:$("#pmob"+p).val(),desc:"Month of Birth - "+p},yob:{id:"pyob"+p,val:$("#pyob"+p).val(),desc:"Year Number - "+p}};bookReq.passengers.push(pTmp)});bookReq.payment={ins:{id:"chkInsu",val:$("#chkInsu").is(":checked")?"1":"0",desc:"Insurance"},ccn:{id:"pmCardID",val:$("#pmCardID").val(),desc:"Credit Card No"},ccid:{id:"pmVerCNum",val:$("#pmVerCNum").val(),desc:"Credit Card Verification No"},expm:{id:"pmExM",val:$("#pmExM").val(),desc:"Expiry Month"},expy:{id:"pmExY",val:$("#pmExY").val(),desc:"Expiry Year"},chdn:{id:"pmCHN",val:$("#pmCHN").val(),desc:"Credit Card Holder Name"},ba1:{id:"pmAddress1",val:$("#pmAddress1").val(),desc:"Billing Address"},ba2:{id:"pmAddress2",val:$("#pmAddress2").val(),desc:"Billing Addresss"},bc:{id:"pmCity",val:$("#pmCity").val(),desc:"City"},bs:{id:"pmState",val:$("#pmState").val(),desc:"State"},bzip:{id:"pmZip",val:$("#pmZip").val(),desc:"Zip Code"},bct:{id:"pmCountry",val:$("#pmCountry").val(),desc:"Country"},bph:{id:"pmPhone",val:$("#pmPhone").val(),desc:"Billing Phone"},bbph:{id:"pmBusinessPhone",val:$("#pmBusinessPhone").val(),desc:"Business Phone"},email:{id:"pmEmail",val:$("#pmEmail").val(),desc:"Email Address"},cemail:{id:"pmCEmail",val:$("#pmCEmail").val(),desc:"Confirm Email Address"}};bookReq.quote={quoteid:$("#qAirQuoteId").val(),visitsessionid:$("#qVSID").val(),departuredate:$("#qDepDate").val(),acceptedcreditcard:$("#pmACC").val()};return bookReq};afslib_Flight.prototype.CallBookingReq=function(Async,req){var objController=new affServeLib_ServiceController();if(Async){objController.callServiceAsync(req,{onRequestCompleted:function(responseTxt){var objJson=eval("("+responseTxt+")");var strHtml=afe.cleanHtml(objJson.bookingConfirm[0].htmlstring);$("#"+afe.divHolderName).html(strHtml);afe.loadDynamicScript(objJson.js);for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}}})}else{objController.callService(req,this);var strJson=this.response;var objJson=eval("("+strJson+")");var strHtml=afe.cleanHtml(objJson.bookingConfirm[0].htmlstring);$("#"+this.divHolderName).html(strHtml);this.loadDynamicScript(objJson.js);for(var i=0;i<objJson.css.length;i++){var strCss=objJson.css[i].cssFile;strCss='<link href="'+strCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}}if(afe.CustomBookingResultCss!=""){strCss='<link href="'+afe.CustomBookingResultCss+'" rel="stylesheet" type="text/css" />';$("head").append(strCss)}};afslib_Flight.prototype.CallBookingValidationReq=function(Async,req,bookReq){var objController=new affServeLib_ServiceController();if(Async){objController.callServiceAsync(req)}else{objController.callService(req,this)}var strJson=this.response;var psgs=bookReq.passengers;var pm=bookReq.payment;var json=eval("("+strJson+")");var errors=json.errors;if(errors.length>0){var errorMessage='<strong>We found something wrong on your given information, Please recheck as items below </strong><br/><br/><ol style="padding-left: 10px;">';var lastPsg="";$(errors).each(function(i,n){if(i==0){$("#"+n.id).focus()}$("#"+n.id).after('<label for="'+n.id+'"  class="error">'+n.msg+"</label>");var itemLbl="";var curPsg="";var startNewPsg=false;$.each(psgs,function(i2,n2){for(var prop in n2){if(n2.hasOwnProperty(prop)&&(typeof(n2[prop])=="object")){if(n2[prop].id==n.id){itemLbl=n2[prop].desc;curPsg=itemLbl.charAt(itemLbl.length-1);if((curPsg!=lastPsg)&&(curPsg!="1")){startNewPsg=true;lastPsg=curPsg}break}}}});if(itemLbl==""){for(var prop in pm){if(pm[prop].id==n.id){if(lastPsg!=""){startNewPsg=true;lastPsg=""}itemLbl=pm[prop].desc;break}}}if(startNewPsg){errorMessage+="<li>&nbsp;</li>"}errorMessage+="<li>"+itemLbl+': <span style="color: red">'+n.msg+"</span></li>"});errorMessage+="</ol>";$.colorbox({html:errorMessage,title:"Validation Error",transition:"none",width:"650px",overlayClose:true,opacity:0.3});afe.invokeBookingInfoValidationFailed();return false}afe.invokeBookingInfoValidationPassed();return true};afslib_Flight.prototype.StoreBookData=function(){globalBookFormData=this.createBookingFormJSON()};afslib_Flight.prototype.ClearBookData=function(){if(typeof(globalBookFormData)!="undefined"){globalBookFormData=undefined}};afslib_Flight.prototype.RestoreBookData=function(){if(typeof(globalBookFormData)!="undefined"){var psgs=globalBookFormData.passengers;$.each(psgs,function(i,n){for(var prop in n){if(n.hasOwnProperty(prop)&&(typeof(n[prop])=="object")){$("#"+n[prop].id).val(n[prop].val)}}});var ccCardInfo="ccn,ccid,expm,expy";var pm=globalBookFormData.payment;for(var prop in pm){if(pm.hasOwnProperty(prop)&&(ccCardInfo.indexOf(prop)==-1)){if(prop=="ins"){$("#"+pm[prop].id).attr("checked",(pm[prop].val=="1")?true:false);$("#"+pm[prop].id).change()}else{$("#"+pm[prop].id).val(pm[prop].val)}}}}};afslib_Flight.prototype.verifySecureSearch=function(){var isSecure=(window.location.protocol=="https:");var valid=true;if((!this.isTestMode)&&(!isSecure)){$("#"+this.divHolderName).html("<strong>Sorry, Search result process must process in https only!!!</strong>");valid=false}return valid};afslib_Flight.prototype.rewriteTargetURL=function(targetUrl){if(targetUrl==null||typeof(targetUrl)=="undefined"){return""}var cIndex=targetUrl.indexOf("://",0);if(cIndex==-1){var newResultURL="";var urlProtocol="http";var urlPort="";if(afe.isTestMode){urlPort=(location.port=="")?"":":"+location.port}var vPath=afe.GetVirtualPath();newResultURL=urlProtocol+"://"+location.hostname+urlPort+((vPath=="")?"":"/"+vPath);if(targetUrl.indexOf("/")!=0){newResultURL+="/"}newResultURL+=targetUrl;return newResultURL}else{return targetUrl}};afslib_Flight.prototype.ShowTile=function(q_wlAccount,q_mil,q_mic,q_TripType,q_From,q_To,q_DepDate,q_RetDate,q_Adult,q_Child,q_Infants){var url=afe.BuildTileRequestURL(q_wlAccount,q_mil,q_mic,q_TripType,q_From,q_To,q_DepDate,q_RetDate,q_Adult,q_Child,q_Infants);var iQMark=this.IndexOfQMark(afe.TilesPopunderPage);if(iQMark<0){url=afe.rewriteTargetURL(afe.TilesPopunderPage)+"?"+url}else{url=afe.rewriteTargetURL(afe.TilesPopunderPage)+"&"+url}url=url.replace("&&","&");var pWin=window.open(url,"pop","height=700, width=1050, resizable=yes, toolbar=yes, location=yes, menubar=yes, scrollbars=yes, left=50, top=50");try{pWin.blur();var agt=navigator.userAgent.toLowerCase();if(agt.indexOf("chrome")!=-1){setTimeout(pWin.blur,0)}}catch(ex){}window.focus();return pWin};afslib_Flight.prototype.IndexOfQMark=function(str){var i=-1;if((str!=undefined)&&(String!="")){if(str.indexOf("?")>-1){i=str.indexOf("?")}else{i=-1}}else{i=-1}return i};afslib_Flight.prototype.GetVirtualPath=function(){var curURL=location.href;var protocalEndIdx=curURL.indexOf("://");var qMarkEndIdx=curURL.indexOf("?");qMarkEndIdx=(qMarkEndIdx==-1)?location.href.length:qMarkEndIdx;protocalEndIdx+="://".length;var firstSlashIdx=curURL.indexOf("/",protocalEndIdx);var lastSlashIdx=curURL.lastIndexOf("/",qMarkEndIdx);var vPath="";if((firstSlashIdx==-1)||(lastSlashIdx<=firstSlashIdx)){vPath=""}else{vPath=curURL.substr(firstSlashIdx+1,lastSlashIdx-firstSlashIdx-1)}return vPath}};
