var searchResultItems;
var currentTourIndex = -1;
var hotelKey = "";
function ValidateUserAgent() {
uaVers = "";
if (window.navigator.userAgent.indexOf("Opera") >= 0) {
ua = "Opera";
uaVers = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera") + 6, 4)
} else {
if (window.navigator.userAgent.indexOf("Gecko") >= 0) {
if (window.navigator.userAgent.indexOf("Firefox") > 0) {
ua = "Firefox";
uaVers = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Firefox") + 8, 3)
} else {
ua = "Chrome";
uaVers = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Chrome") + 7, 3)
}
} else {
if (window.navigator.userAgent.indexOf("MSIE") >= 0) {
ua = "Explorer";
uaVers = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE") + 5, 3)
} else {
ua = window.navigator.appName
}
}
}
if (ua == "Opera" && parseFloat(uaVers) < 9.63 || ua == "Explorer" && parseFloat(uaVers) < 7 || ua == "Firefox" && parseFloat(uaVers) < 3 || ua == "Chrome" && parseFloat(uaVers) < 4) {
alert("Экран поиска работает для браузеров версии не ниже: IE8, Opera 9.7, Mozilla Firefox 3.0, Chrome 4.0. Ваш браузер: " + ua + " " + uaVers);
return false
}
return true
}
function SearchPageLoadedEvent() {
GetSearchFilterFromURL();
GetSearchResults(null)
}
var name;
function ValidateData() {
var e = true;
name = document.getElementById("nameTextBox")
.value;
var a = document.getElementById("phoneTextBox")
.value;
var c = document.getElementById("customerEmailTextBox")
.value;
if (name.length == 0) {
$("#invalidNameMessage")
.show();
$("#invalidNameSymbol")
.show();
e = false
} else {
$("#invalidNameMessage")
.hide();
$("#invalidNameSymbol")
.hide()
}
if (a.length == 0) {
$("#invalidPhoneMessage")
.show();
$("#invalidPhoneSymbol")
.show();
e = false
} else {
$("#invalidPhoneMessage")
.hide();
$("#invalidPhoneSymbol")
.hide()
}
if (c.length > 0) {
var b = c.match(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/gi);
if (b == null || b[0] != c) {
$("#invalidEmailMessage1")
.hide();
$("#invalidEmailMessage")
.show();
$("#invalidEmailSymbol")
.show();
e = false
} else {
$("#invalidEmailMessage1")
.hide();
$("#invalidEmailMessage")
.hide();
$("#invalidEmailSymbol")
.hide()
}
} else {
$("#invalidEmailMessage1")
.show();
$("#invalidEmailMessage")
.hide();
$("#invalidEmailSymbol")
.show();
e = false
}
if (!e) {
$.colorbox.resize()
}
return e
}
function SendMailToAgency() {
if (!ValidateData()) {
return
}
$("#userForm")
.mask("Пожалуйста, подождите...");
document.getElementById("okButton")
.disabled = true;
var e = searchResultItems[currentTourIndex];
var b = document.getElementById("nameTextBox")
.value;
var a = document.getElementById("phoneTextBox")
.value;
var f = document.getElementById("customerEmailTextBox")
.value;
var h = document.getElementById("commentTextBox")
.value;
var c = "mteegca.treuckraudkraadlriaelvi@emve,j-r";
if (d != null && d.email != null) {
c = d.email
}
var g = servicesUrl + "SendMailScriptService.asmx/SendMailToAgency";
$.ajax({
contentType: "application/json; charset=utf-8",
url: g,
data: {
token: "",
customerName: b,
customerPhone: a,
customerEmail: f,
customerNotes: h,
tourName: e.TourName,
tourDateAndDuration: JSON.stringify(e.TourDateLong) + " на " + e.Nights + " ночь(ей)",
tourCountry: e.CountryName,
tourCity: e.CityName,
tourHotel: e.HotelName + " (" + e.HotelCategory + ")",
tourRoom: e.RoomName + " (" + e.RoomCategoryName + ")",
tourAccomodation: e.AccomodationName,
tourPansion: e.PansionName,
tourPrice: e.Price + " " + e.Currency,
tourServices: e.Services,
agencyEmail: c,
priceKey: e.PriceKey,
tourDate: e.TourDateString,
callback: "OnSendMailSuccess"
},
dataType: "jsonp",
error: function (k, i, j) {
OnSendMailError(k, i, j)
}
})
}
function OnSendMailSuccess(a) {
$("#userForm")
.unmask();
$("#tourOfferForm")
.hide();
$("#tourOfferResultPanel")
.addClass("successMessage");
$("#tourOfferResultPanel")
.show();
$("#tourOfferResultPanel")
.html("Спасибо, " + name + "! Ваша заявка принята. Наш оператор обязательно с Вами свяжется по указанному телефону или Email.");
$.colorbox.resize()
}
function OnSendMailError(b, a, c) {
$("#userForm")
.unmask();
$("#tourOfferForm")
.hide();
$("#tourOfferResultPanel")
.addClass("errorMessage");
$("#tourOfferResultPanel")
.show();
$("#tourOfferResultPanel")
.html("Извините, при отправке сообщения с Вашей заявкой произошла ошибка. Пожалуйста, попробуйте позже.");
$.colorbox.resize()
}
function GetSearchResults(keys) {
if (keys == null) {
keys = ""
}
var sfAttr = $("#searchResultTable")
.attr("searchFilter");
if (sfAttr == null || sfAttr.length == 0) {
alert("SearchFilter not set.");
return
}
var searchFilter = eval("(" + sfAttr + ")");
if (searchFilter == null) {
alert("searchFilter is null.");
return
}
if (searchFilter.df == null || searchFilter.df.length == 0) {
alert("DepartFrom field not set.");
return
}
if (searchFilter.cn == null || searchFilter.cn.length == 0) {
alert("Country field not set.");
return
}
var srt = $("#searchResultTable");
var searchServiceUrl = servicesUrl + "SearchScriptService.asmx";
if (searchServiceUrl == null || searchServiceUrl.length == 0) {
alert("SearchService Url not set.");
return
}
var parsedCountAttr = $("#searchResultTable")
.attr("ParsedCount");
var parsedCount = 0;
if (keys.length == 0 && parsedCountAttr != null) {
parsedCount = parsedCountAttr
}
$("#searchContentPlaceHolder")
.mask("Пожалуйста, подождите...");
//document.write(searchServiceUrl + "/GetSearchResults?token=1&jsSearchFilter={'searchFilter':" + JSON.stringify(searchFilter) + "}&firstItemNumber=" + parsedCount + "&priceKeys=" + keys);
$.ajax({
url: searchServiceUrl + "/GetSearchResults?token=1&jsSearchFilter={'searchFilter':" + JSON.stringify(searchFilter) + "}&firstItemNumber=" + parsedCount + "&priceKeys=" + keys,
data: "{}",
dataType: "jsonp",
success: SuccessSearchResponse,
error: ErrorSearchServiceResponse
})
}
function SetSort(sortTypeNew) {
var sfAttr = $("#searchResultTable")
.attr("searchFilter");
if (sfAttr == null || sfAttr.length == 0) {
alert("SearchFilter not set.");
return
}
var searchFilter = eval("(" + sfAttr + ")");
if (searchFilter.sort == sortTypeNew) {
if (searchFilter.sortDir != "Desc") {
searchFilter.sortDir = "Desc"
} else {
searchFilter.sortDir = "Asc"
}
} else {
searchFilter.sort = sortTypeNew;
searchFilter.sortDir = "Asc"
}
$("#searchResultTable")
.attr("searchFilter", JSON.stringify(searchFilter));
PrepareNewSearch();
GetSearchResults(null)
}
function SetQuotaInfo(a, b, c) {
CheckIsNullValue(a, c, b);
if (a != null && a.indexOf(":") != -1) {
var f = a.split(":")[0];
var h = "есть";
var e = "quoteYes";
if (f == "-1") {
h = "запрос";
e = "quoteRQ"
} else {
if (f == "0") {
h = "нет";
e = "quoteNo"
}
}
var g = $("td[noq!=1]:contains(" + c + ")", b);
if (g.length > 0) {
$(g)
.addClass(e);
$(g)
.html($(g)
.html()
.replace(c, h))
}
} else {
$(b)
.html($(b)
.html()
.replace(c, "-"))
}
}
function SetAviaQuotaInfo(a, e, g) {
var h = 0;
if (a != null) {
var b = a.split("|");
for (var f = 0; f < b.length; f++) {
SetQuotaInfo(b[f], e, g.replace("Quota", "Quota" + f));
h = f + 1
}
}
for (var c = h; c < 3; c++) {
SetQuotaInfo(null, e, g.replace("Quota", "Quota" + c))
}
}
function SetSelectedTourInfo() {
var a = $("#selectedTourInfoPanel")
.clone();
if (document.getElementById("selectedTourInfoFilledPanel") != null) {
$("#selectedTourInfoFilledPanel")
.remove()
}
$(a)
.attr("id", "selectedTourInfoFilledPanel");
ReplaceTourInfoStatements(searchResultItems[currentTourIndex], a);
if (searchResultItems[currentTourIndex].IsMain == 1) {
$(a)
.find("#tourOfferForm")
.show();
$(a)
.find("#tourOfferResultPanel")
.hide()
} else {
$(a)
.find("#tourOfferResultPanel")
.addClass("errorMessage");
$(a)
.find("#tourOfferForm")
.hide();
$(a)
.find("#tourOfferResultPanel")
.show();
$(a)
.find("#tourOfferResultPanel")
.html("Извините, бронирование доступно только для основных размещений.
Выберите, пожалуйста, тур с типом размещения 'осн'.")
}
$("#selectedTourInfoPanel")
.before($(a))
}
function PrepareNewSearch() {
$("#searchPager")
.hide();
$("#searchPagerInfo")
.hide();
$("#searchPagerNextLink")
.show();
$("#searchPager a[id!='searchPagerNextLink']")
.remove();
var a = $("#searchResultTable");
$(a)
.hide();
$(a)
.attr("TotalCount", "0");
$(a)
.attr("ParsedCount", "0")
}
function IsEmpty(a) {
return a == null || (a + "")
.replace(/\s/g, "")
.length == 0
}
function CheckIsNullValue(c, b, a) {
b = b.replace("%", "")
.replace("%", "");
if (IsEmpty(c)) {
$("[infoType='" + b + "']")
.hide()
} else {
$("[infoType='" + b + "']")
.show()
}
}
var s = 1;
function ReplaceTourInfoStatements(a, b) {
if (a.HotelURL!="")
{
$(b)
.html($(b)
.html()
.replace("%HotelNamePlus%", ""+ a.HotelName + ""));
}
else
{
$(b)
.html($(b)
.html()
.replace("%HotelNamePlus%", a.HotelName));
}
$(b)
.html($(b)
.html()
.replace("%PriceName%", ""+ a.Price + ""));
CheckIsNullValue(a.TourDateShort, "TourDate", b);
$(b)
.html($(b)
.html()
.replace("%TourDate%", a.TourDateShort));
$(b)
.html($(b)
.html()
.replace("%TourDateString%", a.TourDateString));
CheckIsNullValue(a.HotelName, "HotelName", b);
$(b)
.html($(b)
.html()
.replace("%HotelName%", a.HotelName));
$(b)
.html($(b)
.html()
.replace("%PriceKey%", a.PriceKey));
$(b)
.html($(b)
.html()
.replace("%HotelKey%", a.HotelKey));
$(b)
.html($(b)
.html()
.replace("%HotelURL%", a.HotelURL));
CheckIsNullValue(a.HotelCategory, "HotelCategory", b);
$(b)
.html($(b)
.html()
.replace("%HotelCategory%", a.HotelCategory));
CheckIsNullValue(a.CityName, "CityName", b);
$(b)
.html($(b)
.html()
.replace("%CityName%", a.CityName));
CheckIsNullValue(a.CountryName, "CountryName", b);
$(b)
.html($(b)
.html()
.replace("%CountryName%", a.CountryName));
CheckIsNullValue(a.RoomName, "RoomName", b);
$(b)
.html($(b)
.html()
.replace("%RoomName%", a.RoomName));
CheckIsNullValue(a.RoomCategoryName, "RoomCategoryName", b);
$(b)
.html($(b)
.html()
.replace("%RoomCategoryName%", a.RoomCategoryName));
CheckIsNullValue(a.AccomodationName, "AccomodationName", b);
$(b)
.html($(b)
.html()
.replace("%AccomodationName%", a.AccomodationName));
CheckIsNullValue(a.PansionName, "PansionName", b);
$(b)
.html($(b)
.html()
.replace("%PansionName%", a.PansionName));
CheckIsNullValue(a.Nights, "Nights", b);
$(b)
.html($(b)
.html()
.replace("%Nights%", a.Nights));
CheckIsNullValue(a.Price, "Price", b);
$(b)
.html($(b)
.html()
.replace("%Price%", a.Price));
CheckIsNullValue(a.Currency, "Currency", b);
$(b)
.html($(b)
.html()
.replace("%Currency%", a.Currency));
CheckIsNullValue(a.TourName, "TourName", b);
$(b)
.html($(b)
.html()
.replace("%TourName%", a.TourName));
CheckIsNullValue(a.OfferTourDateShort, "OfferTourDate", b);
$(b)
.html($(b)
.html()
.replace("%OfferTourDate%", a.TourDateShort));
CheckIsNullValue(a.OfferHotelName, "OfferHotelName", b);
$(b)
.html($(b)
.html()
.replace("%OfferHotelName%", a.OfferHotelName));
$(b)
.html($(b)
.html()
.replace("%OfferHotelURL%", a.OfferHotelURL));
CheckIsNullValue(a.OfferHotelCategory, "OfferHotelCategory", b);
$(b)
.html($(b)
.html()
.replace("%OfferHotelCategory%", a.HotelCategory));
CheckIsNullValue(a.OfferCityName, "OfferCityName", b);
$(b)
.html($(b)
.html()
.replace("%OfferCityName%", a.OfferCityName));
CheckIsNullValue(a.OfferCountryName, "OfferCountryName", b);
$(b)
.html($(b)
.html()
.replace("%OfferCountryName%", a.OfferCountryName));
CheckIsNullValue(a.OfferRoomName, "OfferRoomName", b);
$(b)
.html($(b)
.html()
.replace("%OfferRoomName%", a.OfferRoomName));
CheckIsNullValue(a.OfferRoomCategoryName, "OfferRoomCategoryName", b);
$(b)
.html($(b)
.html()
.replace("%OfferRoomCategoryName%", a.OfferRoomCategoryName));
CheckIsNullValue(a.OfferAccomodationName, "OfferAccomodationName", b);
$(b)
.html($(b)
.html()
.replace("%OfferAccomodationName%", a.OfferAccomodationName));
CheckIsNullValue(a.OfferPansionName, "OfferPansionName", b);
$(b)
.html($(b)
.html()
.replace("%OfferPansionName%", a.OfferPansionName));
CheckIsNullValue(a.OfferNights, "OfferNights", b);
$(b)
.html($(b)
.html()
.replace("%OfferNights%", a.OfferNights));
CheckIsNullValue(a.OfferPrice, "OfferPrice", b);
$(b)
.html($(b)
.html()
.replace("%OfferPrice%", a.OfferPrice));
$(b)
.html($(b)
.html()
.replace("%OfferCurrency%", a.OfferCurrency));
CheckIsNullValue(a.OfferTourName, "OfferTourName", b);
$(b)
.html($(b)
.html()
.replace("%OfferTourName%", a.OfferTourName));
CheckIsNullValue(a.OfferServices, "OfferServices", b);
$(b)
.html($(b)
.html()
.replace("%OfferServices%", a.OfferServices));
if (a.HotelURL != null && a.HotelURL.replace(/\s/g, "")
.length > 0) {
$(b)
.find("#hotelLink")
.show()
} else {
$(b)
.find("#hotelLink")
.hide()
}
if (a.TourDescription != null && a.TourReservationCondition != null) {
if ($(b)
.find("[tourLink='true']")
.attr("todesctoo") == "true" && (a.TourDescription.replace(/\s/g, "")
.length > 0 || a.TourReservationCondition.replace(/\s/g, "")
.length > 0)) {
$(b)
.find("[tourLink='true']")
.attr("href", "");
$(b)
.find("[tourLink='true']")
.attr("tourseted", "true")
} else {
if (a.TourURL.replace(/\s/g, "")
.length > 0) {
$(b)
.find("[tourLink='true']")
.attr("href", a.TourURL);
$(b)
.find("[tourLink='true']")
.attr("target", "_blank")
}
}
}
SetQuotaInfo(a.HotelQuota, b, "%HotelQuota%");
SetAviaQuotaInfo(a.CharterThereQuota, b, "%CharterThereQuota%");
SetAviaQuotaInfo(a.CharterBackQuota, b, "%CharterBackQuota%");
SetQuotaInfo(a.HotelQuota, b, "%OfferHotelQuota%");
SetAviaQuotaInfo(a.CharterThereQuota, b, "%OfferCharterThereQuota%");
SetAviaQuotaInfo(a.CharterBackQuota, b, "%OfferCharterBackQuota%")
}
function ShowTourInfo() {
var a = searchResultItems[currentTourIndex];
var b = $("#tourInfoTemplatePanel")
.clone();
b.html(b.html()
.replace("%TourName%", a.TourName));
b.html(b.html()
.replace("%TourURL%", a.TourURL));
b.html(b.html()
.replace("%TourDescription%", a.TourDescription));
b.html(b.html()
.replace("%TourReservationCondition%", a.TourReservationCondition));
if (a.TourURL.replace(/\s/g, "")
.length == 0) {
b.find("#tourLink")
.hide()
}
if (a.TourDescription.replace(/\s/g, "")
.length == 0) {
b.find("#descriptionPanel")
.hide()
}
if (a.TourReservationCondition.replace(/\s/g, "")
.length == 0) {
b.find("#reservationConditionPanel")
.hide()
}
$.colorbox({
html: b.html(),
scrolling: false,
onComplete: function () {
onCboxComplete()
}
});
form = "#colorbox #cboxWrapper #cboxContent #cboxLoadedContent .infoPanel";
isSpecificInfoSeted = false;
BindHotelInfoItem(form, "TourDescription", a.TourDescription);
BindHotelInfoItem(form, "TourReservationCondition", a.TourReservationCondition);
$(form + " a[ifor^='Tour']")
.click(function (c) {
var e = $(this)
.attr("ifor");
$(form + " ." + menuItemSelectedClass)
.removeClass(menuItemSelectedClass);
$(this)
.addClass(menuItemSelectedClass);
if (e == "TourReservationCondition") {
$(form + " #specificInfoPanel")
.html(searchResultItems[currentTourIndex].TourReservationCondition)
}
if (e == "TourDescription") {
$(form + " #specificInfoPanel")
.html(searchResultItems[currentTourIndex].TourDescription)
}
$.colorbox.resize();
c.preventDefault()
})
}
var d;
function SuccessSearchResponse(response) {
//alert(JSON.stringify(response));
$("#searchContentPlaceHolder")
.unmask();
var searchResultTable = $("#searchResultTable");
var searchResult = eval(response);
searchResultItems = eval(searchResult.SearchItems);
var totalCountPrev = $(searchResultTable)
.attr("TotalCount");
var parsedCountPrev = $(searchResultTable)
.attr("ParsedCount");
if (searchResult.TotalCount > 0 && parsedCountPrev < searchResult.ParsedCount) {
$(searchResultTable)
.attr("TotalCount", searchResult.TotalCount);
$("#searchPagerInfo #totalCount")
.text(searchResult.TotalCount)
}
if (searchResult.ParsedCount > 0 && searchResult.ParsedCount >= parsedCountPrev) {
$(searchResultTable)
.attr("ParsedCount", searchResult.ParsedCount);
$("#searchPagerInfo #parsedCount")
.text(searchResult.ParsedCount)
}
var rowTemplate = $("#searchResultTableRow");
$("tr[sri='true']")
.remove();
var searchItemKeys = "";
for (var i = 0; i <= searchResultItems.length - 1; i++) {
var searchResultItem = searchResultItems[i];
var currentRow = $(rowTemplate)
.clone()
.css("display", "table-row");
$(currentRow)
.attr("sriid", i);
$(currentRow)
.attr("sri", "true");
$(currentRow)
.mouseover(function () {
currentTourIndex = parseInt($(this)
.attr("sriid"), 10)
});
$("#searchResultTable")
.append(currentRow);
ReplaceTourInfoStatements(searchResultItem, currentRow);
if (searchItemKeys == "") {
searchItemKeys = searchResultItem.Key
} else {
searchItemKeys = searchItemKeys + "," + searchResultItem.Key
}
}
if (searchItemKeys.length > 0) {
if (parsedCountPrev < searchResult.ParsedCount) {
var pageNumber = $("#searchPager a")
.length;
var pagerLink = $("" + pageNumber + "");
$(pagerLink)
.attr("id", "pagerLink" + pageNumber);
$(pagerLink)
.attr("sd", "true");
$(pagerLink)
.attr("href", "javascript:GetSearchResults('" + searchItemKeys + "')");
$("#searchPagerNextLink")
.before($(pagerLink));
$(pagerLink)
.click(function (event) {
if ($(this)
.attr("id") == "searchPagerNextLink") {
return
}
if ($(this)
.attr("en") == "false") {
event.preventDefault()
} else {
$("#searchPager a[en]")
.attr("en", "true");
$("#searchPager a[en]")
.css("color", "");
$(this)
.css("color", "gray");
$(this)
.attr("en", "false")
}
});
$("#searchPager a")
.attr("en", "true");
$("#searchPager a[en]")
.css("color", "");
$("#searchPager a[en]")
.attr("en", "true");
$("#searchPager a[en]")
.each(function (i) {
if (i == pageNumber - 1) {
$(this)
.css("color", "gray");
$(this)
.attr("en", "false")
}
});
$("#searchPager")
.show();
$("#searchPagerInfo")
.show()
}
}
var searchFilter = eval("(" + $("#searchResultTable")
.attr("searchFilter") + ")");
if (searchFilter.psize > searchResultItems.length) {
if ($("#searchPager a[en]")
.length > 2) {
$("#searchPager a[en]")
.css("color", "");
$("#searchPager a[en]")
.attr("en", "true")
}
$("#searchPagerNextLink")
.hide()
}
if (searchResultItems.length > 0) {
$("#noItemsMessage")
.hide();
$(searchResultTable)
.show()
} else {
$("#noItemsMessage")
.show();
$(searchResultTable)
.hide()
}
$("a[priceLink='1']")
.click(function (event) {
SetSelectedTourInfo();
$.colorbox({
html: $("#selectedTourInfoFilledPanel")
.html(),
scrolling: false
});
event.preventDefault()
});
$("a[isHotelLink='true']")
.click(function (event) {
$("#searchContentPlaceHolder")
.mask("Пожалуйста, подождите...");
hotelKey = $(this)
.attr("hotelKey");
var serviceUrl = servicesUrl + "TourInfoScriptService.asmx/GetHotelInfo";
$.ajax({
contentType: "application/json; charset=utf-8",
url: serviceUrl,
data: {
token: "",
hotelKey: hotelKey,
callback: "OnHotelInfoLoadSuccess"
},
dataType: "jsonp",
error: function (response, status, errortrown) {
OnHotelInfoLoadError(response, status, errortrown)
}
});
event.preventDefault()
});
$("[tourseted='true']")
.click(function (event) {
ShowTourInfo();
event.preventDefault()
})
}
var hotel;
function OnHotelInfoLoadSuccess(b) {
$("#searchContentPlaceHolder")
.unmask();
hotel = b;
$("#hotelInfoPanel")
.remove();
var a = $("#hotelInfoTemplatePanel")
.clone();
$(a)
.attr("id", "hotelInfoPanel");
$("#hotelInfoTemplatePanel")
.before($(a));
$.colorbox({
html: $(a)
.html(),
scrolling: false,
onComplete: function () {
onCboxComplete()
}
});
BindHotelInfoData(a, hotel)
}
function onCboxComplete() {
$.colorbox.resize()
}
var isSpecificInfoSeted = false;
var menuItemSelectedClass = "menuItemSelected";
function BindHotelInfoItem(c, a, b) {
$(c + " a[ifor='" + a + "']")
.hide();
if (b.replace(/\s/g, "")
.length > 0) {
$(c + " a[ifor='" + a + "']")
.show();
if (!isSpecificInfoSeted) {
$(c + " #specificInfoPanel")
.html(b);
$(c + " a[ifor='" + a + "']")
.addClass(menuItemSelectedClass);
isSpecificInfoSeted = true
}
}
}
function BindHotelInfoData(a, b) {
isSpecificInfoSeted = false;
a = "#colorbox #cboxWrapper #cboxContent #cboxLoadedContent #infoPanel";
$(a)
.html($(a)
.html()
.replace("%Name%", b.Name));
$(a)
.html($(a)
.html()
.replace("%Stars%", b.Stars));
if (b.Address.length > 0) {
$(a + " #hotelAddressRow")
.show();
$(a)
.html($(a)
.html()
.replace("%Address%", b.Address))
} else {
$(a + " #hotelAddressRow")
.hide()
}
if (b.Http.length > 0) {
$(a + "#hotelHttpRow")
.show();
$(a)
.html($(a)
.html()
.replace("%Http%", b.Http))
} else {
$(a + " #hotelHttpRow")
.hide()
}
if (b.EMail.length > 0) {
$(a + " #hotelEmailRow")
.show();
$(a)
.html($(a)
.html()
.replace("%EMail%", b.EMail));
$(a)
.html($(a)
.html()
.replace("%EMail%", b.EMail))
} else {
$(a + " #hotelEmailRow")
.hide()
}
if (b.Phone.length > 0) {
$(a + " #hotelPhoneRow")
.show();
$(a)
.html($(a)
.html()
.replace("%Phone%", b.Phone))
} else {
$(a + " #hotelPhoneRow")
.hide()
}
if (b.Fax.length > 0) {
$(a + " #hotelFaxRow")
.show();
$(a)
.html($(a)
.html()
.replace("%Fax%", b.Fax))
} else {
$(a + " #hotelFaxRow")
.hide()
}
BindHotelInfoItem(a, "Description", b.Description);
BindHotelInfoItem(a, "DescRoom", b.DescRoom);
BindHotelInfoItem(a, "DescMeal", b.DescMeal);
BindHotelInfoItem(a, "DescService", b.DescService);
BindHotelInfoItem(a, "DescSport", b.DescSport);
BindHotelInfoItem(a, "DescExcur", b.DescExcur);
BindHotelInfoItem(a, "DescHealth", b.DescHealth);
if (isSpecificInfoSeted) {
$(a + " #menu")
.show();
$(a + " #specificInfoPanel")
.show()
} else {
$(a + " #menu")
.hide();
$(a + " #specificInfoPanel")
.hide()
}
$(a + " a[ifor^='Desc']")
.click(function (c) {
var e = $(this)
.attr("ifor");
$(a + " ." + menuItemSelectedClass)
.removeClass(menuItemSelectedClass);
$(this)
.addClass(menuItemSelectedClass);
if (e == "Description") {
$(a + " #specificInfoPanel")
.html(hotel.Description)
}
if (e == "DescRoom") {
$(a + " #specificInfoPanel")
.html(hotel.DescRoom)
}
if (e == "DescMeal") {
$(a + " #specificInfoPanel")
.html(hotel.DescMeal)
}
if (e == "DescService") {
$(a + " #specificInfoPanel")
.html(hotel.DescService)
}
if (e == "DescSport") {
$(a + " #specificInfoPanel")
.html(hotel.DescSport)
}
if (e == "DescExcur") {
$(a + " #specificInfoPanel")
.html(hotel.DescExcur)
}
if (e == "DescHealth") {
$(a + " #specificInfoPanel")
.html(hotel.DescHealth)
}
$.colorbox.resize();
c.preventDefault()
})
}
function BindInfo(b, c, a) {
$("#hotelInfoPanel div[id^='" + b + "']")
.hide();
if (a.replace(/\s/g, "")
.length > 0) {
$("#hotelInfoPanel div[id^='" + b + "']")
.show();
$("#hotelInfoPanel div[id^='" + b + "']")
.html($("#hotelInfoPanel div[id^='" + b + "']")
.html()
.replace(c, a))
}
}
function SetSpecificInfo(a, b) {}
function SetSpecificInfoDefaultButton(a, b) {
$(a.selector + " a[ifor='" + b + "']")
.addClass("menuItemSelected")
}
function OnHotelInfoLoadError(b, a, c) {
$("#searchContentPlaceHolder")
.unmask()
}
function wow() {
HotelInfoPageLoadedEvent()
}
function ErrorSearchServiceResponse(a) {
$("#searchContentPlaceHolder")
.unmask();
alert("Error occured while calling service")
}
function GetUrlParam(b) {
b = b.replace(/[\[]/, "\\[")
.replace(/[\]]/, "\\]");
var a = "[\\?&]" + b + "=([^]*)";
var e = new RegExp(a);
var c = e.exec(window.location.href);
if (c == null) {
return ""
} else {
return c[1]
}
}
function GetSearchFilterFromURL() {
var b = "";
var a = new Object();
b = GetUrlParam("departFrom");
if (b.length > 0) {
a.df = b
}
b = GetUrlParam("country");
if (b.length > 0) {
a.cn = b
}
b = GetUrlParam("city");
if (b.length > 0) {
a.ct = b
}
b = GetUrlParam("resort");
if (b.length > 0) {
a.rs = b
}
b = GetUrlParam("hotel");
if (b.length > 0) {
a.ht = b
}
b = GetUrlParam("hotelOption");
if (b.length > 0) {
a.ho = b
}
b = GetUrlParam("pansion");
if (b.length > 0) {
a.pn = b
}
b = GetUrlParam("room");
if (b.length > 0) {
a.rm = b
}
b = GetUrlParam("tourtype");
if (b.length > 0) {
a.tt = b
}
b = GetUrlParam("nights");
if (b.length > 0) {
a.n = b
}
b = GetUrlParam("tour");
if (b.length > 0) {
a.tour = b
}
b = GetUrlParam("dateFrom");
if (b.length > 0) {
a.tdf = b
}
b = GetUrlParam("dateTo");
if (b.length > 0) {
a.tdt = b
}
b = GetUrlParam("nightsFrom");
if (b.length > 0) {
a.nf = b
}
b = GetUrlParam("nightsTo");
if (b.length > 0) {
a.nt = b
}
b = GetUrlParam("adults");
if (b.length > 0) {
a.ad = b
}
b = GetUrlParam("childs");
if (b.length > 0) {
a.ch = b
}
b = GetUrlParam("firstChildAge");
if (b.length > 0) {
a.fca = b
}
b = GetUrlParam("secondChildAge");
if (b.length > 0) {
a.sca = b
}
b = GetUrlParam("pageSize");
if (b.length > 0) {
a.psize = b
}
b = GetUrlParam("priceLimit");
if (b.length > 0) {
a.pmax = b
}
b = GetUrlParam("priceMin");
if (b.length > 0) {
a.pmin = b
}
b = GetUrlParam("aviaQuotaMask");
if (b.length > 0) {
a.aqm = b
}
b = GetUrlParam("hotelQuotaMask");
if (b.length > 0) {
a.hqm = b
}
b = GetUrlParam("mainOnly");
if (b.length > 0) {
if (b == "1") {
a.main = "true"
} else {
a.main = "false"
}
}
b = GetUrlParam("rateCode");
if (b.length > 0) {
a.rate = b
}
b = GetUrlParam("agentKey");
if (b.length > 0) {
a.agent = b
}
b = GetUrlParam("useTourSubTypes");
if (b.length > 0) {
a.useTST = b
}
b = GetUrlParam("sortingType");
if (b.length > 0) {
a.sort = b
}
b = GetUrlParam("sortingDirection");
if (b.length > 0) {
a.sortDir = b
}
$("#searchResultTable")
.attr("searchFilter", JSON.stringify(a))
}
function CheckForNumbersOnly(b) {
var a;
var c;
if (window.event) {
a = window.event.keyCode
} else {
if (b) {
a = b.which
} else {
return true
}
}
c = String.fromCharCode(a);
if ((a == null) || (a == 0) || (a == 8) || (a == 9) || (a == 13) || (a == 27)) {
return true
} else {
if ((("0123456789")
.indexOf(c) > -1)) {
return true
} else {
return false
}
}
};