var x; var saID = ""; var saBRID = ""; var tokenflight = "Flight"; var AgentName = ""; var ClientId = ""; var LCCRTChkBox = ""; var domainurl = "http://www.veenaworld.com"; var IndexResource; var xmlHttp; var xu = new XML(); var dom = new DOM(); $(document).ready(function () { $('#txtFlightArrivalDate').datepick({ minDate:0, monthsToShow: 1, onSelect: flightcustomRangeR, changeMonth: false, dateFormat: ('dd MM yyyy'), rangeSeparator: ' to ', changeYear: false, showTrigger: 'Popup', monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }); $('#txtFlightDepartureDate').datepick({ monthsToShow: 1, onSelect: flightcustomRangeO, dateFormat: ('dd MM yyyy'), rangeSeparator: ' to ', showTrigger: 'Popup', monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], changeMonth: false, changeYear: false }); $('#txtFlightArrivalDate').prop("readonly", true); $('#txtFlightDepartureDate').prop("readonly", true); settingdateflight_Oneway(); settingdateflight_RoundTrip(); }); function flightcustomRangeR(dates) { var D = $('#txtFlightArrivalDate').datepick('getDate'); var DepDate = new Date(Date.parse(D[0])); var RetDate = new Date(Date.parse(D[1])); var DepDate_day = D[0].getDate(); var DepDate_month = D[0].getMonth(); var DepDate_year = D[0].getFullYear(); $("#txtFlightArrivalDate").val(DepDate_day + " " + getMonth((DepDate_month + 1).toString()) + " " + DepDate_year); } function flightcustomRangeO(dates) { var date1 = $('#txtFlightDepartureDate').datepick('getDate'); var date = new Date(Date.parse(date1)); var date_day = date.getDate(); var date_month = date.getMonth(); var date_year = date.getFullYear(); $("#txtFlightDepartureDate").val(date_day + " " + getMonth((date_month + 1).toString()) + " " + date_year); date.setDate(date.getDate() + 1); var newDate = date; newDate = new Date(Date.parse(newDate)); var date_day1 = newDate.getDate(); var date_month1 = newDate.getMonth(); var date_year1 = newDate.getFullYear(); if (date != "Invalid Date") { $('#txtFlightArrivalDate').val(date_day1 + " " + getMonth((date_month1 + 1).toString()) + " " + date_year1); } $('#txtFlightArrivalDate').datepick('option', 'minDate', dates[0] || null); } function settingdateflight_Oneway() { 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 + " " + getFirstLetterUpperMonth(month.toString()) + " " + year); var RetDate = (dt1 + " " + getFirstLetterUpperMonth(dt2.toString()) + " " + dt3); $("#txtFlightDepartureDate").val(DepDate); } function settingdateflight_RoundTrip() { 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 + " " + getFirstLetterUpperMonth(month.toString()) + " " + year); var RetDate = (dt1 + " " + getFirstLetterUpperMonth(dt2.toString()) + " " + dt3); $("#txtFlightArrivalDate").val(RetDate); } 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 getDateformatMonthInNumber(getinputFormat) { getinput = getinputFormat.toUpperCase(); switch (getinput) { case "JAN": getinput = "01"; break; case "FEB": getinput = "02"; break; case "MAR": getinput = "03"; break; case "APR": getinput = "04"; break; case "MAY": getinput = "05"; break; case "JUN": getinput = "06"; break; case "JUL": getinput = "07"; break; case "AUG": getinput = "08"; break; case "SEP": getinput = "09"; break; case "OCT": getinput = "10"; break; case "NOV": getinput = "11"; break; case "DEC": getinput = "12"; break; } return getinput; } function ValidateFlexiDates(departDate, arrivalDate) { var GetFirstDate = departDate.split('-'); var GetSecondDate = arrivalDate.split('-'); departDate = GetFirstDate[0] + "-" + getDateformatMonthInNumber(GetFirstDate[1]) + "-" + GetFirstDate[2]; arrivalDate = GetSecondDate[0] + "-" + getDateformatMonthInNumber(GetSecondDate[1]) + "-" + GetSecondDate[2]; var FirstDate = departDate; var SecondDate = arrivalDate; var oneday = 1000 * 60 * 60 * 24; var x = FirstDate.split("-"); var y = SecondDate.split("-"); var chkindate = new Date(x[2], (x[1] - 1), x[0]); var chkoutdate = new Date(y[2], (y[1] - 1), y[0]) var month1 = x[1] - 1; var month2 = y[1] - 1; var No_of_days = Math.ceil((chkoutdate.getTime() - chkindate.getTime()) / (oneday)); if (No_of_days < 6) { alert("The minimum difference between the dates should be 6 days.If you want to search less than 6 days please uncheck the My dates are flexible."); return false; } else return true; } function getSelectedText(elementId) { var elt = document.getElementById(elementId); if (elt.selectedIndex == -1) return null; return elt.options[elt.selectedIndex].text; } function ValidateDate() { var SeprateDateFlight = ""; var SeprateDateFlight1 = ""; var SeprateDateFlight2 = ""; var objFromDate = ""; var objToDate = ""; var ToDate = ""; var FromDate = ""; var DepDt = ""; var RetDate = ""; var fromcity_flight = document.getElementById('fromcityAc').value; var tocity_flight = document.getElementById('tocityAc').value; var String = fromcity_flight.substring(fromcity_flight.lastIndexOf(",") + 1, fromcity_flight.lastIndexOf("-")); var String1 = tocity_flight.substring(tocity_flight.lastIndexOf(",") + 1, tocity_flight.lastIndexOf("-")); var jtype = ""; var DirectFlight = ""; var Flaxi = ""; if (fromcity_flight == tocity_flight) { alert('Departure and Arrival Can not be same'); return false; } var type = ""; if (($("#HdnArrCountryCode").val() == $("#HdnDepCountryCode").val()) && ($("#HdnArrCountryCode").val() == "IN") && ($("#HdnArrCountryCode").val()!="" && $("#HdnDepCountryCode").val()!="")) { type = "D"; } else { type = "I"; } //if (type == "I") { if ($('#fromcityAc').val() == "" || $('#fromcityAc').val() == "From") { alert("Select Departure City"); $('#fromcityAc').focus(); return false; } if ($('#tocityAc').val() == "" || $('#tocityAc').val() == "To") { alert("Select Arrival at City"); $('#tocityAc').focus(); return false; } if ($("#fromcityAc").val() == "" || $("#fromcityAc").val() == "From" || $("#tocityAc").val() == "TO" || $("#tocityAc").val() == "") { alert("Select Departure/Arrival City"); $('#fromcityAc').focus(); return false; } if (document.getElementById("ReturnDateInput").style.display == "none") { jtype = "O"; DepDt=$('#txtFlightDepartureDate').val(); RetDate=""; } if (document.getElementById("ReturnDateInput").style.display == "block") { jtype = "R"; DepDt=$('#txtFlightDepartureDate').val(); RetDate=$('#txtFlightArrivalDate').val(); } if ($("#DirectFlight").is(':checked')) { DirectFlight = "True" } else { DirectFlight = "False"; } if ($("#Flexiflight").is(':checked')) { Flaxi = "True" } else { Flaxi = "False"; } if (Flaxi == "True" && jtype == "R") { // fromdate = SeprateDateFlight1[0] + '-' + SeprateDateFlight1[1] + '-' + SeprateDateFlight1[2]; // todate = SeprateDateFlight2[0] + '-' + SeprateDateFlight2[1] + '-' + SeprateDateFlight2[2]; if (ValidateFlexiDates(FromDate, ToDate) == false) { return false; } } var adult_int = parseInt(getSelectedText("ddlAdultInt")); var child_int = parseInt(getSelectedText("ddlChildInt")); var infant_int = parseInt(getSelectedText("ddlInfantInt")); if (adult_int < infant_int) { alert("Infants must be less than or equal to Adults"); return false; } var total_passenger_int = adult_int + child_int + infant_int; if (total_passenger_int > 9) { alert("Total Number of Passenger can't be more than 9"); return false; } var depart_city_int = document.getElementById("fromcityAc").value; var arrival_city_int = document.getElementById("tocityAc").value; if (depart_city_int != "") { var dept_city = document.getElementById("fromcityAc").value.split('('); var dept_cityname_int = dept_city[1].replace(')', ''); } if (arrival_city_int != "") { var arr_city = document.getElementById("tocityAc").value.split('('); var arr_cityname_int = arr_city[1].replace(')', ''); } var FlightCabin = $("#ddl_class").val(); var airline_int = $("#ddl_airline").val(); if (airline_int == "select") { airline_int = ""; } else { airline_int = airline_int + ","; } var currency = $("#ddl_currency").val(); var uid = sessionStorage.getItem('Struid') if (uid == null) { uid = ""; } else { uid = sessionStorage.getItem('Struid') } var targetpage = domainurl + "/online3s/flight_Deeplinking.aspx?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&FlightMode=" + type + "&JourneyType=" + jtype + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + tokenflight + "&CabinClass=" + FlightCabin + "&Dep=" + dept_cityname_int + "&Arr=" + arr_cityname_int + "&DepDt=" + DepDt + "&RetDt=" + RetDate + "&Adt=" + adult_int + "&Chd=" + child_int + "&Inf=" + infant_int + "&cl=" + FlightCabin + "&DirectFlight=" + DirectFlight + "&IntAirline=" + airline_int + "&DepCity=" + depart_city_int + "&ArrCity=" + arrival_city_int + "&LCCRTChkBox=" + LCCRTChkBox + "&DepDate=" + DepDt + "&RetDate=" + RetDate + "&Airline=" + airline_int + "&Flexi=" + Flaxi + "&comp_currency=" + currency + "&DepCountryCode=" + $("#HdnDepCountryCode").val() + "&ArrCountryCode=" + $("#HdnArrCountryCode").val() + "&Nationality=" + $("#NationalityFlight").val() + "&uid=" + uid; //} // else if (type == "D" || type == "") { // } window.location.href = targetpage; } function SwitchCity() { var store1 = $('#fromcityAc').val(); var store2 = $('#tocityAc').val(); if (store1 != "Enter City or Airport" && store2 != "Enter City or Airport") { $('#fromcityAc').val(store2); $('#tocityAc').val(store1); } } function showspantag() { var adt = $('#ddlAdultInt').val(); var child = $('#ddlChildInt').val(); var infant = $('#ddlInfantInt').val(); var total = +adt + +child + +infant; if (total > 9) { document.getElementById('traveller_span').innerHTML = total + " Travellers"; alert("Total Number of Passenger can't be more than 9"); return false; } else { if (total == "1") { document.getElementById('traveller_span').innerHTML = total + " Traveller"; } else { document.getElementById('traveller_span').innerHTML = total + " Travellers"; } } } function showTravellerTagMulticity() { var adt = $('#Multicity_Adults').val(); var child = $('#Multicity_Child').val(); var infant = $('#Multicity_Infant').val(); var total = +adt + +child + +infant; if (total > 9) { document.getElementById('Trvellerspanmltcy').innerHTML = total + " Travellers"; alert("Total Number of Passenger can't be more than 9"); return false; } else { if (total == "1") { document.getElementById('Trvellerspanmltcy').innerHTML = total + " Traveller"; ; } else { document.getElementById('Trvellerspanmltcy').innerHTML = total + " Travellers"; ; } } } function CurrencyChange(ctrl) { var ChangeCurrency = ctrl.innerHTML; var currentcurreny = document.getElementById('span_currency').innerHTML; document.getElementById('span_currency').innerHTML = ChangeCurrency; ctrl.innerHTML = currentcurreny; } var startval = 3; var endval = 7; function fnRemoveDiv(idval) { if ($("#MULTI_" + idval).css("display") == "block" || $("#MULTI_" + idval).css("display") == "") $("#MULTI_" + idval).hide(); if (document.getElementById("CrossDiv" + parseInt(idval - 1)) != null) $("#CrossDiv" + parseInt(idval - 1)).show(); $("#addmoreDiv").show(); startval = 3; endval = 7; } function fnAddDiv(idval) { if (startval < endval) { for (var i = startval; i < endval; i++) { if ($("#MULTI_" + startval).css("display") != "none") startval = i; } $("#MULTI_" + startval).show(); if (document.getElementById("CrossDiv" + parseInt(startval - 1)) != null) $("#CrossDiv" + parseInt(startval - 1)).hide(); if (startval == 6) $("#addmoreDiv").hide(); startval += 1 } } function FocusNext() { var from = document.getElementById('fromcityAc').value; if (from != "" || from != "Enter City or Airport") { document.getElementById('tocityAc').focus(); } } function roundtrip() { document.getElementById('return_dt').style.display = "block"; document.getElementById("onewaychecked").value = ""; document.getElementById("Roundtripchecked").value = "R"; } function oneway() { document.getElementById('return_dt').style.display = "none"; document.getElementById("onewaychecked").value = "o"; document.getElementById("Roundtripchecked").value = ""; } function Showoneway() { document.getElementById("DirectFlight").checked = false; document.getElementById("ReturnDateInput").style.display = "none"; document.getElementById("OnewayDateInput").style.display = "block"; document.getElementById("fromcityAc").value = "From"; document.getElementById("tocityAc").value = "To"; } function ShowRoundtrip() { document.getElementById("DirectFlight").checked = false; document.getElementById("ReturnDateInput").style.display = "block"; document.getElementById("OnewayDateInput").style.display = "block"; //document.getElementById("fromcityAc").value = "From"; //document.getElementById("tocityAc").value = "To"; } function getMonth(month) { if (month < 10) month = "0" + month; switch (month) { case "01": month = "JAN"; break; case "02": month = "FEB"; break; case "03": month = "MAR"; break; case "04": month = "APR"; break; case "05": month = "MAY"; break; case "06": month = "JUN"; break; case "07": month = "JUL"; break; case "08": month = "AUG"; break; case "09": month = "SEP"; break; case "10": month = "OCT"; break; case "11": month = "NOV"; break; case "12": month = "DEC"; break; } return month; } function getFirstLetterUpperMonth(month) { switch (month) { case "01": month = "Jan"; break; case "02": month = "Feb"; break; case "03": month = "Mar"; break; case "04": month = "Apr"; break; case "05": month = "May"; break; case "06": month = "Jun"; break; case "07": month = "Jul"; break; case "08": month = "Aug"; break; case "09": month = "Sep"; break; case "10": month = "Oct"; break; case "11": month = "Nov"; break; case "12": month = "Dec"; break; } return month; } function AddMlticity() { if ($("#MulticitySelected").val() < 6) { var Mltidiv = $("#MulticitySelected").val(); document.getElementById('MulticitySelected').value = parseInt(Mltidiv) + 1; var append = parseInt(Mltidiv) + 1; var Multicitydiv = 'MULTI_' + append; $("#" + Multicitydiv).show(); } if ($("#MulticitySelected").val() == 6) { $("#Addmulti").hide(); } else { $("#Addmulti").show(); } if ($("#MulticitySelected").val() > 2) { $("#RemoveMulti").show(); } else { $("#RemoveMulti").hide(); } } function RemoveMlticity() { var Mltidiv = $("#MulticitySelected").val(); if (Mltidiv < 3) { return false; } document.getElementById('MulticitySelected').value = parseInt(Mltidiv) - 1; var append = parseInt(Mltidiv); var Multicitydiv = 'MULTI_' + append; $("#" + Multicitydiv).hide(); if ($("#MulticitySelected").val() == 6) { $("#Addmulti").hide(); } else { $("#Addmulti").show(); } if ($("#MulticitySelected").val() > 2) { $("#RemoveMulti").show(); } else { $("#RemoveMulti").hide(); } } function ShowRoundtripFlight() { document.getElementById("DirectFlight").checked = false; document.getElementById("ReturnDateInput").style.display = "block"; document.getElementById("OnewayDateInput").style.display = "block"; //document.getElementById("fromcityAc").value = "From"; //document.getElementById("tocityAc").value = "To"; } function ShowonewayFlight() { document.getElementById("DirectFlight").checked = false; document.getElementById("ReturnDateInput").style.display = "none"; document.getElementById("OnewayDateInput").style.display = "block"; // document.getElementById("fromcityAc").value = "From"; //document.getElementById("tocityAc").value = "To"; } function DirectFlightHit(Dep, Arr, DepCity, ArrCity, Airline) { var Date = GetDate(); var type = "I"; if (document.getElementById("ReturnDateInput").style.display == "none") { jtype = "O"; //DepDt = $('#txtFlightDepartureDate').val(); DepDt = Date.fromdate; //document.write(Date.fromdate); RetDate = ""; } if (document.getElementById("ReturnDateInput").style.display == "block") { jtype = "R"; //DepDt = $('#txtFlightDepartureDate').val(); DepDt = Date.fromdate; // RetDate = $('#txtFlightArrivalDate').val(); RetDate = Date.retdate; } if ($("#DirectFlight").is(':checked')) { DirectFlight = "True" } else { DirectFlight = "False"; } if ($("#Flexiflight").is(':checked')) { Flaxi = "True" } else { Flaxi = "False"; } if (Flaxi == "True" && jtype == "R") { // fromdate = SeprateDateFlight1[0] + '-' + SeprateDateFlight1[1] + '-' + SeprateDateFlight1[2]; // todate = SeprateDateFlight2[0] + '-' + SeprateDateFlight2[1] + '-' + SeprateDateFlight2[2]; if (ValidateFlexiDates(FromDate, ToDate) == false) { return false; } } var adult_int = parseInt(getSelectedText("ddlAdultInt")); var child_int = parseInt(getSelectedText("ddlChildInt")); var infant_int = parseInt(getSelectedText("ddlInfantInt")); //var depart_city_int = document.getElementById("fromcityAc").value; //var arrival_city_int = document.getElementById("tocityAc").value; //if (depart_city_int != "") { // var dept_city = document.getElementById("fromcityAc").value.split('('); // var dept_cityname_int = dept_city[1].replace(')', ''); //} //if (arrival_city_int != "") { // var arr_city = document.getElementById("tocityAc").value.split('('); // var arr_cityname_int = arr_city[1].replace(')', ''); //} var FlightCabin = $("#ddl_class").val(); var airline_int = $("#ddl_airline").val(); if (airline_int == "select") { airline_int = ""; } else { airline_int = airline_int + ","; } var currency = $("#ddl_currency").val(); var uid = sessionStorage.getItem('Struid') if (uid == null) { uid = ""; } else { uid = sessionStorage.getItem('Struid') } domainurl = "http://www.veenaworld.com"; var targetpage = domainurl + "/online3s/flight_Deeplinking.aspx?CompanyId=" + $("#HdncompanyCode").val() + "&LanguageCode=" + $("#Hdnlanguage").val() + "&FlightMode=" + type + "&JourneyType=" + jtype + "&websiteId=" + $("#Hdnwebsiteid").val() + "&ClientId=" + ClientId + "&SalesChannel=" + $("#ChannelCode").val() + "&AgentName=" + AgentName + "&SearchType=" + tokenflight + "&CabinClass=" + FlightCabin + "&Dep=" + Dep + "&Arr=" + Arr + "&DepDt=" + DepDt + "&RetDt=" + RetDate + "&Adt=" + adult_int + "&Chd=" + child_int + "&Inf=" + infant_int + "&cl=" + FlightCabin + "&DirectFlight=" + DirectFlight + "&IntAirline=" + Airline + "&DepCity=" + DepCity + "&ArrCity=" + ArrCity + "&LCCRTChkBox=" + LCCRTChkBox + "&DepDate=" + DepDt + "&RetDate=" + RetDate + "&Airline=" + airline_int + "&Flexi=" + Flaxi + "&comp_currency=" + currency + "&DepCountryCode=" + $("#HdnDepCountryCode").val() + "&ArrCountryCode=" + $("#HdnArrCountryCode").val() + "&Nationality=" + $("#NationalityFlight").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; }