
function confirmarCambioCoche(monoproducto){document.formularioCoche.metodo.value="ajaxSeleccionar";var capa='bloqueContenido';var paginaInclude='/servlet/multiproducto';forwardPostSincrono(capa,paginaInclude,'formularioCoche');if(monoproducto!='SI'){cambiarPestana('0');actualizarPrecios();}
if(monoproducto=='SI'){mostrarCargando(2,'0010');document.formSeleccion.submit();}}
function verBotonConfirmarCoche(producto,desde,hasta){var desde1=eval(desde);var hasta1=eval(hasta);var i=0;for(i=desde1;i<hasta1;i++){if(document.getElementById("capaBotonConfirmar"+i)&&producto!=i){document.getElementById("capaBotonConfirmar"+i).style.display='none';document.getElementById("capaLineaRojaSel"+i).style.display='none';}}
document.getElementById("capaBotonConfirmar"+producto).style.display='block';document.getElementById("capaLineaRojaSel"+producto).style.display='block';}
function masInfoCoche(producto){document.getElementById('frameCapaErrorCoches').style.display='none';escribe('capaMasInfo','');var capa='capaMasInfo';document.formularioCoche.productoMasInfo.value=producto;document.formularioCoche.metodo.value="ajaxMasInfo";var paginaInclude='/servlet/multiproducto';forwardPost(capa,paginaInclude,'formularioCoche');document.getElementById('capaMasInfo').style.display='block';var alto=(document.all)?document.documentElement.scrollTop:window.pageYOffset
document.getElementById('capaMasInfo').style.left='20px';}
function cerrarCapaErrorFichaCoche(){escribe('capaMasInfo','');document.getElementById('capaMasInfo').style.display='none';document.getElementById('frameCapaErrorCoches').style.display='none';}
function cambiarPestanaMasInfo(indicePestana){for(i=0;i<4;i++){if(i==indicePestana){if(document.getElementById('botProMasInfo'+i))
document.getElementById('botProMasInfo'+i).className='actual';if(document.getElementById('barraMasInfo'+i))
document.getElementById('barraMasInfo'+i).className='activo';if(document.getElementById('capaVehiculo'+i))
document.getElementById('capaVehiculo'+i).style.display='block';}else{if(document.getElementById('botProMasInfo'+i))
document.getElementById('botProMasInfo'+i).className='';if(document.getElementById('barraMasInfo'+i))
document.getElementById('barraMasInfo'+i).className='noactivo';if(document.getElementById('capaVehiculo'+i))
document.getElementById('capaVehiculo'+i).style.display='none';}}}
function cambiarPestanaMasInfo2(indicePestana){for(i=0;i<4;i++){if(i==indicePestana){document.getElementById('botProMasInfo'+i).className='actual';document.getElementById('barraMasInfo'+i).className='activo';document.getElementById('capaVehiculo'+i).style.display='block';}else{document.getElementById('botProMasInfo'+i).className='';document.getElementById('barraMasInfo'+i).className='noactivo';document.getElementById('capaVehiculo'+i).style.display='none';}}}
function verCapaUnidades(producto,tipo){if(document.getElementById("chkProductoC"+producto).checked){document.getElementById("capaUnidades"+producto).style.display='block';}else{document.getElementById("capaUnidades"+producto).style.display='none';}
confirmarPrecioNuevoCoche(tipo,producto);}
function cambiarPrecioCoche(producto,tipo){var precioMod=document.getElementById("servicioC"+producto).value;var precio=0;precio=precioMod.substring(precioMod.lastIndexOf("/")+1,precioMod.length);var numUnidades=document.getElementById("servicioC"+producto).value;var total=(numUnidades.substring(0,numUnidades.lastIndexOf("/"))*precio);dwr.util.setValue("precioSuplCoche"+producto,"+"+total);confirmarPrecioNuevoCoche(tipo,producto);}
function confirmarPrecioNuevoCoche(tipoMarcado,producto){document.getElementById("metodo").value="ajaxSeleccionarComplemento";document.getElementById("disponibilidad").value="reserva";document.getElementById("tipocheck").value=tipoMarcado;if(tipoMarcado!="producto"){var numUnidades=document.getElementById("servicioC"+producto).value;document.getElementById("numUnidades").value=numUnidades.substring(0,numUnidades.lastIndexOf("/"));}else{document.getElementById("numUnidades").value=1;}
document.getElementById("indiceServicio").value=producto;var capa='bloqueContenido';var paginaInclude='/servlet/multiproducto';forwardPostSincrono(capa,paginaInclude,'formPresupuesto');actualizarPrecios();}
function compruebaCadena(nStr,nLen){var sRes=String(nStr);var sCeros="0000000000";return sCeros.substr(0,nLen-sRes.length)+sRes;}
function stringToSegundos(tiempo){var sep1=tiempo.indexOf(":");var sep2=tiempo.lastIndexOf(":");var hor=tiempo.substr(0,sep1);var min=tiempo.substr(sep2+1);return((Number(min)*60)+(Number(hor)*3600));}
function segundosToHora(secs){var hor=Math.floor(secs/3600);var min=Math.floor((secs-(hor*3600))/60);return compruebaCadena(hor,2)+":"+compruebaCadena(min,2);}
function sacaTiempos(horFin,horIni){var secs1=stringToSegundos(horFin);var secs2=stringToSegundos(horIni);var secsDif=secs1-secs2;return segundosToHora(secsDif);}
function restaHoras(horaFin,horaIni){var horas;horas=sacaTiempos(horaFin,horaIni);return horas;}
function firstIdaCoche(codLogin){cerrarCapas();if(document.getElementById("cochesFechaIni").value==""){alertTextoIdioma("ALERFECHARECOGIDA");return;}
abrirCalendario(codLogin,'cochesFechaFin',obtenerTextoIdioma('CAPADEVOCOCHE'),'2',document.formulario.cochesFechaIni.value,document.formulario.cochesFechaFin.value,0,'cocheSelDiaDevol','COC');}
function cocheSelDiaRecogida(fecha){var formu=document.formulario;formu.cochesFechaIni.value=fecha;if(comparaFechasString(formu.cochesFechaIni.value,formu.cochesFechaFin.value)){var fechaNueva=incrementaDiasString(formu.cochesFechaIni.value,1);var diaNew=fechaNueva.getDate();if(diaNew<10)diaNew="0"+diaNew;var mesNew=fechaNueva.getMonth()+1;if(mesNew<10)mesNew="0"+mesNew;var anioNew=fechaNueva.getFullYear();var fechaNuevaStr=diaNew+"/"+mesNew+"/"+anioNew;formu.cochesFechaFin.value=fechaNuevaStr;}
if(formu.hotelFechaIni.value==""){formu.hotelFechaIni.value=fecha;}
if(formu.vueloFechaIda.value==""){formu.vueloFechaIda.value=fecha;}
cerrarCalendario();}
function cocheSelDiaDevol(fecha){var formu=document.formulario;formu.cochesFechaFin.value=fecha;if(document.getElementById("hotelFechaFin")){if(formu.hotelFechaFin.value==""){if(formu.cochesFechaFin.value!=formu.hotelFechaIni.value)
formu.hotelFechaFin.value=formu.cochesFechaFin.value;else{var fechaNueva=incrementaDiasString(formu.cochesFechaFin.value,1);var diaNew=fechaNueva.getDate();var mesNew=fechaNueva.getMonth()+1;var anioNew=fechaNueva.getFullYear();var fechaNuevaStr=diaNew+"/"+mesNew+"/"+anioNew;formu.hotelFechaFin.value=fechaNuevaStr;}}}
if(document.getElementById("vueloFechaVuelta")){if(formu.vueloFechaVuelta.value==""){formu.vueloFechaVuelta.value=formu.cochesFechaFin.value;}}
cerrarCalendario();}
function validarBuscadorCoche(){var exp_regular2=/\W/;var exp_regular1=/_/;if(document.getElementById("descripcionZonaCoche").value.length<3){alertTextoIdioma("ALERT_ZONA_COCHE");document.getElementById("descripcionZonaCoche").focus();return b25.Suggest.handleActivity(document.getElementById('descripcionZonaCoche'),'COCHE',document.getElementById('cochesCodZge'));}
if(document.getElementById('devolucion')&&document.getElementById('devolucion').value=='S'){if(document.getElementById("descripcionZonaCocheDevolucion").value.length<3){alertTextoIdioma("ALERT_ZONA_COCHE");document.getElementById("descripcionZonaCocheDevolucion").focus();return b25.Suggest.handleActivity(document.getElementById('descripcionZonaCocheDevolucion'),'COCHE',document.getElementById('cochesCodZgeDev'));}
if(document.getElementById("descripcionZonaCocheDevolucion").value==document.getElementById("descripcionZonaCoche").value){alertTextoIdioma("ALERT_ZONA_COCHE_IGUALES");document.getElementById("descripcionZonaCocheDevolucion").focus();return b25.Suggest.handleActivity(document.getElementById('descripcionZonaCocheDevolucion'),'COCHE',document.getElementById('cochesCodZgeDev'));}}
if(document.getElementById("codDescuento")&&(document.getElementById("codDescuento").value.length>0)){if(exp_regular2.test(document.getElementById("codDescuento").value)){if(exp_regular1.test(document.getElementById("codDescuento").value)){alertTextoIdioma("ALERT_COD_DESCUENTO");document.getElementById("codDescuento").focus();return false;}else{alertTextoIdioma("ALERT_COD_DESCUENTO");document.getElementById("codDescuento").focus();return false;}}
if(exp_regular1.test(document.getElementById("codDescuento").value)){alertTextoIdioma("ALERT_COD_DESCUENTO");document.getElementById("codDescuento").focus();return false;}}
if(document.getElementById("cochesFechaIni").value==""){alertTextoIdioma("ALERFECHARECOGIDA");document.getElementById("cochesFechaIni").focus();return false;}else if(document.getElementById("cochesFechaFin").value==""){alertTextoIdioma("ALERFECHADEVOLUCION");document.getElementById("cochesFechaFin").focus();return false;}
var a='';var dia='';var mes='';var anyo='';document.getElementById("cochesFechaIni").value;dia=a.split("/")[0];mes=a.split("/")[1];anyo=a.split("/")[2];var seleccionadoIda=new Date(anyo,mes-1,dia);a=document.getElementById("cochesFechaFin").value;dia=a.split("/")[0];mes=a.split("/")[1];anyo=a.split("/")[2];var seleccionadoVuelta=new Date(anyo,mes-1,dia);var auxfec2=new Date(document.getElementById("anioFechaActual").value+"/"+document.getElementById("mesFechaActual").value+"/"+document.getElementById("diaFechaActual").value);var horaIni=document.getElementById("cochesHoraIni").value;var horaIaux=horaIni.substring(0,2);var minutosIaux=horaIni.substring(3,5);var horaFin=document.getElementById("cochesHoraFin").value;var horaFaux=horaFin.substring(0,2);var minutosFaux=horaFin.substring(3,5);var horaActual=document.getElementById("horaActual").value;var minutosActual=document.getElementById("minutosActual").value;if((seleccionadoIda.getFullYear()==auxfec2.getFullYear())&&(seleccionadoIda.getMonth()==auxfec2.getMonth())&&(seleccionadoIda.getDate()==auxfec2.getDate())&&(horaIaux<horaActual)){alertTextoIdioma("ALERHORA");return false;}else if((seleccionadoIda.getFullYear()==auxfec2.getFullYear())&&(seleccionadoIda.getMonth()==auxfec2.getMonth())&&(seleccionadoIda.getDate()==auxfec2.getDate())&&(horaIaux==horaActual)&&(minutosIaux<minutosActual)){alertTextoIdioma("ALERHORA");return false;}
if((seleccionadoVuelta.getFullYear()==auxfec2.getFullYear())&&(seleccionadoVuelta.getMonth()==auxfec2.getMonth())&&(seleccionadoVuelta.getDate()==auxfec2.getDate())&&(horaFaux<horaActual)){alertTextoIdioma("ALERHORA2");return false;}else if((seleccionadoVuelta.getFullYear()==auxfec2.getFullYear())&&(seleccionadoVuelta.getMonth()==auxfec2.getMonth())&&(seleccionadoVuelta.getDate()==auxfec2.getDate())&&(horaFaux==horaActual)&&(minutosFaux<minutosActual)){alertTextoIdioma("ALERHORA2");return false;}
var resta=restaHoras(horaFin,horaIni);if((horaIni>=horaFin)&&(seleccionadoIda==auxfec2)){alertTextoIdioma("ALERHORA3");return false;}else if((horaIni==horaFin)&&(seleccionadoVuelta==auxfec2)){alertTextoIdioma("ALERHORA4");return false;}else if((resta<"02:00")&&(seleccionadoIda==seleccionadoVuelta)){alertTextoIdioma("ALERHORA5");return false;}
return true;}
function pintarDesZonaCoche(descripcionZonaCoche,login){var str="";str+='<input onkeyup="return b25.Suggest.handleActivity(this,\'COCHE,;,\'+document.getElementById(\'codcve\').value,document.getElementById(\'cochesCodZge\'),login)" onkeydown="return b25.Suggest.handleKeyNav(event||window.event)" ';str+='onfocus="javascript:cerrarCapas();b25.Suggest.handleActivity(this,\'COCHE,;,\'+document.getElementById(\'codcve\').value,document.getElementById(\'cochesCodZge\'),login)"';str+=' onblur="b25.Suggest.__hidePopup();actualizarDevolucion();" ';str+='autocomplete="off" type="text" class="texto_formu_3_a" name="descripcionZonaCoche" id="descripcionZonaCoche" value="'+descripcionZonaCoche+'" >';escribe("function_pintarDesZonaCoche",str);}
function pintarLupitaCoche(contextPath,dirImages){var str="";str+='<div class="filabuscador_3"><div class="lupita"><a href="javascript:abrirDiccionario(\'COCHE,;,\'+document.getElementById(\'codcve\').value,\'\',\'\',\'\',\'cochesCodZge\',\'descripcionZonaCoche\',\'\');" title="&Iacute;ndice Geogr&aacute;fico de Pa&iacute;ses" tabIndex=9999><img border="0" id="lupaCoche" src="'+contextPath+'/appBase/images/'+dirImages+'/lupa.gif\"></a></div></div>';escribe("function_pintarLupitaCoche",str);}
function pintarCochesFechaIni(cochesFechaIni,login,diasAntelacionCoche,CAPARECOGCOCHE){var str="";str+='<input type="text" class="texto_formu_1_a"  name="cochesFechaIni" id="cochesFechaIni" value="'+cochesFechaIni+'" readonly ';str+="onFocus=\"javascript:cerrarCapas();javascript:abrirCalendario('"+login+"',this.id,'"+CAPARECOGCOCHE+"',\'2\',\'\',this.value,'"+diasAntelacionCoche+"',\'cocheSelDiaRecogida\',\'COC\');\">";escribe("function_pintarCochesFechaIni",str);}
function pintarCochesFechaFin(cochesFechaFin,login){var str="";str+='<input type="text" class="texto_formu_1_a"  name="cochesFechaFin" id="cochesFechaFin" value="'+cochesFechaFin+'" readonly ';str+="onFocus=\"javascript:firstIdaCoche('"+login+"');\">";escribe("function_pintarCochesFechaFin",str);}