var domainurl = "http://www.veenaworld.com";
$(document).ready(function () {
//settingdateHotel() ;
$('#txtDepartHotelDateInternational').datepick({
monthsToShow: 1,
onSelect: HotelcustomRangecheckin,
changeMonth: false,
dateFormat: ('dd MM yyyy'),
changeYear: false,
showTrigger: '
',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
});
$('#txtReturnHotelDateInternational').datepick({
monthsToShow: 1,
onSelect: HotelcustomRangecheckout,
changeMonth: false,
dateFormat: ('dd MM yyyy'),
changeYear: false,
showTrigger: '
',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
});
});
function HotelcustomRangecheckin(dates) {
var date1 = $('#txtDepartHotelDateInternational').datepick('getDate');
var date = new Date(Date.parse(date1));
var date_day = date.getDate();
var date_month = date.getMonth();
var date_year = date.getFullYear();
$("#txtDepartHotelDateInternational").val(date_day + " " + getMonth((date_month + 1).toString()) + " " + date_year);
date.setDate(date.getDate() + 1);
var newDate = date;
var pass="";
newDate = new Date(Date.parse(newDate));
var date_day1 = newDate.getDate();
var date_month1 = newDate.getMonth();
var date_year1 = newDate.getFullYear();
$("#txtReturnHotelDateInternational").val(date_day1 + " " + getMonth((date_month1 + 1).toString()) + " " + date_year1);
$('#txtReturnHotelDateInternational').datepick('option', 'minDate', dates[0] || null);
}
function HotelcustomRangecheckout(dates) {
var date1 = $('#txtReturnHotelDateInternational').datepick('getDate');
var date = new Date(Date.parse(date1));
var date_day = date.getDate();
var date_month = date.getMonth();
var date_year = date.getFullYear();
$("#txtReturnHotelDateInternational").val(date_day + " " + getMonth((date_month + 1).toString()) + " " + date_year);
}
function settingdateHotel() {
var D = new Date();
var month = D.getMonth() + 1;
var day = D.getDate();
var year = D.getFullYear();
var plusday = new Date(D.setDate(D.getDate() + 3));
var dt1 = plusday.getDate();
var dt2 = plusday.getMonth() + 1;
var dt3 = plusday.getFullYear();
if (dt1 < 10)
dt1 = "0" + dt1;
if (dt2 < 10)
dt2 = "0" + dt2;
if (day < 10)
day = "0" + day;
if (month < 10)
month = "0" + month;
var DepDate = (day + " " + getMonth(month) + " " + year);
var RetDate = (dt1 + " " + getMonth(dt2) + " " + dt3);
$("#txtDepartHotelDateInternational").val(day + " " + getMonth(month.toString()) + " " + year);
$("#txtReturnHotelDateInternational").val(dt1 + " " + getMonth(dt2.toString()) + " " + dt3);
}
function getDateformat(getdateinput) {
switch (getdateinput) {
case "01": getdateinput = "JAN";
break;
case "02": getdateinput = "FEB";
break;
case "03": getdateinput = "MAR";
break;
case "04": getdateinput = "APR";
break;
case "05": getdateinput = "MAY";
break;
case "06": getdateinput = "JUN";
break;
case "07": getdateinput = "JUL";
break;
case "08": getdateinput = "AUG";
break;
case "09": getdateinput = "SEP";
break;
case "10": getdateinput = "OCT";
break;
case "11": getdateinput = "NOV";
break;
case "12": getdateinput = "DEC";
break;
}
return getdateinput;
}
function settingdateHotel() {
var date3 = new Date();
var month = date3.getMonth() + 1;
var day = date3.getDate();
var year = date3.getFullYear();
var plusday = new Date(date3.setDate(date3.getDate() + 1));
var dt1 = plusday.getDate();
var dt2 = plusday.getMonth() + 1;
var dt3 = plusday.getFullYear();
if (dt1 < 10)
dt1 = "0" + dt1;
if (dt2 < 10)
dt2 = "0" + dt2;
if (day < 10)
day = "0" + day;
if (month < 10)
month = "0" + month;
var current = (day + " " + getMonth(month.toString()) + " " + year);
var current2 = (dt1 + " " + getMonth(dt2.toString()) + " " + dt3);
// document.getElementById("txtDepartHotelDateInternational").value = current;
//document.getElementById("txtReturnHotelDateInternational").value = current2;
}
var AgentName = "";
var ClientId = "";
var saID = "";
var saBRID = "";
var TokenHotel = "hotel";
var faresearch = "";
var Currency = "";
var strconsol = "";
var decimal_preference = ".";
var UserId = "";
function ValidateDate_hotel() {
var objFromDate = "";
var objToDate = "";
if ($("#txtHTCity").val() == "" || $("#txtHTCity").val() == "Where do you want to go?") {
alert("Please Enter City Name");
$('#txtHTCity').focus();
return false;
}
if ($('#txtDepartHotelDateInternational').val() == "" || $('#txtDepartHotelDateInternational').val() == "Check in") {
alert("Select Checkin Date");
$('#txtDepartHotelDateInternational').focus();
return false;
}
if ($('#txtReturnHotelDateInternational').val() == "" || $('#txtReturnHotelDateInternational').val() == "Check out") {
alert("Select Checkout Date");
$('#txtReturnHotelDateInternational').focus();
return false;
}
if (document.getElementById('divHTCity').style.visibility == "visible") {
alert("Invalid City Name");
document.getElementById('divHTCity').value = "";
return false;
}
var regexLetter = /[a-zA-z]/;
if (!regexLetter.test($('#txtHTCity').val())) {
alert("Please Enter Only Aplhabets");
document.getElementById("txtHTCity").value = "";
$('#txtHTCity').focus();
return false;
}
if ($('#txtDepartHotelDateInternational').val() == "") {
alert('Please Select CheckIn Date')
$('#txtDepartHotelDateInternational').focus();
return false;
}
if ($('#txtReturnHotelDateInternational').val() == "") {
alert('Please Select CheckOut Date')
$('#txtReturnHotelDateInternational').focus();
return false;
}
var HTCity = $('#txtHTCity').val();
if ($('#htlselectedroom').val() == null) {
$('#htlselectedroom').val() = 1;
}
var rooms = $('#htlselectedroom').val();
var str = "";
var adt = new Array();
var chd = new Array();
var chdage = new Array();
var i;
var j;
for (i = 0; i < rooms; i++) {
if (str != "") {
str = str + "$";
}
str = str + (i + 1);
adt[i] = $('#HtlSltAdult' + (i + 1)).val();
str = str + "|" + adt[i];
if ($('#HtlChildSlt' + (i + 1)).val() != 0)
{
chd[i] = $('#HtlChildSlt' + (i + 1)).val();
str = str + "|" + chd[i];
for (j = 0; j < chd[i]; j++) {
chdage[j] =$('#HtlChildAge' + (i + 1) + "_" + (j + 1)).val();
str = str + "|" + chdage[j];
}
}
else {
chd[i] = 0;
str = str + "|" + chd[i];
}
}
selecttype = "on"
if ($("#ChannelCode").val() == "Online-DC") {
showNett = "false";
}
var nationality = $('#ddl_nationality_hotel').val();
if (nationality == '--select--') {
alert('Select Nationality');
$('#ddl_nationality_hotel').focus();
return false;
}
var Currency = $('#ddl_currency_hotel').val();
var star = $('#star_select').val();
if (star == 'Select') {
star = "";
}
else {
star = $('#star_select').val();
}
var uid = sessionStorage.getItem('Struid')
if (uid == null) {
uid = "";
}
else {
uid = sessionStorage.getItem('Struid')
}
var DepartureDate=$('#txtDepartHotelDateInternational').val();
var ArrivalDate=$('#txtReturnHotelDateInternational').val();
// var targetPage = "../../hotel_Deeplinking.aspx?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + TokenHotel + "&HTLCity=" + HTCity + "&Htlcity=" + HTCity + "&Checkin=" + DepartureDate + "&Checkout=" + ArrivalDate + "&Rooms=" + rooms + "&RoomInfo=" + str + "&Star=" + star + "&CustomerRequestedCurrency=" + Currency + "&CountryOfresidence=" + nationality + "&XHostBranchId=" + $("#Hdnbranchid").val();
//var targetPage = domainurl + "/online3s/hotel_Deeplinking.aspx?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + TokenHotel + "&HTLCity=" + HTCity + "&Htlcity=" + HTCity + "&Checkin=" + DepartureDate + "&Checkout=" + ArrivalDate + "&Rooms=" + rooms + "&RoomInfo=" + str + "&Star=" + star + "&CustomerRequestedCurrency=" + Currency + "&CountryOfresidence=" + nationality + "&XHostBranchId=" + $("#Hdnbranchid").val() + "&uid=" + uid;
var targetPage = domainurl + "/Metabook/Home/Landing?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + TokenHotel + "&HTLCity=" + HTCity + "&Htlcity=" + HTCity + "&Checkin=" + DepartureDate + "&Checkout=" + ArrivalDate + "&Rooms=" + rooms + "&RoomInfo=" + str + "&Star=" + star + "&CustomerRequestedCurrency=" + Currency + "&Nationality=" + nationality + "&COR=" + document.getElementById("ddl_Country_Of_Residence").value +"&XHostBranchId=" + $("#Hdnbranchid").val() + "&uid=" + uid;
window.location.href = targetPage;
}
function SelectRoom() {
$("#HtlMainRoomDiv").show();
var TotalRoom = $("#htlselectedroom").val();
if (TotalRoom >= 1) {
$("#RemoveRoomSpan").css({ display: "inline-block" });
$("#AdvanceSeprator").css({ display: "inline-block" });
}
else {
$("#RemoveRoomSpan").css({ display: "none" });
$("#AdvanceSeprator").css({ display: "none" });
}
if (TotalRoom != 5) {
TotalRoom = +TotalRoom + +1;
document.getElementById('htlselectedroom').value = TotalRoom;
}
if (TotalRoom == 5) {
$("#AddRoomspan").css({ display: "none" });
}
else {
$("#AddRoomspan").css({ display: "inline-block" });
}
if (TotalRoom <= 0) {
return false;
}
for (var _i = 1; _i <= parseInt(TotalRoom); _i++) {
var showRoomId = 'HtlMainRoom' + _i;
var HtlAgeDiv = 'HtlAgeDiv' + _i
$("#" + showRoomId).show();
$("#" + HtlAgeDiv).hide();
}
for (var _j = parseInt(TotalRoom) + 1; _j < 6; _j++) {
var showRoomId = 'HtlMainRoom' + _j;
var HtlAgeDiv = 'HtlAgeDiv' + _j
$("#" + showRoomId).hide();
$("#" + HtlAgeDiv).hide();
}
ShowSelectChdAge(TotalRoom);
}
function SelectChild(child) {
var id = $('HtlChildSlt' + child);
var HtlAgeDiv = $('HtlAgeDiv' + child)
$("#" + HtlAgeDiv.selector).show();
var totalChd = $("#" + id.selector).val();
if (parseInt(totalChd) == 0) {
$("#" + HtlAgeDiv.selector).hide();
}
else {
for (var _i = 1; _i <= parseInt(totalChd); _i++) {
var childId = 'HtlChild' + child + '_' + _i;
$("#" + childId).show();
}
for (_j = parseInt(totalChd) + 1; _j < 6; _j++) {
var childId = 'HtlChild' + child + '_' + _j;
$("#" + childId).hide();
}
}
}
function ShowSelectChdAge(TotalRoom) {
for (var i = 1; i <= TotalRoom; i++) {
var id = $('HtlChildSlt' + i);
var HtlAgeDiv = $('HtlAgeDiv' + i)
$("#" + HtlAgeDiv.selector).show();
var totalChd = $("#" + id.selector).val();
if (parseInt(totalChd) == 0) {
$("#" + HtlAgeDiv.selector).hide();
}
else {
for (var _i = 1; _i <= parseInt(totalChd); _i++) {
var childId = 'HtlChild' + i + '_' + _i;
$("#" + childId).show();
}
}
}
}
function RemoveRoom() {
var TotalRoom = $("#htlselectedroom").val();
if (TotalRoom != 1) {
TotalRoom = +TotalRoom + -1;
document.getElementById('htlselectedroom').value = TotalRoom;
}
if (TotalRoom < 5) {
$("#AddRoomspan").css({ display: "inline-block" });
}
else {
$("#AddRoomspan").css({ display: "none" });
}
if (TotalRoom > 1) {
$("#RemoveRoomSpan").css({ display: "inline-block" });
$("#AdvanceSeprator").css({ display: "inline-block" });
}
else {
$("#RemoveRoomSpan").css({ display: "none" });
$("#AdvanceSeprator").css({ display: "none" });
}
if (TotalRoom <= 0 ) {
return false;
}
for (var _i = 1; _i <= parseInt(TotalRoom); _i++) {
var showRoomId = 'HtlMainRoom' + _i;
var HtlAgeDiv = 'HtlAgeDiv' + _i
$("#" + showRoomId).show();
$("#" + HtlAgeDiv).hide();
}
for (var _j = parseInt(TotalRoom) + 1; _j < 6; _j++) {
var showRoomId = 'HtlMainRoom' + _j;
var HtlAgeDiv = 'HtlAgeDiv' + _j
$("#" + showRoomId).hide();
$("#" + HtlAgeDiv).hide();
}
ShowSelectChdAge(TotalRoom);
}
function Direct_Hit_hotel(city) {
var objFromDate = "";
var objToDate = "";
var HTCity = city;
var Date = GetDate();
if ($('#htlselectedroom').val() == null) {
$('#htlselectedroom').val() = 1;
}
var rooms = $('#htlselectedroom').val();
var str = "";
var adt = new Array();
var chd = new Array();
var chdage = new Array();
var i;
var j;
for (i = 0; i < rooms; i++) {
if (str != "") {
str = str + "$";
}
str = str + (i + 1);
adt[i] = $('#HtlSltAdult' + (i + 1)).val();
str = str + "|" + adt[i];
if ($('#HtlChildSlt' + (i + 1)).val() != 0)
{
chd[i] = $('#HtlChildSlt' + (i + 1)).val();
str = str + "|" + chd[i];
for (j = 0; j < chd[i]; j++) {
chdage[j] =$('#HtlChildAge' + (i + 1) + "_" + (j + 1)).val();
str = str + "|" + chdage[j];
}
}
else {
chd[i] = 0;
str = str + "|" + chd[i];
}
}
selecttype = "on"
if ($("#ChannelCode").val() == "Online-DC") {
showNett = "false";
}
var nationality = $('#ddl_nationality_hotel').val();
if (nationality == '--select--') {
alert('Select Nationality');
$('#ddl_nationality_hotel').focus();
return false;
}
var Currency = $('#ddl_currency_hotel').val();
var star = $('#star_select').val();
if (star == 'Select') {
star = "";
}
else {
star = $('#star_select').val();
}
var uid = sessionStorage.getItem('Struid')
if (uid == null) {
uid = "";
}
else {
uid = sessionStorage.getItem('Struid')
}
var DepartureDate=Date.fromdate;;
var ArrivalDate=Date.retdate;
// var targetPage = "../../hotel_Deeplinking.aspx?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + TokenHotel + "&HTLCity=" + HTCity + "&Htlcity=" + HTCity + "&Checkin=" + DepartureDate + "&Checkout=" + ArrivalDate + "&Rooms=" + rooms + "&RoomInfo=" + str + "&Star=" + star + "&CustomerRequestedCurrency=" + Currency + "&CountryOfresidence=" + nationality + "&XHostBranchId=" + $("#Hdnbranchid").val();
var targetPage = domainurl + "/Metabook/Home/Landing?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + TokenHotel + "&HTLCity=" + HTCity + "&Htlcity=" + HTCity + "&Checkin=" + DepartureDate + "&Checkout=" + ArrivalDate + "&Rooms=" + rooms + "&RoomInfo=" + str + "&Star=" + star + "&CustomerRequestedCurrency=" + Currency + "&CountryOfresidence=" + nationality + "&XHostBranchId=" + $("#Hdnbranchid").val() + "&uid=" + uid;
window.location.href = targetPage;
}
function GetDate(){
//var GetDate = function() {
var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var d = new Date();
var r = addDays(d,2);
var dep_date = d.getDate();
var dep_month = d.getMonth();
var dep_year = d.getFullYear();
var ret_date = r.getDate();
var ret_month = r.getMonth();
var ret_year = r.getFullYear();
var from_Date = dep_date + " " + m_names[dep_month] + " " + dep_year;
var ret_Date = ret_date + " " + m_names[ret_month] + " " + ret_year;
// document.write(from_date + "-" + m_names[from_month] + "-" + from_year);
//document.write(ret_date + " " + m_names[ret_month] + " " + ret_year);
return {
fromdate: from_Date,
retdate: ret_Date
};
}
function addDays(date, days) {
var result = new Date(date);
result.setDate(date.getDate() + days);
return result;
}