﻿var _tv = window.a; var tv = window.tv = function(selector, context) { return new tv.fn.init(selector, context) }; tv.WSURL = "/Service.svc/"; tv.RURL = "/okazje/przekierowanieLastMinute.html"; tv.SortBy = "Price"; tv.SortTyp = "asc"; tv.sessionID = ""; tv.KT = ""; tv.status = 0; tv.transType = 0; tv.OnlyAl = false; tv.Period7 = true; tv.Period8 = true; tv.Period14 = true; tv.Period15 = true; tv.Stars = [true, false, false, false, false, false, false]; tv.FlightTime = [true, true, true, true]; tv.PriceMin = 0; tv.PriceMax = 0; tv.Price = [0, 0]; tv.CUR = 0; tv.CUC = "PLN"; tv.EX = 1; tv.DFrom = new Array(); tv.DRegions = new Array(); tv.DCities = new Array(); tv.DCountry = new Array(); tv.DProviders = new Array(); tv.air = null; tv.printAir = null; tv.DataAct = false; tv.ContenerID = '#offerts'; tv.ProgresBar = '#searching-in-progress-box'; tv.ListHdr = '#list-hdr'; tv.listSort = '#list-sort-box'; tv.listFtr = '#list-ftr'; tv.Paging = '#Paging'; tv.HMax = "#HMax"; tv.HCount = "#HCount"; tv.size = 15; tv.paginOffsetDown = 2; tv.paginOffsetUp = 2; tv.paginStartP = 1; tv.paginEndP = 1; tv.TimeOut = 2500; tv.realTime = 0; tv.ATime = 50; tv.SP = true; tv.Template = "Progres"; tv.isHandler = false; tv.HandlerSearch = 0; tv.PBStart = false; tv.HProgress = 0; tv.PBIndex = 0; tv.fn = tv.prototype = { init: function() { }, Avilability: function(Lang) { var d = new Date(); $("#UpDate").show(); $.getJSON(tv.WSURL + "GetLastMinute?Lang=" + Lang, function(data) { var tmp = eval("(" + data.d + ")"); tv.fn.AddDate(tmp); tv.fn.SetStatus(tmp); tv.fn.Sort(); tv.SortBy = 'Price'; tv.fn.printData(); if (!tv.isHandler) Addhandler(); $("#UpDate").hide() }, "json") }, AddDate: function(data) { if (tv.status == 0) tv.air = data.Pr; tv.DProviders = data.Lp; tv.DCountry = data.Co; tv.DCities = data.Ci; tv.DRegions = data.Re; jQuery.each(tv.air, function(i, h) { h.a = true; h.isD = true; h.isC = true; h.apf = true; h.country = tv.fn.GetCountry(h.Co).N; h.countryCode = h.Co; h.apfPattern = ''; if (h.P < tv.PriceMin || tv.PriceMin == 0) tv.PriceMin = h.P; if (h.P > tv.PriceMax || tv.PriceMax == 0) tv.PriceMax = h.P; var sds = GetDate(h.Ds); var today = new Date(); var today7 = new Date(); var today14 = new Date(); var today28 = new Date(); today7.setDate(today7.getDate() + 7); today14.setDate(today14.getDate() + 14); today28.setDate(today28.getDate() + 28); h.flightTime = 0; if (sds <= today7 && sds > today) { h.flightTime = 1 } if (sds <= today14 && sds > today7) { h.flightTime = 2 } if (sds <= today28 && sds > today14) { h.flightTime = 3 } jQuery.each(h.OLI, function(i, d) { h.apfPattern += d + '|'; if (tv.DFrom.length == 0) tv.DFrom = clone(h.OLI); var isAdd = true; jQuery.each(tv.DFrom, function(i, fr) { if (d == fr) isAdd = false }); if (isAdd) tv.DFrom.push(d) }) }); tv.Price[0] = tv.PriceMin; tv.Price[1] = tv.PriceMax }, Bind: function() { tv.printAir = new Array(); if (tv.air != null) { jQuery.each(tv.air, function(i, h) { if (h.P >= tv.PriceMin && h.P <= (tv.PriceMax + 2) && tv.fn.ValPeriod(h) && tv.fn.ValCity(h) && tv.fn.ValStars(h) && tv.FlightTime[h.flightTime] && h.isD && h.isC && h.apf && h.a && tv.fn.ValAl(h)) { tv.printAir.push(clone(h)) } }) } }, ValCity: function(d) { var s = true; if (cityTo != '') s = (d.Ci == cityTo); return s }, ValAl: function(d) { var s = true; if (tv.OnlyAl) s = (d.Bt == 0); return s }, ValPeriod: function(d) { var stan = false; if (d.Pi <= 7) stan = tv.Period7; else if (d.Pi > 7 && d.Pi <= 13) stan = tv.Period8; else if (d.Pi == 14) stan = tv.Period14; else if (d.Pi > 14) stan = tv.Period15; return stan }, ValStars: function(h) { var isVal = false; switch (h.S) { case 0: isVal = tv.Stars[6]; break; case 1: isVal = tv.Stars[1]; break; case 2: isVal = tv.Stars[2]; break; case 3: isVal = tv.Stars[3]; break; case 4: isVal = tv.Stars[4]; break; case 5: isVal = tv.Stars[5]; break; default: isVal = tv.Stars[6]; break } if (tv.Stars[0]) isVal = true; return isVal }, ShowPaging: function() { var count = 0; var html = ""; if (tv.printAir.length > 0) { if (tv.printAir.length / tv.size == 0) count = tse.printAir.length / tv.size; else count = Math.floor(tv.printAir.length / tv.size) + (tv.printAir.length % tv.size == 0 ? 0 : 1); if (tv.index >= count) tv.index = count - 1; else if (tv.index < 0) tv.index = 0; if ((tv.index - 1) >= 0) html += "<a class=\"arr \" href='javascript:void(0)' onclick=\"tv.fn.ShowPage(" + (tv.index - 1) + ")\">&laquo;</a>"; else html += "<span class=\"arr inact\" >&laquo;</span>"; var isS = false; var isE = false; for (var i = 0; i < count; i++) { if ((count > tv.paginStartP + tv.paginOffsetDown + tv.paginOffsetUp) && i >= (tv.paginStartP) && !isS && (tv.index > (tv.paginStartP + tv.paginOffsetDown))) { html += "<span>...</span>"; isS = true } if ((i <= (tv.index + tv.paginOffsetUp) && i >= (tv.index - tv.paginOffsetDown)) || ((i < tv.paginStartP + tv.paginOffsetDown + tv.paginOffsetUp) && tv.index < (tv.paginStartP + tv.paginOffsetDown)) || (tv.index > (count - tv.paginOffsetDown - tv.paginEndP - tv.paginOffsetUp) && i > (count - tv.paginOffsetDown - tv.paginEndP - tv.paginOffsetUp)) || (i < tv.paginStartP) || ((i >= (count - tv.paginEndP)))) html += "<a href='javascript:void(0)' " + (i == tv.index ? " class=\"sel \" " : " onclick=\"tv.fn.ShowPage(" + (i) + ")\" ") + " >" + (i + 1) + "</a>"; if (!isE && (i >= (tv.index + tv.paginOffsetUp + tv.paginEndP + (!isS ? 1 : 0))) && (i < (count - tv.paginEndP))) { html += "<span>...</span>"; isE = true } } if (tv.index < (count - 1)) html += "<a class=\"arr\" href='javascript:void(0)' onclick=\"tv.fn.ShowPage(" + (tv.index + 1) + ")\">&raquo;</a>" } $(tv.Paging).html(html) }, ShowPage: function(index) { tv.index = index; tv.fn.printData(); Jump() }, printDataDelay: function() { tv.fn.Bind(); var html = ""; if (tv.air != null) { if (tv.SP) tv.fn.ShowPaging(); switch (tv.Template) { case 'List': html = tv.tem.TListe(tv.printAir); break; case 'Progres': html = tv.tem.TProgres(tv.printAir); break; default: html = ""; break }; $(tv.ContenerID).html(html); if (tv.printAir.length == 0) { $(tv.ContenerID).html('<div class="cnt-list-warn clearfix">                        <div class="list-warn-in">	                            <div class="list-warn-in2">	                                <div class="list-warn-bdy">' + trKomunikat_LastMinute_1 + '</div>	                            </div>	                            </div>		                    </div>') }; if (tv.air.length == tv.printAir.length) $("#reset").hide(); else $("#reset").show(); $(tv.HMax).html(tv.air.length); $(tv.HCount).html(tv.printAir.length) } setTimeout('$("#UpDate").hide()', 500) }, printData: function() { if (tv.Template == 'List' && tv.isUpdataShow) { $("#UpDate").show() } setTimeout('tv.fn.printDataDelay()', 30) }, SetStatus: function(data) { tv.sessionID = data.IdS; if (data.K != null) tv.KT = data.K; tv.status = data.S; tv.transType = data.Ty; if (tv.status == 0 || tv.status == 1) { $(tv.listSort + '-progres').remove(); tv.Template = "List"; $(tv.ContenerID + '-sep').remove(); $(tv.ProgresBar).hide(); $(tv.ListHdr).show(); $(tv.listSort).show(); $(tv.listFtr).show(); $('.filter-box').show(); $('.sites-searched-box').hide(); $(tv.ContenerID).removeClass('item-list-searching-v2'); if (airportFrom != '') { SetDIO(null, airportFrom) } if (countryTo != '') { SetDesynation(countryTo) } } CreatePriceRange(); CreatePortal(); if (providerCode != '0') { SetPortalOnly(providerCode) } }, Sort: function() { if (tv.air != null) tv.air.sort(tv.fn.SortAir) }, SortAir: function(x, y) { switch (tv.SortBy) { case "Price": return (tv.SortTyp == "asc" ? x.P - y.P : y.P - x.P); case "Category": return (tv.SortTyp == "asc" ? x.S - y.S : y.S - x.S); case "City": return (tv.SortTyp == "asc" ? sortByNameAsc(x.city, y.city) : sortByNameDsc(x.city, y.city)); case "Country": return (tv.SortTyp == "asc" ? sortByNameDsc(x.country, y.country) : sortByNameAsc(x.country, y.country)); case "FlightDate": return (tv.SortTyp == "asc" ? sortByDateAsc(x.Ds, y.Ds) : sortByDateDsc(x.Ds, y.Ds)) } }, GetCity: function(c) { var q = { Co: "N/A", C: "N/A", N: "N/A", Ap: "N/A" }; jQuery.each(tv.DCities, function(i, sci) { if (sci.Co == c) q = sci }); return q }, GetCountry: function(c) { var q = { C: "N/A", N: "N/A" }; jQuery.each(tv.DCountry, function(i, co) { if (co.C == c) q = co }); return q }, GetRegion: function(c) { var q = { Co: "N/A", N: "N/A" }; jQuery.each(tv.DRegions, function(i, aci) { if (aci.Co == c) q = aci }); return q } }; function AddDMonth(month, year) { var isMon = false; jQuery.each(tv.DMonths, function(i, m) { if (m.m == month) isMon = true }); if (!isMon) { var p = { m: month, y: year + '' + (month < 10 ? '0' : '') + month, a: true }; tv.DMonths.push(p) } } function sortByDateAsc(a, b) { var x = null; var y = null; if (a != null) x = eval("new Date(\"" + a.replace('/', '').replace('/', '') + "\")"); if (b != null) y = eval("new Date(\"" + b.replace('/', '').replace('/', '') + "\")"); return ((x < y) ? -1 : ((x > y) ? 1 : 0)) } function sortByDateDsc(a, b) { var x = null; var y = null; if (a != null) x = eval("new Date(\"" + a.replace('/', '').replace('/', '') + "\")"); if (b != null) y = eval("new Date(\"" + b.replace('/', '').replace('/', '') + "\")"); return ((x > y) ? -1 : ((x < y) ? 1 : 0)) } function sortByNameAsc(a, b) { var x = a.toLowerCase().replace(' ', ''); var y = b.toLowerCase().replace(' ', ''); return ((x < y) ? -1 : ((x > y) ? 1 : 0)) } function sortByNameDsc(a, b) { var x = a.toLowerCase().replace(" ", ""); var y = b.toLowerCase().replace(" ", ""); return ((x > y) ? -1 : ((x < y) ? 1 : 0)) } function Addhandler() { tv.isHandler = true; $("#reset").bind("click", function(e) { Reset() }); $("#f_4_1").bind("change", function(e) { tv.FlightTime[1] = e.target.checked; tv.fn.printData() }); $("#f_4_2").bind("change", function(e) { tv.FlightTime[2] = e.target.checked; tv.fn.printData() }); $("#f_4_3").bind("change", function(e) { tv.FlightTime[3] = e.target.checked; tv.fn.printData() }); $("#f_3_7").bind("change", function(e) { tv.OnlyAl = e.target.checked; tv.fn.printData() }); $("#f_3_0").bind("change", function(e) { ResetStars(); tv.fn.printData() }); $("#f_3_5").bind("change", function(e) { $("#f_3_0")[0].checked = false; tv.Stars[0] = false; tv.Stars[5] = e.target.checked; tv.fn.printData() }); $("#f_3_4").bind("change", function(e) { $("#f_3_0")[0].checked = false; tv.Stars[0] = false; tv.Stars[4] = e.target.checked; tv.fn.printData() }); $("#f_3_3").bind("change", function(e) { $("#f_3_0")[0].checked = false; tv.Stars[0] = false; tv.Stars[3] = e.target.checked; tv.fn.printData() }); $("#f_3_2").bind("change", function(e) { $("#f_3_0")[0].checked = false; tv.Stars[0] = false; tv.Stars[2] = e.target.checked; tv.fn.printData() }); $("#f_3_1").bind("change", function(e) { $("#f_3_0")[0].checked = false; tv.Stars[0] = false; tv.Stars[1] = e.target.checked; tv.fn.printData() }); $("#inp_items_per_page").bind("change", function(e) { tv.size = $("#inp_items_per_page").val(); tv.fn.printData() }); $("#inp_currency").bind("change", function(e) { tv.CUR = $("#inp_currency").val(); tv.CUC = tv.ArrCUR[tv.CUR].c; tv.EX = tv.ArrCUR[tv.CUR].e; tv.fn.printData() }); $("#Destination").bind("change", function(e) { SetDesynation($("#Destination").val()); var t = trWszystkie_oferty2; if ($("#Destination")[0].selectedIndex > 0) t = $("#Destination")[0].options[$("#Destination")[0].selectedIndex].text; $("#CountryName").html(t) }); $("#SortCategory").bind("click", function(e) { SortBox("Category") }); $("#SortCity").bind("click", function(e) { SortBox("City") }); $("#SortCountry").bind("click", function(e) { SortBox("Country") }); $("#SortFlightDate").bind("click", function(e) { SortBox("FlightDate") }); $("#SortPrice").bind("click", function(e) { SortBox("Price") }) }; function ResetStars() { for (var i = 0; i <= 5; i++) { $("#f_3_" + i)[0].checked = false; if (i != 0) tv.Stars[i - 1] = false; else tv.Stars[6] = false }; $("#f_3_0")[0].checked = true; tv.Stars[0] = true } function setFligthTimeOnly(id) { ResetFlightTime(false); tv.FlightTime[id] = true; $("#f_4_" + id)[0].checked = true; tv.fn.printData() } function ResetFlightTime(status) { for (var i = 1; i <= 3; i++) { $("#f_4_" + i)[0].checked = status; tv.FlightTime[i] = status } } function SortBox(SortBy) { if (SortBy != tv.SortBy) { $("#Sort" + tv.SortBy).removeClass("sel-desc"); $("#Sort" + tv.SortBy).removeClass("sel-asc") } tv.SortBy = SortBy; tv.SortTyp = (tv.SortTyp == "asc" ? "dsc" : "asc"); tv.fn.Sort(); tv.fn.printData(); if (tv.SortTyp == "dsc") { $("#Sort" + tv.SortBy).removeClass("sel-asc"); $("#Sort" + tv.SortBy).addClass("sel-desc") } else { $("#Sort" + tv.SortBy).removeClass("sel-desc"); $("#Sort" + tv.SortBy).addClass("sel-asc") } } function Reset() { cityTo = ''; $("#f_3_7")[0].checked = false; tv.OnlyAl = false; CreatePriceRange(); CreatePortal(); ResetAC('checked'); ResetPortal(true); ResetStars(); ResetFlightTime(true); $('#f_2_7').attr('checked', 'checked'); $('#f_2_8').attr('checked', 'checked'); $('#f_2_14').attr('checked', 'checked'); $('#f_2_15').attr('checked', 'checked'); tv.Period7 = true; tv.Period8 = true; tv.Period14 = true; tv.Period15 = true; $("#Destination option[value='null']").attr('selected', 'selected'); jQuery.each(tv.air, function(i, h) { h.isD = true }); tv.fn.printData() } function CreateFrom() { } function ResetAC(val) { jQuery.each(tv.DFrom, function(id, f) { $('#f_2_' + f).attr('checked', val) }); jQuery.each(tv.air, function(i, h) { h.apf = (val == 'checked') }) } function ResetM(val) { jQuery.each(tv.DMonths, function(id, f) { $('#fm_3_' + f.m).attr('checked', val); f.a = (val == 'checked') }); jQuery.each(tv.air, function(i, h) { h.month = (val == 'checked') }) } function ResetCC(val) { jQuery.each(tv.DCarierList, function(id, f) { $('#f_3_' + f.C).attr('checked', val) }); jQuery.each(tv.air, function(i, h) { h.isC = (val == 'checked') }) } function SortByC(x, y) { if (x.N > y.N) { return 1 } else if (x.N < y.N) { return -1 } return 0 } function CreateCarier() { var html = ''; tv.DCarierList.sort(SortByC); jQuery.each(tv.DCarierList, function(i, d) { html += '<div class="field-1col clearfix">             <input class="checkbox" ' + (tv.DCarierList.length == 1 ? 'disabled="disabled"' : '') + ' type="checkbox" id="f_3_' + d.C + '" name="f_3_' + d.C + '" value="5" onclick=\"SetCC(this, \'' + d.C + '\')\" checked="checked" /> <label><a onclick=\"SetCCO(this, \'' + d.C + '\')\" href="#link">' + d.N + '</a></label>             </div>' }); $('#Carier').html(html) }; function CreatePortal() { var html = ''; jQuery.each(tv.DProviders, function(i, d) { html += '<div class="field clearfix">                    <div class="col-1 clearfix">                    <input class="checkbox" type="checkbox" id="f_5_' + d.Pr + '" name="f_5_' + d.Pr + '" value="' + d.Pr + '" checked="checked" onClick="javascript:SetPortal(' + d.Pr + ', this)" /> <label><a href="#link" onClick="javascript:SetPortalOnly(' + d.Pr + ')">' + tv.Providers[d.Pr].p + '</a></label>                    </div>                    <div class="col-2">' + d.C + '</div></div>' }); $('#Sites').html(html) }; function SortByM(x, y) { if (x.y > y.y) { return 1 } else if (x.y < y.y) { return -1 } return 0 } function CreatePriceRange() { tv.PriceMin = tv.Price[0]; tv.PriceMax = tv.Price[1]; var sidliderPrice = $("#cnt-main-body-deals-last-minute .filter-box .filters .filter-price-range .slider").slider("destroy"); sidliderPrice.slider({ orientation: "horizontal", range: true, step: 100, min: Zaok(tv.Price[0]), max: Zaok(tv.Price[1]) + 100, values: [Zaok(tv.Price[0]), Zaok(tv.Price[1])], slide: function(event, ui) { $("#cnt-main-body-deals-last-minute #slider_price_range_min").val(Zaok(ui.values[0] / tv.EX) + " " + tv.CUC); $("#cnt-main-body-deals-last-minute #slider_price_range_max").val(Zaok(ui.values[1] / tv.EX) + " " + tv.CUC); tv.PriceMin = ui.values[0]; tv.PriceMax = ui.values[1] }, stop: function(event, ui) { tv.fn.printData() } }); $("#cnt-main-body-deals-last-minute #slider_price_range_min").val(Zaok(tv.Price[0] / tv.EX) + " " + tv.CUC); $("#cnt-main-body-deals-last-minute #slider_price_range_max").val(Zaok(tv.Price[1] / tv.EX) + " " + tv.CUC) }; function CreateDepartureMonth() { var html = ''; tv.DMonths.sort(SortByM); jQuery.each(tv.DMonths, function(i, d) { html += '<div class="field-1col clearfix">             <input class="checkbox" type="checkbox" id="fm_3_' + d.m + '" name="fm_3_' + d.m + '" value="5" onclick=\"SetM(this, ' + d.m + ')\" checked="checked" /> <label><a onclick=\"SetMO(this, ' + d.m + ')\" href="#link">' + monthN[d.m] + '</a></label>             </div>' }); $('#DepartureMonth').html(html) }; function ResetPortal(status) { jQuery.each(tv.DProviders, function(i, d) { $('#f_5_' + d.Pr)[0].checked = status }); jQuery.each(tv.air, function(i, d) { d.a = status }) } function SetPortal(P, obj) { jQuery.each(tv.air, function(i, d) { if (d.Pr == P) d.a = obj.checked }); tv.fn.printData() } function SetPortalOnly(P) { ResetPortal(false); $('#f_5_' + P)[0].checked = true; jQuery.each(tv.air, function(i, d) { if (d.Pr == P) d.a = true; else d.a = false }); tv.fn.printData() } function SetDesynation(code) { jQuery.each(tv.air, function(i, h) { if (code != "null") { if (code == h.countryCode) h.isD = true; else h.isD = false } else h.isD = true }); tv.fn.printData() } function SetDI(obj, f) { jQuery.each(tv.air, function(i, h) { if (h.apfPattern.indexOf(f) != -1) { h.apf = obj.checked } }); tv.fn.printData() }; function SetDIO(obj, f) { ResetAC(''); jQuery.each(tv.air, function(i, h) { if (h.apfPattern.indexOf(f) != -1) { $('#f_2_' + f).attr('checked', 'checked'); h.apf = true } }); tv.fn.printData() }; function SetPeriod(f, obj) { $('#f_2_7').attr('checked', ''); $('#f_2_8').attr('checked', ''); $('#f_2_14').attr('checked', ''); $('#f_2_15').attr('checked', ''); $('#f_2_' + f).attr('checked', 'checked'); tv.Period7 = false; tv.Period8 = false; tv.Period14 = false; tv.Period15 = false; switch (f) { case 7: tv.Period7 = true; break; case 8: tv.Period8 = true; break; case 14: tv.Period14 = true; break; case 15: tv.Period15 = true; break } tv.fn.printData() }; function SetPeriodO(f, obj) { $('#f_2_' + f).attr('checked', (obj.checked ? 'checked' : '')); switch (f) { case 7: tv.Period7 = obj.checked; break; case 8: tv.Period8 = obj.checked; break; case 14: tv.Period14 = obj.checked; break; case 15: tv.Period15 = obj.checked; break } tv.fn.printData() }; function SetCC(obj, f) { jQuery.each(tv.air, function(i, h) { if (f == h.Cr) h.isC = obj.checked }); tv.fn.printData() }; function SetCCO(obj, f) { ResetCC(''); jQuery.each(tv.air, function(i, h) { if (f == h.Cr) { $('#f_3_' + f).attr('checked', 'checked'); h.isC = true } }); tv.fn.printData() }; tv.tem = new Object(); tv.tem = tv.prototype = { TListe: function(Data) { var html = ""; if (tv.air != null) { jQuery.each(Data, function(i, pro) { if (i >= (tv.size * tv.index) && i < (tv.size * (tv.index + 1))) { var sds = GetDate(pro.Ds); var wylot = ''; jQuery.each(pro.OLI, function(i, ol) { wylot += ol; if (i < pro.OLI.length - 1) wylot += ', ' }); html += ' <div class="item">                                <div class="overview-box">                                    <div class="overview-box-in clearfix">                                    	<div class="clearfix">	                                        <div class="col-data clearfix">	                                            <div class="pic col-travel-agency">	                                               <div><span></span><img src="http://tm.turigo.pl/pt/pic/provider/100x50/' + pro.Pr + '.png" alt="" /></div>	                                               <p>' + trod + ' <strong>' + dateFormat(sds, "dd.mm.yyyy") + '</strong></p>	                                            </div>	                                           	<div class="col-info">	                                           		<div class="clearfix">	                                           			<h3>' + tv.fn.GetCountry(pro.Co).N + ' <span>&gt;</span> ' + tv.fn.GetRegion(pro.Ri).N + ' <span>&gt;</span> ' + tv.fn.GetCity(pro.Ci).N + '</h3>	                                           			<h4 class="star-rating star-rating-' + pro.S + '">' + trHotel + ': ' + pro.Hn + '<span class="alt"> ***</span></h4>	                                           		</div>	                                           		<p class="i-description">' + trPokoje + ' ' + pro.R + ' ' + tros + '., ' + BoardingType[pro.Bt] + '</p>	                                           		<p class="i-flight">' + trWylot_z + ': ' + wylot + '</p>	                                           	</div>	                                        </div>	                                        <div class="col-price">	                                           <p class="clearfix">	                                                ' + trod + ' <strong>' + Zaok(pro.P / tv.EX) + '</strong> <em>' + tv.CUC + '</em>	                                                <span class="price-info">' + trcena_za + ' <span>' + pro.Pi + ' ' + trdni + '</span></span>	                                                <a href="#link" class="select-btn" onclick="openNW(' + pro.Pr + ',' + pro.OI + ');"><span class="alt" >' + trSprawdz + '</span></a>	                                           </p>	                                        </div>	                                    </div>                                    </div>                                </div>                            </div>' } }) } return html }, TProgres: function(Hotels) { var html = ""; return html } }; function openNW(prv, id) { var urlRed = tv.RURL + "?prv=" + prv + "&ofid=" + id; var newWindow = window.open(urlRed, '_blank'); newWindow.focus(); return false }; function clone(obj) { if (obj == null || typeof (obj) != 'object') return obj; var temp = new obj.constructor(); for (var key in obj) temp[key] = clone(obj[key]); return temp } function GetDate(str) { str = str.replace('/', '').replace('/', ''); var d = str.split(' ')[0].split(','); var t = str.split(' ')[1].split(':'); return new Date(d[2], d[0], d[1], t[0], t[1], t[2]) } function Zaok(liczba) { var pp = 1; liczba = liczba * pp; var wynik = Math.round(liczba) / pp; return wynik } function Jump() { $('html,body').animate({ scrollTop: 0 }, 1000) } function GetDate(str) { str = str.replace('/', '').replace('/', ''); var d = str.split(' ')[0].split(','); var t = str.split(' ')[1].split(':'); return new Date(d[2], d[0] - 1, d[1], t[0], t[1], t[2]) } $(document).ready(function() { $.facebox.settings.closeImage = 'http://www.tm.turigo.pl/pt/' + trCodeLang + '/img/facebox/closelabel.gif'; $('a[rel*=facebox]').facebox(); jQuery('#UpDate').center() }); $(document).bind('reveal.facebox', function() { init_facebox() }); function init_facebox() { $("#facebox .inp_airport_from").bind("change", function(e) { var Departure = $("#facebox .inp_airport_from").val(); $.get("/okazje/ServiceCodeOkazje.aspx?Departure=" + Departure, function(data) { $("#facebox .inp_country_to").html(data) }) }); $("#facebox .inp_airport_from_lm").bind("click", function(e) { var Departure = $("#facebox .inp_airport_from_lm").val(); $.get("/okazje/ServiceCodeOkazjeLm.aspx?Departure=" + Departure, function(data) { $("#facebox .inp_country_to_lm").html(data) }) }); $("#facebox .btn-promos").bind("click", function(e) { var from = $("#facebox .inp_airport_from").val(); var to = $("#facebox .inp_country_to").val(); var url = "/okazje/promocje-linii.html"; if (from != 'null') url += "?airportFrom=" + from; if (to != 'null') { if (from == 'null') url += "?countryTo=" + to; else url += "&countryTo=" + to } window.location.replace(url); return false }); $("#facebox .btn-lm").bind("click", function(e) { var from = $("#facebox .inp_airport_from_lm").val(); var to = $("#facebox .inp_country_to_lm").val(); var url = "/okazje/last-minute/"; if (from != '0') url += "?airportFrom=" + from; if (to != '0') { if (from == '0') url += "?countryTo=" + to; else url += "&countryTo=" + to } window.location.replace(url); return false }) }
