Target={NULL:-1,TOP:1,BLANK:2};Action={DEAD_PAGE:{targetPage:"error-page",targetType:Target.TOP},ERROR_AREA:{targetPage:"",targetType:Target.NULL},PERMANENT_ERROR:{targetPage:"",targetType:Target.NULL},ALIVE_PAGE:{targetPage:"error-page",targetType:Target.TOP},LOGIN_PAGE:{targetPage:"login",targetType:Target.TOP},NO_ACTION:{targetPage:"",targetType:Target.NULL},BLANK_PAGE:{targetPage:"error-page",targetType:Target.BLANK},BOXED_ERROR:{targetPage:"",targetType:Target.NULL},REDIRECT_HOME:{targetPage:"/home",targetType:Target.TOP}};function initErrorData(){CommonError={LOGIN_REQUIRED:{message:Label.Common.Error.empty,action:Action.LOGIN_PAGE},CONNECTION_FAILURE:{message:Label.Common.Error.connectionFailureMsg,action:Action.DEAD_PAGE},SESSION_EXPIRED:{message:Label.Common.Error.sessionExpiredMsg,action:Action.ALIVE_PAGE},NO_ACTION:{message:Label.Common.Error.empty,action:Action.NULL_ACTION},CONNECTION_FAILURE_BLANK:{message:Label.Common.Error.connectionFailureMsg,action:Action.BLANK_PAGE,windowId:null}};ErrorData={loginPage:{Login:{error_others:CommonError.CONNECTION_FAILURE,error_2:{message:Label.Common.Error.unknownUserMsg,action:Action.PERMANENT_ERROR},error_3:{message:Label.Common.Error.unknownUserMsg,action:Action.PERMANENT_ERROR},error_6:{message:Label.Common.Error.accountExpiredMsg,action:Action.PERMANENT_ERROR},error_7:{message:Label.Common.Error.unknownUserMsg,action:Action.PERMANENT_ERROR}},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}},airportSelectionPage:{GetUser:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},GetCountry:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},GetAirport:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}},tripSelectionPage:{GetUser:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},StartSearch:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE,error_22:{message:Label.Common.Error.userConnectedClientMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_24:{message:Label.Common.Error.userConnectedSessionMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_25:{message:Label.Common.Error.serverTooBusyMsg,action:Action.DEAD_PAGE},error_29:{message:WeeFlyUtil.buildTooManyConnectionMsg({includeHeader:false,includeFooter:false,boldClass:"blackLabel",emailImg:"weefly-support-pink-bg.jpg"}),action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_84:{message:Label.Common.Error.startDateMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_85:{message:Label.Common.Error.endDateMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_86:{message:Label.Common.Error.startDateInPastMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_87:{message:Label.Common.Error.startEndDateConsistencyMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_88:{message:Label.Common.Error.minDaysMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"},error_89:{message:Label.Common.Error.maxDaysMsg,action:Action.BOXED_ERROR,block:"tripSelectionMainBlock"}},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}},flightResultPage:{GetUser:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},StartSearch:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE,error_22:{message:Label.Common.Error.userConnectedClientMsg,action:Action.BOXED_ERROR,block:"flightSearchMainBlock"},error_24:{message:Label.Common.Error.userConnectedSessionMsg,action:Action.BOXED_ERROR,block:"flightSearchMainBlock"},error_25:{message:Label.Common.Error.serverTooBusyMsg,action:Action.DEAD_PAGE},error_26:{message:Label.Common.Error.searchExpiredMsg,action:Action.REDIRECT_HOME}},GetFlight:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE,error_21:{message:Label.Common.Error.sessionExpiredMsg,action:Action.ALIVE_PAGE}},GetSponsor:{error_others:CommonError.NO_ACTION},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}},preBookingPage:{GetBookingLink:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE_BLANK,error_21:{message:Label.Common.Error.sessionExpiredMsg,action:Action.ALIVE_PAGE}}},countactUsPage:{GetUser:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},GetContactUs:{error_4:CommonError.LOGIN_REQUIRED,error_others:{message:Label.Common.Error.connectionFailureMsg,action:Action.ALIVE_PAGE}}},termsOfUsePage:{GetUser:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE},GetTermsOfUse:{error_4:CommonError.LOGIN_REQUIRED,error_others:{message:Label.Common.Error.connectionFailureMsg,action:Action.ALIVE_PAGE}}},registrationPage:{RegisterUser:{error_others:CommonError.CONNECTION_FAILURE,error_8:{message:Label.Common.Error.alreadyRegisteredUserMsg,action:Action.PERMANENT_ERROR},error_10:{message:Label.Common.Error.invalidValidationCodeMsg,action:Action.PERMANENT_ERROR},error_2:{message:Label.Common.Error.wrongUserId,action:Action.PERMANENT_ERROR}},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}},accountPage:{RegisterUser:{error_others:CommonError.CONNECTION_FAILURE,error_4:CommonError.LOGIN_REQUIRED,error_3:{message:Label.Common.Error.wrongPassword,action:Action.PERMANENT_ERROR}},ping:{error_4:CommonError.LOGIN_REQUIRED,error_others:CommonError.CONNECTION_FAILURE}}};}ErrorHandler=Class.create();ErrorHandler.prototype={initialize:function(_1){this.page=_1;},dispatch:function(_2){this.command=_2.command;this.code=_2.code;var _3=this._decode();if(!_3){alert("General error. Please contact our support team.");throw new Error("General error. Please contact our support team.");}switch(_3.action){case Action.DEAD_PAGE:this._handleDeadPage(_3);break;case Action.ERROR_AREA:this._handleErrorArea(_3);break;case Action.PERMANENT_ERROR:this._handlePermanentError(_3);break;case Action.ALIVE_PAGE:this._handleAlivePage(_3);break;case Action.LOGIN_PAGE:this._handleLoginPage(_3);break;case Action.NO_ACTION:this._noAction(_3);break;case Action.BLANK_PAGE:this._handleBlankPage(_3);break;case Action.BOXED_ERROR:this._handleBoxedError(_3);break;case Action.REDIRECT_HOME:Util.redirectTo(APP_URL+_3.action.targetPage);break;}},_handleDeadPage:function(_4){this._submitFakeForm(_4);},_handleErrorArea:function(_5){var _6={message:_5.message,block:""};WeeFlyUtil.showError(_6);},_handlePermanentError:function(_7){var _8={message:_7.message};WeeFlyUtil.showPermanentError(_8);},_handleAlivePage:function(_9){var _a="<span style='padding-left: 30px;'>"+"<input type='button' class='button' id='homeBtn' name='homeBtn' value='Return to the Home Page' onclick=\"javascript:Util.redirectTo('"+APP_URL+"/"+"home"+"');\" />"+"</span>";_9.message=_9.message+_a;this._submitFakeForm(_9);},_handleLoginPage:function(_b){this._submitFakeForm(_b);},_handleBoxedError:function(_c){var _d={message:_c.message,block:_c.block};WeeFlyUtil.showBoxedError(_d);},_noAction:function(_e){},_handleBlankPage:function(_f){var _10=this;window.setTimeout(function(){_10._submitFakeForm(_f);},5000);},_submitFakeForm:function(_11){var _12=this._detectTargetWindow(_11);var frm=_12.document.createElement("form");frm.method="POST";frm.action=APP_URL+"/"+_11.action.targetPage;frm.name="errorFakeForm";frm.id="errorFakeForm";var _14=_12.document.createElement("input");_14.name="htmlMsg";_14.id="htmlMsg";_14.type="hidden";_14.value=_11.message;frm.appendChild(_14);_12.document.body.appendChild(frm);_12.document.forms["errorFakeForm"].submit();},_decode:function(){var _15;try{var _16=ErrorData[this.page];if(!_16){return null;}var _17=_16[this.command];if(!_17){return null;}_15=_17["error_"+this.code];if(!_15){_15=_17["error_others"];if(!!this.code){_15.message=_15.message.replace("XX",this.code);}}}catch(e){_15=null;}return _15;},_detectTargetWindow:function(_18){var _19;if(_18.action.targetType==Target.BLANK&&_18.windowId){_19=_18.windowId;}else{_19=window;}return _19;}};