	/*  Muestra y oculta las pax options en el formulario de busqueda */
	function viewMorePaxes() {	
		// el time out es para resolver un fallo del Internet Explorer
	 	if (document.getElementById("morepaxes").style.visibility == "hidden") {
			document.getElementById("morepaxes").style.position = "relative";
			setTimeout ('document.getElementById("morepaxes").style.visibility = "visible"', 0);

			document.getElementById("imgMorepaxes1").style.visibility = "hidden";
			document.getElementById("imgMorepaxes1").style.display = "none";
			document.getElementById("imgMorepaxes2").style.visibility = "visible";
			document.getElementById("imgMorepaxes2").style.display = "block";

			paxOptions = true;
	 	} else {
			document.getElementById("morepaxes").style.position = "absolute";
			setTimeout ('document.getElementById("morepaxes").style.visibility = "hidden"', 0);

			document.getElementById("imgMorepaxes2").style.visibility = "hidden";
			document.getElementById("imgMorepaxes2").style.display = "none";
			document.getElementById("imgMorepaxes1").style.visibility = "visible";
			document.getElementById("imgMorepaxes1").style.display = "block";

			paxOptions = false;
		}
	}



	/*  Muestra y oculta los detalles de los m?dulos de disponibilidad */
	function viewDetails(index) {
		// el time out es para resolver un fallo del Internet Explorer
	 	if (document.getElementById("module_" + index).style.visibility == "hidden") {
			document.getElementById("module_" + index).style.position = "relative" ;
			setTimeout ('document.getElementById("module_' + index + '").style.visibility = "visible"', 0);
			document.getElementById("ico_" + index).src = "corporate/home/images/ico_minus.gif" ;
	 	} else {
			document.getElementById("module_" + index).style.position = "absolute" ;
			setTimeout ('document.getElementById("module_' + index + '").style.visibility = "hidden"', 0);
			document.getElementById("ico_" + index).src = "corporate/home/images/ico_plus.gif" ;
		}
	}


	/*  Muestra y oculta los detalles de los m?dulos del carro*/
	function viewCartDetails(index) {
		// el time out es para resolver un fallo del Internet Explorer
	 	if (document.getElementById("module_" + index).style.visibility == "hidden") {
			document.getElementById("total_" + index).style.position = "absolute" ;
			setTimeout ('document.getElementById("total_' + index + '").style.visibility = "hidden"', 0);
			document.getElementById("module_" + index).style.position = "relative" ;
			setTimeout ('document.getElementById("module_' + index + '").style.visibility = "visible"', 0);
	 	} else {
			document.getElementById("module_" + index).style.position = "absolute" ;
			setTimeout ('document.getElementById("module_' + index + '").style.visibility = "hidden"', 0);
			document.getElementById("total_" + index).style.position = "relative" ;
			setTimeout ('document.getElementById("total_' + index + '").style.visibility = "visible"', 0);
		}
	}

	/*  Muestra y oculta los pop-up de anuncios */
	function viewAdvert(index) {
	 	if (document.getElementById("advert_" + index).style.visibility == "hidden") {
			document.getElementById("advert_" + index).style.visibility = "visible" ;
			setTimeout ('document.getElementById("advert_' + index + '").style.visibility = "hidden"', 10000); // 10 segundos
	 	} else {
			document.getElementById("advert_" + index).style.visibility = "hidden" ;
		}
	}

	/*  Valida y calcula el n?mero total de paxes de la reserva */
	var numAdults = 0;
    var numUnidades = 0 ;
    var numChilds = 0;
	function sumPaxes(form) {
		var total;
		// primera linea
		if (isNaN(form.i_pax1_0.value)) {
			alert (fun_key953);
			form.i_pax1_0.focus();
			return;
		} else {
			if (!eval(form.i_pax1_0.value)) {
				pax1_0 = 0;
			} else {
				pax1_0 = eval(form.i_pax1_0.value);
			}
		}
		if (isNaN(form.i_pax2_0.value)) {
			alert (fun_key953);
			form.i_pax2_0.focus();
			return;
		} else {
			if (!eval(form.i_pax2_0.value)) {
				pax2_0 = 0;
			} else {
				pax2_0 = eval(form.i_pax2_0.value);
			}
		}
		if (isNaN(form.i_pax3_0.value)) {
			alert (fun_key953);
			form.i_pax3_0.focus();
			return;
		} else {
			if (!eval(form.i_pax3_0.value)) {
				pax3_0 = 0;
			} else {
				pax3_0 = eval(form.i_pax3_0.value);
			}
		}
		if (isNaN(form.i_pax4_0.value)) {
			alert (fun_key953);
			form.i_pax4_0.focus();
			return;
		} else {
			if (!eval(form.i_pax4_0.value)) {
				pax4_0 = 0;
			} else {
				pax4_0 = eval(form.i_pax4_0.value);
			}
		}
		if (isNaN(form.i_pax1_1.value)) {
			alert (fun_key953);
			form.i_pax1_1.focus();
			return;
		} else {
			if (!eval(form.i_pax1_1.value)) {
				pax1_1 = 0;
			} else {
				pax1_1 = eval(form.i_pax1_1.value);
			}
		}
		if (isNaN(form.i_pax2_1.value)) {
			alert (fun_key953);
			form.i_pax2_1.focus();
			return;
		} else {
			if (!eval(form.i_pax2_1.value)) {
				pax2_1 = 0;
			} else {
				pax2_1 = eval(form.i_pax2_1.value);
			}
		}
		if (isNaN(form.i_pax2_2.value)) {
			alert (fun_key953);
			form.i_pax2_2.focus();
			return;
		} else {
			if (!eval(form.i_pax2_2.value)) {
				pax2_2 = 0;
			} else {
				pax2_2 = eval(form.i_pax2_2.value);
			}
		}
		if (isNaN(form.i_pax3_1.value)) {
			alert (fun_key953);
			form.i_pax3_1.focus();
			return;
		} else {
			if (!eval(form.i_pax3_1.value)) {
				pax3_1 = 0;
			} else {
				pax3_1 = eval(form.i_pax3_1.value);
			}
		}
		// segunda linea
		if (isNaN(form.i_pax2_3.value)) {
			alert (fun_key953);
			form.i_pax2_3.focus();
			return;
		} else {
			if (!eval(form.i_pax2_3.value)) {
				pax2_3 = 0;
			} else {
				pax2_3 = eval(form.i_pax2_3.value);
			}
		}
		if (isNaN(form.i_pax3_2.value)) {
			alert (fun_key953);
			form.i_pax3_2.focus();
			return;
		} else {
			if (!eval(form.i_pax3_2.value)) {
				pax3_2 = 0;
			} else {
				pax3_2 = eval(form.i_pax3_2.value);
			}
		}
		if (isNaN(form.i_pax4_1.value)) {
			alert (fun_key953);
			form.i_pax4_1.focus();
			return;
		} else {
			if (!eval(form.i_pax4_1.value)) {
				pax4_1 = 0;
			} else {
				pax4_1 = eval(form.i_pax4_1.value);
			}
		}
		if (isNaN(form.i_pax5_0.value)) {
			alert (fun_key953);
			form.i_pax5_0.focus();
			return;
		} else {
			if (!eval(form.i_pax5_0.value)) {
				pax5_0 = 0;
			} else {
				pax5_0 = eval(form.i_pax5_0.value);
			}
		}
		// tercera linea
		if (isNaN(form.i_pax2_4.value)) {
			alert (fun_key953);
			form.i_pax2_4.focus();
			return;
		} else {
			if (!eval(form.i_pax2_4.value)) {
				pax2_4 = 0;
			} else {
				pax2_4 = eval(form.i_pax2_4.value);
			}
		}
		if (isNaN(form.i_pax3_3.value)) {
			alert (fun_key953);
			form.i_pax3_3.focus();
			return;
		} else {
			if (!eval(form.i_pax3_3.value)) {
				pax3_3 = 0;
			} else {
				pax3_3 = eval(form.i_pax3_3.value);
			}
		}
		if (isNaN(form.i_pax4_2.value)) {
			alert (fun_key953);
			form.i_pax4_1.focus();
			return;
		} else {
			if (!eval(form.i_pax4_2.value)) {
				pax4_2 = 0;
			} else {
				pax4_2 = eval(form.i_pax4_2.value);
			}
		}
		if (isNaN(form.i_pax5_1.value)) {
			alert (fun_key953);
			form.i_pax5_1.focus();
			return;
		} else {
			if (!eval(form.i_pax5_1.value)) {
				pax5_1 = 0;
			} else {
				pax5_1 = eval(form.i_pax5_1.value);
			}
		}
		if (isNaN(form.i_pax6_0.value)) {
			alert (fun_key953);
			form.i_pax6_0.focus();
			return;
		} else {
			if (!eval(form.i_pax6_0.value)) {
				pax6_0 = 0;
			} else {
				pax6_0 = eval(form.i_pax6_0.value);
			}
		}
		total  = pax1_0*1 + pax2_0*2 + pax3_0*3 + pax4_0*4 + pax1_1*2 + pax2_1*3 + pax2_2*4 + pax3_1*4;
		total += pax2_3*5 + pax3_2*5 + pax4_1*5 + pax5_0*5;
		total += pax2_4*6 + pax3_3*6 + pax4_2*6 + pax5_1*6 + pax6_0*6;
		form.i_totalPax.value = total;
		//calculamos el numero de habitaciones
		numUnidades = pax1_0 + pax2_0 + pax3_0 + pax4_0 + pax1_1 + pax2_1 + pax2_2 + pax3_1;
		numUnidades += pax2_3 + pax3_2 + pax4_1 + pax5_0;
		numUnidades += pax2_4 + pax3_3 + pax4_2 + pax5_1 + pax6_0;
		//calculamos el numero total de adultos
		numAdults  = pax1_0*1 + pax2_0*2 + pax3_0*3 + pax4_0*4;
		numAdults += pax1_1*1 + pax2_1*2 + pax2_2*2 + pax3_1*3;
		numAdults += pax2_3*2 + pax3_2*3 + pax4_1*4 + pax5_0*5;
		numAdults += pax2_4*2 + pax3_3*3 + pax4_2*4 + pax5_1*5 + pax6_0*6;
		//calculamos el numero de childrens
		numChilds = pax1_1*1 + pax2_1*1 + pax2_2*2 + pax3_1*1;
		numChilds += pax2_3*3 + pax3_2*2+ pax4_1*1 ;
		numChilds += pax2_4*4 + pax3_3*3 + pax4_2*2 + pax5_1*1;
	}

	/*  Maporama */
	function viewMap (params) {

	 	if (document.getElementById("divmap").style.visibility == "hidden") {

			// pasar los parametros al mapa
			//document.getElementById("iframemap").src = "maporama.htm";
			document.getElementById("divmap").style.position = "relative";

			setTimeout ('document.getElementById("divmap").style.visibility = "visible"', 0);
			setTimeout ('document.getElementById("iframemap").style.display = "block"', 0);
            document.f_map.submit();
	 	} else {

			document.getElementById("divmap").style.position = "absolute";
			setTimeout ('document.getElementById("divmap").style.visibility = "hidden"', 0);
		}
	}

	/* ViaMichelin */
    function viewMapViaMichelin(language, hotelName, longitude,  latitude, address, city, postalCode)
	{
	    if(document.getElementById("divmap").style.visibility == "hidden")
	    {
	        var url = "http://www.viamichelin.com/b2b2c/" + language + "/dyn/controller/dlPoiAccess";
	        url += "?productId=79984";
            url += "&name=" + hotelName;
            url += "&x=" + longitude;
            url += "&y=" + latitude;
            url += "&Address=" + address;
            url += "&AddressCompl=&City=" + city;
            url += "&CountryCode=&ZIPCode=" + postalCode;
            url += "&Telephone=&Fax=&Email=&Info1=&Info2=&Info3=&Info4=&Info5=";
            url += "&typeZoom=1200&IconFileID=1";
	        setTimeout('document.getElementById("divmap").style.visibility = "visible"', 0);
	        setTimeout('document.getElementById("iframemap").style.display = "block"', 0);
            document.getElementById("iframemap").src = url;
	    }
	    else
	    {
	        document.getElementById("divmap").style.position = "relative";
	        setTimeout('document.getElementById("iframemap").style.display = "none"', 0);
	        setTimeout('document.getElementById("divmap").style.visibility = "hidden"', 0);
	    }
    }

	/* Muestra la vista de zoom in */
	function zoomMapIn (params) {

         document.f_map.h_i_scale.value=params;
          document.f_map.submit();
	}

	/* Muestra la vista de zoom in */
	function zoomMapNormal (params) {


         document.f_map.h_i_scale.value=params;
          document.f_map.submit();

	}

	/* Muestra la vista de zoom in */
	function zoomMapOut (params) {

         document.f_map.h_i_scale.value=params;
          document.f_map.submit();
	}

	/*  Muestra en grande la foto seleccionada */
	function viewPhoto(image) {
		document.getElementById("bigphoto").src = image;
	}

		/*  Muestra el formulario de envio por e-mail */
	function viewMailForm() {
	 	if (document.getElementById("divmail").style.visibility == "hidden") {
				document.getElementById("divmail").style.visibility = "visible";
	 	} else {
				document.getElementById("divmail").style.visibility = "hidden";
		}
	}

	/*  Imprime la p?gina */
	function printPage() {
		window.print();
	}

