var domainurl = "https://www.veenaworld.com";
var xu = new XML();
var ajaxAutocompleteResX;
var xmlAjaxHttp;
xmlAjaxHttp = new GetXmlHttpObject();
var currProduct;
var contentHandler = new TagFinder(null);
var dom = new DOM();
var xu = new XML();
var first = "true";
var txtenquiry;
function TagFinder(divTag) {
var divTag;
var txtTag;
var selSpanTag;
return divTag;
}
function u2dp(s) {
ret = '';
for (i = 0; i < s.length; i++) {
charCode = s.charCodeAt(i);
if ((charCode <= 127) && (charCode != 34) && (charCode != 38) &&
(charCode != 60) && (charCode != 62))
ret += s.charAt(i);
else
ret += '' + charCode + ';';
}
return ret;
}
function AjaxDDL(e, strProduct) {
//debugger;
xu = new XML();
if (contentHandler.divTag) {
var strCompCode, strLangCode;
var currValue = contentHandler.txtTag.value;
currValue = currValue.replace(/ /g, '');
currValue = u2dp(currValue);
var strQryXML;
currProduct = strProduct;
if ((currValue.length >= 3) && (currValue != "undefined")) {
if (DivKeyHandler(e) == true) {
xmlHttp = new Ajax().GetXmlHttpObject();
if (xmlHttp) {
if (strProduct == "PKG") {
strProduct = "HHL";
}
else
domainurl = "https://www.veenaworld.com";
var mainService = domainurl + "/Online3s/Services/MainService.asmx";
if (!(mainService == "") || (mainService == "undefined")) {
strCompCode = $("#HdncompanyCode").val();
strLangCode = $("#Hdnlanguage").val();
strQryXML = escape("
" + cityInfo + "
"; }); } else if (currProduct == "HHL") { $.each(JsonObj, function(keyIdx, value) { var cityInfo = value.CityName; if (value.CountryName != "" || value.CityCode != "") { cityInfo += ", " + value.CountryName + " (" + value.CityCode + ")"; clickAction = "Suggest(this)"; } else clickAction = "void(0);" suggest += '" + cityInfo + "
"; }); } else if (currProduct == "CCty") { $.each(JsonObj, function(keyIdx, value) { var cityInfo = value.CityName; if (value.CountryName != "" || value.CityCode != "") { clickAction = "Suggest(this)"; } else clickAction = "void(0);" suggest += '" + cityInfo + "
"; }); } divTag.innerHTML += suggest; var frameHeight = str.length * 18; var myFrame = dom.$("myFrame"); if (myFrame != null) { myFrame.style.height = frameHeight + "px"; myFrame.style.display = "block"; if ((navigator.userAgent.indexOf("Opera") > -1) && (first == "true")) { myFrame.style.top = (parseInt(myFrame.offsetTop) + 10) + "px"; divTag.style.top = (parseInt(divTag.offsetTop) + 10) + "px"; first = "false"; } if (new BrowserSniffer().GetBrowserType() == "ie") { divTag.style.height = frameHeight + "px"; } } var modifyFrame1 = dom.$("modifyFrame1"); if (modifyFrame1 != null) { modifyFrame1.style.height = frameHeight + "px"; modifyFrame1.style.display = "block"; } var myFlightFrame = dom.$("myFlightFrame"); if (myFlightFrame != null) { frameHeight = str.length * 19.2; if (divTag.id == "divFLDepart") { myFlightFrame.style.top = "180"; } else if (divTag.id == "divFLArrival") { myFlightFrame.style.top = "180"; } myFlightFrame.style.height = frameHeight + "px"; myFlightFrame.style.display = "block"; } if ((myFlightFrame == null) && (modifyFrame1 == null) && (myFrame == null)) { if ((navigator.userAgent.indexOf("Opera") > -1) && (first == "true")) { divTag.style.top = (parseInt(divTag.offsetTop) + 10) + "px"; first = "false"; } } if (i > 0) { ShowHideDiv(true); spanNum = -1; ScrollSpan("down"); contentHandler.txtTag.focus(); } } } else { divTag.innerHTML = 'No Result Found
' // divTag.innerHTML = xu.SelectNodeValue(ajaxAutocompleteResX, "data[@name='AjaxAutoCompl_ErrOccurred']/value"); ShowHideDiv(true); } } } catch (e) { divTag.innerHTML = 'No Result Found
' //divTag.innerHTML = xu.SelectNodeValue(ajaxAutocompleteResX, "data[@name='AjaxAutoCompl_ErrOccurred']/value"); ShowHideDiv(true); } } function KeyHandler(e, divTag, txtTag) { divTag = document.getElementById(divTag); var evt = (window.event) ? event : e; if (!evt) evt = window.event; var keyCode = evt.keyCode; var ENTER = 13; var UP = 38; var DOWN = 40; var TAB = 9; var SHIFT = 16; contentHandler.divTag = divTag; contentHandler.txtTag = txtTag; var currValue = contentHandler.txtTag.value; switch (keyCode) { case ENTER: return false; break; case UP: return false; break; case DOWN: return false; break; case TAB: if (IsDivHidden() == true) { if ((currValue.length < 3) && (currValue.length > 0)) return false; else return true; } else { Suggest(contentHandler.selSpanTag); ShowHideDiv(false); return true; } break; case SHIFT: return false; break; default: return true; break; } } function DivKeyHandler(e) { var evt = (window.event) ? event : e; if (!evt) evt = window.event; var keyCode = evt.keyCode; var BKSPC = 8; var TAB = 9; var ALT = 18; var UP = 38; var DOWN = 40; var LEFT = 37; var RIGHT = 39; var ENTER = 13; var SHIFT = 16; var ESC = 27; var HOME = 36; var END = 35; var SHIFT = 16 var CTRL = 17; var LEFTARROW = 37; var UPARROW = 38; var RIGHTARROW = 39; var DOWNARROW = 40; var currValue = contentHandler.txtTag.value; //Return value will determine if fresh request to WS is to be sent. // False - No request // True - Send request (refresh) switch (keyCode) { case HOME: case END: case SHIFT: case CTRL: case LEFTARROW: case RIGHTARROW: ShowHideDiv(false); return false; break; case BKSPC: return true; break; case TAB: ShowHideDiv(false); return false; break; case UP: ScrollSpan("up"); return false; break; case DOWN: ScrollSpan("down"); return false; break; case ENTER: Suggest(contentHandler.selSpanTag); ShowHideDiv(false); return false; break; case ESC: ShowHideDiv(false); return false; break; default: return true; break; } } function ShowHideDiv(show) { var tag = contentHandler.divTag; var bType = new BrowserSniffer().GetBrowserType(); // Only Show/Hide if not already Shown/Hidden respectively. if (bType == "ns") // NS { if (tag.style.display == "show" || tag.style.display == "block") { if (show == false) { tag.style.display = "none"; var myFrame = dom.$("myFrame"); if (myFrame != null) { myFrame.style.display = "none"; } var myFlightFrame = dom.$("myFlightFrame"); if (myFlightFrame != null) { myFlightFrame.style.display = "none"; } if (dom.$("modifyFrame") != null) { dom.$("modifyFrame").style.display = "none"; } if (dom.$("modifyFrame1") != null) { dom.$("modifyFrame").style.display = "none"; } } } else { // if tag.visibility == "hide" if (show == true) { tag.display = "show"; var myFrame = dom.$("myFrame"); if (myFrame != null) { myFrame.style.display = "block"; } var myFlightFrame = dom.$("myFlightFrame"); if (myFlightFrame != null) { myFlightFrame.style.display = "block"; } if (dom.$("modifyFrame") != null) { dom.$("modifyFrame").style.display = "block"; } if (dom.$("modifyFrame1") != null) { dom.$("modifyFrame1").style.display = "block"; } } } } else { // IE or FF if (tag.style.display == "block") { if (show == false) { tag.style.display = "none"; var myFrame = dom.$("myFrame"); if (myFrame != null) { myFrame.style.display = "none"; } var myFlightFrame = dom.$("myFlightFrame") if (myFlightFrame != null) { myFlightFrame.style.display = "none"; } if (dom.$("modifyFrame") != null) { dom.$("modifyFrame").style.display = "none"; } if (dom.$("modifyFrame1") != null) { dom.$("modifyFrame1").style.display = "none"; } } } else { // if tag.style.visibility == "hidden" if (show == true) { // Filters disabled upon request of Faraz. // tag.style.filter = "progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.0,wipestyle=1,motion=forward)"; // tag.filters(0).Apply(); // tag.filters(0).Play(); tag.style.display = "block"; var myFrame = dom.$("myFrame"); if (myFrame != null) { myFrame.style.display = "block"; } var myFlightFrame = dom.$("myFlightFrame") if (myFlightFrame != null) { myFlightFrame.style.display = "block"; } if (dom.$("modifyFrame") != null) { dom.$("modifyFrame").style.display = "block"; } if (dom.$("modifyFrame1") != null) { dom.$("modifyFrame1").style.display = "block"; } } } } } function IsDivHidden() { var divTag = contentHandler.divTag; if (document.layers) { if (divTag.style.display == "show") return false; else return true; } else { if (divTag.style.display == "block") return false; else return true; } } function SuggestOver(tag) { tag.className = "highlight"; } function SuggestOut(tag) { tag.className = "normalS"; } function Suggest(tag) { if (tag != "undefined") { var value; var bType = new BrowserSniffer().GetBrowserType(); if (bType == "ie") value = tag.innerText; else value = tag.textContent; var txtTag = contentHandler.txtTag; var divTag = contentHandler.divTag; txtTag.value = value; var CountryCode = $(tag).attr("countrycode") if (txtTag.id == "txtFlightFromDynamic") { if (dom.$("HdndynamicdeparturecntryCode") != null) { dom.$("HdndynamicdeparturecntryCode").value = CountryCode } } if (txtTag.id == "txtFlightToDynamic") { if (dom.$("HdndynamicarrivalcntryCode") != null) { dom.$("HdndynamicarrivalcntryCode").value = CountryCode } } if (txtTag.id == "fromcityAc") { if (dom.$("HdnDepCountryCode") != null) { dom.$("HdnDepCountryCode").value = CountryCode } } if (txtTag.id == "tocityAc") { if (dom.$("HdnArrCountryCode") != null) { dom.$("HdnArrCountryCode").value = CountryCode } } ShowHideDiv(false); } } var spanNum = -1; var spanCount = 0; function ScrollSpan(direction) { spanCount = contentHandler.divTag.childNodes.length if (direction == "down") { if (spanNum < spanCount - 1) spanNum += 1; else spanNum = 0; SetColor(spanNum); } else { if (spanNum == 0) spanNum = spanCount - 1; else spanNum -= 1; SetColor(spanNum); } } function SetColor(spanNo) { // Turn off highlight for all items. for (i = 0; i < spanCount; i++) { if (contentHandler.divTag.childNodes[i].className == "highlight") contentHandler.divTag.childNodes[i].className = "normalS"; } // Turn on highlight for selected item. contentHandler.divTag.childNodes[spanNo].className = "highlight"; contentHandler.selSpanTag = contentHandler.divTag.childNodes[spanNo]; }