/*12/5/2011 4:43:26 PM*/if(!this.JSON)this.JSON={};
(function(){function k(a){return 10>a?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function m(a,i){var c,d,h,n,g=e,f,b=i[a];b&&"object"===typeof b&&"function"===typeof b.toJSON&&(b=b.toJSON(a));"function"===typeof j&&(b=j.call(i,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?""+b:"null";case "boolean":case "null":return""+b;
case "object":if(!b)return"null";e+=l;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){n=b.length;for(c=0;c<n;c+=1)f[c]=m(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(j&&"object"===typeof j){n=j.length;for(c=0;c<n;c+=1)d=j[c],"string"===typeof d&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h)}else for(d in b)Object.hasOwnProperty.call(b,d)&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+e)+"\n"+
g+"}":"{"+f.join(",")+"}";e=g;return h}}if("function"!==typeof Date.prototype.toJSON)Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,l,r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if("function"!==typeof JSON.stringify)JSON.stringify=function(a,i,c){var d;l=e="";if("number"===typeof c)for(d=0;d<c;d+=1)l+=" ";else"string"===typeof c&&(l=c);if((j=i)&&"function"!==typeof i&&("object"!==typeof i||"number"!==typeof i.length))throw Error("JSON.stringify");return m("",
{"":a})};if("function"!==typeof JSON.parse)JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&"object"===typeof b)for(g in b)Object.hasOwnProperty.call(b,g)&&(f=c(b,g),void 0!==f?b[g]=f:delete b[g]);return e.call(a,d,b)}var d,a=""+a;q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),"function"===typeof e?c({"":d},""):d;throw new SyntaxError("JSON.parse");}})();
if("undefined"===typeof NameSpace){var NameSpace=function(){};NameSpace.prototype={Templates:function(){},UI:function(){},TypeOperations:function(){},Flight:function(){},Hotel:function(){},Basket:function(){},Logger:function(){},Caching:function(){},Logger:function(){},GUI:function(){},Tools:function(){},Ajax:function(){},System:function(){},Localization:function(){},Membership:function(){},$:function(){}}}var SF=new NameSpace;function Clone(a){a=JSON.stringify(a);return JSON.parse(a)}
function getElementsByClass(a,b,c){var d=[];null===b&&(b=document);null===c&&(c="*");b=b.getElementsByTagName(c);c=b.length;a=RegExp("(^|\\s)"+a+"(\\s|$)");for(i=0,j=0;i<c;i++)a.test(b[i].className)&&(d[j]=b[i],j++);return d}NameSpace.prototype.$=$;
function SHA256(f){function a(b,d){var a=(b&65535)+(d&65535);return(b>>16)+(d>>16)+(a>>16)<<16|a&65535}function c(b,a){return b>>>a|b<<32-a}f=function(b){for(var b=b.replace(/\r\n/g,"\n"),a="",c=0;c<b.length;c++){var e=b.charCodeAt(c);128>e?a+=String.fromCharCode(e):(127<e&&2048>e?a+=String.fromCharCode(e>>6|192):(a+=String.fromCharCode(e>>12|224),a+=String.fromCharCode(e>>6&63|128)),a+=String.fromCharCode(e&63|128))}return a}(f);return function(b){for(var a="",c=0;c<4*b.length;c++)a+="0123456789abcdef".charAt(b[c>>
2]>>8*(3-c%4)+4&15)+"0123456789abcdef".charAt(b[c>>2]>>8*(3-c%4)&15);return a}(function(b,d){var f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,
2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],k=Array(64),h,n,s,g,j,l,o,q,r,p,u,v;b[d>>5]|=128<<24-d%32;b[(d+64>>9<<4)+15]=d;for(r=0;r<b.length;r+=16){h=e[0];n=e[1];s=e[2];g=e[3];
j=e[4];l=e[5];o=e[6];q=e[7];for(p=0;64>p;p++)k[p]=16>p?b[p+r]:a(a(a(c(k[p-2],17)^c(k[p-2],19)^k[p-2]>>>10,k[p-7]),c(k[p-15],7)^c(k[p-15],18)^k[p-15]>>>3),k[p-16]),u=a(a(a(a(q,c(j,6)^c(j,11)^c(j,25)),j&l^~j&o),f[p]),k[p]),v=a(c(h,2)^c(h,13)^c(h,22),h&n^h&s^n&s),q=o,o=l,l=j,j=a(g,u),g=s,s=n,n=h,h=a(u,v);e[0]=a(h,e[0]);e[1]=a(n,e[1]);e[2]=a(s,e[2]);e[3]=a(g,e[3]);e[4]=a(j,e[4]);e[5]=a(l,e[5]);e[6]=a(o,e[6]);e[7]=a(q,e[7])}return e}(function(b){for(var a=[],c=0;c<8*b.length;c+=8)a[c>>5]|=(b.charCodeAt(c/
8)&255)<<24-c%32;return a}(f),8*f.length))}
function SHA1(f){function a(b,a){return b<<a|b>>>32-a}function c(b){var a="",c,d;for(c=7;0<=c;c--)d=b>>>4*c&15,a+=d.toString(16);return a}var b,d,m=Array(80),e=1732584193,k=4023233417,h=2562383102,n=271733878,s=3285377520,g,j,l,o,q,f=function(b){for(var b=b.replace(/\r\n/g,"\n"),a="",c=0;c<b.length;c++){var d=b.charCodeAt(c);128>d?a+=String.fromCharCode(d):(127<d&&2048>d?a+=String.fromCharCode(d>>6|192):(a+=String.fromCharCode(d>>12|224),a+=String.fromCharCode(d>>6&63|128)),a+=String.fromCharCode(d&
63|128))}return a}(f);g=f.length;var r=[];for(b=0;b<g-3;b+=4)d=f.charCodeAt(b)<<24|f.charCodeAt(b+1)<<16|f.charCodeAt(b+2)<<8|f.charCodeAt(b+3),r.push(d);switch(g%4){case 0:b=2147483648;break;case 1:b=f.charCodeAt(g-1)<<24|8388608;break;case 2:b=f.charCodeAt(g-2)<<24|f.charCodeAt(g-1)<<16|32768;break;case 3:b=f.charCodeAt(g-3)<<24|f.charCodeAt(g-2)<<16|f.charCodeAt(g-1)<<8|128}for(r.push(b);14!=r.length%16;)r.push(0);r.push(g>>>29);r.push(g<<3&4294967295);for(f=0;f<r.length;f+=16){for(b=0;16>b;b++)m[b]=
r[f+b];for(b=16;79>=b;b++)m[b]=a(m[b-3]^m[b-8]^m[b-14]^m[b-16],1);d=e;g=k;j=h;l=n;o=s;for(b=0;19>=b;b++)q=a(d,5)+(g&j|~g&l)+o+m[b]+1518500249&4294967295,o=l,l=j,j=a(g,30),g=d,d=q;for(b=20;39>=b;b++)q=a(d,5)+(g^j^l)+o+m[b]+1859775393&4294967295,o=l,l=j,j=a(g,30),g=d,d=q;for(b=40;59>=b;b++)q=a(d,5)+(g&j|g&l|j&l)+o+m[b]+2400959708&4294967295,o=l,l=j,j=a(g,30),g=d,d=q;for(b=60;79>=b;b++)q=a(d,5)+(g^j^l)+o+m[b]+3395469782&4294967295,o=l,l=j,j=a(g,30),g=d,d=q;e=e+d&4294967295;k=k+g&4294967295;h=h+j&4294967295;
n=n+l&4294967295;s=s+o&4294967295}q=c(e)+c(k)+c(h)+c(n)+c(s);return q.toLowerCase()}
NameSpace.prototype.Tools=new function(){this.TRYRatio=null;this.TRY=function(f){return null==this.TRYRatio?0:this.TRYRatio*f};this.SerializeObject=function a(c){if(SF.Tools.IsNull(c))return null;if("undefined"!==typeof c.toSource&&"undefined"===typeof c.callee)return c.toSource();switch(typeof c){case "function":return null;case "number":case "boolean":return c;case "string":return'"'+c+'"';case "object":var b;if(c.constructor===Array||"undefined"!==typeof c.callee){b="[";var d,m=c.length;for(d=
0;d<m-1;d++)b+=a(c[d])+",";b+=a(c[d])+"]"}else{b="{";for(d in c)b+='"'+d+'":'+a(c[d])+",";b=b.replace(/\,$/,"")+"}"}return b;default:return"UNKNOWN"}};this.IsFunction=function(a){return"function"==typeof a?!0:!1};this.IsNull=function(a){return null!=a&&void 0!=a&&"undefined"!=a?!1:!0};this.FormatDouble=function(a){return $.formatNumber(Number(a),{format:"#,##0.00",locale:"us"})};this.RemoveByValue=function(a,c){for(var b=0;b<a.length;b++)if(a[b]==c)return a.splice(b,1),!0;return!1};this.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode:function(a){for(var c="",b,d,m,e,k,h,n=0,a=SF.Tools.Base64._utf8_encode(a);n<a.length;)b=a.charCodeAt(n++),d=a.charCodeAt(n++),m=a.charCodeAt(n++),e=b>>2,b=(b&3)<<4|d>>4,k=(d&15)<<2|m>>6,h=m&63,isNaN(d)?k=h=64:isNaN(m)&&(h=64),c=c+this._keyStr.charAt(e)+this._keyStr.charAt(b)+this._keyStr.charAt(k)+this._keyStr.charAt(h);return c},decode:function(a){for(var c="",b,d,m,e,k,h=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<a.length;)b=this._keyStr.indexOf(a.charAt(h++)),d=this._keyStr.indexOf(a.charAt(h++)),
e=this._keyStr.indexOf(a.charAt(h++)),k=this._keyStr.indexOf(a.charAt(h++)),b=b<<2|d>>4,d=(d&15)<<4|e>>2,m=(e&3)<<6|k,c+=String.fromCharCode(b),64!=e&&(c+=String.fromCharCode(d)),64!=k&&(c+=String.fromCharCode(m));return c=SF.Tools.Base64._utf8_decode(c)},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),c="",b=0;b<a.length;b++){var d=a.charCodeAt(b);128>d?c+=String.fromCharCode(d):(127<d&&2048>d?c+=String.fromCharCode(d>>6|192):(c+=String.fromCharCode(d>>12|224),c+=String.fromCharCode(d>>
6&63|128)),c+=String.fromCharCode(d&63|128))}return c},_utf8_decode:function(a){for(var c="",b=0,d=c1=c2=0;b<a.length;)d=a.charCodeAt(b),128>d?(c+=String.fromCharCode(d),b++):191<d&&224>d?(c2=a.charCodeAt(b+1),c+=String.fromCharCode((d&31)<<6|c2&63),b+=2):(c2=a.charCodeAt(b+1),c3=a.charCodeAt(b+2),c+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63),b+=3);return c}};this.Url={encode:function(a){return escape(this._utf8_encode(a))},decode:function(a){return this._utf8_decode(unescape(a))},_utf8_encode:function(a){for(var a=
a.replace(/\r\n/g,"\n"),c="",b=0;b<a.length;b++){var d=a.charCodeAt(b);128>d?c+=String.fromCharCode(d):(127<d&&2048>d?c+=String.fromCharCode(d>>6|192):(c+=String.fromCharCode(d>>12|224),c+=String.fromCharCode(d>>6&63|128)),c+=String.fromCharCode(d&63|128))}return c},_utf8_decode:function(a){for(var c="",b=0,d=c1=c2=0;b<a.length;)d=a.charCodeAt(b),128>d?(c+=String.fromCharCode(d),b++):191<d&&224>d?(c2=a.charCodeAt(b+1),c+=String.fromCharCode((d&31)<<6|c2&63),b+=2):(c2=a.charCodeAt(b+1),c3=a.charCodeAt(b+
2),c+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63),b+=3);return c}};this.Keys={ENTER:13,ESCAPE:27};this.RandomText=function(){for(var a="",c=0;4>c;c++)var b=Math.floor(36*Math.random()),a=a+"0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ".substring(b,b+1);return a};this.SSLWrapper=function(a){return a.replace("http:","https:")}};String.prototype.ReplaceAll=function(f,a){for(var c=this,b=c.indexOf(f);-1!=b;)c=c.replace(f,a),b=c.indexOf(f);return c};String.prototype.Localize=function(){return SF.System.Parameters.LocalizedKeys.GetItem(this.toString())};
String.prototype.padLeft=function(f,a){t="";if(f>this.length)for(i=0;i<f-this.length;i++)t+=a;return t+this};String.prototype.padRight=function(f,a){t=this;if(f>this.length)for(i=0;i<f-this.length;i++)t+=a;return t};Number.prototype.padLeft=function(f,a){return this.toString().padLeft(f,a)};Number.prototype.round=function(){return Math.round(this)};
NameSpace.prototype.Ajax=new function(){this.ServiceEnums={System:0,Flight:1,Hotel:2};this.ServiceResponseType={Result:0,Exception:1,Validation:2};this.ServiceMethods=new function(){this.Flight={Search:1,SearchLocationForFlight:2,AddFlightOptionToBasket:3,EmptyFlightBasket:4,GetFlightPassengerData:5,BookFlight:6,GetFlightSessionItem:7,GetPnr:8,GetPnrData:9,GetCurrentSelectedFlightOption:10,GetDomesticFlightOptionPrice:11,DomesticReSearch:12,InternationalReSearch:21,GetAirlines:30,GetFrequentFlyerAirlineList:31,
GetSecondaryResults:41};this.System={GetCurrentMemberData:1,SignOut:2,LogIn:3,RemindPassword:4,SignUp:5,ConfirmMembership:6,GetReservations:7,UpdateMember:8,EmptyBasket:11,BookCurrentPnr:12,CompleteBooking:13,ApprovePriceChange:14,PaymentLock:15,LogException:21,LogError:22,GetPortalRules:30,GetParameterDetails:40,GetParameterDetail:41,GetCountries:42,GetAirport:50,GetAirlines:51,GetLocalizedKeys:52,GetCities:53,GetAirports:54,CalculatePricedItemTable:60,AddProfilePassenger:71,RemoveProfilePassenger:72,
AddFrequentFlyerCard:73,RemoveFrequentFlyerCard:74,Get3dProcessResult:80,Close3dPaymentWindow:81,Cancel:90,SendMail:91,GetAllTemplates:100,AddLocalizationKey:101,GetLocalizationElements:102,GetTemplate:103,GetCurrentCulture:104,AddMissingLocalizationItem:105,SessionExists:106,GetAllPromotions:110,GetUserFeedback:111};this.Hotel={Search:1,SearchLocation:2,SearchHotelRooms:3,GetHotelDetail:4,GetHotelRoomRule:5,GetHotelPassengerData:6,BookHotel:7,CompleteBook:8,AddToBasket:9,GetHotelSessionItem:10,EmptyHotelBasket:11,
GetMoreResults:12};this.Car={Search:1,SearchCarVendor:2,SearchLocation:3,AddToBasket:4,EmptyCarBasket:5,GetCarSessionItem:6,GetCarPassengerData:7,BookCar:8,GetRules:9}};this.GetServiceUrl=function(a){switch(a){case SF.Ajax.ServiceEnums.Flight:return"Service/Flight.aspx";case SF.Ajax.ServiceEnums.Hotel:return"Service/Hotel.aspx";case SF.Ajax.ServiceEnums.System:return"Service/System.aspx";case SF.Ajax.ServiceEnums.Car:return"Service/Car.aspx";default:return""}};this.CallService=function(a,b,c,e,d){a=
this.GetServiceUrl(a)+"?method="+b+"&dummy="+(new Date).getTime();null==c&&(c="");c=SF.Tools.Base64.encode(c);try{$.ajax({type:"POST",beforeSend:function(a){a.setRequestHeader("clientsession","user")},url:a+"&hash="+SHA1(a),data:c,async:!0,processData:!1,contenttype:"application/json; charset=utf-8",success:function(a){if("RollBackServiceError"==a||"UnhandledException"==a)SF.System.SearchManager.SearchProcessing=!1,SF.Tools.IsFunction(d)&&d();else try{SF.Tools.IsNull(a.TransactionId)||SF.Logger.SetTransactionId(a.TransactionId),
SF.Ajax.CheckServiceResponse(a,function(a){SF.Tools.IsNull(a)||e(a)},d)}catch(b){SF.Tools.IsFunction(d)&&d()}},error:function(){SF.System.SearchManager.SearchProcessing=!1;SF.Tools.IsFunction(d)&&d()}})}catch(f){SF.System.SearchManager.SearchProcessing=!1}};this.GetHtml=function(a,b){$.get(a,function(a){b(a)})};this.CheckServiceResponse=function(a,b,c){if(!SF.Tools.IsNull(a)&&!SF.Tools.IsNull(a.ResponseType))if("Exception"==a.ResponseType)switch(a.Key){case "SessionTimeout":SF.GUI.PopUpControl.Close();
setTimeout(function(){SF.System.SearchManager.SearchProcessing=!1;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!0;SF.GUI.PopUpControl.Buttons.OkButton.OnClick=function(){parent.window.location.reload()};SF.GUI.PopUpControl.ShowMessage(a.Message);b()},1E3);break;case "UnhandledError":SF.GUI.PopUpControl.Close();setTimeout(function(){SF.System.SearchManager.SearchProcessing=!1;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!0;SF.GUI.PopUpControl.Buttons.OkButton.OnClick=function(){parent.window.location.reload()};
SF.GUI.PopUpControl.ShowMessage(a.Message);b()},1E3);break;case "RequiredMemberAuthentication":SF.GUI.PopUpControl.Close();setTimeout(function(){SF.System.SearchManager.SearchProcessing=!1;SF.Membership.SignOut();b()},1E3);break;default:SF.GUI.PopUpControl.ShowMessage(a.Message)}else b(a);else if("UnhandledException"==a){if(SF.GUI.PopUpControl.Close(),SF.Tools.IsFunction(c))SF.System.SearchManager.SearchProcessing=!1,SF.GUI.PopUpControl.ShowMessage(a),c()}else"SessionTimeout"==a?(SF.GUI.PopUpControl.Close(),
setTimeout(function(){SF.System.SearchManager.SearchProcessing=!1;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!0;SF.GUI.PopUpControl.Buttons.OkButton.OnClick=function(){parent.window.location.reload()};SF.GUI.PopUpControl.ShowMessage("Message_SessionTimeout".Localize());b()},1E3)):"RequiredMemberAuthentication"==a?(SF.GUI.PopUpControl.Close(),setTimeout(function(){SF.System.SearchManager.SearchProcessing=!1;SF.Membership.SignOut();b()},1E3)):b(a)}};
NameSpace.prototype.Basket=new function(){this.BasketType=null;this.GetBasketType=function(){if(null==this.BasketType)if(null!=this.HotelBasket.SelectedHotelRoom&&null==this.FlightBasket.SelectedOption.Item)this.BasketType=this.BasketTypeEnum.InternationalFlight;else if(null==this.HotelBasket.SelectedHotelRoom&&null!=this.FlightBasket.SelectedOption.Item)this.BasketType=this.BasketTypeEnum.Hotel;return this.BasketType};this.BasketTypeEnum={Hotel:0,InternationalFlight:1,DomesticFlight:2,Car:3};this.HasItem=
function(){return null!=SF.Basket.HotelBasket.SelectedHotelRoom.Item?!0:null!=SF.Basket.FlightBasket.SelectedOption.Item?!0:null!=SF.Basket.CarBasket.SelectedVehicle.Item?!0:!1};this.TerminatePayment=!1;this.GetBasketTotalFare=function(){var a=0;switch(SF.Basket.BasketType){case SF.Basket.BasketTypeEnum.InternationalFlight:null!=SF.Basket.FlightBasket.SelectedOption.Item&&(a+=SF.Basket.FlightBasket.SelectedOption.Item.TotalFareWithServiceFee.Amount);break;case SF.Basket.BasketTypeEnum.DomesticFlight:null!=
SF.Basket.FlightBasket.SelectedOption.Item&&(a+=SF.Basket.FlightBasket.SelectedOption.Item.TotalFareWithServiceFee.Amount);break;case SF.Basket.BasketTypeEnum.Hotel:null!=SF.Basket.HotelBasket.SelectedHotelRoom.Item&&(a+=SF.Basket.FlightBasket.SelectedHotelRoom.Item.Amount);break;case SF.Basket.BasketTypeEnum.Car:null!=SF.Basket.CarBasket.SelectedVehicle.Item&&(a+=SF.Basket.CarBasket.SelectedVehicle.Item.TotalFareWithServiceFee.Amount);break;default:return 0}return a};this.CarBasket=new function(){this.Currency=
null;this.IsCardPopUpOpened=this.Is3dSecurePopUpOpened=!1;this.SelectedVehicle={Item:null,Recommendation:null};this.AddVehicleToBasket=function(a,b){SF.Basket.CarBasket.SelectedVehicle.Item=null;SF.Basket.CarBasket.SelectedVehicle.Recommendation=null;for(var c=0;c<SF.Car.CarSearchResult.Results.length;c++)if(SF.Car.CarSearchResult.Results[c].Id==a){SF.Basket.CarBasket.SelectedVehicle.Recommendation=SF.Car.CarSearchResult.Results[c];break}null==SF.Basket.CarBasket.SelectedVehicle.Recommendation?SF.GUI.PopUpControl.ShowMessage("Message_IncorrectCarInfo".Localize()):
SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.AddToBasket,"RecommendationId="+a+"&VehicleId="+b,function(a){if(a.ResponseType==SF.Ajax.ServiceResponseType.Validation)SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home);else if(a.ResponseType==SF.Ajax.ServiceResponseType.Result){if(!SF.Tools.IsNull(a))SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Basket),SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Basket,
!1),SF.Basket.CarBasket.SelectedVehicle.Item=a.Result,SF.Basket.BasketType=SF.Basket.BasketTypeEnum.Car,SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Basket,null,function(){SF.Templates.ProcessTemplate("#bskBasket","Templates/Basket/CarBasketSummary",null,function(){SF.Templates.ProcessTemplate("#bskLoad","Templates/Basket/CarBasket",SF.Basket.CarBasket.SelectedVehicle,function(){SF.GUI.BodyControl.Resize()})})},null,!0)}else SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result)})};
this.EmptyCarBasket=function(){try{SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.EmptyCarBasket,null,function(){SF.Basket.CarBasket.SelectedVehicle.Item=null;SF.Basket.CarBasket.SelectedVehicle.Recommendation=null;SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1,null,null);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.GUI.BodyControl.Resize()})})}catch(a){SF.Logger.SaveException(a,"EmptyBasket")}};this.ContinueReservation=function(){if(SF.Basket.BasketType==
SF.Basket.BasketTypeEnum.Car)if(SF.Membership.IsLoggedIn())SF.Basket.CarBasket.ShowPassengerPage();else{var a=SF.System.Rules.GetRule("AskAnonymousUserToChooseMembershipPreference");null!=a&&("True"==a.RuleValue||!0==a.RuleValue)?(SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1,SF.Templates.ProcessTemplate("#temp","Templates/Membership/MemberReservationPreference",null,function(){SF.GUI.PopUpControl.ShowMessage($("#temp").html());$("#temp").html("");SF.Membership.OnPostLogin=function(){SF.Basket.CarBasket.ShowPassengerPage()};
$("#MembershipReservationPreference :button").live("click",function(){var a=$("input[name=rbMembershipPreference]:checked").val();SF.GUI.PopUpControl.Close();switch(a){case "Continue":SF.Basket.CarBasket.ShowPassengerPage();break;case "LogIn":case "SignUp":$("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),SF.Membership.OnPostLogin=function(){SF.Basket.CarBasket.ShowPassengerPage()}}})})):($("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),
SF.Membership.OnPostLogin=function(){SF.Basket.CarBasket.ShowPassengerPage()})}};this.ShowPassengerPage=function(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Passenger);SF.Car.Session.GetSession(function(){SF.Templates.ProcessTemplate("#psg","Templates/Car/Passenger",null,function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Passenger,null,function(){SF.Membership.IsLoggedIn()&&($("#txtFirstName").val(SF.Membership.CurrentMember.Data.FirstName),$("#txtMiddleName").val(SF.Membership.CurrentMember.Data.MiddleName),
$("#txtSurname").val(SF.Membership.CurrentMember.Data.Surname),$("#txtBirthDate").val(SF.TypeOperations.SFCalendar(SF.Membership.CurrentMember.Data.MemberDetail.BirthDate,"dd/MM/yyyy")),$("#txtEMail").val(SF.Membership.CurrentMember.Data.Email),$("#txtGSMNumber").val(SF.Membership.CurrentMember.Data.MemberDetail.ContactMobilePhoneNumber),$("#txtPhoneNumber").val(SF.Membership.CurrentMember.Data.MemberDetail.ContactHomePhoneNumber));SF.GUI.BodyControl.Resize()},!1,!0)})})};this.GetPassengerData=function(a){try{SF.Validation.ValidationCheck("CarPassengers",
function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.GetCarPassengerData,$("#CarPassengers *").serialize(),function(b){b.ResponseType==SF.Ajax.ServiceResponseType.Validation?SF.Validation.ShowValidationErrors(b.ValidationResults):SF.Tools.IsFunction(a)?a():SF.Basket.CarBasket.ShowBookingPage()})})}catch(b){SF.Logger.SaveException(b,"CarPassengerSubmit.click")}};this.ShowBookingPage=function(){try{SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment),SF.Car.Session.GetSession(function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Payment,
function(){this.AllowResize=!1},function(){SF.System.Payment.BillingInformation.BindBillingData();SF.System.Payment.CalculatePricedItemTable();this.AllowResize=!0;SF.GUI.BodyControl.Resize()},!1,!0,!1)})}catch(a){SF.Logger.SaveException(a,"ShowBookingPage")}return!1};this.ProcessCarBooking=function(){SF.GUI.PopUpControl.Close();if(!1==$("#chkRuleAccepted").attr("checked"))SF.GUI.PopUpControl.ShowMessage("Message_ApproveTermsAndConditionsValidation".Localize());else{var a="";SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment,
null,"#tempnodepayment");SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.BookCar,$("#divBooking *").serialize(),function(b){if("string"!=typeof b&&0<b.length)SF.Validation.ShowValidationErrors(Errors);else if(a=b,"summary"==a||"Prebooked"==a||"Eticketed"==a)SF.Membership.IsLoggedIn()&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1),SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,
!1,null,null)});else if("UnableToSell"==a)SF.GUI.PopUpControl.ShowMessage("Message_CarUnableToSell".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("Error"==a)SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("WaitingPriceChargeApproval"==a){if(!1==SF.Basket.CarBasket.IsCardPopUpOpened)SF.Basket.CarBasket.IsCardPopUpOpened=!0,SF.Basket.OpenPayment(),setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},
1E4)}else'"CompletePayment"'==a||"CompletePayment"==a?SF.Basket.CarBasket.CompletePayment():"WaitingPriceChangeApproval"==a?SF.Basket.CarBasket.PriceChangeProcess():(SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment))})}};this.ApprovePriceChange=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.ApprovePriceChange,null,function(b){SF.Tools.IsFunction(a)&&a(b)})};this.PriceChangeProcess=
function(){SF.System.Payment.CalculatePricedItemTable(new function(){var a=$("#divPricedItemTable").html(),a="Message_PriceChangeAlert".Localize()+"<br/>"+a;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1;SF.GUI.PopUpControl.Buttons.YesButton.Visible=!0;SF.GUI.PopUpControl.Buttons.YesButton.OnClick=function(){SF.Basket.CarBasket.ApprovePriceChange(function(a){"BookingWithPriceChange"==a?SF.Basket.CarBasket.ProcessCarBooking():(SF.GUI.PopUpControl.Close(),setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},
1E4))})};SF.GUI.PopUpControl.Buttons.NoButton.Visible=!0;SF.GUI.PopUpControl.Buttons.NoButton.OnClick=function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);SF.GUI.PopUpControl.Close()};SF.GUI.PopUpControl.ShowMessage(a,!1,!0)},null,!0)};this.PaymentAttempt=0;this.MaximumPaymentAttempt=150;this.ClearPaymentProcess=function(a,b,c){SF.Basket.TerminatePayment=!1;SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.PaymentLock,null,function(){SF.Basket.CarBasket.PaymentAttempt=
0;SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);(SF.Tools.IsNull(c)||!1!=c)&&SF.GUI.PopUpControl.Close();SF.GUI.PopUpControl.CloseWindow();SF.Tools.IsNull(a)||SF.GUI.PopUpControl.ShowMessage(a);SF.Tools.IsFunction(b)&&b()})};this.CompletePayment=function(){if(SF.Basket.CarBasket.PaymentAttempt>=SF.Basket.CarBasket.MaximumPaymentAttempt||!0==SF.Basket.TerminatePayment){var a="",a=!0==SF.Basket.TerminatePayment?"\u00d6deme ekran\u0131 i\u015flem tamamlanmadan kapat\u0131ld\u0131.".Localize():
"Message_PaymentProcessTimeout".Localize()+" "+"Message_PleaseTryAgain".Localize();this.ClearPaymentProcess(a)}else SF.Basket.CarBasket.PaymentAttempt++,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.CompleteBooking,null,function(a){if("BookingWithPaymentCompleted"==a)SF.Basket.CarBasket.PaymentAttempt=0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnrData,null,function(a){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,
!1);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){var b={};b.SelectedCar=a.SelectedCar;b.CarSearchInfo=a.SelectedCar.SearchCriteria;b.SelectedVehicle=a.SelectedVehicle;SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Car/CarPnr",b,function(){$("body").scrollTo(SF.GUI.BodyControl.Tabs.Summary.Container,500);SF.GUI.BodyControl.Resize()})})});else if("NotAllowedCreditCard"==a)SF.Basket.CarBasket.ClearPaymentProcess("Message_NotAllowedCreditCard".Localize());else if("UnableToSell"==
a)SF.Basket.CarBasket.ClearPaymentProcess("Message_CarUnableToSell".Localize());else if("WaitingPriceChargeApproval"==a||"3dProcessStarted"==a)setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},1E3);else if("PaymentError"==a||"PaymentException"==a)SF.Basket.CarBasket.ClearPaymentProcess("Message_PaymentError".Localize());else if("PaymentDeclined"==a)SF.Basket.CarBasket.ClearPaymentProcess("Message_PaymentDeclined".Localize());else if("3dSecureProcess"==a){if(!SF.Basket.CarBasket.Is3dSecurePopUpOpened)SF.Basket.CarBasket.Is3dSecurePopUpOpened=
!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.Get3dProcessResult,"result=3dProcessStarted",function(a){"success"==a?(SF.Basket.CarBasket.Is3dSecurePopUpOpened=!1,SF.GUI.PopUpControl.OpenWindow("3dSecureProcess.aspx",800,500),setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},1E4)):(SF.GUI.PopUpControl.ShowMessage("Message_InvalidOperation".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment),SF.Basket.CarBasket.Is3dSecurePopUpOpened=
!1)})}else"3dProcessClosed"==a?(SF.GUI.PopUpControl.Close(),SF.GUI.PopUpControl.CloseWindow(),setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},5E3)):"3dSecureProcessing"==a?(SF.Basket.CarBasket.PaymentAttempt++,setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},5E3)):"3dSecureApproved"==a?(setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},1E3),SF.GUI.PopUpControl.CloseWindow()):"3dSecureError"==a||"3dSecureDeclined"==a?(SF.Basket.CarBasket.ClearPaymentProcess("Message_3dSecureError".Localize()),
SF.GUI.PopUpControl.Close(),SF.GUI.PopUpControl.CloseWindow()):"BookingError"==a?SF.Basket.CarBasket.ClearPaymentProcess("Message_ErrorOccured".Localize()):"WaitingPriceChangeApproval"==a?SF.Basket.CarBasket.PriceChangeProcess():"PriceChargedBookingError"==a?SF.Basket.CarBasket.ClearPaymentProcess("Message_PricedChargedBookingError".Localize()):"InvalidCreditCard"==a?SF.Basket.CarBasket.ClearPaymentProcess("Message_InvalidCreditCard".Localize()):"InvalidFFC"==a?SF.Basket.CarBasket.ClearPaymentProcess("Message_InvalidFFC".Localize()):
"M_PaymentErrorMessage"==a?SF.Basket.CarBasket.ClearPaymentProcess("M_PaymentErrorMessage".Localize()):!SF.Tools.IsNull(a.ResponseType)&&a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.Basket.CarBasket.ClearPaymentProcess(null,null,!1)):setTimeout(function(){SF.Basket.CarBasket.CompletePayment()},1E3)})};$(".CarPassengerCombobox").live("change",function(){var a=$(this).closest(".psg-all"),b=$(this).val();
$(a).find("input:text, select, textarea").not(".PassengerCombobox").val("");$(a).find("input:checkbox").attr("checked","");for(var c=0;c<SF.Membership.CurrentMember.Data.MemberDetail.PassengerList.length;c++){var d=SF.Membership.CurrentMember.Data.MemberDetail.PassengerList[c];if(d.Id==b){$(a).find(".FirstName").val(d.FirstName);$(a).find(".MiddleName").val(d.MiddleName);$(a).find(".Surname").val(d.Surname);$(a).find(".BirthDate").val(SF.TypeOperations.SFCalendar(d.BirthDate,"dd/MM/yyyy"));$(a).find(".PassengerTitle").val(d.Title);
break}}});$("#btnCarCompleteBooking").live("click",function(){SF.Basket.CarBasket.ProcessCarBooking()})};this.HotelBasket=new function(){this.Currency=null;this.IsCardPopUpOpened=this.Is3dSecurePopUpOpened=!1;this.SelectedHotelRoom={Item:null,Recommendation:null};this.AddHotelRoomToBasket=function(a,b){for(var c=0;c<SF.Hotel.HotelSearchResult.Results.length;c++)if(SF.Hotel.HotelSearchResult.Results[c].Id==a){SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation=SF.Hotel.HotelSearchResult.Results[c];
break}null==SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation?SF.GUI.PopUpControl.ShowMessage("Message_IncorrectHotelInfo".Localize()):SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,SF.Ajax.ServiceMethods.Hotel.AddToBasket,"RoomId="+b+"&HotelId="+a,function(a){if(a.ResponseType==SF.Ajax.ServiceResponseType.Validation)SF.Validation.ShowValidationErrors(a.ValidationResults);else if(a.ResponseType==SF.Ajax.ServiceResponseType.Result&&!SF.Tools.IsNull(a))SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Basket),
SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Basket,!1),SF.Basket.HotelBasket.SelectedHotelRoom.Item=a.Result,SF.Basket.BasketType=SF.Basket.BasketTypeEnum.Hotel,SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Basket,null,function(){SF.Templates.ProcessTemplate("#bskBasket","Templates/Basket/HotelBasketSummary",null,function(){SF.Templates.ProcessTemplate("#bskLoad","Templates/Basket/HotelBasket",SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation,function(){SF.Templates.ProcessTemplate("#BasketHotelDetail",
"Templates/Hotel/HotelDetail",SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation,function(){hgallery();SF.GUI.BodyControl.Resize();setTimeout(function(){SF.GUI.BodyControl.Resize()},500)})})})},null,!0)},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result)})};this.EmptyHotelBasket=function(){try{SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,SF.Ajax.ServiceMethods.Hotel.EmptyHotelBasket,null,function(){SF.Basket.HotelBasket.SelectedHotelRoom.Item=null;SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation=
null;SF.Basket.HotelBasket.SelectedHotelRoom.IsDomestic=null;SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1,null,null);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.GUI.BodyControl.Resize()})})}catch(a){SF.Logger.SaveException(a,"EmptyBasket")}};this.ContinueReservation=function(){if(SF.Basket.BasketType==SF.Basket.BasketTypeEnum.Hotel)if(SF.Membership.IsLoggedIn())SF.Basket.HotelBasket.ShowPassengerPage();else{var a=SF.System.Rules.GetRule("AskAnonymousUserToChooseMembershipPreference");
null!=a&&("True"==a.RuleValue||!0==a.RuleValue)?(SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1,SF.Templates.ProcessTemplate("#temp","Templates/Membership/MemberReservationPreference",null,function(){SF.GUI.PopUpControl.ShowMessage($("#temp").html());$("#temp").html("");SF.Membership.OnPostLogin=function(){SF.Basket.HotelBasket.ShowPassengerPage()};$("#MembershipReservationPreference :button").live("click",function(){var a=$("input[name=rbMembershipPreference]:checked").val();SF.GUI.PopUpControl.Close();
switch(a){case "Continue":SF.Basket.HotelBasket.ShowPassengerPage();break;case "LogIn":case "SignUp":$("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),SF.Membership.OnPostLogin=function(){SF.Basket.HotelBasket.ShowPassengerPage()}}})})):($("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),SF.Membership.OnPostLogin=function(){SF.Basket.HotelBasket.ShowPassengerPage()})}};this.ShowPassengerPage=function(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Passenger);
SF.Hotel.Session.GetSession(function(){SF.Templates.ProcessTemplate("#psg","Templates/Hotel/Passenger",null,function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Passenger,null,function(){SF.Membership.IsLoggedIn()&&($("#txtFirstName_1").val(SF.Membership.CurrentMember.Data.FirstName),$("#txtMiddleName_1").val(SF.Membership.CurrentMember.Data.MiddleName),$("#txtSurname_1").val(SF.Membership.CurrentMember.Data.Surname),$("#txtBirthDate_1").val(SF.TypeOperations.SFCalendar(SF.Membership.CurrentMember.Data.MemberDetail.BirthDate,
"dd/MM/yyyy")),$("#txtEMail_1").val(SF.Membership.CurrentMember.Data.Email),$("#txtGSMNumber_1").val(SF.Membership.CurrentMember.Data.MemberDetail.ContactMobilePhoneNumber),$("#txtPhoneNumber_1").val(SF.Membership.CurrentMember.Data.MemberDetail.ContactHomePhoneNumber));SF.GUI.BodyControl.Resize()},!1,!0)})})};this.GetPassengerData=function(a){try{SF.Validation.ValidationCheck("HotelPassengers",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,SF.Ajax.ServiceMethods.Hotel.GetHotelPassengerData,
$("#HotelPassengers *").serialize(),function(b){b.ResponseType==SF.Ajax.ServiceResponseType.Validation?SF.Validation.ShowValidationErrors(b.ValidationResults):SF.Tools.IsFunction(a)?a():SF.Basket.HotelBasket.ShowBookingPage()})})}catch(b){SF.Logger.SaveException(b,"HotelPassengerSubmit.click")}};this.ShowBookingPage=function(){try{SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment),SF.Hotel.Session.GetSession(function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Payment,function(){this.AllowResize=
!1},function(){SF.System.Payment.CalculatePricedItemTable(function(){SF.System.Payment.BillingInformation.BindBillingData();this.AllowResize=!0;SF.GUI.BodyControl.Resize()})},!1,!0,!1)})}catch(a){SF.Logger.SaveException(a,"ShowBookingPage")}return!1};this.ApprovePriceChange=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.ApprovePriceChange,null,function(b){SF.Tools.IsFunction(a)&&a(b)})};this.PriceChangeProcess=function(){SF.System.Payment.CalculatePricedItemTable(new function(){var a=
$("#divPricedItemTable").html(),a="Message_PriceChangeAlert".Localize()+"<br/>"+a;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1;SF.GUI.PopUpControl.Buttons.YesButton.Visible=!0;SF.GUI.PopUpControl.Buttons.YesButton.OnClick=function(){SF.Basket.HotelBasket.ApprovePriceChange(function(a){"BookingWithPriceChange"==a?SF.Basket.HotelBasket.ProcessHotelBooking():(SF.GUI.PopUpControl.Close(),setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E4))})};SF.GUI.PopUpControl.Buttons.NoButton.Visible=
!0;SF.GUI.PopUpControl.Buttons.NoButton.OnClick=function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);SF.GUI.PopUpControl.Close()};SF.GUI.PopUpControl.ShowMessage(a,!1,!0)},null,!0)};this.PaymentAttempt=0;this.MaximumPaymentAttempt=150;this.ClearPaymentProcess=function(a,b,c){SF.Basket.TerminatePayment=!1;SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.PaymentLock,null,function(){SF.Basket.HotelBasket.PaymentAttempt=0;SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);
(SF.Tools.IsNull(c)||!1!=c)&&SF.GUI.PopUpControl.Close();SF.GUI.PopUpControl.CloseWindow();SF.Tools.IsNull(a)||SF.GUI.PopUpControl.ShowMessage(a);SF.Tools.IsFunction(b)&&b()})};this.CompletePayment=function(){if(SF.Basket.HotelBasket.PaymentAttempt>=SF.Basket.HotelBasket.MaximumPaymentAttempt||!0==SF.Basket.TerminatePayment){var a="",a=!0==SF.Basket.TerminatePayment?"\u00d6deme ekran\u0131 i\u015flem tamamlanmadan kapat\u0131ld\u0131.".Localize():"Message_PaymentProcessTimeout".Localize()+" "+"Message_PleaseTryAgain".Localize();
this.ClearPaymentProcess(a)}else SF.Basket.HotelBasket.PaymentAttempt++,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.CompleteBooking,null,function(a){if("BookingWithPaymentCompleted"==a)SF.Basket.HotelBasket.PaymentAttempt=0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnrData,null,function(a){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){var b=
{};b.SelectedHotel=a.SelectedHotel;b.SelectedRoom=a.SelectedRoom;SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Hotel/HotelPnr",b,function(){$("body").scrollTo(SF.GUI.BodyControl.Tabs.Summary.Container,500);SF.GUI.BodyControl.Resize()})})});else if("NotAllowedCreditCard"==a)SF.Basket.HotelBasket.ClearPaymentProcess("Message_NotAllowedCreditCard".Localize());else if("UnableToSell"==a)SF.Basket.HotelBasket.ClearPaymentProcess("Message_HotelUnableToSell".Localize());else if("WaitingPriceChargeApproval"==
a||"3dProcessStarted"==a)setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E3);else if("PaymentError"==a||"PaymentException"==a)SF.Basket.HotelBasket.ClearPaymentProcess("Message_PaymentError".Localize());else if("PaymentDeclined"==a)SF.Basket.HotelBasket.ClearPaymentProcess("Message_PaymentDeclined".Localize());else if("3dSecureProcess"==a){if(!SF.Basket.HotelBasket.Is3dSecurePopUpOpened)SF.Basket.HotelBasket.Is3dSecurePopUpOpened=!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,
SF.Ajax.ServiceMethods.System.Get3dProcessResult,"result=3dProcessStarted",function(a){"success"==a?(SF.Basket.HotelBasket.Is3dSecurePopUpOpened=!1,SF.GUI.PopUpControl.OpenWindow("3dSecureProcess.aspx",800,500),setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E4)):(SF.GUI.PopUpControl.ShowMessage("Message_InvalidOperation".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment),SF.Basket.HotelBasket.Is3dSecurePopUpOpened=!1)})}else"3dProcessClosed"==a?(SF.GUI.PopUpControl.Close(),
SF.GUI.PopUpControl.CloseWindow(),setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},5E3)):"3dSecureProcessing"==a?(SF.Basket.HotelBasket.PaymentAttempt++,setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},5E3)):"3dSecureApproved"==a?(setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E3),SF.GUI.PopUpControl.CloseWindow()):"3dSecureError"==a||"3dSecureDeclined"==a?(SF.Basket.HotelBasket.ClearPaymentProcess("Message_3dSecureError".Localize()),SF.GUI.PopUpControl.Close(),
SF.GUI.PopUpControl.CloseWindow()):"BookingError"==a?SF.Basket.HotelBasket.ClearPaymentProcess("Message_ErrorOccured".Localize()):"WaitingPriceChangeApproval"==a?SF.Basket.HotelBasket.PriceChangeProcess():"PriceChargedBookingError"==a?SF.Basket.HotelBasket.ClearPaymentProcess("Message_PricedChargedBookingError".Localize()):"InvalidCreditCard"==a?SF.Basket.HotelBasket.ClearPaymentProcess("Message_InvalidCreditCard".Localize()):"InvalidFFC"==a?SF.Basket.HotelBasket.ClearPaymentProcess("Message_InvalidFFC".Localize()):
"M_PaymentErrorMessage"==a?SF.Basket.HotelBasket.ClearPaymentProcess("M_PaymentErrorMessage".Localize()):!SF.Tools.IsNull(a.ResponseType)&&a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.Basket.HotelBasket.ClearPaymentProcess(null,null,!1)):setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E3)})};this.ProcessHotelBooking=function(){SF.GUI.PopUpControl.Close();if(!1==$("#chkRuleAccepted").attr("checked"))SF.GUI.PopUpControl.ShowMessage("Message_ApproveTermsAndConditionsValidation".Localize());
else{var a="";SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment,null,"#tempnodepayment");SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,SF.Ajax.ServiceMethods.Hotel.BookHotel,$("#divBooking *").serialize(),function(b){if("string"!=typeof b&&0<b.length)SF.Validation.ShowValidationErrors(Errors);else if(a=b,"summary"==a||"Prebooked"==a||"Eticketed"==a)SF.Membership.IsLoggedIn()&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1),SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,
null,function(){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1,null,null)});else if("UnableToSell"==a)SF.GUI.PopUpControl.ShowMessage("Message_HotelUnableToSell".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("Error"==a)SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("WaitingPriceChargeApproval"==a){if(!1==SF.Basket.HotelBasket.IsCardPopUpOpened)SF.Basket.HotelBasket.IsCardPopUpOpened=
!0,SF.Basket.OpenPayment(),setTimeout(function(){SF.Basket.HotelBasket.CompletePayment()},1E4)}else'"CompletePayment"'==a||"CompletePayment"==a?SF.Basket.HotelBasket.CompletePayment():"WaitingPriceChangeApproval"==a?SF.Basket.HotelBasket.PriceChangeProcess():(SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment))})}};$(".HotelPassengerCombobox").live("change",function(){var a=$(this).closest(".psg-all"),b=$(this).val();
$(a).find("input:text, select, textarea").not(".PassengerCombobox").val("");$(a).find("input:checkbox").attr("checked","");$(a).find(".BaggageCount").val("0");for(var c=0;c<SF.Membership.CurrentMember.Data.MemberDetail.PassengerList.length;c++){var d=SF.Membership.CurrentMember.Data.MemberDetail.PassengerList[c];if(d.Id==b){$(a).find(".FirstName").val(d.FirstName);$(a).find(".MiddleName").val(d.MiddleName);$(a).find(".Surname").val(d.Surname);$(a).find(".BirthDate").val(SF.TypeOperations.SFCalendar(d.BirthDate,
"dd/MM/yyyy"));$(a).find(".PassengerTitle").val(d.Title);break}}});$("#btnHotelCompleteBooking").live("click",function(){SF.Basket.HotelBasket.ProcessHotelBooking()})};this.FlightBasket=new function(){this.Currency=null;this.IsCardPopUpOpened=this.Is3dSecurePopUpOpened=!1;this.BookingType=0;this.SelectedOption={Candidate:null,Item:null,Recommendation:null,IsDomestic:null,GetTotalFare:function(){}};this.EmptyFlightBasket=function(){try{SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.EmptyFlightBasket,
null,function(){SF.Basket.FlightBasket.SelectedOption.Candidate=null;SF.Basket.FlightBasket.SelectedOption.Item=null;SF.Basket.FlightBasket.SelectedOption.Recommendation=null;SF.Basket.FlightBasket.SelectedOption.IsDomestic=null;SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1,null,null);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.GUI.BodyControl.Resize()},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Basket);SF.System.Error()})})}catch(a){SF.Logger.SaveException(a,
"EmptyBasket")}};this.AddDomesticFlightToBasket=function(){try{null==SF.Basket.FlightBasket.SelectedOption.Candidate?SF.GUI.PopUpControl.ShowMessage("Message_PleaseChooseFlight".Localize()):(SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Basket),SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Basket,!1),SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.AddFlightOptionToBasket,"oid="+SF.Basket.FlightBasket.SelectedOption.Candidate.Id,function(a){a.ResponseType==
SF.Ajax.ServiceResponseType.Result?(SF.Basket.FlightBasket.SelectedOption.Item=a.Result,SF.Basket.FlightBasket.SelectedOption.Candidate=a.Result,SF.Basket.BasketType=SF.Basket.BasketTypeEnum.InternationalFlight,SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Basket,null,function(){SF.Templates.ProcessTemplate("#bskBasket","Templates/Basket/FlightBasketSummary",null,function(){SF.Templates.ProcessTemplate("#bskLoad","Templates/Basket/FlightBasket",SF.Basket.FlightBasket.SelectedOption.Item,function(){SF.GUI.BodyControl.Resize()})})},
null,!0)):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length&&(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Basket,!1))},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result);SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Basket,!1);SF.System.Error()}),SF.Basket.FlightBasket.SelectedOption.Candidate=
null)}catch(a){SF.Logger.SaveException(a,"AddBasket")}};this.AddInternationalFlightToBasket=function(a){try{for(var b=!1,c=0;c<SF.Flight.FlightSearchResult.Results.length;c++)if(SF.Flight.FlightSearchResult.Results[c].Id==a){var d=[],g=0;$("#rslFlightItems ."+a).find(".frs-depret").each(function(){d[d.length]=$(this).find("input[name='"+g+"']:checked").attr("id");g++});for(var e=0;e<SF.Flight.FlightSearchResult.Results[c].Options.length;e++){for(var h=!0,f=0;f<SF.Flight.FlightSearchResult.Results[c].Options[e].Itineraries.length;f++)if(SF.Flight.FlightSearchResult.Results[c].Options[e].Itineraries[f].Id!=
d[f]){h=!1;break}if(!0==h){SF.Basket.FlightBasket.SelectedOption.Candidate=SF.Flight.FlightSearchResult.Results[c].Options[e];SF.Basket.FlightBasket.SelectedOption.Recommendation=SF.Flight.FlightSearchResult.Results[c];SF.Basket.FlightBasket.Currency=SF.Basket.FlightBasket.SelectedOption.Recommendation.Currency;SF.Basket.BasketType=SF.Basket.BasketTypeEnum.InternationalFlight;b=!0;break}}if(!0==b)break}b?(SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Basket),SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,
SF.Ajax.ServiceMethods.Flight.AddFlightOptionToBasket,"oid="+SF.Basket.FlightBasket.SelectedOption.Candidate.Id,function(a){a.ResponseType==SF.Ajax.ServiceResponseType.Result?(SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Basket,!1),SF.Basket.FlightBasket.SelectedOption.Item=a.Result,SF.Basket.FlightBasket.SelectedOption.Candidate=null,SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Basket,null,function(){SF.Templates.ProcessTemplate("#bskBasket","Templates/Basket/FlightBasketSummary",
null,function(){SF.Templates.ProcessTemplate("#bskLoad","Templates/Basket/FlightBasket",SF.Basket.FlightBasket.SelectedOption.Item,function(){SF.GUI.BodyControl.Resize()})})},null,!0)):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length&&(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Basket,!1))},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Result);
SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Basket,!1);SF.System.Error()})):SF.GUI.PopUpControl.ShowMessage("Message_PleaseChooseFlight".Localize())}catch(i){SF.Logger.SaveException(i,"AddToBasket")}};this.ContinueReservation=function(){if(SF.Basket.BasketType==SF.Basket.BasketTypeEnum.InternationalFlight||SF.Basket.BasketType==SF.Basket.BasketTypeEnum.DomesticFlight)if(SF.Membership.IsLoggedIn())SF.Basket.FlightBasket.ShowPassengerPage();else{SF.System.Rules.GetRule("IsAnonymousReservationAllowed");
var a=SF.System.Rules.GetRule("AskAnonymousUserToChooseMembershipPreference");null!=a&&("True"==a.RuleValue||!0==a.RuleValue)?(SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1,SF.Templates.ProcessTemplate("#temp","Templates/Membership/MemberReservationPreference",null,function(){SF.GUI.PopUpControl.ShowMessage($("#temp").html());$("#temp").html("");SF.Membership.OnPostLogin=function(){SF.Basket.FlightBasket.ShowPassengerPage()};$("#MembershipReservationPreference :button").live("click",function(){var a=
$("input[name=rbMembershipPreference]:checked").val();SF.GUI.PopUpControl.Close();switch(a){case "Continue":SF.Basket.FlightBasket.ShowPassengerPage();break;case "LogIn":case "SignUp":$("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),SF.Membership.OnPostLogin=function(){SF.Basket.FlightBasket.ShowPassengerPage()}}})})):($("body").scrollTo(".ct",500),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login),SF.Membership.OnPostLogin=function(){SF.Basket.FlightBasket.ShowPassengerPage()})}};
this.ShowPassengerPage=function(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Passenger);SF.Flight.Session.GetSession(function(){SF.Flight.MasterData.ParameterDetails.Get(function(){SF.Flight.MasterData.FrequentFlyerList.Get(function(){SF.Templates.ProcessTemplate("#psg","Templates/Flight/Passenger",null,function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Passenger,null,function(){if(SF.Membership.IsLoggedIn()&&("ERetailWebFareProvider"==SF.Basket.FlightBasket.SelectedOption.Item.ProviderTypeString||
"TravelFusionProvider"==SF.Basket.FlightBasket.SelectedOption.Item.ProviderTypeString))$("#txtPassportNumber_"+SF.Flight.Helpers.GetPassengerCodeText(0)+"_0").val(SF.Membership.CurrentMember.Data.MemberDetail.PassportNumber),$("#txtPassportExpireDate_"+SF.Flight.Helpers.GetPassengerCodeText(0)+"_0").val(SF.TypeOperations.SFCalendar(SF.Membership.CurrentMember.Data.MemberDetail.PassportExpiry,"dd/MM/yyyy")),$("#ddlPassportCountry_"+SF.Flight.Helpers.GetPassengerCodeText(0)+"_0").val(SF.Membership.CurrentMember.Data.MemberDetail.PassportCountry);
SF.GUI.BodyControl.Resize()},!1,!0)})})})})};this.GetPassengerData=function(){try{!0==SF.Validation.ValidationCheck("FlightPassengers")&&SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetFlightPassengerData,$("#FlightPassengers *").serialize(),function(a){a.ResponseType==SF.Ajax.ServiceResponseType.Validation?SF.Validation.ShowValidationErrors(a.ValidationResults):SF.Basket.FlightBasket.ShowBookingPage()})}catch(a){SF.Logger.SaveException(a,"FlightPassengerSubmit.click")}};
this.ShowBookingPage=function(){try{SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment),SF.Flight.Session.GetSession(function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Payment,function(){this.AllowResize=!1},function(){SF.System.Payment.BillingInformation.BindBillingData();SF.System.Payment.ReservationType.ActivateReservationTypeControl(0);SF.System.Payment.CalculatePricedItemTable();this.AllowResize=!0;SF.GUI.BodyControl.Resize()})})}catch(a){SF.Logger.SaveException(a,"ShowBookingPage")}return!1};
this.ApprovePriceChange=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.ApprovePriceChange,null,function(b){SF.Tools.IsFunction(a)&&a(b)})};this.PriceChangeProcessed=!1;this.PriceChangeProcess=function(){this.PriceChangeProcessed||SF.System.Payment.CalculatePricedItemTable(function(){var a=$("#divPricedItemTable").html(),a="Message_PriceChangeAlert".Localize()+"<br/>"+a;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1;SF.GUI.PopUpControl.Buttons.YesButton.Visible=
!0;SF.GUI.PopUpControl.Buttons.YesButton.OnClick=function(){SF.Basket.FlightBasket.PriceChangeProcessed=!0;SF.Basket.FlightBasket.ApprovePriceChange(function(a){"BookingWithPriceChange"==a||"PriceChangeApproved"==a?(SF.Basket.FlightBasket.PriceChangeProcessed=!1,SF.Basket.FlightBasket.ProcessFlightBooking(),SF.GUI.PopUpControl.Close()):(SF.GUI.PopUpControl.Close(),setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E4))})};SF.GUI.PopUpControl.Buttons.NoButton.Visible=!0;SF.GUI.PopUpControl.Buttons.NoButton.OnClick=
function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);SF.GUI.PopUpControl.Close();SF.Basket.FlightBasket.PriceChangeProcessed=!0};SF.GUI.PopUpControl.ShowMessage(a,!1,!0)},null,!0,null,function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment)})};this.PaymentAttempt=0;this.MaximumPaymentAttempt=150;this.ClearPaymentProcess=function(a,b,c){SF.Basket.TerminatePayment=!1;SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.PaymentLock,
null,function(){SF.Basket.FlightBasket.PaymentAttempt=0;SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);if(SF.Tools.IsNull(c)||!1!=c)SF.GUI.PopUpControl.Close(),SF.Basket.FlightBasket.IsCardPopUpOpened=!1;SF.GUI.PopUpControl.CloseWindow();SF.Tools.IsNull(a)||SF.GUI.PopUpControl.ShowMessage(a);SF.Tools.IsFunction(b)&&b()})};this.CompletePayment=function(){if(SF.Basket.FlightBasket.PaymentAttempt==SF.Basket.FlightBasket.MaximumPaymentAttempt||!0==SF.Basket.TerminatePayment){var a=
"",a=!0==SF.Basket.TerminatePayment?"\u00d6deme ekran\u0131 i\u015flem tamamlanmadan kapat\u0131ld\u0131.".Localize():"Message_PaymentProcessTimeout".Localize()+" "+"Message_PleaseTryAgain".Localize();this.ClearPaymentProcess(a)}else SF.Basket.FlightBasket.PaymentAttempt++,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.CompleteBooking,null,function(a){SF.Basket.FlightBasket.PriceChangeProcessed=!1;if("BookingWithPaymentCompleted"==a)SF.Basket.FlightBasket.PaymentAttempt=
0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnrData,null,function(a){SF.GUI.PopUpControl.Close();SF.GUI.PopUpControl.CloseWindow();SF.Basket.FlightBasket.IsCardPopUpOpened=!1;SF.System.Parameters.Airports.Data=a.Airports;SF.Membership.IsLoggedIn()&&SF.Membership.GetReservationList(function(){SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1)});SF.Membership.CurrentMember.Reservations.SelectedFlightOption=a.SelectedFlightOption;
SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Flight/FlightPnr",SF.Membership.CurrentMember.Reservations.SelectedFlightOption,function(){SF.GUI.BodyControl.Resize()})})});else if("NotAllowedCreditCard"==a)SF.Basket.FlightBasket.ClearPaymentProcess("Message_NotAllowedCreditCard".Localize());else if("UnableToSell"==a)SF.GUI.PopUpControl.CloseWindow(),
SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess("Message_FlightUnableToSell".Localize());else if("WaitingPriceChargeApproval"==a||"3dProcessStarted"==a)setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E3);else if("UnableToCreateTicket"==a)SF.Basket.FlightBasket.PaymentAttempt=0,SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.GUI.PopUpControl.CloseWindow(),SF.GUI.PopUpControl.Buttons.OkButton.Visible=!0,SF.GUI.PopUpControl.Buttons.OkButton.OnClick=
function(){SF.GUI.PopUpControl.Close();SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnrData,null,function(a){SF.System.Parameters.Airports.Data=a.Airports;SF.Membership.CurrentMember.Reservations.SelectedFlightOption=a.SelectedFlightOption;SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Flight/FlightPnr",SF.Membership.CurrentMember.Reservations.SelectedFlightOption,
function(){SF.Membership.IsLoggedIn()&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1);SF.GUI.BodyControl.Resize()})})})},SF.GUI.PopUpControl.ShowMessage("Message_ReservationCompletedETicketProblem".Localize(),null,null,SF.GUI.PopUpControl.Buttons.OkButton.OnClick);else if("PaymentError"==a||"PaymentException"==a)SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess("Message_PaymentError".Localize());else if("PaymentDeclined"==a)SF.Basket.FlightBasket.IsCardPopUpOpened=
!1,SF.Basket.FlightBasket.ClearPaymentProcess("Message_PaymentDeclined".Localize());else if("3dSecureProcess"==a){if(!SF.Basket.FlightBasket.Is3dSecurePopUpOpened)SF.Basket.FlightBasket.Is3dSecurePopUpOpened=!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.Get3dProcessResult,"result=3dProcessStarted",function(a){"success"==a?(SF.Basket.FlightBasket.Is3dSecurePopUpOpened=!1,SF.GUI.PopUpControl.OpenWindow("3dSecureProcess.aspx",800,500),setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},
1E4)):(SF.GUI.PopUpControl.ShowMessage("Message_InvalidOperation".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment),SF.Basket.FlightBasket.Is3dSecurePopUpOpened=!1)})}else if("3dProcessClosed"==a)SF.GUI.PopUpControl.Close(),SF.GUI.PopUpControl.CloseWindow(),setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},5E3);else if("3dSecureProcessing"==a)SF.Basket.FlightBasket.PaymentAttempt++,setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},5E3);
else if("TFCardVerificationProcessing"==a)SF.Basket.FlightBasket.PaymentAttempt++,setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},5E3);else if("3dSecureApproved"==a)setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E3),SF.GUI.PopUpControl.CloseWindow();else if("3dSecureError"==a||"3dSecureDeclined"==a)SF.Basket.FlightBasket.ClearPaymentProcess("Message_3dSecureError".Localize()),SF.GUI.PopUpControl.Close(),SF.GUI.PopUpControl.CloseWindow();else if("BookingError"==a)SF.Basket.FlightBasket.IsCardPopUpOpened=
!1,SF.GUI.PopUpControl.CloseWindow(),SF.Basket.FlightBasket.ClearPaymentProcess("Message_ErrorOccured".Localize());else if("WaitingPriceChangeApproval"==a)SF.Basket.FlightBasket.PriceChangeProcess();else if("WaitingCardVerification"==a){if(!SF.Basket.FlightBasket.Is3dSecurePopUpOpened)SF.Basket.FlightBasket.Is3dSecurePopUpOpened=!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.Get3dProcessResult,"result=3dProcessStarted",function(a){"success"==a?(SF.Basket.FlightBasket.Is3dSecurePopUpOpened=
!1,SF.GUI.PopUpControl.OpenWindow("3dSecureProcess.aspx",800,500),setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E4)):(SF.GUI.PopUpControl.ShowMessage("Message_InvalidOperation".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment),SF.Basket.FlightBasket.Is3dSecurePopUpOpened=!1)})}else"PriceChargedBookingError"==a?(SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.GUI.PopUpControl.CloseWindow(),SF.Basket.FlightBasket.ClearPaymentProcess("Message_PricedChargedBookingError".Localize())):
"InvalidCreditCard"==a?(SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess("Message_InvalidCreditCard".Localize())):"InvalidFFC"==a?(SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess("Message_InvalidFFC".Localize())):"M_PaymentErrorMessage"==a?(SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess("M_PaymentErrorMessage".Localize())):!SF.Tools.IsNull(a.ResponseType)&&a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&
0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.Basket.FlightBasket.IsCardPopUpOpened=!1,SF.Basket.FlightBasket.ClearPaymentProcess(null,null,!1)):setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E3)})};this.ProcessFlightBooking=function(){SF.GUI.PopUpControl.Close();if(!1==$("#chkRuleAccepted").attr("checked"))SF.GUI.PopUpControl.ShowMessage("Message_ApproveTermsAndConditionsValidation".Localize());else if(0==SF.Basket.FlightBasket.BookingType||
SF.Validation.ValidationCheck("rez-bill"))if(0!=SF.Basket.FlightBasket.BookingType||SF.Validation.ValidationCheck("rez-delivery")){var a="";0==SF.Basket.FlightBasket.BookingType?SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment,null,"#tempnode"):SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment,null,"#tempnodepayment");SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.BookFlight,$("#divBooking *").serialize(),function(b){if("string"!=typeof b&&
0<b.length)SF.Validation.ShowValidationErrors(b),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if(a=b,"summary"==a||"Prebooked"==a||'"Prebooked"'==a||"Eticketed"==a)SF.Membership.IsLoggedIn()&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1),SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1,null,null);SF.Templates.ProcessTemplate("#PnrItemDetails",
"Templates/Basket/FlightBasket",null,function(){SF.GUI.BodyControl.Resize()});SF.Membership.OnPostLogin=function(){SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Home,!1,null,null);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Home)}});else if("UnableToSell"==a)SF.GUI.PopUpControl.ShowMessage("Message_FlightUnableToSell".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("Error"==a)SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),
SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment);else if("WaitingPriceChargeApproval"==a){if(!1==SF.Basket.FlightBasket.IsCardPopUpOpened)SF.Basket.FlightBasket.IsCardPopUpOpened=!0,SF.Basket.OpenPayment(),setTimeout(function(){SF.Basket.FlightBasket.CompletePayment()},1E4)}else'"CompletePayment"'==a||"CompletePayment"==a?SF.Basket.FlightBasket.CompletePayment():"WaitingPriceChangeApproval"==a?SF.Basket.FlightBasket.PriceChangeProcess():("BookingIsNotAllowed"==a?SF.GUI.PopUpControl.ShowMessage("Message_BookingIsNotAllowedForThisFlight".Localize()):
SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Payment))})}};$("#btnCompleteBooking").live("click",function(){SF.Basket.FlightBasket.ProcessFlightBooking()});$(".FlightPassengerCombobox").live("change",function(){var a=$(this).closest(".psg-all"),b=$(this).val();$(a).find("input:text, select, textarea").not(".PassengerCombobox").val("");$(a).find("input:checkbox").attr("checked","");$(a).find(".BaggageCount").val("0");
for(var c=0;c<SF.Membership.CurrentMember.Data.MemberDetail.PassengerList.length;c++){var d=SF.Membership.CurrentMember.Data.MemberDetail.PassengerList[c];if(d.Id==b){$(a).find(".FirstName").val(d.FirstName);$(a).find(".MiddleName").val(d.MiddleName);$(a).find(".Surname").val(d.Surname);$(a).find(".BirthDate").val(SF.TypeOperations.SFCalendar(d.BirthDate,"dd/MM/yyyy"));$(a).find(".PassengerTitle").val(d.Title);break}}})};this.OpenPayment=function(){return SF.GUI.PopUpControl.OpenWindow("Card.aspx",
650,350)};this.ClearPaymentProcess=function(){this.TerminatePayment=!0}};function cpayment(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment,null);clpayment()}function clpayment(){SF.Basket.CarBasket.IsCardPopUpOpened=SF.Basket.FlightBasket.IsCardPopUpOpened=SF.Basket.HotelBasket.IsCardPopUpOpened=!1}function capayment(){SF.Basket.CarBasket.IsCardPopUpOpened=SF.Basket.FlightBasket.IsCardPopUpOpened=SF.Basket.HotelBasket.IsCardPopUpOpened=!1;SF.Basket.ClearPaymentProcess()};
$(document).ready(function(){});NameSpace.prototype.Caching=new function(){var c=function(a,b){return b=JSON.parse(a)},b=function(a){return JSON.stringify(a)};this.CacheItem=function(a,c){$.cookie(a,b(c))};this.DeSerialize=c;this.FullCache=function(){$.cookie("SF_cookie",b(SF))};this.Serialize=b;this.GetItem=function(a){return $.cookie(a)};this.FullGet=function(){SF=c($.cookie("SF_cookie",SF))};this.Flush=function(){$.cookie("SF_cookie",null)}};
NameSpace.prototype.UI=new function(){this.Splash=function(a){try{1==a?($("#splash").css("height",$(document).height()),$("#splashContent").css("top",$(window).height()/2),$("#splash").fadeIn(),$("#splashContent").fadeIn(),setTimeout("SF.UI.Splash(0)",3E3)):0==a?($("#splash").fadeOut(1E3),$("#splashContent").fadeOut(1E3)):3==a&&($("#splash").css("height",$(document).height()),$("#splashContent").css("top",$(window).height()/2),$("#splash").fadeIn(),$("#splashContent").fadeIn())}catch(b){Splash(0)}}};
var rec={};
NameSpace.prototype.Flight=new function(){this.ResultToShow=null;this.IsSecondaryResultsRetrieved=!1;this.IsDomestic=function(){return!0==SF.Flight.FlightSearchResult.IsDomestic};this.ShowResults=function(b){if(!1==SF.Flight.FlightSearchResult.IsDomestic)SF.Templates.ProcessTemplate("#rslFlightItems","Templates/Flight/InternationalFlightRecommendation",SF.Flight.ResultToShow,function(){$("#rslFlightCalendar").html(SF.Flight.FlightSearchResult.CalendarHtml);SF.Tools.IsFunction(b)&&b()});else{1!=SF.Flight.Refreshing.RefreshingDomesticFlightResult&&
SF.Templates.ProcessTemplate("#rslDomesDeparture","Templates/Flight/DomesticFlightRecommendation",SF.Flight.ResultToShow,function(){SF.GUI.BodyControl.Resize()},{Name:"direction",Value:0});if(0!=SF.Flight.Refreshing.RefreshingDomesticFlightResult)if(2==SF.Flight.FlightSearchResult.SearchCriteria.SearchLocationCriterion.length){for(var a=0;a<SF.Flight.FlightSearchResult.Results[0].Itineraries[1].length;a++)SF.Flight.FlightSearchResult.Results[0].Itineraries[1][a].inOption=!0;SF.Templates.ProcessTemplate("#rslDomesReturn",
"Templates/Flight/DomesticFlightRecommendation",SF.Flight.ResultToShow,function(){SF.GUI.BodyControl.Resize()},{Name:"direction",Value:1})}else $("#rslDomesReturn").html("");SF.Flight.Refreshing.RefreshingDomesticFlightResult=2;SF.Tools.IsFunction(b)&&b()}};this.PrepareResultScreen=function(b){SF.GUI.BodyControl.Tabs.Result.Type=!0==SF.Flight.IsDomestic()?"DomesticFlight":"InternationalFlight";SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.Tools.IsFunction(b)&&b()},
!1,!0)};this.ShowFilterScreens=function(b){try{SF.Templates.ProcessTemplate("#rslFlightFilter","Templates/Flight/FlightFilter",SF.Flight.FlightSearchResult,function(){SF.Tools.IsFunction(b)&&b()})}catch(a){SF.Logger.SaveException(a,"ShowFilterScreens")}};this.ShowPagerSorter=function(b){SF.Templates.ProcessTemplate("#rslFlightSortTop","Templates/Flight/FlightResultSorterPager",SF.Flight.FlightSearchResult.Results,function(){SF.Templates.ProcessTemplate("#rslFlightSortBot","Templates/Flight/FlightResultSorterPager",
SF.Flight.FlightSearchResult.Results,function(){$(".PageSizeSelector").val(SF.Flight.Paging.PageSize);b()},{Name:"Id",Value:1})},{Name:"Id",Value:2})};this.Search=function(){SF.Flight.Paging.CurrentPage=1;SF.Flight.FlightSearchResult=null;SF.Flight.ResultToShow=null;SF.Flight.Session.Data=null;SF.Flight.Filter.CurrentPrice=0;SF.Basket.FlightBasket.SelectedOption.Candidate=null;SF.Basket.FlightBasket.SelectedOption.Item=null;SF.Basket.FlightBasket.Recommendation=null;SF.Basket.FlightBasket.Currency=
null;SF.Basket.FlightBasket.BasketType=null;SF.Flight.Sorting.Direction=1;SF.Flight.Sorting.ActiveSortingDomestic=null;SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.Airline;SF.Flight.Filter.RemoveAll();SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1);SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Result);SF.System.SearchManager.SearchProcessing=!0;SF.Flight.IsSecondaryResultsRetrieved=!1;SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,
SF.Ajax.ServiceMethods.Flight.Search,$("#FlightSearchForm *").serialize(),function(b){b.ResponseType==SF.Ajax.ServiceResponseType.Result&&0==b.Result.Results.length?(SF.GUI.PopUpControl.ShowMessage("Message_NoFlightResults".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):b.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<b.ValidationResults.length?(SF.Validation.ShowValidationErrors(b.ValidationResults),
SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):(SF.Flight.FlightSearchResult=b.Result,SF.Flight.ResultToShow=b.Result.Results,b.Result.Results.length<b.Result.ResultLength&&SF.Flight.RetrieveSecondaryResults(),SF.Tools.TRYRatio=SF.Flight.FlightSearchResult.TRYRatio,SF.System.SessionManager.SessionControl=!0,SF.Flight.Refreshing.RefreshByService(function(){}));SF.System.SearchManager.SearchProcessing=!1},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home);
SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1);SF.System.Error();SF.System.SearchManager.SearchProcessing=!1})};this.RetrieveSecondaryResults=function(){setTimeout(function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetSecondaryResults,null,function(b){SF.Tools.IsNull(b)||0==b.length?SF.Flight.RetrieveSecondaryResults():(SF.Flight.IsSecondaryResultsRetrieved=!0,SF.Flight.FlightSearchResult.Results=b,SF.Flight.ResultToShow=b)})},2E3)};this.DomesticResearch=
function(b,a){try{if(SF.System.SearchManager.CheckSearchPermission())SF.GUI.Splash.Show(),SF.System.SearchManager.SearchProcessing=!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.DomesticReSearch,"d="+b+"&v="+a,function(a){null==a?(SF.GUI.PopUpControl.ShowMessage("Message_NoFlightResults".Localize()),SF.GUI.Splash.Hide()):void 0!=a.ValidationResults&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.Splash.Hide()):0==a.Results.length?
(SF.GUI.PopUpControl.ShowMessage("Message_NoFlightResults".Localize()),SF.GUI.Splash.Hide()):(SF.Flight.FlightSearchResult=a,SF.Flight.ResultToShow=a.Results,SF.Flight.Refreshing.RefreshByService(function(){SF.GUI.Splash.Hide()}));SF.System.SearchManager.SearchProcessing=!1})}catch(d){SF.Logger.SaveException(d,"DomesticResearch"),SF.GUI.Splash.Hide()}};this.CalendarReSearch=function(b,a){try{if(SF.System.SearchManager.CheckSearchPermission())SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Result),
SF.System.SearchManager.SearchProcessing=!0,SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.InternationalReSearch,"DepartureDate="+b+"&ReturnDate="+a,function(a){null==a?(SF.GUI.PopUpControl.ShowMessage("Message_NoFlightResults".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):void 0!=a.ValidationResults&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),
SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):0==a.Results.length?(SF.GUI.PopUpControl.ShowMessage("Message_NoFlightResults".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):(SF.Flight.FlightSearchResult=a,SF.Flight.ResultToShow=a.Results,SF.Flight.Paging.CurrentPage=1,SF.Flight.Refreshing.RefreshByService(function(){}));
SF.System.SearchManager.SearchProcessing=!1})}catch(d){SF.Logger.SaveException(d,"CalendarReSearch")}};this.SetDomesticOptionPrice=function(b,a){try{$(".frs-price-amount").text(SF.Tools.FormatDouble(b)),$(".frs-price-currency").text(a)}catch(d){SF.Logger.SaveException(d,"SetDomesticOptionPrice")}};this.GetDomesticOptionPrice=function(b){try{$(".frs-price-select").css("display","none"),$(".frs-price-amount").html(miniloader24),$(".frs-price-currency").text(""),SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,
SF.Ajax.ServiceMethods.Flight.GetDomesticFlightOptionPrice,"oid="+b,function(a){"Invalid"==a?SF.GUI.PopUpControl.ShowMessage("Message_FlightPairsDoesNotExists".Localize()):SF.Tools.IsNull(a.TotalFare)?SF.GUI.PopUpControl.ShowMessage("Message_PriceValueCanNotRetrievedFromService".Localize()):(SF.Flight.SetDomesticOptionPrice(a.TotalFare.Amount,a.TotalFare.Currency),SF.Basket.FlightBasket.SelectedOption.Candidate=a,$(".frs-price-select").css("display",""))})}catch(a){SF.Logger.SaveException(a,"GetDomesticOptionPrice")}};
this.DomesticItemChecked=function(b){try{var a=$("input[name='selection_0']:checked").attr("id"),d=$("input[name='selection_1']:checked").attr("id");if(!(void 0==a||"undefined"==a))if(0==b)if(1==SF.Flight.FlightSearchResult.SearchCriteria.SearchLocationCriterion.length){for(var e=null,f=0;f<SF.Flight.FlightSearchResult.Results[0].Options.length;f++)if(SF.Flight.FlightSearchResult.Results[0].Options[f].Itineraries[0].Id==a){e=SF.Flight.FlightSearchResult.Results[0].Options[f];SF.Basket.FlightBasket.SelectedOption.Recommendation=
SF.Flight.FlightSearchResult.Results[0];SF.Basket.FlightBasket.Currency=SF.Basket.FlightBasket.SelectedOption.Recommendation.Currency;break}SF.Tools.IsNull(e)?SF.Logger.SaveException("U\u00e7u\u015f e\u015fle\u015ftirmede hata olu\u015ftu","DomesticItemChecked"):(SF.Basket.FlightBasket.SelectedOption.Candidate=e,SF.Flight.GetDomesticOptionPrice(e.Id))}else{for(f=0;f<SF.Flight.FlightSearchResult.Results[0].Itineraries[1].length;f++){SF.Flight.FlightSearchResult.Results[0].Itineraries[1][f].inOption=
!1;SF.Flight.ResultToShow[0].Itineraries[1][f].inOption=!1;for(var c=0;c<SF.Flight.FlightSearchResult.Results[0].Options.length;c++){var g=SF.Flight.FlightSearchResult.Results[0].Options[c].Itineraries[1].Id==SF.Flight.FlightSearchResult.Results[0].Itineraries[1][f].Id;if(SF.Flight.FlightSearchResult.Results[0].Options[c].Itineraries[0].Id==a&&g){SF.Flight.ResultToShow[0].Itineraries[1][f].inOption=!0;break}}}SF.Templates.ProcessTemplate("#rslDomesReturn","Templates/Flight/DomesticFlightRecommendation",
SF.Flight.ResultToShow,function(){SF.GUI.BodyControl.Resize();SF.Flight.SetDomesticOptionPrice("?","")},{Name:"direction",Value:1})}else if(!(void 0==d||"undefined"==d)){e=null;for(c=0;c<SF.Flight.FlightSearchResult.Results[0].Options.length;c++)if(SF.Flight.FlightSearchResult.Results[0].Options[c].Itineraries[0].Id==a&&SF.Flight.FlightSearchResult.Results[0].Options[c].Itineraries[1].Id==d){e=SF.Flight.FlightSearchResult.Results[0].Options[c];SF.Basket.FlightBasket.SelectedOption.Recommendation=
SF.Flight.FlightSearchResult.Results[0];SF.Basket.FlightBasket.Currency=SF.Basket.FlightBasket.SelectedOption.Recommendation.Currency;break}SF.Tools.IsNull(e)?SF.Logger.SaveException("U\u00e7u\u015f e\u015fle\u015ftirmede hata olu\u015ftu","DomesticItemChecked"):(SF.Basket.FlightBasket.SelectedOption.Candidate=e,SF.Flight.GetDomesticOptionPrice(e.Id))}}catch(h){SF.Logger.SaveException(h,"DomesticItemChecked")}};this.MasterData=new function(){this.ParameterDetails=new function(){this.Data=null;this.Get=
function(b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetParameterDetails,"params=MealRequest,SeatRequest,MeetAndAssistRequest,WheelChairRequest",function(a){if(!SF.Tools.IsNull(a))SF.Flight.MasterData.ParameterDetails.Data=a,SF.Tools.IsFunction(b)&&b()})}};this.MarketingAirlineList=new function(){this.Data=null;this.Get=function(b){if(SF.Tools.IsNull(SF.Basket.FlightBasket.SelectedOption.Item))if(SF.Tools.IsFunction(b))b("error");else return;SF.Flight.MasterData.MarketingAirlineList.Data=
"";try{if("__"!=SF.Basket.FlightBasket.SelectedOption.Item.MarketingAirline)SF.Flight.MasterData.MarketingAirlineList.Data=SF.Basket.FlightBasket.SelectedOption.Item.MarketingAirline+",";else for(var a=0;a<SF.Basket.FlightBasket.SelectedOption.Item.Itineraries.length;a++)if("__"!=SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].MarketingAirline)-1==SF.Flight.MasterData.MarketingAirlineList.Data.indexOf(SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].MarketingAirline)&&(SF.Flight.MasterData.MarketingAirlineList.Data+=
SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].MarketingAirline+",");else for(var d=0;d<SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].Segments.length;d++)-1==SF.Flight.MasterData.MarketingAirlineList.Data.indexOf(SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].Segments[d].MarketingAirline)&&(SF.Flight.MasterData.MarketingAirlineList.Data+=SF.Basket.FlightBasket.SelectedOption.Item.Itineraries[a].Segments[d].MarketingAirline+",");SF.Tools.IsFunction(b)&&b()}catch(e){SF.Logger.SaveException(e,
"GetMarketingAirlineList")}}};this.FrequentFlyerList=new function(){this.Data=null;this.Get=function(b){SF.Flight.MasterData.MarketingAirlineList.Get(function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetFrequentFlyerAirlineList,"mAirline="+SF.Flight.MasterData.MarketingAirlineList.Data.substring(0,SF.Flight.MasterData.MarketingAirlineList.Data.length-1),function(a){SF.Flight.MasterData.FrequentFlyerList.Data=a;SF.Tools.IsFunction(b)&&b()})})}}};this.Sorting=
new function(){this.Direction=1;this.ActiveSortingDomestic=null;this.Sorter={Price:{Sort:function(b){if(!0==SF.Flight.IsDomestic())for(var a=SF.Flight.Sorting.ActiveSortingDomestic,d,e=SF.Flight.ResultToShow[0],f=0;f<e.Itineraries[a].length;f++)for(var c=0;c<e.Itineraries[a].length-1;c++)0==SF.Flight.Sorting.Direction?e.Itineraries[a][c].BaseFare.Amount<e.Itineraries[a][c+1].BaseFare.Amount&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d):e.Itineraries[a][c].BaseFare.Amount>
e.Itineraries[a][c+1].BaseFare.Amount&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d);else{d=SF.Flight.ResultToShow;for(f=0;f<d.length;f++)for(c=0;c<d.length-1;c++)0==SF.Flight.Sorting.Direction?d[c].TotalFare.Amount<d[c+1].TotalFare.Amount&&(a=d[c+1],d[c+1]=d[c],d[c]=a):d[c].TotalFare.Amount>d[c+1].TotalFare.Amount&&(a=d[c+1],d[c+1]=d[c],d[c]=a)}SF.Tools.IsFunction(b)&&b()}},Duration:{Sort:function(b){if(!0==SF.Flight.IsDomestic())for(var a=SF.Flight.Sorting.ActiveSortingDomestic,
d,e=SF.Flight.ResultToShow[0],f=0;f<e.Itineraries[a].length;f++)for(var c=0;c<e.Itineraries[a].length-1;c++)0==SF.Flight.Sorting.Direction?parseInt(e.Itineraries[a][c].ElapsedTime,10)<parseInt(e.Itineraries[a][c+1].ElapsedTime,10)&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d):parseInt(e.Itineraries[a][c].ElapsedTime,10)>parseInt(e.Itineraries[a][c+1].ElapsedTime,10)&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=
d);else{d=SF.Flight.ResultToShow;for(f=0;f<d.length;f++)for(c=0;c<d.length-1;c++)0==SF.Flight.Sorting.Direction?SF.Flight.Sorting.Sorter.Duration.GetMinimumDurationOfRecommendation(d[c])<SF.Flight.Sorting.Sorter.Duration.GetMinimumDurationOfRecommendation(d[c+1])&&(a=d[c+1],d[c+1]=d[c],d[c]=a):SF.Flight.Sorting.Sorter.Duration.GetMinimumDurationOfRecommendation(d[c])>SF.Flight.Sorting.Sorter.Duration.GetMinimumDurationOfRecommendation(d[c+1])&&(a=d[c+1],d[c+1]=d[c],d[c]=a)}SF.Tools.IsFunction(b)&&
b()},GetMinimumDurationOfRecommendation:function(b){for(var a=SF.Flight.FlightSearchResult.SearchCriteria.SearchLocationCriterion.length,d=9999900,e=0;e<a;e++)for(var f=0;f<b.Itineraries[e].length;f++){var c=parseInt(b.Itineraries[e][f].ElapsedTime,10);c<d&&(d=c)}return d}},DepartureTime:{Sort:function(b){if(!0==SF.Flight.IsDomestic())for(var a=SF.Flight.Sorting.ActiveSortingDomestic,d,e=SF.Flight.ResultToShow[0],f=0;f<e.Itineraries[a].length;f++)for(var c=0;c<e.Itineraries[a].length-1;c++)0==SF.Flight.Sorting.Direction?
SF.TypeOperations.SFCalendar(e.Itineraries[a][c].Segments[0].DepartureDateTime,"jDate")<SF.TypeOperations.SFCalendar(e.Itineraries[a][c+1].Segments[0].DepartureDateTime,"jDate")&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d):SF.TypeOperations.SFCalendar(e.Itineraries[a][c].Segments[0].DepartureDateTime,"jDate")>SF.TypeOperations.SFCalendar(e.Itineraries[a][c+1].Segments[0].DepartureDateTime,"jDate")&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],
e.Itineraries[a][c]=d);else{d=SF.Flight.ResultToShow;for(f=0;f<d.length;f++)for(c=0;c<d.length-1;c++)0==SF.Flight.Sorting.Direction?SF.Flight.Sorting.Sorter.DepartureTime.GetMinimumOutboundDepartureTimeOfRecommendation(d[c])<SF.Flight.Sorting.Sorter.DepartureTime.GetMinimumOutboundDepartureTimeOfRecommendation(d[c+1])&&(a=d[c+1],d[c+1]=d[c],d[c]=a):SF.Flight.Sorting.Sorter.DepartureTime.GetMinimumOutboundDepartureTimeOfRecommendation(d[c])>SF.Flight.Sorting.Sorter.DepartureTime.GetMinimumOutboundDepartureTimeOfRecommendation(d[c+
1])&&(a=d[c+1],d[c+1]=d[c],d[c]=a);SF.Flight.ResultToShow=d}SF.Tools.IsFunction(b)&&b()},GetMinimumOutboundDepartureTimeOfRecommendation:function(b){for(var a=new Date("10/10/2050"),d=0;d<b.Itineraries[0].length;d++){var e=SF.TypeOperations.SFCalendar(b.Itineraries[0][d].Segments[0].DepartureDateTime,"jDate");e<a&&(a=e)}return a}},LandingTime:{Sort:function(b){if(!0==SF.Flight.IsDomestic())for(var a=SF.Flight.Sorting.ActiveSortingDomestic,d,e=SF.Flight.ResultToShow[0],f=0;f<e.Itineraries[a].length;f++)for(var c=
0;c<e.Itineraries[a].length-1;c++)d=e.Itineraries[a][c].Segments.length-1,0==SF.Flight.Sorting.Direction?SF.TypeOperations.SFCalendar(e.Itineraries[a][c].Segments[d].ArrivalDateTime,"jDate")<SF.TypeOperations.SFCalendar(e.Itineraries[a][c+1].Segments[d].ArrivalDateTime,"jDate")&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d):SF.TypeOperations.SFCalendar(e.Itineraries[a][c].Segments[d].ArrivalDateTime,"jDate")>SF.TypeOperations.SFCalendar(e.Itineraries[a][c+
1].Segments[d].ArrivalDateTime,"jDate")&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d);SF.Tools.IsFunction(b)&&b()}},Airline:{Sort:function(b){if(!0==SF.Flight.IsDomestic())for(var a=SF.Flight.Sorting.ActiveSortingDomestic,d,e=SF.Flight.ResultToShow[0],f=0;f<e.Itineraries[a].length;f++)for(var c=0;c<e.Itineraries[a].length-1;c++)0==SF.Flight.Sorting.Direction?SF.Flight.Helpers.GetAirline(e.Itineraries[a][c].MarketingAirline).AirlineName.charCodeAt(0)<SF.Flight.Helpers.GetAirline(e.Itineraries[a][c+
1].MarketingAirline).AirlineName.charCodeAt(0)&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d):SF.Flight.Helpers.GetAirline(e.Itineraries[a][c].MarketingAirline).AirlineName.charCodeAt(0)>SF.Flight.Helpers.GetAirline(e.Itineraries[a][c+1].MarketingAirline).AirlineName.charCodeAt(0)&&(d=e.Itineraries[a][c+1],e.Itineraries[a][c+1]=e.Itineraries[a][c],e.Itineraries[a][c]=d);SF.Tools.IsFunction(b)&&b()}}};this.ActiveSorter=this.Sorter.Price;this.SelectSorter=
function(b,a,d){if(!SF.Tools.IsNull(a))SF.Flight.Sorting.ActiveSortingDomestic=a,SF.Flight.Refreshing.RefreshingDomesticFlightResult=a;switch(b){case "price":SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.Price;break;case "duration":SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.Duration;break;case "departuretime":SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.DepartureTime;break;case "landingtime":SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.LandingTime;break;
case "airline":SF.Flight.Sorting.ActiveSorter=SF.Flight.Sorting.Sorter.Airline}SF.Flight.Sorting.ActiveSorter.Sort(function(){SF.Flight.Refreshing.RefreshBySorter(function(){SF.Tools.IsFunction(d)&&d()})})};this.ChangeDirection=function(b){if(!SF.Tools.IsNull(b))SF.Flight.Sorting.ActiveSortingDomestic=b,SF.Flight.Refreshing.RefreshingDomesticFlightResult=b;SF.Flight.Sorting.Direction=0==SF.Flight.Sorting.Direction?1:0;SF.Flight.Sorting.ActiveSorter.Sort(function(){SF.Flight.Refreshing.RefreshBySorter(function(){})})};
this.Sort=function(b){SF.GUI.Splash.Show();SF.Flight.Sorting.SelectSorter(b,null,function(){SF.GUI.Splash.Hide()})}};this.Filter=new function(){this.Filters={Stop:{Applied:[],FilterItem:function(b){for(var a=0;a<this.Applied.length;a++)if(b.Segments.length==this.Applied[a])return!0;return!1},Remove:function(b){return SF.Tools.RemoveByValue(this.Applied,b)},Add:function(b){return!this.Contains(b)?(this.Applied.push(b),!0):!1},Clear:function(){if(0==this.Applied.length)return!1;this.Applied=[];$(".StopFilterCheckBox").attr("checked",
!0);return!0},Contains:function(b){for(var a=0;a<this.Applied.length;a++)if(this.Applied[a]==b)return!0;return!1},Only:function(b){this.Clear();for(var a=0;a<SF.Flight.FlightSearchResult.ByStop.length;a++)SF.Flight.FlightSearchResult.ByStop[a].Key!=b&&this.Applied.push(SF.Flight.FlightSearchResult.ByStop[a].Key);$(".StopFilterCheckBox").not("#Stop_"+b).attr("checked",!1);$("#Stop_"+b+" .StopFilterCheckBox").attr("checked",!0);return!0}},Airline:{Applied:[],FilterItem:function(b){for(var a=0;a<this.Applied.length;a++)if(b.MarketingAirline==
this.Applied[a])return b.FilteredByAirline="Airline: "+this.Applied[a],!0;return!1},Remove:function(b){return SF.Tools.RemoveByValue(this.Applied,b)},Add:function(b){return!this.Contains(b)?(this.Applied.push(b),!0):!1},Clear:function(){if(0==this.Applied.length)return!1;this.Applied=[];$(".AirlineFilterCheckBox").attr("checked",!0);return!0},Contains:function(b){for(var a=0;a<this.Applied.length;a++)if(this.Applied[a]==b)return!0;return!1},Only:function(b){this.Clear();for(var a=0;a<SF.Flight.FlightSearchResult.ByAirline.length;a++)SF.Flight.FlightSearchResult.ByAirline[a].Key!=
b&&this.Applied.push(SF.Flight.FlightSearchResult.ByAirline[a].Key);$(".AirlineFilterCheckBox").not("#Airline_"+b).attr("checked",!1);$("#Airline_"+b+" .AirlineFilterCheckBox").attr("checked",!0);return!0}},GoingDepartureTime:{Applied:[],FilterItem:function(b){for(var a=0;a<this.Applied.length;a++)if(b.DepartureTimeCategory==this.Applied[a])return b.FilteredByDepartureTime="DepartureTimeCategory: "+this.Applied[a],!0;return!1},Remove:function(b){return SF.Tools.RemoveByValue(this.Applied,b)},Add:function(b){return!this.Contains(b)?
(this.Applied.push(b),!0):!1},Clear:function(){if(0==this.Applied.length)return!1;this.Applied=[];$(".GoingDepartureTimeFilterCheckBox").attr("checked",!0);return!0},Contains:function(b){for(var a=0;a<this.Applied.length;a++)if(this.Applied[a]==b)return!0;return!1},Only:function(b){this.Clear();for(var a=0;a<SF.Flight.FlightSearchResult.ByGoingDepartureTime.length;a++)SF.Flight.FlightSearchResult.ByGoingDepartureTime[a].Key!=b&&this.Applied.push(SF.Flight.FlightSearchResult.ByGoingDepartureTime[a].Key);
$(".GoingDepartureTimeFilterCheckBox").not("#GoingDepartureTime_"+b).attr("checked",!1);$("#GoingDepartureTime_"+b+" .GoingDepartureTimeFilterCheckBox").attr("checked",!0);return!0}},ReturnDepartureTime:{Applied:[],FilterItem:function(b){for(var a=0;a<this.Applied.length;a++)if(b.DepartureTimeCategory==this.Applied[a])return b.FilteredByReturnTime="ReturnTime: "+this.Applied[a],!0;return!1},Remove:function(b){return SF.Tools.RemoveByValue(this.Applied,b)},Add:function(b){return!this.Contains(b)?(this.Applied.push(b),
!0):!1},Clear:function(){if(0==this.Applied.length)return!1;this.Applied=[];$(".ReturnDepartureTimeFilterCheckBox").attr("checked",!0);return!0},Contains:function(b){for(var a=0;a<this.Applied.length;a++)if(this.Applied[a]==b)return!0;return!1},Only:function(b){this.Clear();for(var a=0;a<SF.Flight.FlightSearchResult.ByReturnDepartureTime.length;a++)SF.Flight.FlightSearchResult.ByReturnDepartureTime[a].Key!=b&&this.Applied.push(SF.Flight.FlightSearchResult.ByReturnDepartureTime[a].Key);$(".ReturnDepartureTimeFilterCheckBox").not("#ReturnDepartureTime_"+
b).attr("checked",!1);$("#ReturnDepartureTime_"+b+" .ReturnDepartureTimeFilterCheckBox").attr("checked",!0);return!0}},Price:{Applied:[],FilterItem:function(b){for(var a=0;a<this.Applied.length;a++)if(b.TotalFare.Amount>this.Applied[a])return!0;return!1},Remove:function(b){return SF.Tools.RemoveByValue(this.Applied,b)},Add:function(b){return!this.Contains(b)?(this.Applied.push(b),!0):!1},Clear:function(){this.Applied=[];$("#cbFlightFilterprice").slider("value",SF.Flight.FlightSearchResult.MaxPrice.Amount);
$("#slider-amount").html(SF.Tools.FormatDouble(SF.Flight.FlightSearchResult.MaxPrice.Amount));return!0},Contains:function(b){for(var a=0;a<this.Applied.length;a++)if(this.Applied[a]==b)return!0;return!1},Only:function(b){this.Applied=[];this.Applied.push(b);return!0}}};this.Add=function(b,a){SF.GUI.Splash.Show();var d=!1;switch(b){case "Stop":d=this.Filters.Stop.Add(a);break;case "Airline":d=this.Filters.Airline.Add(a);break;case "Return":d=this.Filters.ReturnDepartureTime.Add(a);break;case "Going":d=
this.Filters.GoingDepartureTime.Add(a);break;case "Price":d=this.Filters.Price.Add(a)}d?this.Filter():SF.GUI.Splash.Hide()};this.Remove=function(b,a){SF.GUI.Splash.Show();var d=!1;switch(b){case "Stop":d=this.Filters.Stop.Remove(a);break;case "Airline":d=this.Filters.Airline.Remove(a);break;case "Return":d=this.Filters.ReturnDepartureTime.Remove(a);break;case "Going":d=this.Filters.GoingDepartureTime.Remove(a);break;case "Price":d=this.Filters.Price.Remove(a)}d?this.Filter():SF.GUI.Splash.Hide()};
this.Clear=function(b){SF.GUI.Splash.Show();var a=!1;switch(b){case "Stop":a=this.Filters.Stop.Clear();break;case "Airline":a=this.Filters.Airline.Clear();break;case "Return":a=this.Filters.ReturnDepartureTime.Clear();break;case "Going":a=this.Filters.GoingDepartureTime.Clear();break;case "Price":this.Filters.Price.Clear();return;case "AirlineStop":a=this.Filters.Airline.Clear()&&this.Filters.Stop.Clear()}a?this.Filter():SF.GUI.Splash.Hide()};this.Only=function(b,a,d){SF.GUI.Splash.Show();var e=!1;
switch(b){case "Stop":e=this.Filters.Stop.Only(a);break;case "Airline":e=this.Filters.Airline.Only(a);break;case "Return":e=this.Filters.ReturnDepartureTime.Only(a);break;case "Going":e=this.Filters.GoingDepartureTime.Only(a);break;case "Price":e=this.Filters.Price.Only(a);break;case "AirlineStop":e=this.Filters.Airline.Only(a)&&this.Filters.Stop.Only(d)}e?this.Filter():SF.GUI.Splash.Hide()};this.Filter=function(){for(var b=SF.Flight.FlightSearchResult.Results,a=[],d=SF.Flight.FlightSearchResult.SearchCriteria.SearchLocationCriterion.length,
e=0;e<b.length;e++)if(!this.Filters.Price.FilterItem(b[e])&&!this.Filters.Airline.FilterItem(b[e])){var f=b[e];f.isFiltered=!1;if(0<d)for(var c=f.Itineraries[0],g=0;g<c.length&&!f.isFiltered;g++)c.FilteredBy=[],f.isFiltered=f.isFiltered||this.Filters.GoingDepartureTime.FilterItem(c[g])||this.Filters.Stop.FilterItem(c[g]);if(1<d&&!f.isFiltered)for(c=1;c<d&&!f.isFiltered;c++)for(var g=f.Itineraries[c],h=0;h<g.length&&!f.isFiltered;h++)f.isFiltered=f.isFiltered||this.Filters.ReturnDepartureTime.FilterItem(g[h])||
this.Filters.Stop.FilterItem(g[h]);f.isFiltered||a.push(f)}SF.Flight.ResultToShow=a;SF.Flight.Refreshing.RefreshByFilter(function(){SF.GUI.BodyControl.Resize();SF.GUI.Splash.Hide()});SF.Templates.ProcessTemplate("#flightFilterSummary","Templates/Flight/FilterSummary",null,function(){SF.GUI.BodyControl.Resize()})};this.Change=function(b,a,d){$(b).is(":checked")?SF.Flight.Filter.Remove(a,d):SF.Flight.Filter.Add(a,d)};this.RemoveAll=function(){this.Filters.Airline.Applied=[];this.Filters.GoingDepartureTime.Applied=
[];this.Filters.Price.Applied=[];this.Filters.ReturnDepartureTime.Applied=[];this.Filters.Stop.Applied=[]}};this.Refreshing=new function(){this.RefreshingDomesticFlightResult=2;this.RefreshByPager=function(b){!0==SF.Flight.IsDomestic()?SF.Tools.IsFunction(b)&&b():SF.Flight.ShowResults(function(){SF.Flight.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(b)&&b()})})};this.RefreshByService=function(b){!0==SF.Flight.IsDomestic()?SF.Flight.PrepareResultScreen(function(){SF.Flight.ShowResults(function(){SF.Tools.IsFunction(b)&&
b()})}):SF.Flight.PrepareResultScreen(function(){SF.Flight.ShowResults(function(){SF.Flight.ShowPagerSorter(function(){SF.Flight.ShowFilterScreens(function(){$("#cbFlightFilterprice").slider({range:"min",min:SF.Flight.FlightSearchResult.MinPrice.Amount,max:SF.Flight.FlightSearchResult.MaxPrice.Amount,value:SF.Flight.FlightSearchResult.MaxPrice.Amount,slide:function(a,b){$("#slider-amount").html(b.value)},change:function(a,b){SF.Flight.Filter.Only("Price",b.value)}});SF.Tools.IsFunction(b)&&(SF.GUI.BodyControl.Resize(),
b())})})})})};this.RefreshBySorter=function(b){!0==SF.Flight.IsDomestic()?SF.Flight.ShowResults(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(b)&&b()}):SF.Flight.ShowResults(function(){SF.Flight.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(b)&&b()})})};this.RefreshByFilter=function(b){!0==SF.Flight.IsDomestic()?SF.Tools.IsFunction(b)&&b():(SF.Flight.Paging.CurrentPage=1,SF.Flight.PrepareResultScreen(function(){SF.Flight.ShowResults(function(){SF.Flight.ShowPagerSorter(function(){SF.Tools.IsFunction(b)&&
b()})})}))}};this.Paging=new function(){this.PageSize=10;this.CurrentPage=1;this.GoToPage=function(b){"f"==b?SF.Flight.Paging.CurrentPage++:"b"==b?SF.Flight.Paging.CurrentPage--:SF.Flight.Paging.CurrentPage=b;SF.Flight.Refreshing.RefreshByPager()};this.ChangePageSize=function(b){SF.Flight.Paging.CurrentPage=1;SF.Flight.Paging.PageSize=$(b).val();$(".PageSizeSelector").val(SF.Flight.Paging.PageSize);SF.Flight.Refreshing.RefreshByPager()};this.GetPageCount=function(){try{var b=(!0==SF.Flight.IsSecondaryResultsRetrieved?
SF.Flight.ResultToShow.length:SF.Flight.FlightSearchResult.ResultLength)/SF.Flight.Paging.PageSize;return parseInt(b)<b?parseInt(b)+1:b}catch(a){}return 0};this.ChangeCurrentPage=function(b){try{SF.Flight.Paging.PageSize=$(b).val(),SF.Flight.Paging.GetPageCount()}catch(a){}};this.GetPagingRecordIndex=function(b){try{if(1==b)return SF.Flight.Paging.PageSize*SF.Flight.Paging.CurrentPage;if(0==b)return SF.Flight.Paging.PageSize*(SF.Flight.Paging.CurrentPage-1)+1}catch(a){SaveException(a,"GetPagingRecordIndex")}}};
this.Helpers=new function(){this.GetPassengerTypeText=function(){var b="";try{for(var a=0;a<SF.Flight.FlightSearchResult.SearchCriteria.UniquePassengerCodes.length;a++){var d=SF.Flight.FlightSearchResult.SearchCriteria.UniquePassengerCodes[a],e=SF.Flight.Helpers.GetNumberOfPassengerType(d);0!=e&&(b+=e+" "+SF.Flight.Helpers.GetPassengerTypeQuantityName(d)+" ")}}catch(f){}return b};this.GetPassengerCodeText=function(b){try{return SF.Flight.FlightSearchResult.SearchCriteria.PassengerCodes[b]}catch(a){SF.Logger.SaveException(a,
"SF.Flight.Helpers.GetPassengerCodeText")}};this.GetTimeCategoryName=function(b){switch(b){case 0:return"TimeCategoryMorning".Localize()+" (03:00-12:00)";case 1:return"TimeCategoryAfternoon".Localize()+" (12:00-18:00)";case 2:return"TimeCategoryEvening".Localize()+" (18:00-03:00)";default:return""}};this.GetNumberOfPassengerType=function(b){var a=0;try{for(var d=0;d<SF.Flight.FlightSearchResult.SearchCriteria.PassengerCodes.length;d++)SF.Flight.FlightSearchResult.SearchCriteria.PassengerCodes[d]==
b&&a++}catch(e){SaveException(e,"SF.Flight.Helpers.GetNumberOfPassengerType")}return a};this.GetPassengerTypeQuantityName=function(b){return("PassengerType_"+b).Localize()};this.GetStopName=function(b){switch(b){case 1:return"StopName_NonStop".Localize();default:return b-1+"StopName_Stop".Localize()}};this.GetCityName=function(b){try{for(var a=0;a<SF.Flight.FlightSearchResult.Airports.length;a++)if(SF.Flight.FlightSearchResult.Airports[a].AirportCode==b||SF.Flight.FlightSearchResult.Airports[a].CityCode==
b)return SF.Flight.FlightSearchResult.Airports[a].CityName}catch(d){SF.Logger.SaveException(d,"GetCityName")}return""};this.GetCabinClassName=function(b){switch(b){case "W":case "S":case "Y":case "B":case "H":case "K":case "L":case "M":case "N":case "Q":case "T":case "V":case "X":return"CabinClassName_Economy".Localize();case "R":case "P":case "F":case "A":return"CabinClassName_FirstClass".Localize();case "J":case "C":case "D":case "I":case "Z":return"CabinClassName_BusinessClass".Localize();default:return""}};
this.GetAirport=function(b){try{for(var a=0;a<SF.Flight.FlightSearchResult.Airports.length;a++)if(SF.Flight.FlightSearchResult.Airports[a].AirportCode==b)return SF.Flight.FlightSearchResult.Airports[a]}catch(d){}return""};this.GetAirline=function(b){try{for(var a=0;a<SF.Flight.FlightSearchResult.Airlines.length;a++)if(SF.Flight.FlightSearchResult.Airlines[a].AirlineCode==b)return SF.Flight.FlightSearchResult.Airlines[a]}catch(d){}return""};this.GetAirplane=function(b){try{for(var a=0;a<SF.Flight.FlightSearchResult.Airplanes.length;a++)if(SF.Flight.FlightSearchResult.Airplanes[a].AirplaneCode==
b)return SF.Flight.FlightSearchResult.Airplanes[a]}catch(d){}return""};this.GetAirlineName=function(b){if("__"==b)return"MultipleAirlines".Localize();if(SF.Tools.IsNull(SF.Flight.FlightSearchResult)||SF.Tools.IsNull(SF.Flight.FlightSearchResult.Airlines))return b;for(var a=0;a<SF.Flight.FlightSearchResult.Airlines.length;a++)if(SF.Flight.FlightSearchResult.Airlines[a].AirlineCode==b)return SF.Flight.FlightSearchResult.Airlines[a].AirlineName};this.GetParameterDetails=function(b){try{for(var a=0;a<
SF.Flight.MasterData.ParameterDetails.Data.length;a++)if(SF.Flight.MasterData.ParameterDetails.Data[a].Code==b)return SF.Flight.MasterData.ParameterDetails.Data[a].ParameterDetails;return null}catch(d){SF.Logger.SaveException(d,"GetParameterDetails")}};this.GetIfStopContainsData=function(b){for(var a=0;a<SF.Flight.FlightSearchResult.ByAirlineAndStop.length;a++)if(null!=SF.Flight.FlightSearchResult.ByAirlineAndStop[a].Prices[b])return!0;return!1}};this.Matching=new function(){this.LockUnmatchedItineraries=
function(b){try{var a=[],d=[],e=[],f=[],c=b.attr("value"),b=[],g;for(g in SF.Flight.FlightSearchResult.Results)for(var h in SF.Flight.FlightSearchResult.Results[g].Options)for(var k in SF.Flight.FlightSearchResult.Results[g].Options[h].Itineraries)for(var i in SF.Flight.FlightSearchResult.Results[g].Options[h].Itineraries[k].Segments)SF.Flight.FlightSearchResult.Results[g].Options[h].Itineraries[k].Segments[i].Id==c&&(b.push(SF.Flight.FlightSearchResult.Results[g].Options[h].IndexList),a.push(g),
d.push(h));var l=(""+b).split(",");for(g in l){var n=(""+l[g]).split(";");e.push(n[1])}for(i in a)for(var j in SF.Flight.FlightSearchResult.Results[a[i]].Itineraries[1]){for(var o in SF.Flight.FlightSearchResult.Results[a[i]].Itineraries[1][j].Segments)var m=-1;for(g in e)if(e[g]==j){m=g;break}-1==m&&f.push(SF.Flight.FlightSearchResult.Results[a[i]].Itineraries[1][j].Segments[o].Id)}$('input[name="1"]').attr("disabled",!1);for(g in f)$('input[value="'+f[g]+'"]').is(":checked")&&$('input[value="'+
f[g]+'"]').attr("checked",!1),$('input[value="'+f[g]+'"]').attr("disabled",!0)}catch(p){SF.Logger.SaveException(p,"LockUnmatchedItineraries")}}};this.Terms={Domestic:{Flight:"Templates/Flight/FlightRules",Agency:"Templates/Flight/AgencyDomesticFlightRules",Show:function(b){!SF.Tools.IsNull(b)&&!0==b?SF.GUI.PopUpControl.ShowUrl(SF.Flight.Terms.Domestic.Agency):SF.GUI.PopUpControl.ShowUrl(SF.Flight.Terms.Domestic.Flight)}},International:{Flight:"Templates/Flight/FlightRules",Agency:"Templates/Flight/AgencyInternationalFlightRules",
Show:function(b){!SF.Tools.IsNull(b)&&!0==b?SF.GUI.PopUpControl.ShowUrl(SF.Flight.Terms.International.Agency):(SF.GUI.PopUpControl.ShowLocalizedMessage(""),$("#lightmein").html(srcloader),SF.Templates.ProcessTemplate("#lightmein",SF.Flight.Terms.International.Flight,SF.Basket.FlightBasket.SelectedOption.Item,function(){}))}}};this.Session=new function(){this.Data=null;this.GetSession=function(b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetFlightSessionItem,null,
function(a){if(!SF.Tools.IsNull(a))SF.Basket.FlightBasket.SelectedOption.Item=a.BasketItem.SelectedOption,SF.Basket.FlightBasket.SelectedOption.Recommendation=a.BasketItem.SelectedRecommendation,SF.Basket.FlightBasket.SelectedOption.Candidate=null,SF.Basket.FlightBasket.SelectedOption.FlightSearchResult=a.FlightSearchResult,SF.Flight.Session.Data=a,SF.Tools.IsFunction(b)&&b()})}};this.SelectDomesticItem=function(b,a){if(!$(b).closest(".drs-row").hasClass("frs-selected-flight")){$(b).closest(".drs-row").siblings().removeClass("frs-selected-flight");
$(b).closest(".drs-row").addClass("frs-selected-flight");$(b).closest(".drs-row").find("input").attr("checked","checked");if(0==a)SF.Basket.FlightBasket.SelectedOption.Candidate=null;SF.Flight.DomesticItemChecked(a)}}};
var rules=null;
NameSpace.prototype.Car=new function(){this.ResultToShow=null;this.ShowResults=function(a){SF.Templates.ProcessTemplate("#rslCarItems","Templates/Car/CarRecommendation",SF.Car.ResultToShow,function(){SF.Tools.IsFunction(a)&&a()})};this.PrepareResultScreen=function(a){SF.GUI.BodyControl.Tabs.Result.Type="Car";SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.Tools.IsFunction(a)&&a()},!1,!0)};this.ShowPagerSorter=function(a){SF.Templates.ProcessTemplate("#rslCarSortTop","Templates/Car/CarResultSorterPager",
SF.Car.CarSearchResult.Results,function(){SF.Templates.ProcessTemplate("#rslCarSortBot","Templates/Car/CarResultSorterPager",SF.Car.CarSearchResult.Results,function(){$(".PageSizeSelector").val(SF.Car.Paging.PageSize);SF.Tools.IsFunction(a)&&a()},{Name:"Id",Value:1})},{Name:"Id",Value:2})};this.Search=function(a){if(SF.System.SearchManager.CheckSearchPermission()){SF.Car.Paging.CurrentPage=1;SF.System.SearchManager.SearchProcessing=!0;SF.Car.CarSearchResult=null;SF.Car.ResultToShow=null;SF.Car.Session.Data=
null;SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1);SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Result);var c=SF.Ajax.ServiceMethods.Car.Search;if(!SF.Tools.IsNull(a))c=SF.Ajax.ServiceMethods.Car.GetMoreResults;SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,c,$("#CarSearchForm *").serialize(),function(a){a.ResponseType==SF.Ajax.ServiceResponseType.Result&&0==a.Result.Results.length?(SF.GUI.PopUpControl.ShowMessage("Message_NoCarResults".Localize()),
SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):(SF.Car.CarSearchResult=a.Result,SF.Car.ResultToShow=a.Result.Results,SF.Tools.TRYRatio=SF.Car.CarSearchResult.TRYRatio,
SF.System.SessionManager.SessionControl=!0,SF.Car.Refreshing.RefreshByService(function(){SF.GUI.BodyControl.Resize()}));SF.System.SearchManager.SearchProcessing=!1},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home);SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)})}};this.SearchCarVendor=function(a){for(var c=0;c<SF.Car.CarSearchResult.Results.length;c++)if(SF.Car.CarSearchResult.Results[c].Id==a){0==$("#_"+a+"_VendorVehiclesAll").find("tr").length?($("#_"+
a+"_VendorVehiclesAll").html(srcloader),SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.SearchCarVendor,"RecommendationId="+a,function(b){if(!SF.Tools.IsNull(b))for(var c=0;c<SF.Car.CarSearchResult.Results.length;c++)if(SF.Car.CarSearchResult.Results[c].Id==a){SF.Car.CarSearchResult.Results[c]=b;SF.Templates.ProcessTemplate("#_"+a+"_VendorVehiclesAll","Templates/Car/VendorVehicle",b,function(){SF.Car.CarSearchResult.Results[c].Retrieved=!0;SF.Car.CarSearchResult.Results[c].Expanded=
!0;SF.GUI.BodyControl.Resize()});break}},function(){$("#_"+a+"_VendorVehiclesAll").css("display","none");SF.Car.CarSearchResult.Results[c].Expanded=!1;SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize())})):!0==SF.Car.CarSearchResult.Results[c].Expanded?($("#_"+a+"_VendorVehiclesAll").css("display","none"),SF.Car.CarSearchResult.Results[c].Expanded=!1):($("#_"+a+"_VendorVehiclesAll").css("display",""),SF.Car.CarSearchResult.Results[c].Expanded=!0);SF.GUI.BodyControl.Resize();break}};
this.MasterData=new function(){this.ParameterDetails=new function(){this.Data=null;this.Get=function(){}}};this.Sorting=new function(){this.Direction=1;this.Sorter={Price:{Sort:function(a){for(var c,b=SF.Car.ResultToShow,e=0;e<b.length;e++)for(var d=0;d<b.length-1;d++)0==SF.Car.Sorting.Direction?b[d].Vendor.Vehicles[0].TotalFare.Amount<b[d+1].Vendor.Vehicles[0].TotalFare.Amount&&(c=b[d+1],b[d+1]=b[d],b[d]=c):b[d].Vendor.Vehicles[0].TotalFare.Amount>b[d+1].Vendor.Vehicles[0].TotalFare.Amount&&(c=b[d+
1],b[d+1]=b[d],b[d]=c);SF.Tools.IsFunction(a)&&a()}},Type:{Sort:function(a){for(var c,b=SF.Car.ResultToShow,e=0;e<b.length;e++)for(var d=0;d<b.length-1;d++)0==SF.Car.Sorting.Direction?b[d].Vendor.Vehicles[0].VehicleCategory.charCodeAt(0)<b[d+1].Vendor.Vehicles[0].VehicleCategory.charCodeAt(0)&&(c=b[d+1],b[d+1]=b[d],b[d]=c):b[d].Vendor.Vehicles[0].VehicleCategory.charCodeAt(0)>b[d+1].Vendor.Vehicles[0].VehicleCategory.charCodeAt(0)&&(c=b[d+1],b[d+1]=b[d],b[d]=c);SF.Tools.IsFunction(a)&&a()}},VendorName:{Sort:function(a){for(var c,
b=SF.Car.ResultToShow,e=0;e<b.length;e++)for(var d=0;d<b.length-1;d++)0==SF.Car.Sorting.Direction?b[d].Vendor.CompanyShortName.charCodeAt(0)<b[d+1].Vendor.CompanyShortName.charCodeAt(0)&&(c=b[d+1],b[d+1]=b[d],b[d]=c):b[d].Vendor.CompanyShortName.charCodeAt(0)>b[d+1].Vendor.CompanyShortName.charCodeAt(0)&&(c=b[d+1],b[d+1]=b[d],b[d]=c);SF.Tools.IsFunction(a)&&a()}}};this.ActiveSorter=this.Sorter.Price;this.SelectSorter=function(a,c){switch(a){case "price":SF.Car.Sorting.ActiveSorter=SF.Car.Sorting.Sorter.Price;
break;case "vendorname":SF.Car.Sorting.ActiveSorter=SF.Car.Sorting.Sorter.VendorName;break;case "type":SF.Car.Sorting.ActiveSorter=SF.Car.Sorting.Sorter.Type}SF.Car.Sorting.ActiveSorter.Sort(function(){SF.Car.Refreshing.RefreshBySorter(function(){SF.Tools.IsFunction(c)&&c()})})};this.ChangeDirection=function(){SF.GUI.Splash.Show();SF.Car.Sorting.Direction=0==SF.Car.Sorting.Direction?1:0;SF.Car.Sorting.ActiveSorter.Sort(function(){SF.Car.Refreshing.RefreshBySorter(function(){SF.GUI.Splash.Hide()})})};
this.Sort=function(a){SF.GUI.Splash.Show();SF.Car.Sorting.SelectSorter(a,function(){SF.GUI.Splash.Hide()})}};this.Refreshing=new function(){this.RefreshByPager=function(a){SF.Car.ShowResults(function(){SF.Car.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(a)&&a()})})};this.RefreshByService=function(a){SF.Car.PrepareResultScreen(function(){SF.Car.ShowResults(function(){SF.Car.Sorting.ActiveSorter=SF.Car.Sorting.Sorter.Price;SF.Car.ShowPagerSorter(function(){SF.Tools.IsFunction(a)&&
(SF.GUI.BodyControl.Resize(),a())})})})};this.RefreshBySorter=function(a){SF.Car.ShowResults(function(){SF.Car.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(a)&&a()})})}};this.Paging=new function(){this.PageSize=10;this.CurrentPage=1;this.GoToPage=function(a){"f"==a?SF.Car.Paging.CurrentPage++:"b"==a?SF.Car.Paging.CurrentPage--:SF.Car.Paging.CurrentPage=a;SF.Car.Refreshing.RefreshByPager()};this.ChangePageSize=function(a){SF.Car.Paging.CurrentPage=1;SF.Car.Paging.PageSize=
$(a).val();$(".PageSizeSelector").val(SF.Car.Paging.PageSize);SF.Car.Refreshing.RefreshByPager()};this.GetPageCount=function(){try{var a=SF.Car.ResultToShow.length/SF.Car.Paging.PageSize;return parseInt(a)<a?parseInt(a)+1:a}catch(c){}return 0};this.ChangeCurrentPage=function(a){try{SF.Car.Paging.PageSize=$(a).val(),SF.Car.Paging.GetPageCount()}catch(c){}};this.GetPagingRecordIndex=function(a){try{if(1==a)return SF.Car.Paging.PageSize*SF.Car.Paging.CurrentPage;if(0==a)return SF.Car.Paging.PageSize*
(SF.Car.Paging.CurrentPage-1)+1}catch(c){SaveException(c,"GetPagingRecordIndex")}}};this.Helpers=new function(){this.GetParameterDetails=function(a){try{for(var c=0;c<SF.Car.MasterData.ParameterDetails.Data.length;c++)if(SF.Car.MasterData.ParameterDetails.Data[c].Code==a)return SF.Car.MasterData.ParameterDetails.Data[c].ParameterDetails;return null}catch(b){SF.Logger.SaveException(b,"GetParameterDetails")}};this.GetAmenityName=function(a){return("CarAmenity_"+a).Localize()};this.GetMapCars=function(){if(null!=
SF.Car.Map.MapCars)return SF.Car.Map.MapCars;for(var a=[],c=0;c<SF.Car.ResultToShow.length;c++){var b=SF.Car.ResultToShow[c];if("0"!=b.Latitude&&"0"!=b.Longitude&&(b.MapIndex=a.length+1,a.push(b),10==a.length))break}return SF.Car.Map.MapCars=a}};this.Terms={Car:{Vehicle:"Templates/Car/CarRules",Agency:"Templates/Car/AgencyCarRules",Show:function(a,c,b){!SF.Tools.IsNull(a)&&!0==a?SF.GUI.PopUpControl.ShowUrl(SF.Car.Terms.Car.Agency):(SF.GUI.PopUpControl.ShowLocalizedMessage(""),$("#lightmein").html(srcloader),
SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.GetRules,"&RecommendationId="+c+"&VehicleId="+b,function(a){a.ResponseType==SF.Ajax.ServiceResponseType.Result&&null!=a.Result?(rules=a.Result.Rule,SF.Templates.ProcessTemplate("#lightmein",SF.Car.Terms.Car.Vehicle,rules,function(){})):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length&&($("#lightmein").html(""),SF.GUI.PopUpControl.ChangeMessage("Kurallar y\u00fcklenemedi"),SF.Validation.ShowValidationErrors(a.ValidationResults))}))},
ShowBasketItemRules:function(){null==SF.Basket.CarBasket.SelectedVehicle.Item?alert("Basket is empty"):SF.Car.Terms.Car.Show(!1,SF.Basket.CarBasket.SelectedVehicle.Recommendation.Id,SF.Basket.CarBasket.SelectedVehicle.Item.Id)}}};this.Session=new function(){this.Data=null;this.GetSession=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Car,SF.Ajax.ServiceMethods.Car.GetCarSessionItem,null,function(c){if(!SF.Tools.IsNull(c))SF.Basket.CarBasket.SelectedVehicle.Item=c.BasketItem.SelectedVehicle,
SF.Basket.CarBasket.SelectedVehicle.Recommendation=c.BasketItem.SelectedRecommendation,SF.Basket.CarBasket.SelectedVehicle.CarSearchResult=c.CarSearchResult,SF.Car.Session.Data=c,SF.Tools.IsFunction(a)&&a()})}}};
NameSpace.prototype.Visa=new function(){this.Search=function(){var a=$("#cmbVisaCountry").val(),b=$("#cmbVisaType").val();SF.System.SearchManager.CheckSearchPermission()&&SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Visa,null,function(){$(".visa-cnt").load("Visa/ulke.aspx?cCode="+a+"&recType="+b)})}};
NameSpace.prototype.Hotel=new function(){this.ResultToShow=null;this.ShowHotelDetails=function(a,b){var c=$("#"+a);!SF.Tools.IsNull(b)&&!0==b&&($("body").scrollTo("#"+a,1E3),c.removeClass("hotel-selected"),SF.GUI.BodyControl.Resize());c.hasClass("hotel-selected")?(c.removeClass("hotel-selected"),c.find(".hotel-item-features").css("display","none"),c.find("td.hotel-price").toggleClass("hotel-price-opened"),SF.GUI.BodyControl.Resize()):(c.addClass("hotel-selected"),c.find(".hotel-item-features").css("display",
"block"),SF.GUI.BodyControl.Resize(),c.find(".hotel-item-features").find("table").length||(c.find(".hotel-item-features").html(rslloader),SF.Hotel.GetHotelDetail(a,function(b){SF.Templates.ProcessTemplate("#"+a+"_Detail","Templates/Hotel/HotelRooms",b,function(){SF.Templates.ProcessTemplate("#"+a+"_HotelItemDetail","Templates/Hotel/HotelDetail",b,function(){hgallery();SF.GUI.BodyControl.Resize();c.find("td.hotel-price").toggleClass("hotel-price-opened");setTimeout(function(){SF.GUI.BodyControl.Resize()},
500)})})})));SF.GUI.BodyControl.Resize();return!1};this.ShowResults=function(a){SF.Templates.ProcessTemplate("#rslHotelItems","Templates/Hotel/HotelRecommendation",SF.Hotel.ResultToShow,function(){SF.Tools.IsFunction(a)&&a()})};this.PrepareResultScreen=function(a){SF.GUI.BodyControl.Tabs.Result.Type="Hotel";SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Result,null,function(){SF.Tools.IsFunction(a)&&a()},!1,!0)};this.ShowFilterScreens=function(a){try{SF.Templates.ProcessTemplate("#HotelFilterTable",
"Templates/Hotel/HotelFilter",SF.Hotel.HotelSearchResult,function(){SF.Tools.IsFunction(a)&&a();fixIEpos()})}catch(b){SF.Logger.SaveException(b,"ShowFilterScreens")}};this.ShowPagerSorter=function(a){SF.Templates.ProcessTemplate("#rslHotelSortTop","Templates/Hotel/HotelResultSorterPager",SF.Hotel.HotelSearchResult.Results,function(){SF.Templates.ProcessTemplate("#rslHotelSortBot","Templates/Hotel/HotelResultSorterPager",SF.Hotel.HotelSearchResult.Results,function(){$(".PageSizeSelector").val(SF.Hotel.Paging.PageSize);
SF.Tools.IsFunction(a)&&a()},{Name:"Id",Value:1})},{Name:"Id",Value:2})};this.ShowMapView=function(a){SF.Hotel.Map.MapHotels=null;SF.Templates.ProcessTemplate("#rslHotelMap","Templates/Hotel/HotelMap",SF.Hotel.HotelSearchResult.Results,function(){fixIEposMap();SF.Hotel.Map.GetGoogleMap(function(){SF.Tools.IsFunction(a)&&a()})})};this.Search=function(a){if(SF.System.SearchManager.CheckSearchPermission()){SF.Hotel.Paging.CurrentPage=1;SF.System.SearchManager.SearchProcessing=!0;SF.Hotel.HotelSearchResult=
null;SF.Hotel.ResultToShow=null;SF.Hotel.Session.Data=null;SF.Basket.HotelBasket.Currency=null;SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,!1);SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Result,!1);SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Result);var b=SF.Ajax.ServiceMethods.Hotel.Search;if(!SF.Tools.IsNull(a))b=SF.Ajax.ServiceMethods.Hotel.GetMoreResults;SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,b,$("#HotelSearchForm *").serialize(),function(a){a.ResponseType==
SF.Ajax.ServiceResponseType.Result&&0==a.Result.Results.length?(SF.GUI.PopUpControl.ShowMessage("Message_NoHotelResults".Localize()),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length?(SF.Validation.ShowValidationErrors(a.ValidationResults),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home),SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,
!1)):(SF.Hotel.HotelSearchResult=a.Result,SF.Hotel.ResultToShow=a.Result.Results,SF.Tools.TRYRatio=SF.Hotel.HotelSearchResult.TRYRatio,SF.System.SessionManager.SessionControl=!0,SF.Hotel.Refreshing.RefreshByService(function(){SF.GUI.BodyControl.Resize()}));SF.System.SearchManager.SearchProcessing=!1},function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Home);SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Result,!1)})}};this.GetHotelDetail=function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,
SF.Ajax.ServiceMethods.Hotel.GetHotelDetail,"HotelId="+a,function(c){if(!SF.Tools.IsNull(c)){for(var e=0;e<SF.Hotel.HotelSearchResult.Results.length;e++)if(SF.Hotel.HotelSearchResult.Results[e].Id==a)SF.Hotel.HotelSearchResult.Results[e].HotelInfo=c.HotelInfo,SF.Hotel.HotelSearchResult.Results[e].Rooms=c.Rooms;SF.Tools.IsFunction(b)&&b(c)}})};this.MasterData=new function(){this.ParameterDetails=new function(){this.Data=null;this.Get=function(){}}};this.Sorting=new function(){this.Direction=1;this.Sorter=
{Price:{Sort:function(a){for(var b,c=SF.Hotel.ResultToShow,e=0;e<c.length;e++)for(var d=0;d<c.length-1;d++)0==SF.Hotel.Sorting.Direction?c[d].RateRangeMinRate<c[d+1].RateRangeMinRate&&(b=c[d+1],c[d+1]=c[d],c[d]=b):c[d].RateRangeMinRate>c[d+1].RateRangeMinRate&&(b=c[d+1],c[d+1]=c[d],c[d]=b);SF.Tools.IsFunction(a)&&a()}},Name:{Sort:function(a){for(var b,c=SF.Hotel.ResultToShow,e=0;e<c.length;e++)for(var d=0;d<c.length-1;d++)0==SF.Hotel.Sorting.Direction?c[d].HotelName.charCodeAt(0)<c[d+1].HotelName.charCodeAt(0)&&
(b=c[d+1],c[d+1]=c[d],c[d]=b):c[d].HotelName.charCodeAt(0)>c[d+1].HotelName.charCodeAt(0)&&(b=c[d+1],c[d+1]=c[d],c[d]=b);SF.Tools.IsFunction(a)&&a()}},ChainName:{Sort:function(a){for(var b,c=SF.Hotel.ResultToShow,e=0;e<c.length;e++)for(var d=0;d<c.length-1;d++)0==SF.Hotel.Sorting.Direction?c[d].ChainName.charCodeAt(0)<c[d+1].ChainName.charCodeAt(0)&&(b=c[d+1],c[d+1]=c[d],c[d]=b):c[d].ChainName.charCodeAt(0)>c[d+1].ChainName.charCodeAt(0)&&(b=c[d+1],c[d+1]=c[d],c[d]=b);SF.Tools.IsFunction(a)&&a()}},
Star:{Sort:function(a){for(var b,c=SF.Hotel.ResultToShow,e=0;e<c.length;e++)for(var d=0;d<c.length-1;d++)0==SF.Hotel.Sorting.Direction?c[d].Rating.charCodeAt(0)<c[d+1].Rating.charCodeAt(0)&&(b=c[d+1],c[d+1]=c[d],c[d]=b):c[d].Rating.charCodeAt(0)>c[d+1].Rating.charCodeAt(0)&&(b=c[d+1],c[d+1]=c[d],c[d]=b);SF.Tools.IsFunction(a)&&a()}}};this.ActiveSorter=this.Sorter.Price;this.SelectSorter=function(a,b){switch(a){case "price":SF.Hotel.Sorting.ActiveSorter=SF.Hotel.Sorting.Sorter.Price;break;case "name":SF.Hotel.Sorting.ActiveSorter=
SF.Hotel.Sorting.Sorter.Name;break;case "chainname":SF.Hotel.Sorting.ActiveSorter=SF.Hotel.Sorting.Sorter.ChainName;break;case "star":SF.Hotel.Sorting.ActiveSorter=SF.Hotel.Sorting.Sorter.Star}SF.Hotel.Sorting.ActiveSorter.Sort(function(){SF.Hotel.Refreshing.RefreshBySorter(function(){SF.Tools.IsFunction(b)&&b()})})};this.ChangeDirection=function(){SF.GUI.Splash.Show();SF.Hotel.Sorting.Direction=0==SF.Hotel.Sorting.Direction?1:0;SF.Hotel.Sorting.ActiveSorter.Sort(function(){SF.Hotel.Refreshing.RefreshBySorter(function(){SF.GUI.Splash.Hide()})})};
this.Sort=function(a){SF.GUI.Splash.Show();SF.Hotel.Sorting.SelectSorter(a,function(){SF.GUI.Splash.Hide()})}};this.Filtering=new function(){this.CurrentPrice=0;this.Filters={ChainName:{Applied:[],Filter:function(){},FilterItem:function(a){for(var b=0;b<this.Applied.length;b++)if(a.ChainCode===this.Applied[b])return!0;return!1},Remove:function(a){SF.Tools.RemoveByValue(this.Applied,a)},Add:function(a){this.Contains(a)||this.Applied.push(a)},Clear:function(){this.Applied=[];$(".ChainFilterCheckBox").attr("checked",
!0)},Contains:function(a){for(var b=0;b<this.Applied.length;b++)if(this.Applied[b]==a)return!0;return!1},Only:function(a){this.Clear();for(var b=0;b<SF.Hotel.HotelSearchResult.ByChain.length;b++)SF.Hotel.HotelSearchResult.ByChain[b].Key!=a&&this.Applied.push(SF.Hotel.HotelSearchResult.ByChain[b].Key);$(".ChainFilterCheckBox").not("#ChainCode_"+a).attr("checked",!1);$("#ChainCode_"+a+" .ChainFilterCheckBox").attr("checked",!0)}},Rating:{Applied:[],Filter:function(){},FilterItem:function(a){for(var b=
0;b<this.Applied.length;b++)if(a.Rating==this.Applied[b])return!0;return!1},Remove:function(a){SF.Tools.RemoveByValue(this.Applied,a)},Add:function(a){this.Contains(a)||this.Applied.push(a)},Clear:function(){this.Applied=[];$(".RatingFilterCheckBox").attr("checked",!0)},Contains:function(a){for(var b=0;b<this.Applied.length;b++)if(this.Applied[b]==a)return!0;return!1},Only:function(a){this.Clear();for(var b=0;b<SF.Hotel.HotelSearchResult.ByRating.length;b++)SF.Hotel.HotelSearchResult.ByRating[b].Key!=
a&&this.Applied.push(SF.Hotel.HotelSearchResult.ByRating[b].Key);$(".RatingFilterCheckBox").not("#RatingCode_"+a).attr("checked",!1);$("#RatingCode_"+a+" .RatingFilterCheckBox").attr("checked",!0)}},Amenity:{Applied:[],Filter:function(){},FilterItem:function(a){for(var b=0;b<this.Applied.length;b++)if("0"==a.HotelAmenityCode.charAt(parseInt(this.Applied[b])))return!0;return!1},Remove:function(a){SF.Tools.RemoveByValue(this.Applied,a);$("#AmenityCode_"+a).find("img").attr("src","images/hotel/AmenityIcons/"+
a+"-0.png")},Add:function(a){this.Contains(a)||(this.Applied.push(a),$("#AmenityCode_"+a).find("img").attr("src","images/hotel/AmenityIcons/"+a+"-1.png"))},Clear:function(){for(var a=0;a<this.Applied.length;a++)$("#AmenityCode_"+this.Applied[a]).find("img").attr("src","images/hotel/AmenityIcons/"+this.Applied[a]+"-0.png");this.Applied=[]},Contains:function(a){for(var b=0;b<this.Applied.length;b++)if(this.Applied[b]==a)return!0;return!1},Only:function(a){this.Clear();this.Applied.push(a)},Toggle:function(a){this.Contains(a)?
this.Remove(a):this.Add(a)}},Name:{Applied:[],Filter:function(){},FilterItem:function(a){for(var b=0;b<this.Applied.length;b++)if(0>a.HotelName.indexOf(this.Applied[b]))return!0;return!1},Remove:function(a){SF.Tools.RemoveByValue(this.Applied,a)},Add:function(a){this.Applied=[];this.Contains(a)||this.Applied.push(a)},Clear:function(){this.Applied=[];$("#txtHotelNameFilter").val("")},Contains:function(a){for(var b=0;b<this.Applied.length;b++)if(this.Applied[b]==a)return!0;return!1},Only:function(){this.Applied=
[];var a=$("#txtHotelNameFilter").val();null!=a&&""!=a&&this.Applied.push(a)}},Price:{Applied:[],Filter:function(){},FilterItem:function(a){for(var b=0;b<this.Applied.length;b++)if(a.RateRangeMinRate>this.Applied[b])return!0;return!1},Remove:function(a){SF.Tools.RemoveByValue(this.Applied,a)},Add:function(a){this.Contains(a)||this.Applied.push(a)},Clear:function(){this.Applied=[];$("#cbHotelFilterPrice").slider("value",SF.Hotel.HotelSearchResult.MaxPrice.Amount);$("#slider-amount").html(SF.Tools.FormatDouble(SF.Hotel.HotelSearchResult.MaxPrice.Amount));
return!0},Contains:function(a){for(var b=0;b<this.Applied.length;b++)if(this.Applied[b]==a)return!0;return!1},Only:function(a){this.Applied=[];this.Applied.push(a);return!0}}};this.Remove=function(a,b){switch(a){case "ChainName":this.Filters.ChainName.Remove(b);break;case "Rating":this.Filters.Rating.Remove(b);break;case "Amenity":this.Filters.Amenity.Remove(b);break;case "Name":this.Filters.Name.Remove(b);break;case "Price":this.Filters.Price.Remove(b)}this.Filter()};this.Add=function(a,b){switch(a){case "ChainName":this.Filters.ChainName.Add(b);
break;case "Rating":this.Filters.Rating.Add(b);break;case "Amenity":this.Filters.Amenity.Add(b);break;case "Name":this.Filters.Name.Add(b);break;case "Price":this.Filters.Price.Add(b)}this.Filter()};this.Toggle=function(a,b){switch(a){case "Amenity":SF.Hotel.Filtering.Filters.Amenity.Toggle(b)}this.Filter()};this.Remove=function(a,b){switch(a){case "ChainName":this.Filters.ChainName.Remove(b);break;case "Rating":this.Filters.Rating.Remove(b);break;case "Amenity":this.Filters.Amenity.Remove(b);break;
case "Name":this.Filters.Name.Remove(b);break;case "Price":this.Filters.Price.Remove(b)}this.Filter()};this.Clear=function(a){switch(a){case "ChainName":this.Filters.ChainName.Clear();break;case "Rating":this.Filters.Rating.Clear();break;case "Amenity":this.Filters.Amenity.Clear();break;case "Name":this.Filters.Name.Clear();break;case "Price":this.Filters.Price.Clear()}this.Filter()};this.Only=function(a,b){switch(a){case "ChainName":this.Filters.ChainName.Only(b);break;case "Rating":this.Filters.Rating.Only(b);
break;case "Amenity":this.Filters.Amenity.Only(b);break;case "Name":this.Filters.Name.Only(b);break;case "Price":this.Filters.Price.Only(b)}this.Filter()};this.Filter=function(){SF.Hotel.ResultToShow=[];for(var a=0;a<SF.Hotel.HotelSearchResult.Results.length;a++){var b=SF.Hotel.HotelSearchResult.Results[a];b.IsFiltered=SF.Hotel.Filtering.Filters.Amenity.FilterItem(b)||SF.Hotel.Filtering.Filters.ChainName.FilterItem(b)||SF.Hotel.Filtering.Filters.Name.FilterItem(b)||SF.Hotel.Filtering.Filters.Price.FilterItem(b)||
SF.Hotel.Filtering.Filters.Rating.FilterItem(b);b.IsFiltered||SF.Hotel.ResultToShow.push(b)}SF.Templates.ProcessTemplate("#HotelFilterSummary","Templates/Hotel/FilterSummary",null,function(){SF.Hotel.Refreshing.RefreshByFilter(function(){SF.GUI.BodyControl.Resize()})})};this.Change=function(a,b,c){$(a).is(":checked")?SF.Hotel.Filtering.Remove(b,c):SF.Hotel.Filtering.Add(b,c)}};this.Refreshing=new function(){this.RefreshByPager=function(a){SF.Hotel.ShowResults(function(){SF.Hotel.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();
SF.Tools.IsFunction(a)&&a()})})};this.RefreshByService=function(a){SF.Hotel.PrepareResultScreen(function(){SF.Hotel.ShowMapView(function(){SF.Hotel.ShowResults(function(){SF.Hotel.Sorting.ActiveSorter=SF.Hotel.Sorting.Sorter.Price;SF.Hotel.ShowPagerSorter(function(){SF.Hotel.ShowFilterScreens(function(){SF.Tools.IsFunction(a)&&($("#cbHotelFilterPrice").slider({range:"min",min:SF.Hotel.HotelSearchResult.MinPrice.Amount,max:SF.Hotel.HotelSearchResult.MaxPrice.Amount,value:SF.Hotel.HotelSearchResult.MaxPrice.Amount,
slide:function(a,c){$("#slider-amount").html(c.value)},change:function(a,c){SF.Hotel.Filtering.Only("Price",c.value)}}),SF.GUI.BodyControl.Resize(),a())})})})})})};this.RefreshBySorter=function(a){SF.Hotel.ShowResults(function(){SF.Hotel.ShowPagerSorter(function(){SF.GUI.BodyControl.Resize();SF.Tools.IsFunction(a)&&a()})})};this.RefreshByFilter=function(a){SF.Hotel.ShowResults(function(){SF.Hotel.ShowPagerSorter(function(){SF.Tools.IsFunction(a)&&(SF.GUI.BodyControl.Resize(),a())})})}};this.Paging=
new function(){this.PageSize=10;this.CurrentPage=1;this.GoToPage=function(a){"f"==a?SF.Hotel.Paging.CurrentPage++:"b"==a?SF.Hotel.Paging.CurrentPage--:SF.Hotel.Paging.CurrentPage=a;SF.Hotel.Refreshing.RefreshByPager()};this.ChangePageSize=function(a){SF.Hotel.Paging.CurrentPage=1;SF.Hotel.Paging.PageSize=$(a).val();$(".PageSizeSelector").val(SF.Hotel.Paging.PageSize);SF.Hotel.Refreshing.RefreshByPager()};this.GetPageCount=function(){try{var a=SF.Hotel.ResultToShow.length/SF.Hotel.Paging.PageSize;
return parseInt(a)<a?parseInt(a)+1:a}catch(b){}return 0};this.ChangeCurrentPage=function(a){try{SF.Hotel.Paging.PageSize=$(a).val(),SF.Hotel.Paging.GetPageCount()}catch(b){}};this.GetPagingRecordIndex=function(a){try{if(1==a)return SF.Hotel.Paging.PageSize*SF.Hotel.Paging.CurrentPage;if(0==a)return SF.Hotel.Paging.PageSize*(SF.Hotel.Paging.CurrentPage-1)+1}catch(b){SaveException(b,"GetPagingRecordIndex")}}};this.Helpers=new function(){this.GetParameterDetails=function(a){try{for(var b=0;b<SF.Hotel.MasterData.ParameterDetails.Data.length;b++)if(SF.Hotel.MasterData.ParameterDetails.Data[b].Code==
a)return SF.Hotel.MasterData.ParameterDetails.Data[b].ParameterDetails;return null}catch(c){SF.Logger.SaveException(c,"GetParameterDetails")}};this.GetAmenityName=function(a){return("HotelAmenity_"+a).Localize()};this.GetMapHotels=function(){if(null!=SF.Hotel.Map.MapHotels)return SF.Hotel.Map.MapHotels;for(var a=[],b=0;b<SF.Hotel.ResultToShow.length;b++){var c=SF.Hotel.ResultToShow[b];if("0"!=c.Latitude&&"0"!=c.Longitude&&(c.MapIndex=a.length+1,a.push(c),10==a.length))break}return SF.Hotel.Map.MapHotels=
a}};this.Terms={Hotel:{Room:"Templates/Hotel/RoomRules",Agency:"Templates/Hotel/AgencyHotelRules",Show:function(a,b){if(!SF.Tools.IsNull(a)&&!0==a)SF.GUI.PopUpControl.ShowUrl(SF.Hotel.Terms.Hotel.Agency);else{for(var c=null,e=0;e<SF.Hotel.HotelSearchResult.Results.length;e++){var d=!1;if(!SF.Tools.IsNull(SF.Hotel.HotelSearchResult.Results[e].Rooms))for(var f=0;f<SF.Hotel.HotelSearchResult.Results[e].Rooms.length;f++)if(SF.Hotel.HotelSearchResult.Results[e].Rooms[f].Id==b){d=!0;c=SF.Hotel.HotelSearchResult.Results[e].Rooms[f];
c.Currency=SF.Hotel.HotelSearchResult.Results[e].Currency;break}if(d)break}if(!1==d&&!SF.Tools.IsNull(SF.Basket.HotelBasket.SelectedHotelRoom.Item)&&SF.Basket.HotelBasket.SelectedHotelRoom.Item.Id==b)c=SF.Basket.HotelBasket.SelectedHotelRoom.Item;!1==d&&SF.GUI.PopUpControl.ShowMessage("NotFound");SF.GUI.PopUpControl.ShowUrl(SF.Hotel.Terms.Hotel.Room,null,null,c)}}}};this.Session=new function(){this.Data=null;this.GetSession=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.Hotel,SF.Ajax.ServiceMethods.Hotel.GetHotelSessionItem,
null,function(b){if(!SF.Tools.IsNull(b))SF.Basket.HotelBasket.SelectedHotelRoom.Item=b.BasketItem.SelectedHotelRoom,SF.Basket.HotelBasket.SelectedHotelRoom.Recommendation=b.BasketItem.SelectedRecommendation,SF.Basket.HotelBasket.SelectedHotelRoom.HotelSearchResult=b.HotelSearchResult,SF.Hotel.Session.Data=b,SF.Tools.IsFunction(a)&&a()})}};this.Map=new function(){this.MapHotels=null;this.Markers=[];this.InfoWindow={};this.CurrentMap={};this.GetGoogleMap=function(a){var b=SF.Hotel.Helpers.GetMapHotels();
0==b.length?($("#rslHotelMap").hide(),$(".hrs-map-trig").hide(),SF.Tools.IsFunction(a)&&a()):($("#rslHotelMap").show(),$(".hrs-map-trig").show());setTimeout(function(){var a={zoom:14,center:new google.maps.LatLng(0,0),mapTypeId:google.maps.MapTypeId.ROADMAP};SF.Hotel.Map.CurrentMap=new google.maps.Map(document.getElementById("hotelmapcontainer"),a);SF.Hotel.Map.InfoWindow=new google.maps.InfoWindow;google.maps.event.addListener(SF.Hotel.Map.CurrentMap,"click",function(){SF.Hotel.Map.InfoWindow.close()});
SF.Hotel.Map.ConstructMarkers(b,function(){if(0!=b.length){var a=new google.maps.LatLng(b[0].Latitude,b[0].Longitude);SF.Hotel.Map.CurrentMap.setCenter(a)}})},2E3);SF.Tools.IsFunction(a)&&a()};this.ConstructMarkers=function(a,b){for(var c=0;c<a.length;c++){var e=a[c],d="#"+e.MapIndex+" "+e.HotelName,f=SF.Hotel.Map.ConstructHotelMarkerContent(e);SF.Hotel.Map.DisplayMarker(d,f,e)}SF.Tools.IsFunction(b)&&b()};this.ConstructHotelMarkerContent=function(a){for(var b='<div id="hotel'+a.MapIndex+'" class="mapContainer">',
b=b+('<div class="mapContentLeft"><h1>'+a.HotelName+"<i></i></h1><div>"),b=b+'</div></div><div class="mapContentRight"><div class="mapHotelStars">',c=1;c<=parseInt(a.Rating);c++)b+='<img src="images/css/Star',b=-1<parseInt(a.Rating)-c?b+"1":b+"0",b+='.png" />';b=b+'</div><div class="mapHotelAdress"></div><div class="mapHotelPrice">'+(SF.Tools.FormatDouble(a.RateRangeMinRate)+" "+a.Currency+"</div>");b=b+'<div class="mapHotelDetail"><a href="javascript:SF.Hotel.Map.FocusHotelDetail(\''+(a.Id+"',true);\">Detaylar</a></div>");
return b+"</div></div>"};this.DisplayMarker=function(a,b,c){var e=new google.maps.Marker({map:SF.Hotel.Map.CurrentMap,title:a,icon:"images/Hotel/Map/icon"+c.MapIndex+".png",position:new google.maps.LatLng(c.Latitude,c.Longitude)});SF.Hotel.Map.Markers[SF.Hotel.Map.Markers.length]=e;google.maps.event.addListener(e,"click",function(){SF.Hotel.Map.InfoWindow.setContent(b);SF.Hotel.Map.InfoWindow.open(SF.Hotel.Map.CurrentMap,e)});c.Marker=e};this.Focus=function(a,b){try{var c=SF.Hotel.Map.MapHotels[a-
1],e=SF.Hotel.Map.ConstructHotelMarkerContent(c);SF.Hotel.Map.InfoWindow.setContent(e);SF.Hotel.Map.InfoWindow.open(SF.Hotel.Map.CurrentMap,c.Marker);!SF.Tools.IsNull(b)&&!0==b&&$("body").scrollTo(".hrs-map-all",1E3)}catch(d){}};this.FocusHotelDetail=function(a,b){SF.Hotel.ShowHotelDetails(a,b)}};this.ToggleHotelDetail=function(a){a=$("#"+a);SF.Hotel.ShowHotelDetails($(a).attr("id"),!1)};$(".hrs-all .hotel-item").not(".HotelPnrPage").live("click",function(){});$(".hrs-map-trig").live("click",function(){$(".hrs-map-all").toggleClass("dnone");
$(this).toggleClass("hrs-map-trig-hover");return!1})};
$(document).ready(function(){$(".login0").hide();$(".login1").hide();SF.Membership.GetCurrentMemberData(function(){SF.GUI.HeaderControl.OrganizeMemberControls();SF.Membership.IsLoggedIn()?($(".login0").hide(),$(".login1").show()):($(".login0").show(),$(".login1").hide())})});
NameSpace.prototype.Membership=new function(){this.OnPostLogin=null;this.CurrentMember={Data:null,Reservations:{Data:null,CurrentPnr:null,Get:function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetReservations,null,function(b){SF.Membership.CurrentMember.Reservations.Data=b;a(b)})},GetItem:function(a){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Summary);(SF.Tools.IsNull(SF.Membership.CurrentMember.Reservations.CurrentPnr)||SF.Membership.CurrentMember.Reservations.CurrentPnr.Pnr.PnrNo!=
a)&&SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnr,"pnrno="+a,function(a){SF.Membership.CurrentMember.Reservations.CurrentFlightOption=a.SelectedFlightOption;SF.Ajax.CallService(SF.Ajax.ServiceEnums.Flight,SF.Ajax.ServiceMethods.Flight.GetPnrData,null,function(d){"Flight"==d.PnrType?(SF.Basket.BasketType=SF.Basket.BasketTypeEnum.InternationalFlight,SF.System.Parameters.Airports.Data=d.Airports,SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1),
SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Flight/FlightPnr",a.SelectedFlightOption,function(){$("body").scrollTo(SF.GUI.BodyControl.Tabs.Summary.Link,500);SF.GUI.BodyControl.Resize()})},null,null,null,function(){SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.PreviousTab);SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,!1);SF.System.Error()})):"Hotel"==d.PnrType?(SF.Basket.BasketType=
SF.Basket.BasketTypeEnum.Hotel,SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1),SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){var c={};c.SelectedHotel=a.SelectedHotel;c.SelectedRoom=a.SelectedRoom;SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Hotel/HotelPnr",c,function(){$("body").scrollTo(SF.GUI.BodyControl.Tabs.Summary.Link,500);hgallery();SF.GUI.BodyControl.Resize()})})):(d.PnrType="Car",SF.Basket.BasketType=SF.Basket.BasketTypeEnum.Car,
SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Summary,!1),SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Summary,null,function(){var c={};c.SelectedCar=a.SelectedCar;c.CarSearchInfo=a.CarSearchInfo;c.SelectedVehicle=a.SelectedVehicle;SF.Templates.ProcessTemplate("#PnrItemDetails","Templates/Car/CarPnr",c,function(){$("body").scrollTo(SF.GUI.BodyControl.Tabs.Summary.Link,500);SF.GUI.BodyControl.Resize()})}))})})},Hide:function(){SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,
!1);SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Home,!1);$("body").scrollTo(SF.GUI.HeaderControl.Tabs.Reservation.Container,500);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Home,null,function(){})},BookPnr:function(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Payment);SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.BookCurrentPnr,null,function(a){!1==a?(SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Summary),SF.GUI.PopUpControl.ShowMessage("Message_BookingIsNotAllowedForThisFlight".Localize(),
!0)):SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Payment,function(){this.AllowResize=!1},function(){SF.System.Payment.CalculatePricedItemTable(new function(){SF.System.Payment.BillingInformation.BindBillingData();SF.System.Payment.ReservationType.Organize();SF.System.Payment.ReservationType.ActivateReservationTypeControl(0)});this.AllowResize=!0;SF.GUI.BodyControl.Resize()},!1,!0,!1)})},ProcessAfterClose:null,Cancel:function(){SF.GUI.BodyControl.PreActivate(SF.GUI.BodyControl.Tabs.Summary);
SF.GUI.PopUpControl.Buttons.YesButton.Visible=!0;SF.GUI.PopUpControl.Buttons.NoButton.Visible=!0;SF.GUI.PopUpControl.Buttons.OkButton.Visible=!1;SF.GUI.PopUpControl.Buttons.YesButton.OnClick=function(){SF.GUI.PopUpControl.ChangeMessage(srcloader,!0);SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.Cancel,null,function(a){1==a?(SF.GUI.PopUpControl.ChangeMessage("Message_YourReservationIsCancelled".Localize(),!0),SF.Membership.CurrentMember.Reservations.ProcessAfterClose=
null,SF.GUI.BodyControl.ControlTab(SF.GUI.BodyControl.Tabs.Summary,!1),SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Home,!1),$("body").scrollTo(SF.GUI.HeaderControl.Tabs.Reservation.Link,500),SF.Membership.IsLoggedIn()&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Reservation,null,null,!1)):0==a&&(SF.GUI.PopUpControl.ChangeMessage("Message_CancellationErrorContactAcency".Localize(),!0),SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Summary))})};SF.GUI.PopUpControl.Buttons.NoButton.OnClick=
function(){SF.GUI.PopUpControl.Close();SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Summary)};this.ProcessAfterClose=SF.GUI.BodyControl.RollbackActivation(SF.GUI.BodyControl.Tabs.Summary);SF.GUI.PopUpControl.ShowMessage("Message_AreYouSureToCancelYourReservation".Localize(),null,null,function(){SF.Tools.IsFunction(SF.Membership.CurrentMember.Reservations.ProcessAfterClose)&&SF.Membership.CurrentMember.Reservations.ProcessAfterClose()})},SendMail:function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,
SF.Ajax.ServiceMethods.System.SendMail,null,function(a){"Sent"==a?SF.GUI.PopUpControl.ShowMessage("Message_PleaseCheckYourInbox".Localize()):"Error"==a&&SF.GUI.PopUpControl.ShowMessage("Message_MailingError".Localize())})},Paging:new function(){this.PageSize=10;this.CurrentPage=1;this.GoToPage=function(a){"f"==a?this.CurrentPage++:"b"==a?this.CurrentPage--:this.CurrentPage=a;SF.Membership.CurrentMember.Reservations.Refreshing.RefreshByPager()};this.GetPageCount=function(){try{var a=SF.Membership.CurrentMember.Reservations.Data.length/
this.PageSize;return parseInt(a)<a?parseInt(a)+1:a}catch(b){}return 0};this.GetPagingRecordIndex=function(a){try{if(1==a)return this.PageSize*this.CurrentPage;if(0==a)return this.PageSize*(this.CurrentPage-1)}catch(b){SaveException(b,"GetPagingRecordIndex")}}},Refreshing:new function(){this.RefreshByPager=function(a){SF.Membership.CurrentMember.Reservations.Get(function(b){SF.Templates.ProcessTemplate(SF.GUI.HeaderControl.Tabs.Reservation.Container,"Templates/Membership/ReservationList",b,function(){SF.Tools.IsFunction(a)&&
a()})})}}},AddPassenger:function(){SF.Validation.ValidationCheck("ProfilePassengers",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.AddProfilePassenger,$("#ProfilePassengers *").serialize(),function(a){a.ResponseType==SF.Ajax.ServiceResponseType.Result?(SF.Membership.CurrentMember.Data.MemberDetail.PassengerList=a.Result,SF.Templates.ProcessTemplate("#ProfilePassengers","Templates/Membership/ProfilePassengers",a.Result,function(){$(".BirthDateTextBox").datepick({yearRange:"c-80:c+0"});
$(".NumericTextBox").numeric();$(".datepicker").datepick();SF.GUI.HeaderControl.Resize()})):a.ResponseType==SF.Ajax.ServiceResponseType.Validation&&0<a.ValidationResults.length&&SF.Validation.ShowValidationErrors(a.ValidationResults)})})},RemovePassenger:function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.RemoveProfilePassenger,"PassengerId="+a,function(a){SF.Membership.CurrentMember.Data.MemberDetail.PassengerList=a;SF.Templates.ProcessTemplate("#ProfilePassengers",
"Templates/Membership/ProfilePassengers",a,function(){$(".BirthDateTextBox").datepick({yearRange:"c-80:c+0"});$(".NumericTextBox").numeric();$(".datepicker").datepick();SF.GUI.HeaderControl.Resize()})})},AddFrequentFlyerCard:function(){SF.Validation.ValidationCheck("ProfileFrequentFlyerCards",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.AddFrequentFlyerCard,$("#ProfileFrequentFlyerCards *").serialize(),function(a){SF.Membership.CurrentMember.Data.MemberDetail.FrequentFlyerList=
a;SF.Templates.ProcessTemplate("#ProfileFrequentFlyerCards","Templates/Membership/ProfileFrequentFlyerCards",a,function(){$(".NumericTextBox").numeric();SF.GUI.HeaderControl.Resize()})})})},RemoveFrequentFlyerCard:function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.RemoveFrequentFlyerCard,"FrequentFlyerCardId="+a,function(a){SF.Membership.CurrentMember.Data.MemberDetail.FrequentFlyerList=a;SF.Templates.ProcessTemplate("#ProfileFrequentFlyerCards","Templates/Membership/ProfileFrequentFlyerCards",
a,function(){$(".NumericTextBox").numeric();SF.GUI.HeaderControl.Resize()})})},Helpers:{GetNumberOfPassengerType:function(a){if(SF.Tools.IsNull(SF.Membership.CurrentMember.Data)||SF.Tools.IsNull(SF.Membership.CurrentMember.Data.MemberDetail.PassengerList)||0==SF.Membership.CurrentMember.Data.MemberDetail.PassengerList.length)return 0;var b=0;try{for(var d=0;d<SF.Membership.CurrentMember.Data.MemberDetail.PassengerList.length;d++)SF.Membership.CurrentMember.Data.MemberDetail.PassengerList[d].PassengerType==
a&&b++}catch(c){SaveException(c,"SF.Membership.CurrentMember.Helpers.GetNumberOfPassengerType")}return b}}};this.Login=function(){SF.Validation.ValidationCheck("MemberLoginForm",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.LogIn,$("#MemberLoginForm *").serialize(),function(a){null==a?SF.GUI.PopUpControl.ShowMessage("Membership_IncorrectUsernameOrPassword".Localize()):void 0!=a.ValidationResults&&0<a.ValidationResults.length?SF.Validation.ShowValidationErrors(a.ValidationResults):
!0==a?SF.Membership.GetCurrentMemberData(function(){SF.GUI.HeaderControl.OrganizeMemberControls();if(!SF.Tools.IsNull(SF.Membership.OnPostLogin))SF.Membership.OnPostLogin(),SF.Membership.OnPostLogin=null}):"refresh"==a?parent.window.location.reload():SF.GUI.PopUpControl.ShowMessage("Membership_IncorrectUsernameOrPassword".Localize())})})};this.GetCurrentMemberData=function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetCurrentMemberData,null,function(b){if(""!=
b)SF.Membership.CurrentMember.Data=b,SF.Tools.IsFunction(a)&&a()})};this.SignUp=function(a){SF.Validation.ValidationCheck("SignUpForm",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.SignUp,$("#SignUpForm *").serialize(),function(b){b.ResponseType==SF.Ajax.ServiceResponseType.Validation?SF.Validation.ShowValidationErrors(b.ValidationResults):(b.ResponseType==SF.Ajax.ServiceResponseType.Result?"SignUpCompleted"==b.Result?(SF.GUI.PopUpControl.ShowMessage("Membership_RegistrationCompleted".Localize()),
SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login)):"EMailConfirmation"==b.Result?(SF.GUI.PopUpControl.ShowMessage("Membership_EMailConfirmation".Localize()),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login)):"RegistrationIsNowAllowed"==b.Result&&SF.GUI.PopUpControl.ShowMessage("Membership_RegistrationIsNotAllowed".Localize()):"SignUpCompleted"==b?(SF.GUI.PopUpControl.ShowMessage("Membership_RegistrationCompleted".Localize()),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login)):
"EMailConfirmation"==b?(SF.GUI.PopUpControl.ShowMessage("Membership_EMailConfirmation".Localize()),SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Login)):"RegistrationIsNowAllowed"==b&&SF.GUI.PopUpControl.ShowMessage("Membership_RegistrationIsNotAllowed".Localize()),SF.Tools.IsFunction(a)&&a())})})};this.Confirm=function(a){SF.Tools.IsFunction(a)&&a()};this.RemindPassword=function(a){SF.Validation.ValidationCheck("LostPasswordForm",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,
SF.Ajax.ServiceMethods.System.RemindPassword,$("#LostPasswordForm *").serialize(),function(b){SF.GUI.PopUpControl.ShowMessage(eval(b));SF.Tools.IsFunction(a)&&a()})})};this.UpdateMember=function(){SF.Membership.IsLoggedIn()&&SF.Validation.ValidationCheck("MemberElementaryData",function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.UpdateMember,$("#MemberProfileForm *").serialize(),function(a){if(a.ResponseType==SF.Ajax.ServiceResponseType.Validation)SF.Validation.ShowValidationErrors(a.ValidationResults);
else if(a.ResponseType==SF.Ajax.ServiceResponseType.Result)SF.Membership.CurrentMember.Data=a.Result,SF.GUI.PopUpControl.ShowMessage("Membership_ProfileUpdated".Localize())})})};this.SignOut=function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.SignOut,null,function(a){"refresh"==a&&parent.window.location.reload();SF.Membership.CurrentMember.Data=null;SF.Membership.CurrentMember.Reservations.Data=null;SF.Membership.CurrentMember.Reservations.CurrentFlightOption=
null;SF.GUI.BodyControl.ControlNext(SF.GUI.BodyControl.Tabs.Home,!1,!1,!0);SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Home,null,null);SF.GUI.HeaderControl.OrganizeMemberControls()})};this.IsLoggedIn=function(){return SF.Tools.IsNull(SF.Membership.CurrentMember.Data)?!1:!0};this.GetReservationList=function(a){SF.Membership.CurrentMember.Reservations.Refreshing.RefreshByPager(function(){SF.Tools.IsFunction(a)&&a()})}};
(function(a){a.browserTest=function(b,d){var g=function(a,c){for(var b=0;b<c.length;b+=1)a=a.replace(c[b][0],c[b][1]);return a},f=function(b,c,d,f){c={name:g((c.exec(b)||["unknown","unknown"])[1],d)};c[c.name]=!0;c.version=(f.exec(b)||["X","X","X","X"])[3];if(c.name.match(/safari/)&&400<c.version)c.version="2.0";if("presto"===c.name)c.version=9.27<a.browser.version?"futhark":"linear_b";c.versionNumber=parseFloat(c.version,10)||0;c.versionX="X"!==c.version?(c.version+"").substr(0,1):"X";c.className=
c.name+c.versionX;return c},b=(b.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?g(b,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,""],["Chrome Safari","Chrome"],["KHTML","Konqueror"],["Minefield","Firefox"],["Navigator","Netscape"]]):b).toLowerCase();a.browser=a.extend(!d?a.browser:{},f(b,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));a.layout=
f(b,/(gecko|konqueror|msie|opera|webkit)/,[["konqueror","khtml"],["msie","trident"],["opera","presto"]],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);a.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||["unknown"])[0].replace("sunos","solaris")};d||a("html").addClass([a.os.name,a.browser.name,a.browser.className,a.layout.name,a.layout.className].join(" "))};a.browserTest(navigator.userAgent)})(jQuery);
$(window).error(function(a){var b={};if(!SF.Tools.IsNull(a.originalEvent))b.Name=a.originalEvent.filename,b.LineNumber=a.originalEvent.lineno,b.Message=a.originalEvent.message;SF.Logger.CustomException(null,"App",b)});var exceptions=[];
NameSpace.prototype.Logger=new function(){this.TransactionId=null;this.SetTransactionId=function(a){this.TransactionId=a;$("#TransactionId").html(a)};this.CustomLog=function(a,b){setTimeout(function(){SF.Logger.SaveException(null,"CL_"+a,b,!0,SF)},1E3)};this.CustomException=function(a,b,d,g){setTimeout(function(){var f=null;!SF.Tools.IsNull(g)&&!0==g&&(f=SF);SF.Logger.SaveException(a,"CE_"+b,d,!0,f);delete f},1E3)};this.LogException=function(a,b,d){SF.Logger.SaveException(a,b,d)};this.LogError=function(a,
b,d){SF.Logger.SaveException(a,b,d)};this.SaveException=function(a,b,d,g,f){try{var e={};e.Key=SF.Tools.RandomText();e.Exception=a;e.Navigator={};e.Navigator.Browser=$.browser;e.Navigator.Layout=$.layout;e.Navigator.OS=$.os;e.Parameters=d;e.ClientTimestamp=(new Date).toString();if(!SF.Tools.IsNull(navigator))e.Navigator.Language=navigator.language;e.Snapshot=f;SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.LogException,"&error="+SF.Tools.SerializeObject(e).ReplaceAll("&",
"#######")+"&source=C_"+e.Key+"_"+b,function(){});SF.Tools.IsNull(g)}catch(c){}}};
$(document).ready(function(){SF.System.Parameters.Countries.Get(function(){});SF.System.Parameters.MealRequests.Get(function(){});SF.System.Parameters.LocalizedKeys.Get(function(){});Cultures.push("tr-TR");Cultures.push("en-US");SF.System.SessionManager.SessionExists()});Cultures=[];
NameSpace.prototype.System=new function(){this.Error=function(){SF.GUI.PopUpControl.ShowMessage("Message_ErrorOccured".Localize())};this.Localization={CurrentCulture:null,Get:new function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetCurrentCulture,null,function(a){SF.System.Localization.CurrentCulture=a})}};this.Parameters={LocationHelper:{BindingControlId:"",Mode:"City",ShowLocations:function(a){this.Mode="Location";this.BindingControlId=a;SF.System.Parameters.Countries.ShowInPopUp()},
ShowCities:function(a){this.Mode="City";this.BindingControlId=a;SF.System.Parameters.Countries.ShowInPopUp()},ShowAirports:function(a){this.Mode="Airport";this.BindingControlId=a;SF.System.Parameters.Countries.ShowInPopUp()},Set:function(a,b){$("#"+this.BindingControlId).val(a);$("#"+this.BindingControlId+"_Code").val(b);SF.GUI.PopUpControl.Close();this.BindingControlId=Number},Scroll:function(a){$("#lightmein").scrollTo(".pop-indexer-letter:contains('"+a+"')",500)}},Countries:{Data:null,Indexers:null,
Get:function(a){SF.Tools.IsNull(SF.System.Parameters.Countries.Data)?SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetCountries,null,function(b){SF.System.Parameters.Countries.Data=b;SF.Tools.IsFunction(a)&&a(SF.System.Parameters.Countries.Data)}):a(SF.System.Parameters.Countries.Data)},GetIndexers:function(){if(null==SF.System.Parameters.Countries.Indexers){for(var a=[],b=0;b<SF.System.Parameters.Countries.Data.length;b++){for(var d=!1,c=0;c<a.length;c++)a[c]==SF.System.Parameters.Countries.Data[b].CountryName.charAt(0)&&
(d=!0);d||a.push(SF.System.Parameters.Countries.Data[b].CountryName.charAt(0))}SF.System.Parameters.Countries.Indexers=a}return SF.System.Parameters.Countries.Indexers},GetByIndexer:function(a){for(var b=[],d=0;d<SF.System.Parameters.Countries.Data.length;d++)SF.System.Parameters.Countries.Data[d].CountryName.charAt(0)==a&&b.push(SF.System.Parameters.Countries.Data[d]);return b},ShowInPopUp:function(){SF.Templates.ProcessTemplate("#temp","Templates/System/Countries",null,function(){SF.GUI.PopUpControl.ShowMessage($("#temp").html());
$("#temp").html("")})},ShowCountryCitiesInPopUp:function(a){$("#CountryCityAirport").html(srcloader);SF.System.Parameters.Cities.GetItemsByCountryCode(a,function(b){for(var d=-1,c=0;c<SF.System.Parameters.Countries.Data.length;c++)if(SF.System.Parameters.Countries.Data[c].CountryCode==a){d=c;SF.System.Parameters.Countries.Data[c].Cities=b;break}SF.Templates.ProcessTemplate("#temp","Templates/System/Cities",SF.System.Parameters.Countries.Data[d],function(){$("#CountryCityAirport").html($("#temp").html())})})},
ShowCountryAirportsInPopUp:function(a){$("#CountryCityAirport").html(srcloader);SF.System.Parameters.Airports.GetItemsByCountryCode(a,function(b){for(var d=-1,c=0;c<SF.System.Parameters.Countries.Data.length;c++)if(SF.System.Parameters.Countries.Data[c].CountryCode==a){d=c;break}SF.System.Parameters.Countries.Data[d].Airports=b;SF.Templates.ProcessTemplate("#temp","Templates/System/Airports",SF.System.Parameters.Countries.Data[d],function(){$("#CountryCityAirport").html($("#temp").html())})})}},Cities:{Indexers:null,
CurrentCountryCode:null,GetItemsByCountryCode:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetCities,"&CountryCode="+a,function(a){SF.Tools.IsFunction(b)&&b(a)})},GetIndexers:function(a,b){if(null==SF.System.Parameters.Cities.Indexers||null!=SF.System.Parameters.Cities.Indexers&&SF.System.Parameters.Cities.CurrentCountryCode!=a){for(var d=[],c=0;c<b.length;c++){for(var e=!1,f=0;f<d.length;f++)d[f]==b[c].CityName.charAt(0)&&(e=!0);e||d.push(b[c].CityName.charAt(0))}SF.System.Parameters.Cities.Indexers=
d}SF.System.Parameters.Cities.CurrentCountryCode=a;return SF.System.Parameters.Cities.Indexers},GetByIndexer:function(a,b){for(var d=[],c=0;c<b.length;c++)b[c].CityName.charAt(0)==a&&d.push(b[c]);return d},ShowCityAirportsInPopUp:function(a){$("#CountryCityAirport").html(rslloader);SF.System.Parameters.Airports.GetItemsByCityCode(a,function(b){for(var d=-1,c=-1,e=0;e<SF.System.Parameters.Countries.Data.length;e++)if(null!=SF.System.Parameters.Countries.Data[e].Cities)for(var f=0;f<SF.System.Parameters.Countries.Data[e].Cities.length;f++)if(SF.System.Parameters.Countries.Data[e].Cities[f].CityCode==
a){d=e;for(f=0;f<SF.System.Parameters.Countries.Data[e].Cities.length;f++)if(SF.System.Parameters.Countries.Data[e].Cities[f].CityCode==a){c=f;SF.System.Parameters.Countries.Data[e].Cities[f].Airports=b;break}break}SF.Templates.ProcessTemplate("#temp","Templates/System/Airports",SF.System.Parameters.Countries.Data[d].Cities[c],function(){$("#CountryCityAirport").html($("#temp").html())})})},ShowCityLocationsInPopUp:function(a){$("#CountryCityAirport").html(rslloader);SF.System.Parameters.Airports.GetItemsByCityCode(a,
function(b){for(var d=-1,c=-1,e=0;e<SF.System.Parameters.Countries.Data.length;e++)if(null!=SF.System.Parameters.Countries.Data[e].Cities)for(var f=0;f<SF.System.Parameters.Countries.Data[e].Cities.length;f++)if(SF.System.Parameters.Countries.Data[e].Cities[f].CityCode==a){d=e;for(f=0;f<SF.System.Parameters.Countries.Data[e].Cities.length;f++)if(SF.System.Parameters.Countries.Data[e].Cities[f].CityCode==a){c=f;SF.System.Parameters.Countries.Data[e].Cities[f].Airports=b;break}break}SF.Templates.ProcessTemplate("#temp",
"Templates/System/Airports",SF.System.Parameters.Countries.Data[d].Cities[c],function(){$("#CountryCityAirport").html($("#temp").html())})})}},Airports:{Data:null,Indexers:null,CurrentCityCode:null,GetItem:function(a){for(var b=0;b<SF.System.Parameters.Airports.Data.length;b++)if(SF.System.Parameters.Airports.Data[b].AirportCode==a)return SF.System.Parameters.Airports.Data[b];return""},GetItemsByCountryCode:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAirports,
"&CountryCode="+a,function(a){SF.Tools.IsFunction(b)&&b(a)})},GetItemsByCityCode:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAirports,"&CityCode="+a,function(a){SF.Tools.IsFunction(b)&&b(a)})},GetCached:function(a){if(!SF.Tools.IsNull(SF.System.Parameters.Airports))for(var b=0;b<SF.System.Parameters.Airports.Data.length;b++)if(SF.System.Parameters.Airports.Data[b].AirportCode==a)return SF.System.Parameters.Airports.Data[b];return null},Add:function(a){null==
SF.System.Parameters.Airports.GetCached(a.AirportCode)&&SF.System.Parameters.Airports.Data.push(a)},GetIndexers:function(a){for(var b=[],d=0;d<a.Airports.length;d++){for(var c=!1,e=0;e<b.length;e++)b[e]==a.Airports[d].AirportName.charAt(0)&&(c=!0);c||b.push(a.Airports[d].AirportName.charAt(0))}SF.System.Parameters.Airports.Indexers=b;return SF.System.Parameters.Airports.Indexers},GetByIndexer:function(a,b){for(var d=[],c=0;c<b.Airports.length;c++)b.Airports[c].AirportName.charAt(0)==a&&d.push(b.Airports[c]);
return d}},Locations:{Data:null,Indexers:null,CurrentCityCode:null,GetItem:function(a){for(var b=0;b<SF.System.Parameters.Airports.Data.length;b++)if(SF.System.Parameters.Airports.Data[b].AirportCode==a)return SF.System.Parameters.Airports.Data[b];return""},GetItemsByCountryCode:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAirports,"&CountryCode="+a,function(a){SF.Tools.IsFunction(b)&&b(a)})},GetItemsByCityCode:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,
SF.Ajax.ServiceMethods.System.GetAirports,"&CityCode="+a,function(a){SF.Tools.IsFunction(b)&&b(a)})},GetCached:function(a){if(!SF.Tools.IsNull(SF.System.Parameters.Airports))for(var b=0;b<SF.System.Parameters.Airports.Data.length;b++)if(SF.System.Parameters.Airports.Data[b].AirportCode==a)return SF.System.Parameters.Airports.Data[b];return null},Add:function(a){null==SF.System.Parameters.Airports.GetCached(a.AirportCode)&&SF.System.Parameters.Airports.Data.push(a)},GetIndexers:function(a){for(var b=
[],d=0;d<a.Airports.length;d++){for(var c=!1,e=0;e<b.length;e++)b[e]==a.Airports[d].AirportName.charAt(0)&&(c=!0);c||b.push(a.Airports[d].AirportName.charAt(0))}SF.System.Parameters.Airports.Indexers=b;return SF.System.Parameters.Airports.Indexers},GetByIndexer:function(a,b){for(var d=[],c=0;c<b.Airports.length;c++)b.Airports[c].AirportName.charAt(0)==a&&d.push(b.Airports[c]);return d}},MealRequests:{Data:null,Code:"MealRequest",Get:function(){SF.Tools.IsNull(SF.System.Parameters.MealRequests.Data)&&
SF.System.Parameters.Helper.GetParameterDetail(this.Code,function(a){SF.System.Parameters.MealRequests.Data=a})}},Airlines:{Data:null,Get:function(a){SF.Tools.IsNull(SF.System.Parameters.Airlines.Data)?SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAirlines,null,function(b){SF.System.Parameters.Airlines.Data=b;SF.Tools.IsFunction(a)&&a(SF.System.Parameters.Airlines.Data)}):a(SF.System.Parameters.Airlines.Data)}},LocalizedKeys:{Data:null,Get:function(a){SF.Tools.IsNull(SF.System.Parameters.Airlines.Data)?
SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetLocalizedKeys,null,function(b){SF.System.Parameters.LocalizedKeys.Data=b;SF.Tools.IsFunction(a)&&a(SF.System.Parameters.Airlines.Data)}):a(SF.System.Parameters.Airlines.Data)},GetItem:function(a){var b=a;if(!SF.Tools.IsNull(SF.System.Parameters.LocalizedKeys.Data))for(var d in SF.System.Parameters.LocalizedKeys.Data)if(SF.System.Parameters.LocalizedKeys.Data[d].Code==a)b=SF.System.Parameters.LocalizedKeys.Data[d].LocalizedValue;
a==b&&SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.AddMissingLocalizationItem,"&code="+a,function(){});return b},GetValueFromLocalizationElements:function(a,b){for(var d=0;d<a.length;d++)if(a[d].CultureCode==b)return a[d].LocalizedValue}},Helper:{GetParameterDetail:function(a,b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetParameterDetail,"code="+a,function(a){SF.Tools.IsNull(a)||SF.Tools.IsFunction(b)&&b(a)})}}};this.Rules={Data:null,
Retrieve:function(){$(SF.GUI.HeaderControl.Tabs.Flight.Container).html(srcloader);var a=new Date,b=a.getTimezoneOffset(),a=a.toString().indexOf("tandard");SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetPortalRules,"&OffSet="+b+"&standard="+a,function(a){SF.System.Rules.Data=a;!SF.Tools.IsNull(SF.GUI)&&!SF.Tools.IsNull(SF.GUI.HeaderControl)&&SF.GUI.HeaderControl.Activate(SF.GUI.HeaderControl.Tabs.Flight);SF.TypeOperations.SetTimeOffset(parseInt(SF.System.Rules.GetRule("DateTimeOffset").RuleValue))})},
GetRule:function(a){if(null!=SF.System.Rules.Data&&0<SF.System.Rules.Data.length)for(var b=0;b<SF.System.Rules.Data.length;b++)if(SF.System.Rules.Data[b].RuleCode==a)return SF.System.Rules.Data[b]}};this.Payment={PricedItems:null,CalculatePricedItemTable:function(a,b,d,c,e){var f="PaymentInstallmentId="+$("input[name='cmbInstalments']:checked").attr("value"),f=f+("&HasPayment="+c),c=$("#cmbCurrencyCode").val(),f=f+("&Currency="+(SF.Tools.IsNull(c)?"TRY":c));SF.Tools.IsNull(b)&&(b="#divPricedItemTable");
SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.CalculatePricedItemTable,f,function(c){if(c.ResponseType==SF.Ajax.ServiceResponseType.Exception)SF.GUI.PopUpControl.ShowMessage(c.Exception.Message);else if(c.ResponseType==SF.Ajax.ServiceResponseType.Result&&!SF.Tools.IsNull(c.Result)&&0<c.Result.length)SF.Tools.IsNull(d)?(SF.System.Payment.PricedItems=c.Result,SF.System.Payment.PreviousPricedItems=null):(SF.System.Payment.PreviousPricedItems=SF.System.Payment.PricedItems,
SF.System.Payment.PricedItems=c.Result),SF.System.Payment.UpdatePricedItemTable(b,c.Result,function(){for(var b=0,c=0,d=0,e=0;e<SF.System.Payment.PricedItems.length;e++){if("TotalFareFromCardAmount"==SF.System.Payment.PricedItems[e].ItemCode)b=SF.System.Payment.PricedItems[e].TRYAmount;if("ServiceFee"==SF.System.Payment.PricedItems[e].ItemCode)c=SF.System.Payment.PricedItems[e].TRYAmount;if("InterestRate"==SF.System.Payment.PricedItems[e].ItemCode)d=SF.System.Payment.PricedItems[e].TRYAmount}0!=b?
($("#TotalFareFromCardAmount").html(b),$("#TotalFareFromCardAmount").closest("li").show()):$("#TotalFareFromCardAmount").closest("li").hide();0!=d?($("#SummaryInterestAmount").html(d),$("#SummaryInterestAmount").closest("li").show()):$("#SummaryInterestAmount").closest("li").hide();0!=c?($("#ServiceFeeFromCardAmount").html(c),$("#ServiceFeeFromCardAmount").closest("li").show()):$("#ServiceFeeFromCardAmount").closest("li").hide();SF.Tools.IsFunction(a)&&(SF.GUI.BodyControl.Resize(),a())},SF.System.Payment.PreviousPricedItems)},
e)},UpdatePricedItemTable:function(a,b,d,c){var e={};e.Current=b;e.Previous=SF.Tools.IsNull(c)?null:c;SF.Templates.ProcessTemplate(a,"Templates/Basket/BookingPriceTable",e,function(){SF.Tools.IsFunction(d)&&(d(),SF.GUI.BodyControl.Resize())})},BillingInformation:new function(){this.OrganizeView=function(){$("#cmbBillingProfileType_0").is(":checked")?($(".rez-tuzel").show(),$(".rez-gercek").hide(),$(".RealPerson").removeClass("RequiredField"),$(".JuridicalPerson").addClass("RequiredField")):($(".rez-tuzel").hide(),
$(".rez-gercek").show(),$(".JuridicalPerson").removeClass("RequiredField"),$(".RealPerson").addClass("RequiredField"));SF.GUI.BodyControl.Resize()};this.BindBillingData=function(){if(!0==SF.Membership.IsLoggedIn()&&!SF.Tools.IsNull(SF.Membership.CurrentMember.Data.MemberDetail)){var a=SF.Membership.CurrentMember.Data;$("#rez-bill #txtContactNameBilling").val(a.FullName);$("#rez-bill #txtBillingAddressLine1").val(a.MemberDetail.BillingAddress);$("#rez-bill #cmbBillingCountry").val(a.MemberDetail.BillingCountryCode);
$("#rez-bill #txtBillingPostCode").val(a.MemberDetail.BillingZipCode);$("#rez-bill #txtBillingCity").val(a.MemberDetail.BillingCity);$("#rez-bill #txtIdentityNo").val(a.TCKN);$("#rez-bill #txtCompanyName").val(a.MemberDetail.BillingCompanyName);$("#rez-bill #txtTaxOffice").val(a.MemberDetail.BillingTaxOfficeName);$("#rez-bill #txtTaxNumber").val(a.MemberDetail.BillingTaxNumber);null!=SF.Basket.FlightBasket.SelectedOption.Item&&"THYProvider"==SF.Basket.FlightBasket.SelectedOption.Item.ProviderTypeString&&
($("#rez-delivery #txtDeliveryContactName").val(a.FullName),$("#rez-delivery #txtDeliveryAddress").val(a.MemberDetail.BillingAddress),$("#rez-delivery #cmbDeliveryCountry").val(a.MemberDetail.BillingCountryCode),$("#rez-delivery #txtDeliveryZipCode").val(a.MemberDetail.BillingZipCode),$("#rez-delivery #txtDeliveryCity").val(a.MemberDetail.BillingCity),$("#rez-delivery #txtDeliveryIdentityNumber").val(a.TCKN))}SF.System.Payment.BillingInformation.OrganizeView()};this.ActivateBillingTypeControl=function(a){$("#cmbBillingProfileType_"+
a).attr("checked","checked");SF.System.Payment.BillingInformation.OrganizeView()}},PriceTable:new function(){$("#cmbCurrencyCode").live("change",function(){SF.System.Payment.CalculatePricedItemTable()})},ReservationType:new function(){this.OrganizeView=function(){if($("#cmbDeliveryType_0").is(":checked"))SF.Basket.FlightBasket.BookingType=0,$("#rez-coupon").hide(),$("#rez-bill").hide(),$("#rez-delivery").show(),$("#divCreditCard").hide(),$(".rez-type tr").removeClass("rez-radio-selected"),$("#cmbDeliveryType_0").closest("tr").addClass("rez-radio-selected"),
$("#PricedItem_InterestRate").hide(),$(".PriceDescription").hide();else if($("#cmbDeliveryType_1").is(":checked"))SF.Basket.FlightBasket.BookingType=1,$("#rez-coupon").show(),$("#rez-bill").show(),$("#divCreditCard").show(),$("#rez-delivery").hide(),$(".rez-type tr").removeClass("rez-radio-selected"),$("#cmbDeliveryType_1").closest("tr").addClass("rez-radio-selected"),$("#PricedItem_InterestRate").show(),$(".PriceDescription").show();else if($("#cmbDeliveryType_2").is(":checked"))SF.Basket.FlightBasket.BookingType=
2,$("#rez-coupon").show(),$("#rez-bill").show(),$("#divCreditCard").show(),$(".rez-type tr").removeClass("rez-radio-selected"),$("#cmbDeliveryType_2").closest("tr").addClass("rez-radio-selected"),$("#PricedItem_InterestRate").show(),$(".PriceDescription").show();SF.GUI.BodyControl.Resize()};this.ActivateReservationTypeControl=function(a,b,d){0==$("#cmbDeliveryType_"+a).length?$("#cmbDeliveryType_2").attr("checked","checked"):$("#cmbDeliveryType_"+a).attr("checked","checked");SF.System.Payment.ReservationType.OrganizeView();
!SF.Tools.IsNull(b)&&!0==b&&SF.System.Payment.CalculatePricedItemTable(null,null,null,d)};this.Organize=function(){1==$("#cmbDeliveryType_0").length?SF.System.Payment.ReservationType.ActivateReservationTypeControl(0):1==$("#cmbDeliveryType_1").length?SF.System.Payment.ReservationType.ActivateReservationTypeControl(1):SF.System.Payment.ReservationType.ActivateReservationTypeControl(2)}}};this.SearchManager={SearchProcessing:!1,CheckSearchPermission:function(){return this.SearchProcessing?(SF.GUI.PopUpControl.ShowMessage("SearchIsAlreadyInProcess".Localize()),
!1):!0}};this.SessionManager={SessionControl:!1,SessionExists:function(){!0==SF.System.SessionManager.SessionControl&&SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.SessionExists,null,function(){})}};this.Promotions={Data:null,Retrieve:function(a){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAllPromotions,null,function(b){SF.System.Promotions.Data=b;SF.Tools.IsFunction(a)&&a()})}};this.Feedback={Send:function(){SF.Validation.ValidationCheck("userFeedBackForm",
function(){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetUserFeedback,$("#userFeedBackForm *").serialize(),function(a){1==a?$("#userFeedBackForm").html("Mesaj\u0131n\u0131z g\u00f6nderildi.Te\u015fekk\u00fcr ederiz"):$("#userFeedBackForm").html("Hata olu\u015ftu");SF.Tools.IsFunction(CallBack)&&CallBack()})})},Show:function(){SF.GUI.PopUpControl.ShowUrl("Templates/Home/Feedback");setTimeout(function(){SF.Membership.IsLoggedIn()&&($("#userFeedBackForm #txtFullName").val(SF.Membership.CurrentMember.Data.FullName),
$("#userFeedBackForm #txtEmail").val(SF.Membership.CurrentMember.Data.Email))},1E3)}}};
$(document).ready(function(){SF.Templates.GetTemplatesFromService(function(){SF.GUI.BodyControl.Activate(SF.GUI.BodyControl.Tabs.Home,function(){SF.GUI.BodyControl.AllowResize=!1},function(){SF.GUI.BodyControl.AllowResize=!0});SF.System.Parameters.Airlines.Get(function(){SF.System.Rules.Retrieve()})})});
NameSpace.prototype.Templates=new function(){this.ServiceTemplates=[];this.GetTemplatesFromService=function(b){SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,SF.Ajax.ServiceMethods.System.GetAllTemplates,null,function(e){SF.Templates.ServiceTemplates=e;SF.Tools.IsFunction(b)&&b()})};this.GetTemplateByName=function(b,e){for(var f=!1,c=0;c<this.ServiceTemplates.length;c++)if(this.ServiceTemplates[c].Name==b.toUpperCase()){f=!0;e(this.ServiceTemplates[c].Content);break}f||SF.Ajax.CallService(SF.Ajax.ServiceEnums.System,
SF.Ajax.ServiceMethods.System.GetTemplate,"tName="+b,function(a){null!=a&&0<a.length?(SF.Templates.ServiceTemplates.push(a[0]),e(a[0].Content)):e(null)})};this.ProcessTemplate=function(b,e,f,c,a){null==f&&(f={});this.GetTemplateByName(e,function(d){if(null!=d){$(b).setTemplate(d);void 0!=a&&null!=a&&"undefined"!=a&&$(b).setParam(a.Name,a.Value);try{$(b).processTemplate(f,null,function(){SF.Tools.IsFunction(c)&&c()})}catch(g){d={};d.TemplateName=e;d.Selector=b;d.Data=f;if(SF.Tools.IsFunction(c))d.CallBack=
c.toString();d.Parameter=a;SF.Logger.CustomException(g,"ProcessTemplate",d)}}})}};
$(document).ready(function(){});
NameSpace.prototype.TypeOperations=new function(){this.ClientDateTime=this.ServerDateTime=null;this.TimeOffset=2;this.IsDailyLightSaving=0;this.SetTimeOffset=function(a){this.TimeOffset=a;this.IsDailyLightSaving=this.isDailyLightSaving()};this.getTurkishDays=function(a){return("DayName_"+a).Localize()};this.getTurkishMonth=function(a){return("MonthName_"+a).Localize()};this.isDailyLightSaving=function(){var a=new Date,b=new Date,d=new Date;b.setMonth(2);b.setDate(31);var c=b.getDay();b.setDate(31-
c);d.setMonth(9);d.setDate(31);c=d.getDay();d.setDate(31-c);return a<b||a>=d?1:0};this.ParseCustomDateTime=function(a){var b={};if(SF.Tools.IsNull(a))return b;try{b.Day=parseInt(a.substring(3,5),10),b.Month=parseInt(a.substring(6,8),10),b.Year=parseInt(a.substring(9,13),10),b.Hour=parseInt(a.substring(14,16),10),b.Minute=parseInt(a.substring(17,19),10),b.Second=parseInt(a.substring(20,22),10),b.DayOfWeek=parseInt(a.substring(26,27),10)}catch(d){b.Day=1,b.Month=1,b.Year=2E3,b.Hour=0,b.Minute=0,b.Second=
0,b.DayOfWeek=1}return b};this.SFCalendar=function(a,b){var d=[{date:a},{param:b}];try{if(SF.Tools.IsNull(a)||""==a)return"";var c;if(-1!=a.indexOf("Date"))c=new Date(parseInt(a.substring(6,19))+6E4*this.TimeOffset);else if(-1!=a.indexOf("DT"))switch(c=this.ParseCustomDateTime(a),b){case "day":return this.getTurkishDays(c.DayOfWeek);case "month":return this.getTurkishMonth(c.Month-1);case "longdatestring":return c.Day+" "+this.getTurkishMonth(c.Month-1)+" "+c.Year+" "+this.getTurkishDays(c.DayOfWeek);
case "date-MON":return c.DayOfWeek+1+" "+this.getTurkishMonth(c.Month-1).substring(0,3);case "time":return c.Hour.padLeft(2,0)+":"+c.Minute.padLeft(2,0);case "dd/MM/yyyy":return c.Day+"/"+c.Month+"/"+c.Year;default:throw Error("Second parameter is worng !! Please enter 'day', 'month','date-MON', 'longdatestring' or 'jDate'");}else if(-1!=a.indexOf(".")){a=a.split(".");a.reverse();var e=a.shift();a.push(e);c=new Date(a)}else if(-1!=a.indexOf("/"))a=a.split("/"),a.reverse(),e=a.shift(),a.push(e),c=
new Date(a);else throw Error("Error");switch(b){case "day":return this.getTurkishDays(c.getDay());case "month":return this.getTurkishMonth(c.getMonth());case "longdatestring":return c.getDate()+" "+this.getTurkishMonth(c.getMonth())+" "+c.getFullYear()+" "+this.getTurkishDays(c.getDay());case "date-MON":return c.getDay()+1+" "+this.getTurkishMonth(c.getMonth()).substring(0,3);case "jDate":return eval("new"+a.replace(/\//g," "));case "time":return c.getHours().padLeft(2,0)+":"+c.getMinutes().padLeft(2,
0);case "dd/MM/yyyy":return c.getDate()+"/"+(c.getMonth()+1)+"/"+c.getFullYear();default:throw Error("Second parameter is worng !! Please enter 'day', 'month','date-MON', 'longdatestring' or 'jDate'");}}catch(f){SF.Logger.SaveException(f,"SFCalendar",d)}};this.ConvertToDate=function(a){try{return new Date(a.substring(6,10),a.substring(3,5),a.substring(0,2),a.substring(11,13),a.substring(14,16),0,0)}catch(b){SF.Logger.SaveException(b,"ConvertToDate")}};this.ConvertToTime=function(a){try{if(4==a.length)return a.substring(0,
2)+":"+a.substring(2,4)}catch(b){SF.Logger.SaveException(b,"ConvertToTime")}return a};this.FormatDateTime=function(a,b){try{switch(b){case "date":return a.substring(0,2)+"/"+a.substring(3,5)+"/"+a.substring(6,10);case "datetime":return a.substring(0,2)+"/"+a.substring(3,5)+"/"+a.substring(6,10)+" "+a.substring(11,13)+":"+a.substring(14,16);case "time":return a.substring(11,13)+":"+a.substring(14,16);default:return a}}catch(d){SF.Logger.SaveException(d,"FormatDateTime")}return a};this.TimeDifference=
function(a,b){try{var d=a.getTime()-b.getTime(),c=Math.floor(d/1E3/60/60/24),d=d-864E5*c,e=Math.floor(d/1E3/60/60),d=d-36E5*e,f=Math.floor(d/1E3/60);return new Date(0,0,c,e,f,Math.floor((d-6E4*f)/1E3),0,0)}catch(g){}};this.DayDifference=function(a,b){return b.getDate()-a.getDate()};this.GetTimeDifference=function(a,b){var d=(new Date(parseInt(b.substring(8,21)))).getTime();this.serverDate=new Date(a.substring(6,10),a.substring(3,5)-1,a.substring(0,2),a.substring(11,13),a.substring(14,16),a.substring(17,
19),0);this.TimeOffset=parseInt(this.serverDate-d);this.TimeOffset=parseInt(this.TimeOffset+59999)/12E4>parseInt(this.TimeOffset/12E4)?parseInt(this.TimeOffset+59999):this.TimeOffset}};Date.prototype.stdTimezoneOffset=function(){var a=new Date(this.getFullYear(),0,1),b=new Date(this.getFullYear(),6,1);return Math.max(a.getTimezoneOffset(),b.getTimezoneOffset())};Date.prototype.dst=function(){return this.getTimezoneOffset()<this.stdTimezoneOffset()};
NameSpace.prototype.Validation=new function(){this.ValidateValue=function(a,b,c){switch(b){case "RequiredField":if(null==a||0==a.length||""==a)return!1;break;case "DateFormatValidation":return!0;case "EMailValidation":return ValidateEmail(a);case "MandatoryCheckBox":return $(c).is(":checked")}};this.Validate=function(a){var b=[];jQuery.each(["RequiredField","DateFormatValidation","EMailValidation","MandatoryCheckBox"],function(){var c=this.toString();$(a+" ."+c).each(function(){var a=$(this).val();
if(!1==ValidateValue(a,c,$(this)))b[b.length]={},b[b.length-1].Message=$(this).siblings("."+c+"_"+$(this).attr("id").replace("#","")).html()})});$(a).append("<div id='ErrorMessageTxt' class='hide'>test</div>");ShowValidationErrors(b);if(0!=b.length)return!1};this.ShowValidationErrors=function(a){try{SF.Templates.ProcessTemplate("#ErrorMessageTxt","Templates/System/ValidationError",a,function(){SF.GUI.PopUpControl.ShowMessage($("#ErrorMessageTxt").html())})}catch(b){SF.Logger.SaveException(b,"ShowValidationErrors")}};
this.ValidateEmail=function(a){return/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i.test(a)};this.ValidationCheck=function(a,b){var c=!0,d=null;if("object"==typeof a){if(d=$(window.frames.cardframe.document).find(".RequiredField"),0<$(window.frames.cardframe.document).find(".ValidationDate_Future").length&&($(window.frames.cardframe.document).find(".ValidationYear").each(function(){$(this).val()==(new Date).getFullYear()&&$(window.frames.cardframe.document).find(".ValidationMonth").each(function(){parseInt($(this).val())<=
(new Date).getMonth()+1&&(c=!1)})}),!c))return SF.GUI.PopUpControl.ShowMessage("CreditCardExpireDateValidation".Localize()),!1}else d="#"+a+" .RequiredField";$(d).each(function(){if(($(this).is("input:text")||$(this).is("input:password")||$(this).is("select"))&&""==$(this).val())$(this).addClass("notvalidated"),c=!1});if(c)if(SF.Tools.IsFunction(b))b();else return c;else SF.GUI.PopUpControl.ShowMessage("RequiredFieldsMustBeFilled".Localize()),$(".RequiredField").live("click",function(){$(this).removeClass("notvalidated")})}};

