function click_img_origenes(){new AutoSuggest(document.getElementById("B_LOCATION_1P"),ciudadesdestino,"Y")}function click_img_destinos(){ibe_listaPaisesEng2("E_LOCATION_1P")}function click_img_destinosEsp(){ibe_listaPaisesEsp2("E_LOCATION_1P")}function idioma(a){IDIOMA=a}function ibe_crearCookiesEng(){var a=1e3;crearCookie("cTRIP_TYPE1",document.form1.TRIP_TYPE1.checked,a),crearCookie("cTRIP_TYPE2",document.form1.TRIP_TYPE2.checked,a),crearCookie("cDepart",document.getElementById("Depart").value,a),crearCookie("cReturn",document.getElementById("Return").value,a),crearCookie("cSEARCH_BY1",document.form1.SEARCH_BY1.checked,a),crearCookie("cSEARCH_BY2",document.form1.SEARCH_BY2.checked,a),crearCookie("cCABIN",document.getElementById("CABIN").value,a),crearCookie("cadults",document.getElementById("adults").value,a),crearCookie("cchild",document.getElementById("child").value,a),crearCookie("cinfant",document.getElementById("infant").value,a),crearCookie("cCuponNo",document.getElementById("CuponNo").value,a);var b,c,d,e="";e=document.getElementById("B_LOCATION_1P").value,b=e.toLowerCase().indexOf("("),d=e.length,c=e.substring(b+1,d-1);var f,g,h,i="";i=document.getElementById("E_LOCATION_1P").value,f=i.toLowerCase().indexOf("("),h=i.length,g=i.substring(f+1,h-1),crearCookie("cB_LOCATION_1P",c,a),crearCookie("cE_LOCATION_1P",g,a),crearCookie("cB_LOCATION_1",document.getElementById("B_LOCATION_1").value.toUpperCase(),a),crearCookie("cE_LOCATION_1",document.getElementById("E_LOCATION_1").value.toUpperCase(),a),crearCookie("IbeB_LOCATION_1P_ENG",document.getElementById("B_LOCATION_1P").value,a),crearCookie("IbeE_LOCATION_1P_ENG",document.getElementById("E_LOCATION_1P").value,a)}function ibe_crearCookies(){var a=1e3;crearCookie("cTRIP_TYPE1",document.form1.TRIP_TYPE1.checked,a),crearCookie("cTRIP_TYPE2",document.form1.TRIP_TYPE2.checked,a),crearCookie("cDepart",document.getElementById("Depart").value,a),crearCookie("cReturn",document.getElementById("Return").value,a),crearCookie("cSEARCH_BY1",document.form1.SEARCH_BY1.checked,a),crearCookie("cSEARCH_BY2",document.form1.SEARCH_BY2.checked,a),crearCookie("cCABIN",document.getElementById("CABIN").value,a),crearCookie("cadults",document.getElementById("adults").value,a),crearCookie("cchild",document.getElementById("child").value,a),crearCookie("cinfant",document.getElementById("infant").value,a),crearCookie("cCuponNo",document.getElementById("CuponNo").value,a);var b,c,d,e="";e=document.getElementById("B_LOCATION_1P").value,b=e.toLowerCase().indexOf("("),d=e.length,c=e.substring(b+1,d-1);var f,g,h,i="";i=document.getElementById("E_LOCATION_1P").value,f=i.toLowerCase().indexOf("("),h=i.length,g=i.substring(f+1,h-1),crearCookie("cB_LOCATION_1P",c,a),crearCookie("cE_LOCATION_1P",g,a),crearCookie("cB_LOCATION_1",document.getElementById("B_LOCATION_1").value.toUpperCase(),a),crearCookie("cE_LOCATION_1",document.getElementById("E_LOCATION_1").value.toUpperCase(),a),crearCookie("IbeB_LOCATION_1P",document.getElementById("B_LOCATION_1P").value,a),crearCookie("IbeE_LOCATION_1P",document.getElementById("E_LOCATION_1P").value,a)}function ibe_cargarCookies_Eng(){leerCookie("cTRIP_TYPE1")!=null?(leerCookie("cTRIP_TYPE1")=="true"&&(document.form1.TRIP_TYPE1.checked="checked"),leerCookie("cTRIP_TYPE1")=="false"&&(document.form1.TRIP_TYPE2.checked="checked")):resetB2(),leerCookie("cB_LOCATION_1")!=null&&(document.getElementById("B_LOCATION_1").value=leerCookie("cB_LOCATION_1"),city1=leerCookie("cB_LOCATION_1")),leerCookie("cE_LOCATION_1")!=null&&(document.getElementById("E_LOCATION_1").value=leerCookie("cE_LOCATION_1"),city2=leerCookie("cE_LOCATION_1")),leerCookie("cDepart")!=null&&(document.getElementById("Depart").value=leerCookie("cDepart")),leerCookie("cReturn")!=null&&(document.getElementById("Return").value=leerCookie("cReturn")),leerCookie("cSEARCH_BY1")!=null&&(leerCookie("cSEARCH_BY1")=="true"&&(document.getElementById("SEARCH_BY1").checked="checked"),leerCookie("cSEARCH_BY1")=="false"&&(document.getElementById("SEARCH_BY2").checked="checked")),leerCookie("cCABIN")!=null&&(document.getElementById("CABIN").value=leerCookie("cCABIN")),leerCookie("cadults")!=null&&(document.getElementById("adults").value=leerCookie("cadults")),leerCookie("cchild")!=null&&(document.getElementById("child").value=leerCookie("cchild")),leerCookie("cinfant")!=null&&(document.getElementById("infant").value=leerCookie("cinfant")),leerCookie("cCuponNo")!=null&&(document.getElementById("CuponNo").value=leerCookie("cCuponNo")),leerCookie("cB_LOCATION_1P")!=null&&(leerCookie("IbeB_LOCATION_1P_ENG")!=null?document.getElementById("B_LOCATION_1P").value=leerCookie("IbeB_LOCATION_1P_ENG"):document.getElementById("B_LOCATION_1P").value=scripts.textoDepartingFrom),leerCookie("cE_LOCATION_1P")!=null&&(leerCookie("IbeE_LOCATION_1P_ENG")!=null?document.getElementById("E_LOCATION_1P").value=leerCookie("IbeE_LOCATION_1P_ENG"):document.getElementById("E_LOCATION_1P").value=scripts.textoTravelingTo)}function ibe_cargarCookies(){leerCookie("cTRIP_TYPE1")!=null?(leerCookie("cTRIP_TYPE1")=="true"&&(document.form1.TRIP_TYPE1.checked="checked"),leerCookie("cTRIP_TYPE1")=="false"&&(document.form1.TRIP_TYPE2.checked="checked")):resetB2(),leerCookie("cB_LOCATION_1")!=null&&(document.getElementById("B_LOCATION_1").value=leerCookie("cB_LOCATION_1"),city1=leerCookie("cB_LOCATION_1")),leerCookie("cE_LOCATION_1")!=null&&(document.getElementById("E_LOCATION_1").value=leerCookie("cE_LOCATION_1"),city2=leerCookie("cE_LOCATION_1")),leerCookie("cDepart")!=null&&(document.getElementById("Depart").value=leerCookie("cDepart")),leerCookie("cReturn")!=null&&(document.getElementById("Return").value=leerCookie("cReturn")),leerCookie("cSEARCH_BY1")!=null&&(leerCookie("cSEARCH_BY1")=="true"&&(document.getElementById("SEARCH_BY1").checked="checked"),leerCookie("cSEARCH_BY1")=="false"&&(document.getElementById("SEARCH_BY2").checked="checked")),leerCookie("cCABIN")!=null&&(document.getElementById("CABIN").value=leerCookie("cCABIN")),leerCookie("cadults")!=null&&(document.getElementById("adults").value=leerCookie("cadults")),leerCookie("cchild")!=null&&(document.getElementById("child").value=leerCookie("cchild")),leerCookie("cinfant")!=null&&(document.getElementById("infant").value=leerCookie("cinfant")),leerCookie("cCuponNo")!=null&&(document.getElementById("CuponNo").value=leerCookie("cCuponNo")),leerCookie("cB_LOCATION_1P")!=null&&(leerCookie("IbeB_LOCATION_1P")!=null?document.getElementById("B_LOCATION_1P").value=leerCookie("IbeB_LOCATION_1P"):document.getElementById("B_LOCATION_1P").value=scripts.textoDepartingFrom),leerCookie("cE_LOCATION_1P")!=null&&(leerCookie("IbeE_LOCATION_1P")!=null?document.getElementById("E_LOCATION_1P").value=leerCookie("IbeE_LOCATION_1P"):document.getElementById("E_LOCATION_1P").value=scripts.textoTravelingTo)}function ibe_exito(a,b){if(a==!1)return destinosTaca.wsInfoDestinos.getCiudad(city1,callGetCiudad1,fallo,"nada"),retornoValidaciones=!1,!1;city2.length>1&&setArrival(city2);if(enviarInfo==!0){IDIOMA=="ENG"?ibe_crearCookiesEng():ibe_crearCookies(),document.getElementById("form1").action=scripts.actionFormBookTravel;var c=document.getElementById("form1"),d=0;if(d==0)try{c.value=firstTracker._linkByPost(c),d=1}catch(e){}if(d==0)try{c.value=secondTracker._linkByPost(c),d=1}catch(e){}if(d==0)try{c.value=thirdTracker._linkByPost(c),d=1}catch(e){}c.submit()}return!0}function resetB2(){city1!=""&&$get("initialMap").style.visibility=="visible"&&(setDeparture(""),resetPoints()),city1="",city2="",document.getElementById("B_LOCATION_1P").value=scripts.textoDepartingFrom,document.getElementById("E_LOCATION_1P").value=scripts.textoTravelingTo,document.getElementById("CuponNo").value=scripts.textoDiscountCode,document.getElementById("Depart").value=scripts.textoDepart,document.getElementById("Return").value=scripts.textoReturn,document.getElementById("CABIN").selectedIndex=0,document.getElementById("adults").selectedIndex=0,document.getElementById("child").selectedIndex=0,document.getElementById("infant").selectedIndex=0,document.getElementById("SEARCH_BY1").checked="checked",document.getElementById("TRIP_TYPE1").checked="checked"}function ibe_validarRuta(a,b){destinosTaca.wsInfoDestinos.validarRuta(a,b,ibe_exito,fallo,"nada")}function ibe_ciudadesValidas(a){enviarInfo=a,ibe_validarRuta(city1,city2)}function notienefoco(){document.getElementById("autosuggest").style.display="none",muestra=""}function tienefoco(){document.getElementById("autosuggest").style.display="block",muestra=""}function ibe_quitarTexto(a){document.getElementById(a).value==scripts.textoDepartingFrom&&a=="B_LOCATION_1P"?document.getElementById(a).value="":document.getElementById(a).value==scripts.textoTravelingTo&&a=="E_LOCATION_1P"&&(document.getElementById(a).value="")}function ibe_setCiudad1Temp(){var a,b,c;document.getElementById("B_LOCATION_1P").value!=scripts.textoDepartingFrom&&(city1=document.getElementById("B_LOCATION_1P").value,a=city1.toLowerCase().indexOf("("),b=city1.length,c=city1.substring(a+1,b-1),city1=c,city1.length==3&&setDeparture(city1))}function ibe_listaPaisesEng(a){cajaPaisReturn=a,a=="E_LOCATION_1P"&&(city1!=""?ibe_cargarDestinosEng():alertaGenerica(scripts.textoSeleccionarSalida))}function ibe_cargarDestinosEng(){destinosTaca.wsInfoDestinos.getListaCiudades(city1,ibe_callDestinosEng,callFalloDest,"nada")}function ibe_callDestinosEng(a,b){var c,d=a.length,e=1,f=0,g,h,i;i="";if(d>0){var j=new Array(d);for(c=0;c<d;c++)h=a[c].nombreEng+", "+a[c].nombrePais+" ("+a[c].codigo+")",j[c]=h;new AutoSuggest(document.getElementById("E_LOCATION_1P"),j)}else alertaGenerica(scripts.textoNoHayDestinos)}function ibe_listaPaisesEng2(a){cajaPaisReturn=a,a=="E_LOCATION_1P"&&(city1!=""?ibe_cargarDestinosEng2():alertaGenerica(scripts.textoSeleccionarSalida))}function ibe_cargarDestinosEng2(){destinosTaca.wsInfoDestinos.getListaCiudades(city1,ibe_callDestinosEng2,callFalloDest,"nada")}function ibe_callDestinosEng2(a,b){var c,d=a.length,e=1,f=0,g,h,i;i="";if(d>0){var j=new Array(d);for(c=0;c<d;c++)h=a[c].nombreEng+", "+a[c].nombrePais+" ("+a[c].codigo+")",j[c]=h;new AutoSuggest(document.getElementById("E_LOCATION_1P"),j,"Y")}else alertaGenerica(scripts.textoNoHayDestinos)}function ibe_listaPaisesEsp(a){cajaPaisReturn=a,a=="E_LOCATION_1P"&&(city1!=""?ibe_cargarDestinosEsp():alertaGenerica(scripts.textoSeleccionarSalida))}function ibe_cargarDestinosEsp(){destinosTaca.wsInfoDestinos.getListaCiudadesEsp(city1,ibe_callDestinosEsp,callFalloDest,"nada")}function ibe_callDestinosEsp(a,b){var c,d=a.length,e=1,f=0,g,h,i;i="";if(d>0){var j=new Array(d);for(c=0;c<d;c++)h=a[c].nombre+", "+a[c].nombrePaisEsp+" ("+a[c].codigo+")",j[c]=h;new AutoSuggest(document.getElementById("E_LOCATION_1P"),j)}else alertaGenerica(scripts.textoNoHayDestinos)}function ibe_listaPaisesEsp2(a){cajaPaisReturn=a,a=="E_LOCATION_1P"&&(city1!=""?ibe_cargarDestinosEsp2():alertaGenerica(scripts.textoSeleccionarSalida))}function ibe_cargarDestinosEsp2(){destinosTaca.wsInfoDestinos.getListaCiudadesEsp(city1,ibe_callDestinosEsp2,callFalloDest,"nada")}function ibe_callDestinosEsp2(a,b){var c,d=a.length,e=1,f=0,g,h,i;i="";if(d>0){var j=new Array(d);for(c=0;c<d;c++)h=a[c].nombre+", "+a[c].nombrePaisEsp+" ("+a[c].codigo+")",j[c]=h;new AutoSuggest(document.getElementById("E_LOCATION_1P"),j,"Y")}else alertaGenerica(scripts.textoNoHayDestinos)}function ibe_searchBook(){var a=$find("nteDualLoginAtempt"),b=$find("rteDualLoginAtempt");city1=="DAV"||city1.value=="BOC"||city2=="DAV"||city2=="BOC"?a.show():city1.value=="LIM"&&city2=="CUZ"||city1=="CUZ"&&city2=="LIM"?b.show():validarcupon()}function ibe_validaciones(){var a,b,c,d,e;a=document.getElementById("B_LOCATION_1P").value.toUpperCase(),b=document.getElementById("E_LOCATION_1P").value.toUpperCase(),c=a.toLowerCase().indexOf("("),d=a.length,e=a.substring(c+1,d-1),city1=e,c="",d="",e="",c=b.toLowerCase().indexOf("("),d=b.length,e=b.substring(c+1,d-1),city2=e,document.getElementById("B_LOCATION_1").value=city1,document.getElementById("E_LOCATION_1").value=city2;var f,g="SI";f=document.getElementById("CuponNo").value.toUpperCase(),f=="GROUPON"&&(document.getElementById("adults").value!="1"||document.getElementById("child").value!="0"||document.getElementById("infant").value!="0")&&(g="NO");var h=!1;if(city1.length!=3)return alertaGenerica(scripts.textoSeleccionarSalida),!1;if(city2.length!=3)return alertaGenerica(scripts.textoSeleccionarDestino),!1;h=validarFechas();if(h!=!0)return;h=validarPasajeros();if(h!=!0)return h;if(g=="NO")return IDIOMA=="ENG"&&alertaGenerica("The selected combination of Discount Coupon and number of adults is not valid."),IDIOMA=="ESP"&&alertaGenerica("La combinaci&oacute;n seleccionada de Cup&oacute;n y n&uacute;mero de Adultos no es v&aacute;lida."),!1;quitarTexto("CuponNo"),ibe_ciudadesValidas(!0)}function validarcupon(){var a;a=document.getElementById("CuponNo").value.toUpperCase(),destinosTaca.wsInfoDestinos.CuponValido(a,callcupon,fallocupon)}function callcupon(a,b){var c,d=a.length,e=$find("cupons"),f=$find("cuponvenc");if(d>0){a=="2"&&f.show();if(a=="1"){var g;g=document.getElementById("CuponNo").value.toUpperCase(),g==""||g==scripts.textoDiscountCode.toUpperCase()||g=="GROUPON"?ibe_validaciones():e.show()}a=="0"&&ibe_validaciones()}}function fallocupon(a){}function AutoSuggest(a,b,c){var d=this;this.elem=a,this.suggestions=b,this.eligible=new Array,this.inputText=null,this.highlighted=-1,this.div=document.getElementById("autosuggest");var e=9,f=27,g=38,h=40,j=13;a.setAttribute("autocomplete","off");if(!a.id){var k="autosuggest"+idCounter;idCounter++,a.id=k}a.onclick=function(){document.getElementById("B_LOCATION_1P").value==scripts.textoDepartingFrom&&a.id=="B_LOCATION_1P"&&(document.getElementById("B_LOCATION_1P").value=""),document.getElementById("E_LOCATION_1P").value==scripts.textoTravelingTo&&a.id=="E_LOCATION_1P"&&(document.getElementById("E_LOCATION_1P").value=""),c=="N",ev=65,d.inputText=this.value,d.getEligible(),d.createDiv(),d.positionDiv(),d.showDiv()},a.onkeydown=function(a){var b=d.getKeyCode(a);switch(b){case e:d.useSuggestion();break;case j:d.useSuggestion();break;case f:d.hideDiv();break;case g:d.highlighted>0&&d.highlighted--,d.changeHighlight(b);break;case h:d.highlighted<d.eligible.length-1&&d.highlighted++,d.changeHighlight(b)}},a.onkeyup=function(a){var b=d.getKeyCode(a);switch(b){case e:case j:case f:case g:case h:return;default:this.value!=d.inputText&&this.value.length>-1&&(d.inputText=this.value,d.getEligible(),d.createDiv(),d.positionDiv(),d.showDiv())}},this.useSuggestion=function(){if(this.highlighted>-1){this.elem.value=this.eligible[this.highlighted];if(this.elem.id=="E_LOCATION_1P"){var a="",b,c,d;a=document.getElementById("E_LOCATION_1P").value,b=a.toLowerCase().indexOf("("),c=a.length,d=a.substring(b+1,c-1),city2=d,ibe_validarRuta(city1,city2)}banderamos=="Y"?(this.hideDiv(),setTimeout("document.getElementById('"+this.elem.id+"').focus()",0)):banderamos="Y"}},this.showDiv=function(){this.div.style.display="block"},this.hideDiv=function(){this.div.style.display="none",this.highlighted=-1},this.changeHighlight=function(){var a=this.div.getElementsByTagName("LI");banderamos="Y";for(i in a){var b=a[i];this.highlighted==i?(v_bandera!="Y"&&(banderamos="N",d.useSuggestion()),b.className="selected",v_bandera="N"):typeof b!="undefined"&&(b.className="")}},this.positionDiv=function(){var a=this.elem,b=0,c=a.offsetHeight,d,e,f;while(a.offsetParent&&a.tagName.toUpperCase()!="BODY")f=a.tagName.toUpperCase(),b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent,a.tagName.toUpperCase()=="DIV"&&(d=b,e=c);this.div.style.left=d+"px",this.div.style.top=e+"px"},this.createDiv=function(){var a=document.createElement("ul");for(i in this.eligible){var b=this.eligible[i],c=document.createElement("li"),e=document.createElement("a");e.href="javascript:false",e.innerHTML=b,c.appendChild(e),d.highlighted==i&&(c.className="selected"),a.appendChild(c)}this.div.replaceChild(a,this.div.childNodes[0]),a.onmouseover=function(a){var b=d.getEventSource(a);while(b.parentNode&&b.tagName.toUpperCase()!="LI")b=b.parentNode;var c=d.div.getElementsByTagName("LI");for(i in c){var e=c[i];if(e==b){d.highlighted=i;break}}v_bandera="Y",d.changeHighlight()},a.onclick=function(a){return d.useSuggestion(),d.hideDiv(),d.cancelEvent(a),!1},this.div.className="suggestion_list",this.div.style.position="absolute"},this.getEligible=function(){this.eligible=new Array;for(i in this.suggestions){var a=this.suggestions[i],b=this.suggestions[i],c,d,e,f,g;c=a.toLowerCase().indexOf("("),e=a.length,d=a.substring(c+1,e-1),f=this.elem.value.length;if(f>1){b=b.toLowerCase(),b=b.replace("\u00e1","a"),b=b.replace("\u00e9","e"),b=b.replace("\u00ed","i"),b=b.replace("\u00f3","o"),b=b.replace("\u00fa","u"),g=a.toLowerCase().indexOf(this.inputText.toLowerCase());if(a.toLowerCase().indexOf(this.inputText.toLowerCase())>="0"||b.toLowerCase().indexOf(this.inputText.toLowerCase())>="0"||d.toLowerCase().indexOf(this.inputText.toLowerCase())=="0")this.eligible[this.eligible.length]=a}else if(a.toLowerCase().indexOf(this.inputText.toLowerCase())=="0"||b.toLowerCase().indexOf(this.inputText.toLowerCase())=="0"||d.toLowerCase().indexOf(this.inputText.toLowerCase())=="0")this.eligible[this.eligible.length]=a}},this.getKeyCode=function(a){if(a)return a.keyCode;if(window.event)return window.event.keyCode},this.getEventSource=function(a){if(a)return a.target;if(window.event)return window.event.srcElement},this.cancelEvent=function(a){a&&(a.preventDefault(),a.stopPropagation()),window.event&&(window.event.returnValue=!1)},c=="Y"&&(ev=65,d.inputText="",d.getEligible(),d.createDiv(),d.positionDiv(),d.showDiv())}var banderamos="Y",v_bandera="N",muestra="",IDIOMA="ENG",ciudadesdestino3,idCounter=0