/*Saca la fecha de la cabecera con el formato de las paginas auxiliares*/
function data_modif()
{
	//Selecci?n de idioma
	var idiI;
	var idioma = strIdi; //esta variable se declara en la pagina desde la cual hagamos la llamada a esta funcion
	if (idioma == 'ALE') idiI = 1;
	else if (idioma == 'ENG') idiI = 2;
	else if (idioma == 'FRA') idiI = 3;
	else idiI = 0;

	Dia= new Date();
	if(document.all)
	{
		document.write(Dia.getDate()+' / '+(arrMes[idiI][Dia.getMonth()])+' / '+Dia.getYear());
	}
	else
	{
		document.write(Dia.getDate()+' / '+(arrMes[idiI][Dia.getMonth()])+' / '+Dia.getFullYear());
	}
}

//funcion que mira que el valor introducido corresponda con un precio
function IsPrice(casilla,mensage) {
               var strValidChars = "0123456789.-";
               var strChar;
             //  if (casilla.value.length == 0) return false;
               for (i = 0; i < casilla.value.length; i++) {
                  strChar = casilla.value.charAt(i);
                  if (strValidChars.indexOf(strChar) == -1) {
                     alert(mensage);
                     casilla.value = '';
                  }
               }
            }

/*INCIO Funciones para el kid layer*/
	/* Muestra  y oculta din?micamente el layer de edades de ni?os */
	// parametros necesarios para cargar el layer de los kids
      var paxOptions = false;
      var numPaxes = 0;
      var numRooms = 0;

	function viewKids(page, textsup, rooms, ages, buttoncont, buttoncancel, textinf, ftform,feform) {
		var DivRef = document.getElementById('divkids');
		var DivRefBody = document.getElementById('divBody');
		if (document.getElementById("divkids").style.display == "none") {
		    pax1_1 = eval("document." + ftform +".i_pax1_1").value;
			pax2_1 = eval("document." + ftform +".i_pax2_1").value;
			pax2_2 = eval("document." + ftform +".i_pax2_2").value;
			pax3_1 = eval("document." + ftform +".i_pax3_1").value;
			pax2_3 = eval("document." + ftform +".i_pax2_3").value;
			pax3_2 = eval("document." + ftform +".i_pax3_2").value;
			pax4_1 = eval("document." + ftform +".i_pax4_1").value;
			pax2_4 = eval("document." + ftform +".i_pax2_4").value;
			pax3_3 = eval("document." + ftform +".i_pax3_3").value;
			pax4_2 = eval("document." + ftform +".i_pax4_2").value;
			pax5_1 = eval("document." + ftform +".i_pax5_1").value;
			DivRef.innerHTML = generateKidsLayer(textsup, rooms, ages, buttoncont, buttoncancel, textinf, ftform, feform);
			DivRef.style.display = "block";
			DivRefBody.style.display = "none";

		} else {
			DivRef.style.display = "none";
			DivRefBody.style.display = "block"
		}

	}

  function copyKidsFormToFe(ftform,feform)  {

        var valor = '';
        for (atributos = 0; atributos < eval("document."+ftform+".length"); atributos ++){
            valor = eval("document."+ftform+".elements["+atributos+"]").name;
            if (valor.substring(0,6) == 'kid1_1'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax1_1").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                }
            }
            if (valor.substring(0,6) == 'kid2_1'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax2_1").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid2_2'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax2_2").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid3_1'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax3_1").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid2_3'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                   eval("document."+feform+".h_i_agepax2_3").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                }
           }
            if (valor.substring(0,6) == 'kid3_2'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax3_2").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid4_1'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax4_1").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid2_4'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax2_4").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid3_3'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax3_3").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid4_2'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax4_2").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
            if (valor.substring(0,6) == 'kid5_1'){
                if (eval("document."+ftform+".elements["+atributos+"]").value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    eval("document."+feform+".h_i_agepax5_1").value += eval("document."+ftform+".elements["+atributos+"]").value + '_';
                 }
            }
        }
         //returnAllElements(document.fe_search);
        eval("document."+feform).submit();
    }

        function resetAgeFe(feform)  {
           eval("document." + feform + ".h_i_agepax1_1").value = '';
           eval("document." + feform + ".h_i_agepax2_1").value = '';
           eval("document." + feform + ".h_i_agepax2_2").value = '';
           eval("document." + feform + ".h_i_agepax3_1").value = '';
           eval("document." + feform + ".h_i_agepax2_3").value = '';
           eval("document." + feform + ".h_i_agepax3_2").value = '';
           eval("document." + feform + ".h_i_agepax4_1").value = '';
           eval("document." + feform + ".h_i_agepax2_4").value = '';
           eval("document." + feform + ".h_i_agepax3_3").value = '';
           eval("document." + feform + ".h_i_agepax4_2").value = '';
           eval("document." + feform + ".h_i_agepax5_1").value = '';
        }

	// Genera el contenido del layer de edades de ni?os
	function generateKidsLayer(textsup, rooms, ages, buttoncont, buttoncancel, textinf,ftform,feform) {
	    var v_ftform = "'f_kids'";   //formulario de los kids
	    var v_feform = "'" + feform + "'";  //formulario de envio
		var code= "";
        code += '<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">';
        code += '<tr>';
        code += '<td colspan="4">&nbsp;</td>';
        code += '</tr>';
        code += '<tr>';
        code += '<td colspan="4" align="left" class="textostandarbold">'+ textsup +'</td>';
		code += '</tr>';
        code += '<tr>';
        code += '<td colspan="4">&nbsp;</td>';
        code += '</tr>';
        code += '<tr>';
        code += '<td width="150" height="20">&nbsp;</td>';
        code += '<td width="100" align="left" class="motortit">'+rooms+'</td>';
        code += '<td width="200" align="left" class="motortit">'+ages+'</td>';
        code += '<td width="50">&nbsp;</td>';
        code += '</tr>';
		for(i=0; i<pax1_1; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax1_1.gif" class="munecos"  /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid1_1_' + i + '" id="kid1_1_' + i + '" type="text" onBlur="javascript:isNumber(this)" /></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax2_1; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax2_1.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid2_1_' + i + '" id="kid2_1_' + i + '" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax2_2; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax2_2.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid2_2_' + i + '_0" id="kid2_2_' + i + '_0" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid2_2_' + i + '_2" id="kid2_2_' + i + '_2" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax3_1; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax3_1.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid3_1_' + i + '" id="kid3_1_' + i + '" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax2_3; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax2_3.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid2_3_' + i + '_0" id="kid2_3_' + i + '_0" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid2_3_' + i + '_1" id="kid2_3_' + i + '_1" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid2_3_' + i + '_2" id="kid2_3_' + i + '_2" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax3_2; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax3_2.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid3_2_' + i + '_0" id="kid3_2_' + i + '_0" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid3_2_' + i + '_1" id="kid3_2_' + i + '_1" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax4_1; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax4_1.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid4_1_' + i + '" id="kid4_1_' + i + '" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax2_4; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax2_4.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid2_4_' + i + '_0" type="text"/>';
			code += ' <input size="2" class="formmotor" name="kid2_4_' + i + '_1" id="kid2_4_' + i + '_1" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid2_4_' + i + '_2" id="kid2_4_' + i + '_2" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid2_4_' + i + '_3" id="kid2_4_' + i + '_3" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax3_3; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax3_3.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid3_3_' + i + '_0" id="kid3_3_' + i + '_0" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid3_3_' + i + '_1" id="kid3_3_' + i + '_1" type="text"  onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid3_3_' + i + '_2" id="kid3_3_' + i + '_2" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax4_2; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax4_2.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid4_2_' + i + '_0" id="kid4_2_' + i + '_0" type="text" onBlur="javascript:isNumber(this)"/>';
			code += ' <input size="2" class="formmotor" name="kid4_2_' + i + '_1" id="kid4_2_' + i + '_1" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
		for(i=0; i<pax5_1; i++) {
			code += '<tr>';
			code += '<td height="20">&nbsp;</td>';
			code += '<td align="left"><img src="corporate/home/images/ico_pax5_1.gif" class="munecos" /></td>';
			code += '<td align="left"><input size="2" class="formmotor" name="kid5_1_' + i + '" id="kid5_1_' + i + '" type="text" onBlur="javascript:isNumber(this)"/></td>';
			code += '<td>&nbsp;</td>';
			code += '</tr>';
		}
      code += '<tr>';
      code += '<td colspan="4">&nbsp;</td>';
      code += '</tr>';
	  code += '<tr>';
      code += '<td colspan="4" align="right"><input type="button" class="botonreset" value="   '+buttoncancel+'   " onclick="javascript: viewKids();"> <input type="button" class="botonaddcart" value=" '+buttoncont+' " onclick="javascript:resetAgeFe('+v_feform+');copyKidsFormToFe('+v_ftform+','+v_feform+');"></td>';
	  code += '</tr>';
      code += '<tr>';
      code += '<td colspan="4">&nbsp;</td>';
      code += '</tr>';
      code += '<tr>';
      code += '<td colspan="4" align="left" class="textostandar">'+ textinf +'</td>';
	  code += '</tr>';
      code += '<tr>';
      code += '<td colspan="4">&nbsp;</td>';
      code += '</tr>';
      code += '</table>';
     // code += '</form>'
      return (code);
	}
/*FIN Funciones kid layer*/

/*para la validacion de emails*/
function validaEmail(valor) {
    var cadena = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    if (valor.match(cadena) == null) return false;
    return true;

}
     /*llama a la funcion validaEmail que si nos devuelve false nos mostrara el alert y pondra el foco
     en el input email con el fin de obligar a inttroducir un mail correcto*/
function compruebaEmail(campo){
   if (!validaEmail(campo.value)){
        alert(fun_key946);
        campo.value="";
        campo.focus();
        return false;
   }
   return true;
}

 function esNumero(obj){
                  var ascii = null;
                  for ( var i = 0 ; i < obj.length ; i ++ ){
                         ascii = obj.charCodeAt(i);
                         if ( ascii < 48 || ascii > 57 )
                              return false;
                         }
                  return true;
 }

   /*       function vHotel (hotel,contract) {
               if (hotel==""){
                    var url =  "hb_hotelFactSheet_Special.jsp";
                    var width = "630";
                    var height = "320";
                    var dateAux = document.refine.h_i_from.value;
                    var any = dateAux.substring(0,4);
                    var mes = dateAux.substring(4,6);
                    var dia = dateAux.substring(6,8);
                    var date = dia+'/'+mes+'/'+any;
                    url += "?h_i_hotelcode=" + contract;
                    url += "&h_i_from=" + date;
                    window.open(url, '', 'menubar=no,scrollbars=no,width='+width+',height='+height);

               }else{
                   document.refine.h_fdestino.value = "hb_hotelFactSheet.jsp";
                   document.refine.h_i_hotelcode.value = hotel;
                   document.refine.page.value = '1';
                   document.refine.submit();
               }
      }
      */
        /*se utiliza para el listado de acc de la pantalla disponibilidad,
                el de la pantalla de listahotel y la de shopping*/
                function vHotel (hotel,form) {
                         form.h_fdestino.value = "hb_hotelFactSheet.jsp";
                         form.h_i_accommodation.value = hotel;                         
                         form.submit();
            }
                     
         /*funcion utilizada para el apartado de hotel publicidad 3*/
          function pHotel (hotel,contract,date) {

               if ((hotel=="")||(hotel=='null')){
                    var url =  "hb_hotelFactSheet_Special.jsp";
                    var width = "630";
                    var height = "320";
                    var dateAux = date;
                    var any = dateAux.substring(0,4);
                    var mes = dateAux.substring(4,6);
                    var dia = dateAux.substring(6,8);
                    var dateAux2 = dia+'/'+mes+'/'+any;
                    url += "?h_i_hotelcode=" + contract;
                    url += "&h_i_from=" + dateAux2;
                    window.open(url, '', 'menubar=no,scrollbars=no,width='+width+',height='+height);

               }else{
                    document.f_confirm.h_fdestino.value = "hb_hotelFactSheet.jsp";
                    document.f_confirm.h_i_hotelcode.value = hotel;
                    document.f_confirm.page.value = '1';
                    document.f_confirm.submit();
             }
      }

/*funcion que abre la ventanita de aeropuertos*/
 function abrirTerminal(form,idi,oficina,pOrigen,age_path){
                   /*  parametros
                   form=nembre del formulario sobre el que estan los imputs de aeropuerto
                   idi = idioma, lo recuperamos del xml
                   oficina = se ha de recuoerar del sml
                   pOrigen = nombre del imput
                   age_path = este por ahora ira vacilo
                   */
                    var pagTerm="hb_searchAero.jsp?idi=" + idi + "&ofi="+oficina+"&campo="+pOrigen+"&age_path="+age_path+"&form="+form;
                    window.open(pagTerm,'_blank','location=no,menubar=no,scrollbars=yes,width=550,height=300,screenX=0,screenY=0,top=0,left=0');
              }

      /*funcion para las edades de los ni?os, comprueba que la edad sea un numero inferior o igual a 18*/
 function isNumber(caja){

     if(isNaN(caja.value)){
        alert(fun_key957);
        caja.value="";
        caja.select();
     }else{
        if(parseInt(caja.value)>18){
             alert(fun_key958);
             caja.value="";
             caja.select();
        }
     }
 }

  	/* Muestra un mensaje de alerta al abandonar la sesion */
	function logoutAlert(text) {
		temp = confirm(text);
		if(temp) {
			window.location.href = 'hb_logout.jsp';
		}
	}

//funciones de quenera capa edad ni?os para las paginas con selects de mumero de ni?os
/* Muestra  y oculta din?micamente el layer de edades de ni?os; se usan en INSURANCE y en TICKETS*/
	function viewKids2 (textsup, children, ages, buttoncont, buttoncancel, textinf) {
		var DivRef = document.getElementById('divkids');
		var DivRefBody = document.getElementById('divBody');
		if (document.getElementById("divkids").style.display == "none") {
		    DivRef.innerHTML = generateKidsLayer2(textsup, children, ages, buttoncont, buttoncancel, textinf);
			DivRef.style.display = "block";
			DivRefBody.style.display = "none";

		} else {
			DivRef.style.display = "none";
			DivRefBody.style.display = "block";
		}
	}

	/* Genera el contenido del layer de edades de ni?os para transfers */
	function generateKidsLayer2(textsup, children, ages, buttoncont, buttoncancel, textinf) {
		    var code = "";
            code += '<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">';
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4" align="left" class="textostandarbold">' + textsup + '</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td width="150" height="20">&nbsp;</td>';
            code += '<td width="100" align="left" class="motortit">' + children + '</td>';
            code += '<td width="200" align="left" class="motortit">' + ages + '</td>';
            code += '<td width="50">&nbsp;</td>';
            code += '</tr>';
            for(i=0; i<document.ft_search.s_children.value; i++) {
                code += '<tr>';
                code += '<td height="20">&nbsp;</td>';
                code += '<td align="left"><img src="corporate/home/images/ico_pax0-1.gif" class="munecos" /></td>';
                code += '<td align="left"><input size="2" class="formmotor" name="kid_0_1_' + i + '" type="text" onBlur="javascript:isNumber(this)"/></td>';
                code += '<td>&nbsp;</td>';
                code += '</tr>';
            }
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4" align="right">';
            code += '<input type="button" class="botonreset"  name="cancel" value="   '+buttoncancel+'  " onclick="javascript: viewKids2();">&nbsp;';
            code += '<input type="button" name="confirm" class="botonaddcart" value=" '+buttoncont+' " onclick="javascript:copyKids2();">';            
            code += '</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4" align="left" class="textostandar">' + textinf + '</td>';
            code += '</tr>';
            code += '<tr>';
            code += '<td colspan="4">&nbsp;</td>';
            code += '</tr>';
            code += '</table>';
            return (code);
	}

    function copyKids2()  {
       document.fe_search.h_i_agepax.value = '';
        var valor = '';
        for (atributos = 0; atributos < document.f_kids.length; atributos ++){
            valor = document.f_kids.elements[atributos].name;
            if (valor.substring(0,7) == 'kid_0_1'){
                 if (document.f_kids.elements[atributos].value==""){
                    alert(fun_key956);
                    return;
                 }else{
                    document.fe_search.h_i_agepax.value += document.f_kids.elements[atributos].value + '_';
                 }
            }
        }

        document.fe_search.submit();
    }
    /*fin de genera layes*/

/*Funcion que submita el formulario que nos carga la fucha de los tiquets*/
  function openFicha(code,country,lang,origin, descripcion){
                document.fe_loadFicha.tick.value = code;
                document.fe_loadFicha.pais.value = country;
                document.fe_loadFicha.language.value = lang;
                switch(origin)
                {
                    case 'hb_tic_list.jsp':
                        document.fe_loadFicha.origen.value = 'HTL';
                        break;
                    case 'hb_tic_valuateTicket.jsp':
                        document.fe_loadFicha.origen.value = 'HTV';
                        break;
                    default:
                        document.fe_loadFicha.origen.value = 'HTT';
                }
                document.fe_loadFicha.descripcion.value = descripcion;
                document.fe_loadFicha.submit();
  }

   function cargaOcupacion(occ,id_input){
        /*funcion que se usa para cargar las ocupaciones que viene en el tag de pageInfo en el xml
         - occ el contenido del tag /root/pageInfo/occupancy
         - id_input prefigo de los inputs de la ocupacion de la pagina que llama a esta funcion, es decir (i_pax, o pax ). Generalmente sera i_pax*/
                v_occ = occ.split('#');               
                for (i=0; i < v_occ.length-1; i++){
                    occ_aux = v_occ[i].split('_');
                    RestOccupacy(id_input,occ_aux[1],occ_aux[2],occ_aux[0]);
                }
          }

   function RestOccupacy(id,adultos,ninos,cuantos){
        /*funcion que pasandole el numero de adultos, ni?os y la cantidad de la ocupacion te pone,
        el input de ocupacion el numero que le corresponda , nontando con los datos de entrada el id del input
        - id: prefigo de los inputs de la ocupacion de la pagina que llama a esta funcion, es decir (i_pax, o pax ). Generalmente sera i_pax
        - adultos: numero de adultos de la ocupacion, para montar el id del input
        - ni?os: numero de ni?os de la ocupacion, para montar el id del input
        - cuantos: cantidad de unidades de la ocupacion en cuestion*/
        var target = document.getElementById(id+adultos+'_'+ninos);
        if (target) target.value = cuantos;
   }

   function EscriveOptions(cuantos,seleccionado)
   {
    for(var x = 0; x<cuantos; x++)
        {
        if (x==seleccionado)
                document.write('<option value="' + x + '" selected=selected>' + x + '</option>');
        else
                document.write('<option value="' + x + '">' + x + '</option>');
        }
   }
	/* Muestra un mensaje de alerta al abandonar la modificacion de reservas */
	function quitAlert(serviceLink,mode)
	{
	 
		if (mode =='M')
		{
		temp = confirm(fun_key947);
		} else temp=1;
		if(temp)
		{

		   if (mode =='M') {

		    serviceLink=serviceLink+"&modify_out=yes";
		    window.location.href = serviceLink;
		    }else{

		     window.location.href = serviceLink;
		     }
		}
    }


/*confinto de funciones que restan dos fechas determinadas, devolviendo el numero de dias que hay entre ellas*/
function creaFecha(string) {
		var temp = new Array();
		temp = string.split('/');
		var date;
		date = new Date(temp[2],eval(temp[1])-1,temp[0]);
		return (date);
	}


  	function restaFechas(string1, string2) {
		var date1 = new Date();
		date1 = creaFecha(string1);
		var date2 = new Date();
		date2 = creaFecha(string2);

		// The number of milliseconds in one day
		  if (date2 < date1){
		        //alert(fun_key945);
		        sendIt = false;
		        return;
		   }else {
            var ONE_DAY = 1000 * 60 * 60 * 24

            // Convert both dates to milliseconds
            var date1_ms = date1.getTime()
            var date2_ms = date2.getTime()

            // Calculate the difference in milliseconds
            var difference_ms = Math.max(0, date2_ms - date1_ms)

            // Convert back to days and return
            return Math.round(difference_ms/ONE_DAY)
        }
	}

/*fin restar fechas*/

/* set cursor position */
function setCursorPosition()
{
    for(var formsCounter = 0; formsCounter < document.forms.length; formsCounter++)
    {
        for(var elementsCounter = 0; elementsCounter < document.forms[formsCounter].elements.length; elementsCounter++)
        {
            if(document.forms[formsCounter].elements[elementsCounter].type == 'text')
            {
                document.forms[formsCounter].elements[elementsCounter].focus();
                return;
            }
        }
    }
}


function compruebaIata(iata){
  //alert(iata)
    if (iata.indexOf('~')==-1){
        return false;
   }else {
        return true;
   }
   return true;
}

function fechaActual()
{      /*nos devuelve la cehca actual en formato de trabajo (yyymmdd)*/
       var miFechaActual = new Date();
       diaAux = miFechaActual.getDate();
       mesAux = miFechaActual.getMonth();
       dia = '';
       mes = '';
       anyo = miFechaActual.getFullYear();
       if (parseInt(diaAux) <= 9 ){
            dia = '0' + diaAux;
       }else{
            dia =  diaAux;
       }
       if (parseInt(mesAux) <= 9 ){
            mes = '0' + (parseInt(mesAux) + 1);
       }else{
            mes =  parseInt(mesAux) + 1;
       }
       fecha = anyo.toString() + mes.toString() + dia.toString();
  return (fecha);
}




function getActualYear(){
       var miFechaActual = new Date();
       anyo = miFechaActual.getFullYear();      
      return (anyo);
}

    function Muestra(id){
            var target = document.getElementById(id);
            if (target.style.display != "block") target.style.display = "block";
          }
    function Oculta(id){
            var target = document.getElementById(id);
            if (target.style.display != "none") target.style.display = "none";
          }
    function addPaxes(pos) {
		var DivRef = document.getElementById('paxes');
        var nombre = document.getElementById('newNombre').value;
        var apellido = document.getElementById('newApell').value;
        var t = document.getElementById('newType').value.split("_");
        var tipo = t[0];
        var edad = t[1];
        var code = generaDivPaxes(pos,nombre,apellido,tipo,edad);

        DivRef.innerHTML += code;

        Muestra("paxes");
        document.getElementById("total").value = paxesTotales;
	}
    function generaDivPaxes(pos, nombre, apellido, tipo, edad)
    {
         var code = "";
         code += '<div id="pax_' + pos + '"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="textostandar">';
         code += '<tr>';
         tipo2 = "'" + tipo + "'";
         code += '   <td width="65" align="center"><input name="leader" type="radio" value="' + pos + '" /></td>';
         code += '   <td width="17" valign="middle"><input name="check' + pos + '" type="checkbox" value="" onclick="suma(this,' + tipo2 + ');" /></td>';
         code += '   <td width="56" valign="middle">Pax ' + pos + '</td>';
         code += '   <td width="131" valign="middle">' + nombre + '<input id="name_' + pos +'" name="name_' + pos +'" type="hidden" class="formmotor" value="' + nombre + '"/></td>';
         code += '   <td width="122">' + apellido + '<input id="surname_' + pos +'" name="surname_' + pos +'" type="hidden" class="formmotor" value="' + apellido + '" /></td>';
         code += '   <td width="38">' + tipo + '<input id="type_' + pos +'" name="type_' + pos +'" type="hidden" class="formmotor" value="' + tipo + '"/></td>';
         code += '   <td width="63">' + edad + '<input type="hidden" id="edad_' + pos +'" name="edad_' + pos +'" value="' + edad + '" class="formmotor" size="2"/></td>';
         code += '   <td width="70">&nbsp;</td>';
         tipo = "'"+ tipo + "'";
         code += '   <td><a href="javascript: delPax(' + pos + ');">Delete</a></td>';
         code += '</tr>';
         code += '</table></div>';
        return code;
    }
      function delPax(pos,tipo)
      {
        document.getElementById("pax_" + pos).innerHTML = "";
      }



function suma(obj, tipo)
{
    if (obj.checked == true){
        if (tipo == "AD") adultos++;
        else childs++;
        obj.value = "S";
     }else if (obj.checked == false) {
        if (tipo == "AD") adultos--;
        else childs--;
        obj.value = "";
      }
}

function displayCapa(capa){
	alert("entra");
				  document.getElementById(capa).style.display="block";
}
// DESDISPLAYA UNA CAPA
function noDisplayCapa(capa){
				  document.getElementById(capa).style.display="none";
}



