var x;
var visibilitydomestic = "false";
var visibilityinternational = "false";
var saID = "";
var saBRID = "";
var domainurl = "https://www.veenaworld.com";
$(document).ready(function () {
$('#deparrDate1').datepick({
showTrigger: '
',
rangeSelect: true,
rangeSelect: 0,
monthsToShow: 1,
changeMonth: false,
onSelect: multiselectf1,
dateFormat: ('dd-MM-yyyy'),
rangeSeparator: ' to ',
changeYear: false,
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
});
$('#deparrDate2').datepick({
monthsToShow: 1,
showTrigger: '
',
dateFormat: ('dd-MM-yyyy'),
onSelect: multiselectf2,
rangeSeparator: ' to ',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
changeMonth: false,
changeYear: false,
rangeSelect: true,
rangeSelect: 0
});
$('#deparrDate3').datepick({
monthsToShow: 1,
showTrigger: '
',
dateFormat: ('dd-MM-yyyy'),
onSelect: multiselectf3,
rangeSeparator: ' to ',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
changeMonth: false,
changeYear: false,
rangeSelect: true,
rangeSelect: 0
});
$('#deparrDate4').datepick({
monthsToShow: 1,
showTrigger: '
',
dateFormat: ('dd-MM-yyyy'),
onSelect: multiselectf4,
rangeSeparator: ' to ',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
changeMonth: false,
changeYear: false,
rangeSelect: true,
rangeSelect: 0
});
$('#deparrDate5').datepick({
monthsToShow: 1,
showTrigger: '
',
dateFormat: ('dd-MM-yyyy'),
onSelect: multiselectf5,
rangeSeparator: ' to ',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
changeMonth: false,
changeYear: false,
rangeSelect: true,
rangeSelect: 0
});
$('#deparrDate6').datepick({
monthsToShow: 1,
showTrigger: '
',
dateFormat: ('dd-MM-yyyy'),
rangeSeparator: ' to ',
monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
changeMonth: false,
changeYear: false,
rangeSelect: true,
rangeSelect: 0
});
$('#deparrDate1').prop("readonly", true);
$('#deparrDate2').prop("readonly", true);
$('#deparrDate3').prop("readonly", true);
$('#deparrDate4').prop("readonly", true);
$('#deparrDate5').prop("readonly", true);
$('#deparrDate6').prop("readonly", true);
});
function multiselectf1(dates) {
var D = $('#deparrDate1').datepick('getDate');
$('#deparrDate2').datepick('option', 'minDate', dates[0] || null);
}
function multiselectf2(dates) {
var D = $('#deparrDate2').datepick('getDate');
$('#deparrDate3').datepick('option', 'minDate', dates[0] || null);
}
function multiselectf3(dates) {
var D = $('#deparrDate3').datepick('getDate');
$('#deparrDate4').datepick('option', 'minDate', dates[0] || null);
}
function multiselectf4(dates) {
var D = $('#deparrDate4').datepick('getDate');
$('#deparrDate5').datepick('option', 'minDate', dates[0] || null);
}
function multiselectf5(dates) {
var D = $('#deparrDate5').datepick('getDate');
$('#deparrDate6').datepick('option', 'minDate', dates[0] || null);
}
function CopyDestination(srcCtrl) {
if (srcCtrl.value != "")
return;
var ctrlName = srcCtrl.id;
if (ctrlName.match(/\d/) != null) {
var ctrlNum = parseInt(ctrlName.match(/\d/)[0]);
var valCtrlName = document.getElementById("arrcity1").value;
srcCtrl.value = valCtrlName;
document.getElementById("depcity2").focus();
}
}
function CopyDestination_next(srcCtrl) {
if (srcCtrl.value != "")
return;
var ctrlName = srcCtrl.id;
if (ctrlName.match(/\d/) != null) {
var ctrlNum = parseInt(ctrlName.match(/\d/)[0]);
var valCtrlName = document.getElementById("arrcity2").value;
srcCtrl.value = valCtrlName;
document.getElementById("depcity3").focus();
}
}
function CopyDestination_next1(srcCtrl) {
if (srcCtrl.value != "")
return;
var ctrlName = srcCtrl.id;
if (ctrlName.match(/\d/) != null) {
var ctrlNum = parseInt(ctrlName.match(/\d/)[0]);
var valCtrlName = document.getElementById("arrcity3").value;
srcCtrl.value = valCtrlName;
document.getElementById("depcity4").focus();
}
}
function CopyDestination_next2(srcCtrl) {
if (srcCtrl.value != "")
return;
var ctrlName = srcCtrl.id;
if (ctrlName.match(/\d/) != null) {
var ctrlNum = parseInt(ctrlName.match(/\d/)[0]);
var valCtrlName = document.getElementById("arrcity4").value;
srcCtrl.value = valCtrlName;
document.getElementById("depcity5").focus();
}
}
function CopyDestination_next3(srcCtrl) {
if (srcCtrl.value != "")
return;
var ctrlName = srcCtrl.id;
if (ctrlName.match(/\d/) != null) {
var ctrlNum = parseInt(ctrlName.match(/\d/)[0]);
var valCtrlName = document.getElementById("arrcity5").value;
srcCtrl.value = valCtrlName;
document.getElementById("depcity6").focus();
}
}
function setQueryStringValue() {
var Flexi = "False";
var myLocation = window.location.toString();
var lastIndex = myLocation.lastIndexOf("/");
var exapctPath = myLocation.substring(0, lastIndex);
var targetPage;
var InputXml = ""
for (var i = 1; i <= 6; i++) {
if ($("#depcity" + i).val() == "" && $("#depcity" + i).val() != null || $("#depcity" + i).val() == "From") {
if (i <= 2) {
alert("Departure city is a required field.");
$('#depcity' + i).focus();
return false;
} else {
InputXml += "" + "" + "";
}
}
else {
if ($("#depcity" + i).val() != "" || $("#depcity" + i).val() != null) {
var DepartCity = $("#depcity" + i).val()
InputXml += "" + DepartCity + "";
}
}
if ($("#arrcity" + i).val() == "" && $("#arrcity" + i).val() != null || $("#arrcity" + i).val() == "To") {
if (i <= 2) {
alert("Arrival city is a required field.");
$('#arrcity' + i).focus();
return false;
}
else {
InputXml += "" + "" + "";
}
}
else {
if ($("#arrcity" + i).val() != "" || $("#arrcity" + i).val() != null) {
var DepartCity = $("#arrcity" + i).val()
InputXml += "" + DepartCity + "";
}
}
if ($("#deparrDate" + i).val() != "" && $("#deparrDate" + i).val() != null) {
var Ddate = $("#deparrDate" + i).val().split('-');
InputXml += "" + Ddate[0] + "-" + getDateformat(Ddate[1]) + "-" + Ddate[2] + "";
}
else {
if (i <= 2 && ($("#deparrDate" + i).val() == "" && $("#deparrDate" + i).val() != null)) {
alert("Date is a required field.");
$('#deparrDate' + i).focus();
return false;
}
else if ($("#deparrDate" + i).val() == "" && $("#deparrDate" + i).val() != null) {
InputXml += "" + "" + "";
}
}
}
InputXml += "";
var xu = new XML();
var MulticityDoc = xu.LoadXMLString(InputXml);
var DirectFlight = "";
var DirectFlight = "";
if ($("#MulticityDirectFlight").is(':checked')) {
DirectFlight = "True"
}
else {
DirectFlight = "False";
}
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity1") == xu.SelectNodeValue(MulticityDoc, "//ArrivalCity1")) {
alert("Departure Arrival Can't Be Same")
return false;
}
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity2") == xu.SelectNodeValue(MulticityDoc, "//ArrivalCity2")) {
alert("Departure Arrival Can't Be Same")
return false;
}
var Depart1 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity1").split('(')
var Dep1 = Depart1[1].replace(")", "");
var Depart2 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity2").split('(')
var Dep2 = Depart2[1].replace(")", "");
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity3") == "" || xu.SelectNodeValue(MulticityDoc, "//DepartureCity3") == "From") {
var Dep3 = "";
} else {
var Depart3 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity3").split('(')
Dep3 = Depart3[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity4") == "" || xu.SelectNodeValue(MulticityDoc, "//DepartureCity4") == "From") {
var Dep4 = "";
} else {
var Depart4 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity4").split('(')
Dep4 = Depart4[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity5") == "" || xu.SelectNodeValue(MulticityDoc, "//DepartureCity5") == "From") {
var Dep5 = "";
}
else {
var Depart5 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity5").split('(')
Dep5 = Depart5[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//DepartureCity6") == "" || xu.SelectNodeValue(MulticityDoc, "//DepartureCity6") == "From") {
var Dep6 = "";
}
else {
var Depart6 = xu.SelectNodeValue(MulticityDoc, "//DepartureCity6").split('(')
Dep6 = Depart6[1].replace(")", "");
}
var Arrival1 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity1").split('(')
var Arr1 = Arrival1[1].replace(")", "");
var Arrival2 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity2").split('(')
var Arr2 = Arrival2[1].replace(")", "");
if (xu.SelectNodeValue(MulticityDoc, "//ArrivalCity3") == "" || xu.SelectNodeValue(MulticityDoc, "//ArrivalCity3") == "To") {
var Arr3 = "";
}
else {
var Arrival3 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity3").split('(')
Arr3 = Arrival3[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//ArrivalCity4") == "" || xu.SelectNodeValue(MulticityDoc, "//ArrivalCity4") == "To") {
var Arr4 = "";
}
else {
var Arrival4 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity4").split('(')
Arr4 = Arrival4[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//ArrivalCity5") == "" || xu.SelectNodeValue(MulticityDoc, "//ArrivalCity5") == "To") {
var Arr5 = "";
}
else {
var Arrival5 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity5").split('(')
Arr5 = Arrival5[1].replace(")", "");
}
if (xu.SelectNodeValue(MulticityDoc, "//ArrivalCity6") == "" || xu.SelectNodeValue(MulticityDoc, "//ArrivalCity6") == "To") {
var Arr6 = "";
}
else {
var Arrival6 = xu.SelectNodeValue(MulticityDoc, "//ArrivalCity6").split('(')
Arr6 = Arrival6[1].replace(")", "");
}
var uid = sessionStorage.getItem('Struid')
if (uid == null) {
uid = "";
}
else {
uid = sessionStorage.getItem('Struid')
}
var targetPage = "";
targetPage = domainurl + "/online3s/MulticityDeeplinking.aspx?DeparturePoint1=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity1") +
"&DeparturePoint2=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity2") +
"&DeparturePoint3=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity3") +
"&DeparturePoint4=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity4") +
"&DeparturePoint5=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity5") +
"&DeparturePoint6=" + xu.SelectNodeValue(MulticityDoc, "//DepartureCity6") +
"&ArrivalPoint1=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity1") +
"&ArrivalPoint2=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity2") +
"&ArrivalPoint3=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity3") +
"&ArrivalPoint4=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity4") +
"&ArrivalPoint5=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity5") +
"&ArrivalPoint6=" + xu.SelectNodeValue(MulticityDoc, "//ArrivalCity6") +
"&DateM1=" + xu.SelectNodeValue(MulticityDoc, "//Date1") +
"&DateM2=" + xu.SelectNodeValue(MulticityDoc, "//Date2") +
"&DateM3=" + xu.SelectNodeValue(MulticityDoc, "//Date3") +
"&DateM4=" + xu.SelectNodeValue(MulticityDoc, "//Date4") +
"&DateM5=" + xu.SelectNodeValue(MulticityDoc, "//Date5") +
"&DateM6=" + xu.SelectNodeValue(MulticityDoc, "//Date6") +
"&Dep1=" + Dep1 + "&Dep2=" + Dep2 + "&Dep3=" + Dep3 + "&Dep4=" + Dep4 + "&Dep5=" + Dep5 + "&Dep6=" + Dep6 +
"&Arr1=" + Arr1 + "&Arr2=" + Arr2 + "&Arr3=" + Arr3 + "&Arr4=" + Arr4 + "&Arr5=" + Arr5 + "&Arr6=" + Arr6 +
"&Adult=" + $("#Multicity_Adults").val() +
"&Child=" + $("#Multicity_Child").val() +
"&Infant=" + $("#Multicity_Infant").val() +
"&Airline=" + $("#Multicity_airline").val() +
"&CabinClass=" + $("#DDLCabinClass_Multicity").val() +
"&journeyType=International&compId=" + $("#HdncompanyCode").val() +
"&LanguageCode=" + $('#Hdnlanguage').val() + "&SalesChannel=" + $("#ChannelCode").val() +
"&RequestedCurrency=" + $("#DDLcurrency_mulity").val() +
"&FlexiCheck=" + Flexi +
"&DirectFlight=" + DirectFlight + "&WebsiteID=" + $("#Hdnwebsiteid").val() + "&uid=" + uid + "&Flighttype=Multicity";
window.location.href = targetPage;
}
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 ValidateMulticityDates() {
if (xu.SelectNodeValue(MulticityDoc, "//Date1") < xu.SelectNodeValue(MulticityDoc, "//Date2")) {
alert("Select Proper date")
return false;
}
else if (xu.SelectNodeValue(MulticityDoc, "//Date2") < xu.SelectNodeValue(MulticityDoc, "//Date1") || xu.SelectNodeValue(MulticityDoc, "//Date3") < xu.SelectNodeValue(MulticityDoc, "//Date2")) {
alert("Select Proper date")
return false;
}
else if (xu.SelectNodeValue(MulticityDoc, "//Date3") < xu.SelectNodeValue(MulticityDoc, "//Date2") || xu.SelectNodeValue(MulticityDoc, "//Date4") < xu.SelectNodeValue(MulticityDoc, "//Date3")) {
alert("Select Proper date")
return false;
}
else if (xu.SelectNodeValue(MulticityDoc, "//Date4") < xu.SelectNodeValue(MulticityDoc, "//Date3") || xu.SelectNodeValue(MulticityDoc, "//Date5") < xu.SelectNodeValue(MulticityDoc, "//Date4")) {
alert("Select Proper date")
return false;
}
else if (xu.SelectNodeValue(MulticityDoc, "//Date5") < xu.SelectNodeValue(MulticityDoc, "//Date4") || xu.SelectNodeValue(MulticityDoc, "//Date6") < xu.SelectNodeValue(MulticityDoc, "//Date5")) {
alert("Select Proper date")
return false;
}
}
var Datetoday = new Date();
var month = Datetoday.getMonth() + 1;
var day = Datetoday.getDate();
var year = Datetoday.getFullYear();
var current = (month + "/" + day + "/" + year);
var currentdate = new Date(current);
function Datecheck() {
if ($("#deparrDate1").val() < currentdate) {
alert("Departure Date should not be less than current date");
return false;
}
else if ($("#deparrDate2").val() < $("#deparrDate1").val() || $("#deparrDate3").val() < $("#deparrDate2").val()) {
alert("Please select valid date. Return date shold be later than Departure Date");
return false;
}
else if ($("#deparrDate3").val() < $("#deparrDate2").val() || $("#deparrDate4").val() < $("#deparrDate3").val()) {
alert("Please select valid date. Return date shold be later than Departure Date");
return false;
}
else if ($("#deparrDate4").val() < $("#deparrDate3").val() || $("#deparrDate5").val() < $("#deparrDate4").val()) {
alert("Please select valid date. Return date should be later than Departure Date");
return false;
}
else if ($("#deparrDate5").val() < $("#deparrDate4").val() || $("#deparrDate6").val() < $("#deparrDate5").val()) {
alert("Please select valid date. Return date should be later than Departure Date");
return false;
}
}