/* ================================================ Original Author: Ayoosh Joshi. Creation Date: September 2007. Modified by: Surabhi Gupta, Anuj Arora, Rajesh Parbat, Tejveer Singh, Rahul Tyagi, Vipin Bhardwaj, Ayoosh Joshi. Purpose: Serves as a common repository for all Online related JS. (or atleast, that was intended!) Copyright ©: QuadLabs Technologies Ltd. All Rights Reserved. ================================================ */ var bType = new BrowserSniffer().GetBrowserType(); /******** GENERAL AJAX FUNCTIONS *************/ /****************************************/ //function GetXmlHttpObject() //{ // var ajax = null; // if (window.XMLHttpRequest) // { // // If IE7, Mozilla, Safari, and so on: Use native object // ajax = new XMLHttpRequest(); // } // else // { // if (window.ActiveXObject) // { // // ...otherwise, use the ActiveX control for IE5.x and IE6 // ajax = new ActiveXObject('MSXML2.XMLHTTP.3.0'); // } // } // return ajax; //} /******** GENERAL PAGE FUNCTIONS *************/ /****************************************/ // Function used to show/hide DIV's. Used on Payment page to toggle Delivery address DIV. function CopyAddress(srcField, srcType) { var optBillEqualsDel = getElement("optBillEqualsDel", false); if (optBillEqualsDel) { if (optBillEqualsDel.checked == true) { if ((srcField == null) && (srcType == null)) { var bTitile=getElement("ddlBTitle",false).value; var bFName = getElement("txtBFName", false).value; var bLName = getElement("txtBLName", false).value; var bAddy = getElement("txtBAddress", false).value; var bCity = getElement("txtBCity", false).value; var bCode=getElement("txtBPostCode",false).value; var bEmail=getElement("txtBEmailId",false).value; var bCountry = getElementWithSeparator("ddlCountry", true, "BCountry", "$").value; //var bState =getElementWithSeparator("ddlState", true, "BCountry", "$").value; var bOtherState=getElementWithSeparator("txtOtherState", true, "BCountry", "$").value; var dTitile=getElement("ddlDTitle",false); dTitile.style.background = "#eee"; dTitile.disabled = true; dTitile.value = bTitile; var txtDFName = getElement("txtDFName", false); txtDFName.style.background = "#eee"; txtDFName.disabled = true; txtDFName.value = bFName; var txtDLName = getElement("txtDLName", false); txtDLName.style.background = "#eee"; txtDLName.disabled = true; txtDLName.value = bLName; var txtDAddress = getElement("txtDAddress", false); txtDAddress.style.background = "#eee"; txtDAddress.disabled = true; txtDAddress.value = bAddy; var txtDCity = getElement("txtDCity", false); txtDCity.style.background = "#eee"; txtDCity.disabled = true; txtDCity.value = bCity; var txtDPostCode = getElement("txtDPostCode", false); txtDPostCode.style.background = "#eee"; txtDPostCode.disabled = true; txtDPostCode.value = bCode; var txtDMail = getElement("txtDMailId", false); txtDMail.style.background = "#eee"; txtDMail.disabled = true; txtDMail.value = bEmail; var txtCountry = getElementWithSeparator("ddlCountry", true, "DCountry", "$"); txtCountry.disabled = true; txtCountry.style.background = "#eee"; txtCountry.value = bCountry; // var txtState=getElementWithSeparator("ddlState", true, "DCountry", "$"); // txtState.disabled=true; // txtState.value=bState var txtOther_State=getElementWithSeparator("txtOtherState", true, "DCountry", "$"); txtOther_State.disabled=true; txtOther_State.style.background = "#eee"; txtOther_State.value=bOtherState } else { switch (srcType) { case "title": var btitle = srcField.value; getElement("ddlDTitle", false).value = btitle; break; case "Fname": var bFName = srcField.value; getElement("txtDFName", false).value = bFName; break; case "Lname": var bLName = srcField.value; getElement("txtDLName", false).value = bLName; break; case "address": var bAddy = srcField.value; getElement("txtDAddress", false).value = bAddy; break; case "city": var bCity = srcField.value; getElement("txtDCity", false).value = bCity; break; case "postcode": var bCode = srcField.value; getElement("txtDPostCode", false).value = bCode; break; case "mail": var bmail = srcField.value; getElement("txtDMailId", false).value = bmail; break; case "country": var bCountry = srcField.value; getElementWithSeparator("ddlCountry", true, "DCountry", "$").value = bCountry; break; // Added by rajesh case "state": // var bState = srcField.value; // getElementWithSeparator("ddlState", true, "DCountry", "$").value = bState; // break; case "otherState": var bOtherState=srcField.value; getElementWithSeparator("txtOtherState", true, "DCountry", "$").value = bOtherState; break; } } } else { var dTitle=getElement("ddlDTitle",false); dTitle.style.background = "#fff"; dTitle.disabled = false; dTitle.value = "Mr"; //getElement("txtBFName", false).value; var txtDFName = getElement("txtDFName", false); txtDFName.style.background = "#fff"; txtDFName.disabled = false; txtDFName.value = getElement("txtDFName", false).value; var txtDLName = getElement("txtDLName", false); txtDLName.style.background = "#fff"; txtDLName.disabled = false; //txtDLName.value = ""; txtDLName.value =getElement("txtDLName", false).value; var txtDAddress = getElement("txtDAddress", false); txtDAddress.style.background = "#fff"; txtDAddress.disabled = false; //txtDAddress.value = ""; txtDAddress.value =getElement("txtDAddress", false).value; var txtDCity = getElement("txtDCity", false); txtDCity.style.background = "#fff"; txtDCity.disabled = false; //txtDCity.value = ""; txtDCity.value =getElement("txtDCity", false).value; var txtDPostCode = getElement("txtDPostCode", false); txtDPostCode.style.background = "#fff"; txtDPostCode.disabled = false; //txtDPostCode.value = ""; txtDPostCode.value =getElement("txtDPostCode",false).value; var txtDmail = getElement("txtDMailId", false); txtDmail.style.background = "#fff"; txtDmail.disabled = false; //txtDmail.value = ""; txtDmail.value =getElement("txtDMailId",false).value; var txtCountry = getElementWithSeparator("ddlCountry", true, "DCountry", "$"); txtCountry.disabled = false; txtCountry.style.background = "#fff"; //txtCountry.value = "IN"; txtCountry.value=getElementWithSeparator("ddlCountry", true, "DCountry", "$").value; // //Added by rajesh // var txtState = getElementWithSeparator("ddlState", true, "DCountry", "$"); // txtState.disabled = false; // txtState.value = ""; // var txtState = getElementWithSeparator("txtOtherState", true, "DCountry", "$"); txtState.disabled = false; txtState.style.background = "#fff"; //txtState.value = ""; txtState.value =getElementWithSeparator("txtOtherState", true, "DCountry", "$").value; } } } // Function used to disable entry in text fields. Used on Flight Search page to disable return date and city for One-way trip. function LockField(fieldNames, fieldStatus) { if (fieldNames) { var f; for (f in fieldNames) { f = parseFloat(f); var field = fieldNames[f]; if (field.substr(0,3) == "txt") { field = getElement(field, true); } else field = document.getElementById(field); if (fieldStatus == true) { if(field != null) { if ((field.tagName.toLowerCase() == "input") && (field.type == "image")) field.style.cursor = "default"; else { field.style.background = "#ccc"; field.style.bordercolor = "#869DB2"; field.style.borderwidth = "1px"; field.style.borderstyle = "solid"; } } } else { if(field != null) { if (field.tagName == "IMG") field.style.cursor = "hand"; else { field.style.background = "#efefef"; field.style.bordercolor = "#869DB2"; field.style.borderwidth = "1px"; field.style.borderstyle = "solid"; } } } if(field != null) { field.disabled = fieldStatus; } } } } function closediv() { //document.all.Iframe1.style.visibility="hidden"; document.getElementById('Iframe1').style.visibility="hidden"; document.getElementById('maindiv1').style.visibility="hidden"; document.getElementById('NavBar1').style.visibility="hidden"; //document.getElementById('Calendar1').style.visibility="hidden"; document.getElementById('Calendar1').style.visibility="hidden"; //self.close(); } // Function used to Toggle the Domestic and International DIV's on the Flight Search page. function ToggleFlightMode(mode) { if (mode == "FlightIntl") { closediv(); if (document.getElementById("ctl00_contentMain_ctl00_FlightDom")) { document.getElementById("ctl00_contentMain_ctl00_FlightDom").style.display = "none"; } //document.getElementById("spnIntlI").className = "FlightModeActive"; if (document.getElementById("ctl00_contentMain_ctl00_TdIntlI")) { document.getElementById("ctl00_contentMain_ctl00_TdIntlI").className = "ActiveTab"; } //document.getElementById("spnDomI").className = "FlightModeInactive"; if (document.getElementById("ctl00_contentMain_ctl00_TdDomI")) { document.getElementById("ctl00_contentMain_ctl00_TdDomI").className = "InactiveTab"; } if (document.getElementById("ctl00_contentMain_ctl00_hdnFlightMode")) { document.getElementById("ctl00_contentMain_ctl00_hdnFlightMode").value = "I"; } document.getElementById("hdnDisabledDate").value = document.getElementById("ctl00_contentMain_ctl00_hdnDisabledDateInt").value; } //TdInt //TdDomI else if (mode == "FlightDom") { closediv(); if (document.getElementById("ctl00_contentMain_ctl00_FlightIntl")) { document.getElementById("ctl00_contentMain_ctl00_FlightIntl").style.display = "none"; } //document.getElementById("spnIntlD").className = "FlightModeInactive"; if (document.getElementById("ctl00_contentMain_ctl00_TdInt")) { document.getElementById("ctl00_contentMain_ctl00_TdInt").className = "InactiveTab"; } //document.getElementById("spnDomD").className = "FlightModeActive"; if (document.getElementById("ctl00_contentMain_ctl00_TdDom")) { document.getElementById("ctl00_contentMain_ctl00_TdDom").className = "ActiveTab"; } if (document.getElementById("ctl00_contentMain_ctl00_hdnFlightMode")) { document.getElementById("ctl00_contentMain_ctl00_hdnFlightMode").value = "D"; } document.getElementById("hdnDisabledDate").value = document.getElementById("ctl00_contentMain_ctl00_hdnDisabledDateDom").value; } else if(mode=="FlightMultiCity") { //document.getElementById("hdnDisabledDate").value = document.getElementById("ctl00_contentMain_ctl00_hdnDisabledDateInt").value; } document.getElementById("ctl00_contentMain_ctl00_"+mode).style.display = "block"; } function FlightModeToggle(mode) { if (mode == "FlightIntl") { document.getElementById("hdnDisabledDate").value = document.getElementById("ctl00_contentMain_ctl00_hdnDisabledDateInt").value; } else if (mode == "FlightDom") { document.getElementById("hdnDisabledDate").value = document.getElementById("ctl00_contentMain_ctl00_hdnDisabledDateDom").value; } } /******** CALENDAR SPECIFIC *************/ /****************************************/ // No. of millisecs in a single day. var DAY = 24 * 60 * 60 * 1000; // Function disables ALL dates before the current date in the Calendar. The parameter represents each date rendered by the calendar. function DisableDates(theDate, calendarType) { var disabledDiff; if (calendarType == "dom") { var hdn = getElement("hdnDisabledDateDom", true); if (hdn) disabledDiff = hdn.value; } else if (calendarType == "int") { var hdn = getElement("hdnDisabledDateInt", true); if (hdn) disabledDiff = hdn.value; } else { var hdn = getElement("hdnDisabledDate", true); if (hdn) disabledDiff = hdn.value; if(document.getElementById("ctl00_contentMain_Modify_hdnDisabledDate")) { disabledDiff = document.getElementById("ctl00_contentMain_Modify_hdnDisabledDate").value } } var today = new Date(); today.setDate(today.getDate() + parseInt(disabledDiff) + 1); var currTime = Math.abs(today.getTime()); var theTime = Math.abs(theDate.getTime()); if ((currTime - theTime) / DAY >= 1) return true; else return false; } function GetYear(type) { var today = new Date(); var thisYear = today.getFullYear(); if (type == "curr") return thisYear; else if (type == "next") return (thisYear + 1); } function setupCalendar(txtFieldName, imgFieldName, calType) { var txtField = getElementName(txtFieldName, true); Calendar.setup({inputField:txtField, button:imgFieldName, range:[GetYear("curr"), GetYear("next")], calendarType:calType}); } function setupModifyCalendar(txtField, imgFieldName, calType) { Calendar.setup({inputField:txtField, button:imgFieldName, range:[GetYear("curr"), GetYear("next")], calendarType:calType}); } /******** ELEMENT RETRIEVAL *************/ /****************************************/ // Function returns an ELEMENT, when supplied the id and a boolean indicating whether the element is contained in a UserControl. // contentMain is the name of the Content container defined in the Master page. // This function assumes the default separator "$". function getElement(elName, prefixCtrlName) { var elName = getElemName(elName, prefixCtrlName, "_"); var chkVar = new DOM().$(elName); if (chkVar == null) { elName = elName.replace(/[\$]/g,'_'); } return new DOM().$(elName); } // Function returns an Element Name, when supplied the id and a boolean indicating whether the element is contained in a UserControl. // contentMain is the name of the Content container defined in the Master page. function getElementName(elName, prefixCtrl) { var prefix = "ctl00$contentMain$"; if(prefixCtrl==true) { prefix += "ctl00$"; } elName = prefix + elName; return elName; } function getElemName(elName, prefixCtrlName, separator) { if (separator == undefined) separator = "_"; if (prefixCtrlName == undefined) prefixCtrlName = ""; if(prefixCtrlName=="") { prefixCtrlName="" } else { prefixCtrlName+="_" } var prefix = "ctl00" + separator + "contentMain" + separator; elName = prefix + prefixCtrlName + elName; // Modify the elName to the ID if this is Mozilla. if (bType != "ie") { elName = elName.replace(/[\$]/g,'_'); } return elName; } function getElementWithSeparator(elName, prefixCtrl, ctrlName, separator) { var prefix = "ctl00" + separator + "contentMain" + separator; if(prefixCtrl==true) { prefix = prefix + ctrlName + separator; } // elName = prefix + elName; var chkVar = new DOM().$(elName); if (chkVar == null) { elName = elName.replace(/[\$]/g,'_'); } return new DOM().$(elName); //return document.getElementById(elName); } function getDDLNameWithSeparator(elName, prefixCtrl, ctrlName, separator) { var prefix = "ctl00" + separator + "contentMain" + separator; if(prefixCtrl==true) { prefix = prefix + ctrlName + separator; } // elName = prefix + elName; return elName; } function getElementNameWithSeparator(elName, prefixCtrl, separator) { var prefix = "ctl00" + separator + "contentMain" + separator; if(prefixCtrl==true) { prefix += "ctl00" + separator; } // elName = prefix + elName; return elName; } function getElementShortName(elFullName, separator) { var elName; var idx = elFullName.lastIndexOf(separator); if (idx != -1) { elName = elFullName.slice(idx + 1); } return elName; } /******** CALENDAR DATE VALIDATION ********/ /****************************************/ // Function validates the date set for a particular calendar by comparing it with the date set for the paired field. // This function is called by the onSelect event of the Calendar. function checkDate(calendar, selDate) { if (calendar.dateClicked) { // Get the date set by the current field. var thisDate = calendar.date; // Get name of input field attached to this Calendar. var thisField = calendar.params.inputField; var thisFieldName = thisField.id; // Get name of other input field related to this one. // Create an object variable so that it can be passed ByRef var thisFieldNameIsPrevious = new Object(); var otherField = getOtherField(thisFieldName, thisFieldNameIsPrevious); // Get the value in the other field. var otherValue = otherField.value; var otherDefaultValue = otherField.defaultValue; // If the otherField has been set OR is not blank OR is not equal to the selected date in the Calendar. if (!((otherValue == otherDefaultValue) || (otherValue == "") || (otherValue == selDate))) { // Convert the value (dd-mmm-yyyy) to an acceptable date object. var du = new DateUtils(); var otherDate = du.convertStringToDate(otherValue, "-"); if (thisFieldNameIsPrevious.value == false) { // This field should have a date later than the other field. if (thisDate > otherDate) { thisField.value = selDate; } else { alert("~Translate~(Commons_ArrivalbeforeDepr)");//The Arrival date cannot be before the Departure date. // Set field to present date. thisField.value = otherValue; } } else { // This field should have a date earlier than the other field. if (thisDate < otherDate) { thisField.value = selDate; } else { alert("~Translate~(Commons_DeprAftrArrival)");//The Departure date cannot be after the Arrival date. // Set field to present date. thisField.value = otherValue; } } if (calendar.dateClicked) calendar.callCloseHandler(); } else // If the other is blank, simply set the Date. thisField.value = selDate; if (calendar.dateClicked) calendar.callCloseHandler(); } } // Returns the paired text field as well as the order of succession, when passed a field Name. function getOtherField(thisField, thisFieldIsPrevious) { var otherFieldName; thisField = getElementShortName(thisField, "_"); switch(thisField) { case "txtFLDepDate": otherFieldName = "txtFLRetDate"; thisFieldIsPrevious.value = true; break; case "txtFLRetDate": otherFieldName = "txtFLDepDate"; thisFieldIsPrevious.value = false; break; case "txtFLDDepDate": otherFieldName = "txtFLDRetDate"; thisFieldIsPrevious.value = true; break; case "txtFLDRetDate": otherFieldName = "txtFLDDepDate"; thisFieldIsPrevious.value = false; break; case "txtHTCheckIn": otherFieldName = "txtHTCheckOut"; thisFieldIsPrevious.value = true; break; case "txtHTCheckOut": otherFieldName = "txtHTCheckIn"; thisFieldIsPrevious.value = false; break; case "txtCRPickupDate": otherFieldName = "txtCRDropDate"; thisFieldIsPrevious.value = true; break; case "txtCRDropDate": otherFieldName = "txtCRPickupDate"; thisFieldIsPrevious.value = false; break; case "txtINDepartDate": otherFieldName = "txtINRetDate"; thisFieldIsPrevious.value = true; break; case "txtINRetDate": otherFieldName = "txtINDepartDate"; thisFieldIsPrevious.value = false; break; } var otherField if (document.getElementById("ctl00_contentMain_Modify_hndModifyCal") != null) { otherField = "ctl00$contentMain$Modify$" + otherFieldName } else { otherField = getElement(otherFieldName, true); } return otherField; } /******** DATE UTILITY CLASS *************/ /*********************************************/ function DateUtils() { // Function converts a string in any format, separated by a specified symbol, into a Date object and returns that Date object. this.convertStringToDate = function(strDate, dateSeparator) { var dateParts = strDate.split(dateSeparator); var day = parseInt(dateParts[0], 10); var month = this.getMonthNum(dateParts[1]); var year = parseInt(dateParts[2]); var theDate = new Date(year, month, day); return theDate; } // Function converts a date object into a string in the format ddMMMyyyy and returns that string. this.convertDateToString = function(thisDate, dateSeparator) { var day = thisDate.getDate(); var month = this.getMonthName(thisDate.getMonth()); var year = thisDate.GetYear(); var theDateString = day + dateSeparator + month + dateSeparator + year; return theDateString; } //capitaliseFirstLetter of string this.capitaliseFirstLetter= function(string) { string=string.toLowerCase(); return string.charAt(0).toUpperCase() + string.slice(1); } // Utility function used by convertDateToString(). Returns Month name in "MMM" format. this.getMonthName = function(monthNum) { switch (monthNum) { case 0: return "Jan"; break; case 1: return "Feb"; break; case 2: return "Mar"; break; case 3: return "Apr"; break; case 4: return "May"; break; case 5: return "Jun"; break; case 6: return "Jul"; break; case 7: return "Aug"; break; case 8: return "Sep"; break; case 9: return "Oct"; break; case 10: return "Nov"; break; case 11: return "Dec"; break; } } // Utility function used by convertStringToDate(). Returns Month number(base 0) when supplied a month name in "MMM" format. this.getMonthNum = function(monthName) { switch (monthName) { case "Jan": return 0; break; case "Feb": return 1; break; case "Mar": return 2; break; case "Apr": return 3; break; case "May": return 4; break; case "Jun": return 5; break; case "Jul": return 6; break; case "Aug": return 7; break; case "Sep": return 8; break; case "Oct": return 9; break; case "Nov": return 10; break; case "Dec": return 11; break; } } /////////////////////////todisply in dd/mm/yyyy fromat/////////////// // Utility function used by convertStringToDate(). Returns Month number(base 0) when supplied a month name in "MMM" format. this.getMonthNumNew = function(monthName) { switch (monthName) { case "Jan": return "01"; break; case "Feb": return "02"; break; case "Mar": return "03"; break; case "Apr": return "04"; break; case "May": return "05"; break; case "Jun": return "06"; break; case "Jul": return "07"; break; case "Aug": return "08"; break; case "Sep": return "09"; break; case "Oct": return "10"; break; case "Nov": return "11"; break; case "Dec": return "12"; break; } } // Get Day of Week using a Date in format ddMMyy. this.getDayOfWeek = function(strDate) { var day = strDate.substring(0, 2); var month = parseInt(strDate.substring(2, 4),10) - 1; var year = "20" + strDate.substring(4, 6); var theDate = new Date(year, month, day); return theDate.getDay(); } // Adds a date to a date in ddMMyy format and returns the new date in same format. this.AddDate = function(startDate, dateDiff) { var startDay = startDate.substring(0, 2); var startMonth = parseInt(startDate.substring(2, 4)) - 1; var startYear = "20" + startDate.substring(4, 6); var newDate = new Date(startYear, startMonth, startDay); newDate.setDate(newDate.getDate() + dateDiff); var newDay = newDate.getDate(); newDay = newDay.toString().length < 2 ? "0" + newDay : newDay; var newMonth = newDate.getMonth(); newMonth = newMonth.toString().length < 2 ? "0" + (newMonth + 1) : newMonth + 1; var newYear = newDate.getFullYear().toString(); newYear = newYear.substring(2); var nd = newDay.toString() + newMonth.toString() + newYear.toString(); return nd; } } /*********** WEB SERVICE UTILITY FUNCTIONS **********/ /****************************************************/ // Set the service URL's before page loads. //fnSetServiceURL(); function fnSetServiceURL() { xmlHttp = new GetXmlHttpObject(); if (xmlHttp) { var webServiceURL; var httpMethod = "GET"; webServiceURL="GetServiceName.aspx" xmlHttp.onreadystatechange = fnServiceResponseHandler; xmlHttp.open("GET", webServiceURL, true); //xmlHttp.send(null); } } function fnServiceResponseHandler() { if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') { if (xmlHttp.status == 200) { var strReply=(xmlHttp.responseText).split("||~~||") //BE_Service=strReply[0] //XChangeOnlineService=strReply[1] //mainService=strReply[2] } } } function openfarerules(event,fareref,airlinesno,currCode,ROE) { if (document .getElementById("divFareBreakup").style.display="block") { document .getElementById("divFareBreakup").style.display="none"; } document .getElementById ('image_').style.display=""; var hdnFareRuleRedirect = (dom.$("ctl00$contentMain$Basket1$hdnFareRuleRedirect") != null ? dom.$("ctl00$contentMain$Basket1$hdnFareRuleRedirect") : dom.$("ctl00$contentMain$hdnFareRuleRedirect")); var x=0; var y=0; var bType = new BrowserSniffer().GetBrowserType(); if (bType == "ie") { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } else { x = event.pageX; y = event.pageY; } if ((ObjectExists(hdnFareRuleRedirect)) && (hdnFareRuleRedirect.value == "True")) { if(airlinesno.indexOf("SGP") != -1) { window.open("http://www.spicejet.com/tnc.asp","FareRules","width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if(airlinesno.indexOf("SSP") != -1) { window.open("http://www.spicejet.com/tnc.asp","FareRules","width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if (airlinesno.indexOf("SCP") != -1) { window.open("http://www.spicejet.com/tnc.asp", "FareRules", "width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if(airlinesno.indexOf("DNP") != -1) { window.open("http://airdeccan.net/data/helpdesk/terms_cons.html","FareRules","width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if(airlinesno.indexOf("INP") != -1) { window.open("http://book.goindigo.in/skylights/images/html/COC.html","FareRules","width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if(airlinesno.indexOf("ISP") != -1) { window.open("http://book.goindigo.in/skylights/images/html/COC.html","FareRules","width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else if(airlinesno.indexOf("GSP") != -1) { path = "GoAir_TC.html?airlinesno=" + airlinesno + "&fareref=" + fareref + "&CurrCode=" + currCode + "&ROE=" + ROE; } else if(airlinesno.indexOf("IXP") != -1) { window.open("http://www.airindiaexpress.in/Terms.htm", "FareRules", "width=800,height=400,top=50,left=60,scrollbars=yes,resizable=no"); } else { path="FareRules.aspx?airlinesno=" + airlinesno + "&fareref=" + fareref + "&CurrCode=" + currCode + "&ROE=" + ROE; open_farerule_url(path,x,y) } } else { path="FareRules.aspx?airlinesno=" + airlinesno + "&fareref=" + fareref + "&CurrCode=" + currCode + "&ROE=" + ROE; open_farerule_url(path,x,y) } } function GetDimensions(div) { w = 0; h = 0; if(typeof(div.innerWidth) == 'number') { //Non-IE w = div.innerWidth; h = div.innerHeight; } else { //IE versions // alert("elsepart") w = div.clientWidth; h = div.clientHeight; } return {"Width": w, "Height": h}; } function changeSAMarkup(fareref,airlinesno) { path="updSAMarkup.aspx?fareref="+fareref+"&airlinesno=" + airlinesno window.open(path,"UpdateSAMarkup","width=570,height=275,top=50,left=120,scrollbars=yes,resizable=no,toolbar=no,menubar=no,titlebar=no"); } function open_farerule_url(geturl,x,y) { var fareRuleDiv = document.getElementById("dvFarerule"); fareRuleDiv .style.display="block"; var iframe = document.getElementById("ifrmFareRules"); var divDimension = GetDimensions(fareRuleDiv); x =(x+40) - divDimension.Width; y =y+10; if (ObjectExists(fareRuleDiv)) { fareRuleDiv.style.top =y +'px'; fareRuleDiv.style.left =x +'px'; } else { alert("Fare rule div not found."); } var path="http://"+window .location .host+"/"+"OnlineX/ASPX/"+geturl ; iframe .setAttribute ("src",path ); if (navigator.userAgent.indexOf("MSIE") > -1 && !window.opera) { iframe.onreadystatechange = function() { if (iframe.readyState == "complete") { document .getElementById ('image_').style.display="none"; } }; } else { iframe.onload = function() { //alert("sanjai kumar") //$('#image_').hide(); document .getElementById ('image_').style.display="none"; }; } } function open_fareBreakup_url(geturl,x,y) { var fareBreakupDiv = document.getElementById("divFareBreakup"); fareBreakupDiv .style.display="block"; var iframe = document.getElementById("ifrmFareBreakup"); var divDimension = GetDimensions(fareBreakupDiv); x =(x+40) - divDimension.Width; y =y+10; if (ObjectExists(fareBreakupDiv)) { fareBreakupDiv.style.top =y +'px'; fareBreakupDiv.style.left =x +'px'; } else { alert("Fare Breakup div not found."); } var path="http://"+window .location .host+"/"+"OnlineX/ASPX/"+geturl ; iframe .setAttribute ("src",path ); if (navigator.userAgent.indexOf("MSIE") > -1 && !window.opera) { iframe.onreadystatechange = function() { if (iframe.readyState == "complete") { document .getElementById ('image_fareBreakup').style.display="none"; } }; } else { iframe.onload = function() { document .getElementById ('image_fareBreakup').style.display="none"; }; } } //function CloseDV_Breakup() //{ //document .getElementById ('divFareBreakup').style.display="none"; //} //function CloseDVfare() //{ //document .getElementById ('dvFarerule').style.display="none"; //} function PositionLayers_fare(shadowLayer, msgLayer) { var divWidth = 400; var divHeight = 350; //var divWidth = 200; //var divHeight = 175; // Get Inner height and width. var dimension = GetInnerDimensions(); var h = dimension.Height; var w = dimension.Width; // Shadow layer needs to cover entire area. shadowLayer.style.width = w + "px"; shadowLayer.style.height = h + "px"; // Get Scroll offset. var scrollY = GetVerticalScrollPosition(); var left = (w - divWidth) * 0.5; var top = ((h - divHeight) * 0.5); // Message layer needs to be centered. msgLayer.style.left = left + "px"; msgLayer.style.top = top + "px"; } function openfareBreakup(fareref,airlinesno) { if (document .getElementById("dvFarerule").style.display="block") { document .getElementById("dvFarerule").style.display="none"; } document .getElementById ('image_fareBreakup').style.display=""; var x=0; var y=0; var bType = new BrowserSniffer().GetBrowserType(); if (bType == "ie") { x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } else { x = event.pageX; y = event.pageY; } if(window.location.href.toLowerCase().indexOf("flightresult.aspx")>0) { path="FareBreakup.aspx?fareref="+fareref+"&airlinesno=" + airlinesno +"&FlagSafiAPC=False" } else { path="FareBreakup.aspx?fareref="+fareref+"&airlinesno=" + airlinesno +"&FlagSafiAPC=True" } open_fareBreakup_url(path,x,y) } function openDynamicSearchfareBreakup(fareref,airlinesno) { path="DynamicSearchfarebreakup.aspx?fareref="+fareref+"&airlinesno=" + airlinesno window.open(path,"FareBreakup","width=575,height=575,top=50,left=120,scrollbars=yes,resizable=no"); } function openTermsConditions() { window.open("TermsConditions.aspx","TermsConditions","width=550,height=400,top=50,left=120,scrollbars=yes,resizable=no"); if (document.getElementById("ctl00_contentMain_chkTerms")) { document.getElementById("ctl00_contentMain_chkTerms").disabled = false; document.getElementById("ctl00_contentMain_chkTerms").checked = true; } } function fnPrintEticket(BookingRef,FlightId,WebServiceurl,compID) { var tempxml=''+ BookingRef+''+compID+''+FlightId+''; var webUrl=WebServiceurl+ "ETICKET/ETICKET.ASMX/fnEticket?tempxml="+ tempxml; xmlHttp = new GetXmlHttpObject(); xmlHttp.open("GET", webUrl, true) xmlHttp.onreadystatechange = fnFetchResult; xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlHttp.send(null) } function fnFetchResult() { if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') { if (xmlHttp.status == 200) { var xmlResult=new ActiveXObject("Msxml2.DOMDocument") var strResult = xmlHttp.responseXML.text; xmlResult.loadXML(strResult); var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslProc; var htmlResult; var xsltPassengerResult = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); xsltPassengerResult.async = false; xsltPassengerResult.resolveExternals = false; xsltPassengerResult.load("../XSLT/EticketXSL1.xsl"); xslt.stylesheet = xsltPassengerResult; xslProc = xslt.createProcessor(); xslProc.input = xmlResult; xslProc.transform(); htmlResult=xslProc.output; var win= window.open('ETicket.aspx','eTicket','width=800,height=800,top=10,left=50,scrollbars=yes,resizable=no'); win.document.write(htmlResult); win.document.close(); win.print(); } } } function replaceSeparator(strInput) { var hdnDecSeparator = document.getElementById("ctl00_hdnDecSeparator").value; var hdnTextSeparator = document.getElementById("ctl00_hdnTextSeparator").value; var textSeparator = ""; var spaceCharactor=/\s/g; if(hdnTextSeparator == ",") textSeparator = /\,/g; ///[^\d,]/g; else if(hdnTextSeparator == "\u00A0") textSeparator = /\u00A0/g; else textSeparator = /\./g; return strInput.replace(spaceCharactor,'').replace(textSeparator,'').replace(/ /g,"").replace(hdnDecSeparator,'.'); } /******** LAYER FUNCTIONS *************/ /****************************************/ function ToggleLayer(hide) { var dom = new DOM(); var shadow = dom.$("Shadow"); var msg = dom.$("Message"); var results = dom.$("tblResults"); PositionLayers(shadow, msg); if (hide == true) { shadow.style.display = "block"; msg.style.display = "block"; //results.style.display = "none"; } else { shadow.style.display = "none"; msg.style.display = "none"; //results.style.display = "block"; } } function PositionLayers(shadowLayer, msgLayer) { var divWidth = 400; var divHeight = 350; //var divWidth = 200; //var divHeight = 175; // Get Inner height and width. var dimension = GetInnerDimensions(); var h = dimension.Height; var w = dimension.Width; // Shadow layer needs to cover entire area. shadowLayer.style.width = w + "px"; shadowLayer.style.height = h + "px"; // Get Scroll offset. var scrollY = GetVerticalScrollPosition(); var left = (w - divWidth) * 0.5; var top = ((h - divHeight) * 0.5); // Message layer needs to be centered. msgLayer.style.left = left + "px"; msgLayer.style.top = top + "px"; } function GetInnerDimensions() { w = 0; h = 0; if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { //IE 6+ in 'standards compliant mode' w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE 4 compatible w = document.body.clientWidth; h = document.body.clientHeight; } else if(typeof(window.innerWidth) == 'number') { //Non-IE w = window.innerWidth; h = window.innerHeight; } return {"Width": w, "Height": h}; } function GetVerticalScrollPosition() { var scrollY = 0; if(typeof(window.pageYOffset) == 'number') { //Netscape compliant scrollY = window.pageYOffset; } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) { //DOM compliant scrollY = document.body.scrollTop; } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { //IE6 standards compliant mode scrollY = document.documentElement.scrollTop; } return scrollY; } function chkSpecialFare_no() { var trLCC = document.getElementById('trLCCRT'); var chkLCC = document.getElementById('ctl00_contentMain_ModifyFlightSearch1_chkLCCRT'); if (ObjectExists(trLCC)) { chkLCC.checked = false ; } } function closeShoppingDiv(t) { if(t=="AIRBrk") { document.getElementById('divFareBreakup').style.display="none"; } else if(t=="AIRFare") { document.getElementById('dvFarerule').style.display="none"; } else if(t=="HHLCPly") { document.getElementById('divCancellationPolicy').style.display="none"; } else if(t=="HHLBrk") { document.getElementById('HoteldivFareBreakup').style.display="none"; } //ToggleLayer(false); } function GetJSResourcePath(jsFileName) { var langCode=$("#ctl00_hdnLingoCode").val(); var compCode=$("#ctl00_hndCompCode").val(); var langCode; var path = "../Resources/" + compCode + "/" + langCode + "/" + jsFileName + ".xml"; return path; } function getGoogleMapPath(address) { var path="http://maps.googleapis.com/maps/api/geocode/xml?address="+ address +"&sensor=true"; return path; } function GetXmlHttpObject() { var ajax=null; try { // Firefox, Opera 8.0+, Safari ajax=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { ajax=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { ajax=new ActiveXObject("Microsoft.XMLHTTP"); } } return ajax; } function fnOnerror(errImg,errId) { if (typeof errImg == "undefined") { errImg = "img"; } var y = document.getElementById(errImg+errId); if(y != null) { y.src="../Images/imgna.jpg"; } } function getDate12hrFormat(dateVal) { var lhours = dateVal.substring(0, 2)//Math.floor(dateVal / 60); var lminutes = dateVal.substring(2, 4)//dateVal - (lhours * 60); if(String(lhours).length == 1){ lhours = '0' + lhours}; if(String(lminutes).length == 1) {lminutes = '0' + lminutes}; var lFormat="am"; if(lhours>=12){ if(lminutes>0){ lFormat="pm" lhours=lhours-12 } } if(lhours==0) { lhours=12 } return lhours +':'+ lminutes + " " + lFormat ; } function htlPreloaderToggleLayer(hide) { var dom = new DOM(); var Main = dom.$("page_preloader"); if (hide == true) { Main.style.display = "block"; } else { Main.style.display = "none"; } } function HtlToggleLayer(hide) { var dom = new DOM(); var results = dom.$("HtlFilterloader"); if (hide == true) { results.style.display = "block"; } else { results.style.display = "none"; } } function ShowhideDiv(id) { var dom = new DOM(); var hideShowDiv = dom.$(id); if(hideShowDiv.style.display=="block"||hideShowDiv.style.display=="") { hideShowDiv.style.display="none"; } else if(hideShowDiv.style.display=="none") { hideShowDiv.style.display="block"; } } if (typeof String.prototype.startsWith != 'function') { String.prototype.startsWith = function (str){ return this.indexOf(str) == 0; }; } if (typeof String.prototype.endsWith != 'function') { String.prototype.endsWith = function (str){ return this.slice(-str.length) == str; }; } if (typeof String.prototype.trim != 'function') { String.prototype.trim = function () { return this.replace(/^\s+/, '').replace(/\s+$/, '').replace(" ", ""); }; } String.prototype.killWhiteSpace = function() { return this.replace(/\s/g, ''); }; function countstar(str) { var count = 0; for (_j = 1; _j <= str.length; _j++) { if (str.charAt(_j) == "*") { count ++; } } return count + 1; } function trim(s) { return s.replace(/^\s+|\s+$/g,""); } function windowOpen(pageToOpen) { var uid= getElement("hdnHtlScriptstrUid").value; var path; if (pageToOpen=="Home") { path="../aspx/Home.aspx?uid=" +uid; } else if(pageToOpen=="IndexHotel") { path="../aspx/IndexHotel.aspx?uid=" +uid; } else { path="../Hotel.aspx"; } window.parent.location.href=path } function DynamicWinOpen(pageToOpen) { var uid= getElement("hdndynstrUid").value; var path; if (pageToOpen=="Home") { path="../aspx/Home.aspx?uid=" +uid; } else if(pageToOpen=="IndexDynamic") { path="../aspx/IndexDynamic.aspx?uid=" +uid; } else { path="../IndexDynamic.aspx"; } window.parent.location.href=path } function hasClass(ele,cls) { return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function removeClass(ele,cls) { if (hasClass(ele,cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); ele.className=ele.className.replace(reg,' '); } } function addClass(ele,cls) { if (!hasClass(ele,cls)) ele.className += " "+cls; } function SetDefaultCheck() { var RowCount=$("#ctl00_contentMain_chargesDelOnly_hdnrowNum").val(); for (var i = 0; i <= parseInt(RowCount); i++) { if(document.getElementById("ctl00_contentMain_chargesDelOnly_optDel"+i).checked==true) { document.getElementById("ctl00_contentMain_chargesDelOnly_hdnselectedInputId").value="optDel"+i; } } var getSelectedid=$("#ctl00_contentMain_chargesDelOnly_hdnselectedInputId").val(); for (var i = 0; i <= parseInt(RowCount); i++) { document.getElementById("ctl00_contentMain_chargesDelOnly_optDel"+i).checked= false; } document.getElementById("ctl00_contentMain_chargesDelOnly_"+getSelectedid).checked= true; }