var oXT="";var freeNid="";var zXml={useActiveX:(typeof ActiveXObject!="undefined"),useDom:document.implementation&&document.implementation.createDocument,useXmlHttp:(typeof XMLHttpRequest!="undefined")};zXml.ARR_XMLHTTP_VERS=["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];zXml.ARR_DOM_VERS=["MSXML2.DOMDocument.6.0","MSXML2.DOMDocument.3.0"];function zXmlHttp(){}zXmlHttp.createRequest=function(){if(zXml.useXmlHttp){return new XMLHttpRequest()}else{if(zXml.useActiveX){if(!zXml.XMLHTTP_VER){for(var i=0;i<zXml.ARR_XMLHTTP_VERS.length;i++){try{new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);zXml.XMLHTTP_VER=zXml.ARR_XMLHTTP_VERS[i];break}catch(oError){}}}if(zXml.XMLHTTP_VER){return new ActiveXObject(zXml.XMLHTTP_VER)}else{throw new Error("Could not create XML HTTP Request.")}}else{throw new Error("Your browser doesn't support an XML HTTP Request.")}}};zXmlHttp.isSupported=function(){return zXml.useXmlHttp||zXml.useActiveX};function hoFreeText(oInput,oXML){this.IEvers=false;this.cur=-1;this.parent=null;this.layer=null;this.langXML=oXML;this.textbox=oInput;this.textboxhidden=$("freetext");this.error=$("content_error");this.timeoutId=null;this.sFCh=null;this.userText=oInput.value;this.init()}hoFreeText.prototype.IEold=function(){var IE=(typeof ActiveXObject!="undefined");if(!IE){return}var reIE=new RegExp("MSIE (\\d+\\.\\d+);");reIE.test(navigator.userAgent);this.IEvers=(parseFloat(RegExp["$1"])<=6)};hoFreeText.prototype.findSugg=function(XXM){var nXXM=XXM.documentElement||oXT.documentElement;if(!nXXM){return false}var nEqu=nXXM.childNodes.length;this.cur=-1;var nMax=0;var oFragment=document.createDocumentFragment();var userText=this.userText.toLowerCase().replace(" ","-");for(var i=0;i<nEqu;i++){var sDestName=nXXM.childNodes[i].getAttribute("name");var sDestFormat=nXXM.childNodes[i].getAttribute("formato");var sDestPrio=nXXM.childNodes[i].getAttribute("priority");var sDestParam=nXXM.childNodes[i].getAttribute("params");var oDiv=document.createElement("div");if((sDestFormat.substring(0,userText.length)!==format(userText))&&(sDestFormat.substring(sDestFormat.indexOf("*")+1,sDestFormat.indexOf("*")+1+userText.length)!==format(userText)&&sDestFormat.substring(sDestFormat.indexOf("-")+1,sDestFormat.indexOf("-")+1+userText.length)!==format(userText))&&(sDestName.substring(0,userText.length)!==userText)){continue}oDiv.appendChild(document.createTextNode(sDestName));oDiv.className=(sDestPrio>4)?"desti prio":"desti";oDiv.setAttribute("name",(sDestName+sDestParam));oFragment.appendChild(oDiv);if(nMax>15){break}else{nMax++}}this.layer.innerHTML="";this.layer.appendChild(oFragment);this.showSugg();if(this.layer.childNodes.length<1){this.showSError();newMailrequest();this.textboxhidden.value=""}};hoFreeText.prototype.createLayer=function(){this.layer=$("content_free");this.lang=$("footlang").value;this.web=$("footcod").value;var codweb=this.web;if(codweb.indexOf("wgf")!=-1){this.lang="gulfENG"}if(codweb.indexOf("0304")!=-1){this.lang="bronce304/304"+this.lang}if(codweb.indexOf("0375")!=-1||codweb.indexOf("0376")!=-1){this.lang="bronce375/gulf"}this.parent=this.layer;for(var i=0;i<100;i++){var Parent=this.parent.parentNode;if(Parent.tagName=="FORM"||Parent.tagName=="form"){this.parent=Parent;break}else{this.parent=Parent}}var oOutInput=this;setTimeout(function(){oOutInput.textbox.disabled=false;if($("radiogatew")==null){oOutInput.textbox.focus()}oOutInput.textbox.value=oOutInput.textboxhidden.value.split(",")[0]},500);var oThis=this;this.layer.onmousedown=this.layer.onmouseup=this.layer.onmouseover=function(oEvent){oEvent=oEvent||window.event;oTarget=oEvent.target||oEvent.srcElement;if(oEvent.type=="mousedown"){oThis.textbox.value=oTarget.firstChild.nodeValue;oThis.hideSugg();oThis.textboxhidden.value=oTarget.attributes.getNamedItem("name").nodeValue;if($("airport")!=null&&$("destino")!=null){$("airport").selectedIndex=0;$("destino").options.length=0}if($("radiogatew")!=null){clearRadioDest($("frsv01"))}$("diaE").focus()}else{if(oEvent.type=="mouseover"){oThis.focusSugg(oTarget)}else{oThis.textbox.focus()}}}};hoFreeText.prototype.KeyDown=function(oEvent){switch(oEvent.keyCode){case 38:this.toSugg(-1);break;case 40:this.toSugg(1);break;case 27:this.textbox.value=this.userText;case 13:this.hideSugg();var url=window.location.toString();if($("airport")!=null&&$("destino")!=null){$("airport").selectedIndex=0;$("destino").options.length=0}if($("radiogatew")!=null&&url.indexOf("gateway")==-1){clearRadioDest("document.frsv01")}$("diaE").focus();var layerLength=this.layer.childNodes;for(i=0;i<layerLength.length;i++){if(format(layerLength[i].innerHTML)==format(this.userText)){this.textboxhidden.value=layerLength[i].attributes.getNamedItem("name").nodeValue;break}}oEvent.returnValue=false;if(oEvent.preventDefault){oEvent.preventDefault()}break}};hoFreeText.prototype.KeyUp=function(oEvent){var iKeyCode=oEvent.keyCode;var oThis=this;oThis.userText=this.textbox.value;clearTimeout(this.timeoutId);if(oThis.userText.length!==0){if(iKeyCode==46||iKeyCode==8){oThis.findSugg(false);this.textboxhidden.value="";return}else{if(iKeyCode<32||(iKeyCode>=33&&iKeyCode<46)||(iKeyCode>=112&&iKeyCode<=123)){}else{this.timeoutId=setTimeout(function(){oThis.langXML.request(oThis,oThis.userText.charAt(0),oThis.lang)},200)}}}else{this.error.style.display="none";this.hideSugg();if($("airport")!=null&&$("destino")!=null){$("airport").selectedIndex=0;$("destino").options.length=0}if($("radiogatew")!=null){clearRadioDest($("frsv01"))}this.DPoff("visible");this.layer.innerHTML=""}};hoFreeText.prototype.focusSugg=function(oSuggestionNode){for(var i=0;i<this.layer.childNodes.length;i++){var oNode=this.layer.childNodes[i];if(oNode==oSuggestionNode){if(oNode.className.indexOf("sel")==-1){oNode.className+=" sel"}}else{oNode.className=oNode.className.replace(" sel","")}}};hoFreeText.prototype.toSugg=function(iDiff){var selNodes=this.layer.childNodes;if(selNodes.length>0){var oNode=null;if((iDiff>0)&&(this.cur<selNodes.length-1)){oNode=selNodes[++this.cur]}else{if((this.cur>0)&&(this.cur<selNodes.length-1)){oNode=selNodes[--this.cur]}else{this.cur=-1;this.toSugg(1)}}if(oNode){if(oNode.innerHTML==undefined){return}this.focusSugg(oNode);this.textbox.value=oNode.firstChild.nodeValue;this.textboxhidden.value=this.textboxhidden.value=oNode.attributes.getNamedItem("name").nodeValue}}};hoFreeText.prototype.hideSugg=function(){this.DPoff("visible");this.layer.style.visibility="hidden"};hoFreeText.prototype.hideError=function(){this.DPoff("visible");this.error.style.visibility="hidden"};hoFreeText.prototype.showSugg=function(){this.DPoff("hidden");this.error.style.display="none";this.layer.style.visibility="visible"};hoFreeText.prototype.showSError=function(){this.DPoff("hidden");this.error.style.display="block";this.error.style.visibility="visible"};hoFreeText.prototype.DPoff=function(x){if(this.IEvers){var dp=this.parent.getElementsByTagName("select");for(i=0;i<dp.length;i++){if(x){dp[i].style.visibility=x}}}};hoFreeText.prototype.init=function(){var oThis=this;this.textbox.onkeyup=function(oEvent){if(!oEvent){oEvent=window.event}oThis.KeyUp(oEvent)};this.textbox.onkeydown=function(oEvent){if(!oEvent){oEvent=window.event}oThis.KeyDown(oEvent)};this.textbox.onblur=function(){oThis.hideSugg();if($("airport")!=null&&$("destino")!=null){$("airport").selectedIndex=0;$("destino").options.length=0}if($("radiogatew")!=null){clearRadioDest($("frsv01"))}oThis.hideError()};this.IEold();this.createLayer()};function format(x){var tesxt=x;tesxt=tesxt.toLowerCase();tesxt=tesxt.replace(/ /g,"-");tesxt=tesxt.replace(/ß/g,"ss");tesxt=tesxt.replace(/à/g,"a");tesxt=tesxt.replace(/á/g,"a");tesxt=tesxt.replace(/â/g,"a");tesxt=tesxt.replace(/ã/g,"a");tesxt=tesxt.replace(/ä/g,"a");tesxt=tesxt.replace(/å/g,"a");tesxt=tesxt.replace(/æ/g,"ae");tesxt=tesxt.replace(/ç/g,"c");tesxt=tesxt.replace(/è/g,"e");tesxt=tesxt.replace(/é/g,"e");tesxt=tesxt.replace(/ê/g,"e");tesxt=tesxt.replace(/ë/g,"e");tesxt=tesxt.replace(/ì/g,"i");tesxt=tesxt.replace(/í/g,"i");tesxt=tesxt.replace(/î/g,"i");tesxt=tesxt.replace(/ï/g,"i");tesxt=tesxt.replace(/ð/g,"o");tesxt=tesxt.replace(/ñ/g,"n");tesxt=tesxt.replace(/ò/g,"o");tesxt=tesxt.replace(/ó/g,"o");tesxt=tesxt.replace(/ô/g,"o");tesxt=tesxt.replace(/õ/g,"o");tesxt=tesxt.replace(/ö/g,"o");tesxt=tesxt.replace(/ø/g,"o");tesxt=tesxt.replace(/ù/g,"u");tesxt=tesxt.replace(/ú/g,"u");tesxt=tesxt.replace(/û/g,"u");tesxt=tesxt.replace(/ü/g,"u");tesxt=tesxt.replace(/ý/g,"y");tesxt=tesxt.replace(/ÿ/g,"y");tesxt=tesxt.replace(/&/g,"&amp;");return tesxt}function newRequest(){}newRequest.prototype.request=function(oX,f,i){if(oX.oFCh==f){oX.findSugg(false);return}var oXmlHttp=zXmlHttp.createRequest();var ruta="XML/free/free.jsp";if(String(document.location).indexOf("/bbva")!=-1||String(document.location).indexOf("/whitelabel")!=-1||String(document.location).indexOf("/hotels")!=-1){ruta="../XML/free/free.jsp"}if(String(document.location).indexOf("/bbva-argentina")!=-1||String(document.location).indexOf("/bbva-colombia")!=-1){ruta="../../XML/free/free.jsp"}if((String(document.location).indexOf("gateways.jsp")!=-1)||(String(document.location).indexOf("special.jsp")!=-1)||(String(document.location).indexOf("whitelabel/destination")!=-1)){ruta="../../XML/free/free.jsp"}oXmlHttp.open("get",ruta+"?f="+format(f)+"&i="+i,true);oXmlHttp.onreadystatechange=function(){if(oXmlHttp.readyState==4){try{if(oXmlHttp.status!==undefined&&oXmlHttp.status!=0){httpStatus=oXmlHttp.status}else{httpStatus=13030}}catch(e){httpStatus=13030}if(httpStatus==200){oXT=oXmlHttp.responseXML;oX.oFCh=f;oX.findSugg(oXmlHttp.responseXML)}else{return"An error occurred"}}};oXmlHttp.send(null)};function newMailrequest(){if(($("footcod").value).indexOf("h")==0){var free_error=$(freeNid).value;pageTracker._trackEvent("Buscador","Error",free_error);rollupTracker._trackEvent("Buscador","Error",free_error)}else{var free_error=$(freeNid).value;pageTracker._trackEvent("Buscador","Error",free_error)}}function free(){freeNid="freesearch"+Math.floor(Math.random()*9000);$("freesearch").id=freeNid;new hoFreeText($(freeNid),new newRequest())}function loadMapDest(dest){document.getElementById("freetext").value=dest;document.getElementById("newDest").value=dest.split(",")[0];document.getElementById("goto").value=dest.split(",")[0];document.getElementById("goto").value==document.getElementById("freetext").value;document.getElementById("mapa").style.display="none";document.getElementById("cityHidden").style.display="none";document.getElementById("changeDest").style.display="block";document.getElementById("showmap").style.display="none"}function changeMapDest(){document.getElementById("freetext").value="";document.getElementById("newDest").value="";document.getElementById("mapa").style.display="block";document.getElementById("changeDest").style.display="none";document.getElementById("showmap").style.display="none"}function loadDest(){var destino=document.getElementById("dest").value;document.getElementById("freetext").value=destino;document.getElementById("newDest").value=destino.split(",")[0];document.getElementById("showmap").style.display="none"}function loadMapNewDest(){document.getElementById("cityHidden").style.display="block";document.getElementById("mapa").style.display="none";document.getElementById("showmap").style.display="block"}function loadMapa(){document.getElementById("mapa").style.display="block";document.getElementById("cityHidden").style.display="none"};