/*
\u00e1 -> á
\u00e9 -> é
\u00ed -> í
\u00f3 -> ó
\u00fa -> ú
\u00c1 -> Á
\u00c9 -> É
\u00cd -> Í
\u00d3 -> Ó
\u00da -> Ú
\u00f1 -> ñ
\u00d1 -> Ñ 
Mas caracteres en: http://www.fileformat.info/info/unicode/version/1.1/index.htm
*/
function aplicaseguro(){
	if (document.getElementById('seguro').checked == true){
		document.getElementById('sin').style.display='none'; 
		document.getElementById('con').style.display='block';
	} 
	else {
		document.getElementById('sin').style.display='block';
		document.getElementById('con').style.display='none';
	}
}

var losIds=["D1","D2"];
function muestraDiv(id) { 
    for(a=0;a<losIds.length;a++) 
        document.getElementById( losIds[a] ).style.display="none"; 
        document.getElementById( id ).style.display="block"; 
} 

var losIds2=["B1","B2"]; 
function muestraDiv2(id) {
    for(a=0;a<losIds2.length;a++) 
        document.getElementById( losIds2[a] ).style.display="none";
    document.getElementById( id ).style.display="block";
}

var losIds3=["DTIPO1","DTIPO2"]; 
function muestraDiv3(id) {
    for(a=0;a<losIds3.length;a++) 
        document.getElementById( losIds3[a] ).style.display="none";
    document.getElementById( id ).style.display="block";
}  

function muestracapa(capa1,capa2) {
    document.getElementById( capa2 ).style.display="none"; 
    document.getElementById( capa1 ).style.display="block";
}
 
function enviar_formulario(){ 
   document.calenda.submit()
}

//esta funcion se llama desde dos formularios distintos, en un caso hay que validar la distribucion, en el otro no
function validar_buscar(ValidarDistribucion,Mensaje1,Mensaje2,Mensaje3,Mensaje4,Mensaje5)
{ 
    if((document.calenda.hoy.value.length==0)||(document.calenda.saida.value.length==0)||(document.calenda.Fecha1.value.length==0)||(document.calenda.Fecha2.value.length==0)){
        alert(Mensaje1);
        return false
    };

    if((document.calenda.destino.value=="0") && (document.calenda.nombrehotel.value=='')){
	    alert(Mensaje2);
	    return false
	}
	
    if (document.calenda.nombrehotel.value.length ==1){ 
        alert(Mensaje3);
        return false;
    }
	

	if (ValidarDistribucion==true){
		var sumacombo=0
		var valor=0
		var edad=''
		var correcto='S'
		for (var i=1;i<7;i++)
	    {
	        //sumo el valor de todos los combos
	        sumacombo+=eval("parseFloat(document.calenda.h"+i+"a.value)")
	        
	        switch (i) 
	        {
	            case 1:
	                for (var a=1;a<3;a++)
	                {
	               		valor=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")
	              		 if (valor>0)
	              		 {
							for (var n=1;n<=valor;n++)
							{
								edad=eval("parseFloat(document.calenda.e"+i+"a"+a+"n"+a+n+".value)")
								if (edad=='99'){ correcto='N'}
							}	
	              		 }
	                	sumacombo+=valor
	                };break; 
	            case 2: 
	                for (var a=1;a<5;a++)
	                {
	                	valor=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")
	                	if (valor>0)
	                	{
	                		for (var n=1;n<=valor;n++)
	                		{
	                			edad=eval("parseFloat(document.calenda.e"+i+"a"+a+"n"+a+n+".value)")
								if (edad=='99'){ correcto='N'}
	                		}
	                	}
		                sumacombo+=valor
	                };break;       
	            case 3:
	                for (var a=1;a<4;a++)
	                { 
	                	valor=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")
	                	if (valor>0)
	                	{
	                		for(var n=1;n<=valor;n++)
	                		{
	                			edad=eval("parseFloat(document.calenda.e"+i+"a"+a+"n"+a+n+".value)")
								if (edad=='99'){ correcto='N'}
	                		}
	                	}
	                	sumacombo+=valor
	                };break;       
	            case 4:
	                for (var a=1;a<3;a++)
	                { 
	                	valor=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")
	                	if (valor>0)
	                	{
	                		for(var n=1;n<=valor;n++)
	                		{
	                			edad=eval("parseFloat(document.calenda.e"+i+"a"+a+"n"+a+n+".value)")
								if (edad=='99'){ correcto='N'}
	                		}
	                	}
	                	sumacombo+=valor
	                };break;       
	            case 5:
	                for (var a=1;a<2;a++)
	                {	
	                	valor= eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")
	                	if (valor>0)
	                	{
	                		for(var n=1;n<=valor;n++)
	                		{
	                			edad=eval("parseFloat(document.calenda.e"+i+"a"+a+"n"+a+n+".value)")
								if (edad=='99'){ correcto='N'}
	                		}
	                	}
	                	sumacombo+=valor
	                };break;       
	        }
	    }
	
	   if (sumacombo==0){alert(Mensaje4);return false};
	   if (correcto=='N') {alert(Mensaje5);return false};
	}
	
	document.calenda.method='post';
	document.calenda.action='index.aspx';
	document.calenda.submit();
}



function controlar_habitaciones(Ctrl,numero){ //controla nº de habitaciones
    var sumacombo=0
    var valor=0
     
    for (var i=1;i<7;i++)
    {
        //sumo el valor de todos los combos
        sumacombo+=eval("parseFloat(document.calenda.h"+i+"a.value)")
        
        switch (i) {
            case 1:
                for (var a=1;a<3;a++){sumacombo+=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")};break;
            case 2:
                for (var a=1;a<5;a++){ sumacombo+=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")};break;
            case 3:
                for (var a=1;a<4;a++){ sumacombo+=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")};break;
            case 4:
                for (var a=1;a<3;a++){ sumacombo+=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")};break;
            case 5:
                for (var a=1;a<2;a++){ sumacombo+=eval("parseFloat(document.calenda.h"+i+"a"+a+"n.value)")};break;
        }
    }

    ocultar_edades(numero)

    for (var i=1;i<7;i++){   

        valor=eval("parseFloat(document.calenda.h"+i+"a.value)")
        var num_elementos = numero - sumacombo

        if (valor == 0){
            //borro los options del combo
            eval("document.calenda.h"+i+"a.length=0")
            for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a.options["+e+"]=new Option("+e+","+e+")")}
         }
         else{
            if (Ctrl.name != "h"+i+"a"){
              var ele=numero - sumacombo
              var sel=eval("parseFloat(document.calenda.h"+i+"a.value)") + 1
              var lon=eval("parseFloat(document.calenda.h"+i+"a.length)")


              ele= sel + ele
              if (lon < ele ){
                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a.options["+e+"]=new Option("+e+","+e+")")}
              }
              else{
                eval("document.calenda.h"+i+"a.length="+ele)   
              }
            }
         }
       
         switch (i) {
           case 1:
                for (var j=1;j<3;j++){ 
                    valor=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)")
                    if (valor == 0){ 
                        eval("document.calenda.h"+i+"a"+j+"n.length=0");
                        for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                    }
                    else{
                        if (Ctrl.name != "h"+i+"a"+j+"n"){
                            var ele=numero - sumacombo
                            var sel=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)") + 1
                            var lon=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.length)")
                            ele= sel + ele
                            if (lon < ele ){
                                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                            }
                            else {
                                eval("document.calenda.h"+i+"a"+j+"n.length="+ele)   
                            }
                        }

                        var tiene =eval("document.calenda.h"+i+"a"+j+"n.length") - 1
                        if ( tiene != numero) {
                            for (var g=num_elementos-tiene;g>=0;g--){
                              var insertar=numero - g
                              eval("document.calenda.h"+i+"a"+j+"n.options["+insertar+"]=new Option("+insertar+","+insertar+")") 
                            }
                        }
                        document.getElementById("edades").style.display="block";
                        document.getElementById("1a").style.display="block";
                        for (var z=1;z<=valor;z++){
                            document.getElementById(i+"a"+j+"n"+z).style.display="block";
                        }
                    }
                 };
                 break;  
           case 2: 
                for (var j=1;j<5;j++){
                     valor=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)")
                     if (valor == 0){
                        eval("document.calenda.h"+i+"a"+j+"n.length=0");
                        for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                     }
                     else {
                        if (Ctrl.name != "h"+i+"a"+j+"n") {
                            var ele=numero - sumacombo
                            var sel=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)") + 1
                            var lon=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.length)")
                            ele= sel + ele
                            if (lon < ele ) {
                                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                            }
                            else {
                                eval("document.calenda.h"+i+"a"+j+"n.length="+ele)   
                            }
                        }

                        var tiene =eval("document.calenda.h"+i+"a"+j+"n.length") - 1
                        if ( tiene != numero){
                            for (var g=num_elementos-tiene;g>=0;g--){
                              var insertar=numero - g
                              eval("document.calenda.h"+i+"a"+j+"n.options["+insertar+"]=new Option("+insertar+","+insertar+")") 
                            }
                        }
                        document.getElementById("edades").style.display="block";
                        document.getElementById("2a").style.display="block";
                        for (var z=1;z<=valor;z++){
                            document.getElementById(i+"a"+j+"n"+z).style.display="block";
                        }       
                     }  
                };
                break;
           case 3:
                for (var j=1;j<4;j++) {
                    valor=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)")
                    if (valor == 0){ 
                        eval("document.calenda.h"+i+"a"+j+"n.length=0");
                        for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                    }
                    else{
                        if (Ctrl.name != "h"+i+"a"+j+"n") {
                            var ele=numero - sumacombo
                            var sel=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)") + 1
                            var lon=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.length)")
                            ele= sel + ele
                            if (lon < ele ){
                                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                            }
                            else {
                                eval("document.calenda.h"+i+"a"+j+"n.length="+ele)   
                            }
                        }
                        
                        var tiene =eval("document.calenda.h"+i+"a"+j+"n.length") - 1
                        if ( tiene != numero) {
                            for (var g=num_elementos-tiene;g>=0;g--){
                              var insertar=numero - g
                              eval("document.calenda.h"+i+"a"+j+"n.options["+insertar+"]=new Option("+insertar+","+insertar+")") 
                            }
                        }
                        document.getElementById("edades").style.display="block";
                        document.getElementById("3a").style.display="block";
                        for (var z=1;z<=valor;z++) {
                            document.getElementById(i+"a"+j+"n"+z).style.display="block";
                        }
                    }
                };
                break;
           case 4:
                for (var j=1;j<3;j++){
                    valor=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)")
                    if (valor == 0){ 
                        eval("document.calenda.h"+i+"a"+j+"n.length=0");
                        for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                    }
                    else{
                        if (Ctrl.name != "h"+i+"a"+j+"n"){
                            var ele=numero - sumacombo
                            var sel=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)") + 1
                            var lon=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.length)")
                            ele= sel + ele
                            if (lon < ele ){
                                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                            }
                            else{
                                eval("document.calenda.h"+i+"a"+j+"n.length="+ele)
                            }
                        }

                        var tiene =eval("document.calenda.h"+i+"a"+j+"n.length") - 1
                        if ( tiene != numero){
                            for (var g=num_elementos-tiene;g>=0;g--) {
                              var insertar=numero - g
                              eval("document.calenda.h"+i+"a"+j+"n.options["+insertar+"]=new Option("+insertar+","+insertar+")") 
                            }
                        }
                        document.getElementById("edades").style.display="block";
                        document.getElementById("4a").style.display="block";
                        for (var z=1;z<=valor;z++){
                            document.getElementById(i+"a"+j+"n"+z).style.display="block";
                        }
                    }
                 };
                 break;
           case 5:
                for (var j=1;j<2;j++){ 
                    valor=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)")
                    if (valor == 0){
                        eval("document.calenda.h"+i+"a"+j+"n.length=0");
                        for (var e=0;e<=num_elementos;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                    }
                    else{
                        if (Ctrl.name != "h"+i+"a"+j+"n"){
                            var ele=numero - sumacombo
                            var sel=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.value)") + 1
                            var lon=eval("parseFloat(document.calenda.h"+i+"a"+j+"n.length)")
                            ele= sel + ele
                            if (lon < ele ){
                                for (var e=lon;e<ele;e++){eval("document.calenda.h"+i+"a"+j+"n.options["+e+"]=new Option("+e+","+e+")")}
                            }
                            else{
                                eval("document.calenda.h"+i+"a"+j+"n.length="+ele)
                            }
                        }

                        var tiene =eval("document.calenda.h"+i+"a"+j+"n.length") - 1
                        if ( tiene != numero) {
                            for (var g=num_elementos-tiene;g>=0;g--){
                              var insertar=numero - g
                              eval("document.calenda.h"+i+"a"+j+"n.options["+insertar+"]=new Option("+insertar+","+insertar+")") 
                            }
                        }
                        document.getElementById("edades").style.display="block";
                        document.getElementById("5a").style.display="block";
                        for (var z=1;z<=valor;z++){
                            document.getElementById(i+"a"+j+"n"+z).style.display="block";
                        }
                    }
                };
                break;
           }
     }    
}


function ocultar_edades(numero){
    document.getElementById("edades").style.display="none";

    document.getElementById("3a").style.display="none";
    document.getElementById("4a").style.display="none";
    document.getElementById("5a").style.display="none";

    //1 adulto
    document.getElementById("1a").style.display="none";
    for (var a=1;a<3;a++) {
        for (var i=1;i<=numero;i++){
            document.getElementById("1a"+a+"n"+i).style.display="none";
        }
    }    
    //2 adultos
    document.getElementById("2a").style.display="none";
    for (var a=1;a<5;a++){
        for (var i=1;i<=numero;i++){
            document.getElementById("2a"+a+"n"+i).style.display="none";
        }
    }
    //3 adultos
    document.getElementById("3a").style.display="none";
    for (var a=1;a<4;a++){
        for (var i=1;i<=numero;i++){
            document.getElementById("3a"+a+"n"+i).style.display="none";
        }
    }
    //4 adultos
    document.getElementById("4a").style.display="none";
    for (var a=1;a<3;a++){
        for (var i=1;i<=numero;i++){
            document.getElementById("4a"+a+"n"+i).style.display="none";
        }
    }
    //5 adultos
    document.getElementById("5a").style.display="none";
    for (var a=1;a<2;a++){
        for (var i=1;i<=numero;i++){
            document.getElementById("5a"+a+"n"+i).style.display="none";
        }
    }
}

//marca/desmarca un check de un formulario
function seleccionar(casilla,checkear,PosX,PosY){
	for (i=0;i<document.ajustar.elements.length;i++){
    	if(document.ajustar.elements[i].type == "checkbox"){
    	    if (document.ajustar.elements[i].id==casilla){
    	        poncapa(PosX,PosY);
    		    if (checkear==true){
	        	    if (document.ajustar.elements[i].checked==1){
		        	    document.ajustar.elements[i].checked=0;
		            }
	        	    else{
	        		    document.ajustar.elements[i].checked=1;
	        	    }
	        	}
	        }
	    }
	    //document.ajustar.elements[i].disabled=true;
	}
   	document.ajustar.method='post';
   	document.ajustar.action='index.aspx?PosX='+ PosX + '&PosY=' + PosY;
    document.ajustar.submit();
}

function poncapa(PosX,PosY){
    //creo 2 divs, uno ocupará toda la web (lo que se ve y lo que no) y el otro ocupará solo la pantalla visible y en este segundo centraremos la imagen
    var div_f1 = document.createElement('DIV');
    var div_f2 = document.createElement('DIV');
    
    //le asigno el class
    div_f1.className='semitrans';//translúcida
    div_f2.className='capa';//transparente
     
    //le asigno el id a la ventana
    div_f1.id = 'trans';
    div_f1.name='trans';

    div_f2.id = 'capa2';
    div_f2.name='capa2';

    div_f1.style.left = 0;
    div_f1.style.top = 0;
    div_f1.style.width =  document.body.scrollWidth;
    div_f1.style.height = document.body.scrollHeight;
    
    div_f2.style.left = PosX;
    div_f2.style.top = PosY;
    div_f2.style.width =  document.body.scrollWidth;
    div_f2.style.height = screen.height;
  
    document.body.appendChild(div_f1);
    document.body.appendChild(div_f2);

    //el mensaje pasado por parametro muestro dentro del div
    div_f2.innerHTML ='<TABLE WIDTH="100%" HEIGHT="100%"><TR><TD VALIGN="MIDDLE" ALIGN="CENTER"><img src="../graficos/wait.gif"/></TD></TR>';
}

var capas=["Capa1","Capa2","Capa3","Capa4","Capa5","Capa6","Capa7","Capa8","Capa9","Capa10","Capa11","Capa12","Capa13","Capa14","Capa15","Capa16"];
function ampliar_foto(capa,foto) {
    for(a=0;a<capas.length;a++){
        document.getElementById( capas[a] ).style.display="none";
    }
    document.getElementById( capa ).style.display="block";
    
    img = document.getElementById(foto);
    //Si la imagen es demasiado grande le ponemos un ancho
    //por algún extraño motivo al abrir la ficha del alojamiento la primera vez no es capaz de obtener el tamaño de la imagen por lo tanto la muestra en tamaño natural
    //¿Alguna solución?
    if (img.width > 360){
        img.width = 360;
    }
}



function validarcierrereservas(Mensaje1,Mensaje2){
	 if(document.productos.titular.value==""){
		alert(Mensaje1);
		return false
	 };
	
	 if(document.productos.referencia.value==""){
		alert(Mensaje2);
		return false
	 };

	document.productos.method='post';
	document.productos.action='index.aspx?pag=hacerreserva';
	document.productos.submit();
}

function muestracapapresupuesto(Correo,seguro,PosX,PosY,Titulo,PorImpresora,Imprimir,PorCorreo,Enviar,Cerrar,Aviso,Mensaje1,Mensaje2){
    //creo 2 divs, uno ocupará toda la web (lo que se ve y lo que no) y el otro ocupará solo la pantalla visible y en este segundo centraremos la imagen
    var div_f1 = document.createElement('DIV');
    var div_f2 = document.createElement('DIV');
    
    //le asigno el class
    div_f1.className='capapresusemitrans';//translúcida
    div_f2.className='capapresu';//transparente
     
    //le asigno el id a la ventana
    div_f1.id = 'capapresupuesto1';
    div_f1.name='capapresupuesto1';

    div_f2.id = 'capapresupuesto2';
    div_f2.name='capapresupuesto2';

    div_f1.style.left = 0;
    div_f1.style.top = 0;
    div_f1.style.width = document.body.scrollWidth;
    div_f1.style.height = document.body.scrollHeight;

    div_f2.style.left = ((document.body.scrollWidth / 2) - (250));
	div_f2.style.top = ((document.body.scrollHeight / 2) - (150));
    div_f2.style.width = 500
    
    document.body.appendChild(div_f1);
    document.body.appendChild(div_f2);

    if (Correo!=''){
        div_f2.innerHTML ='<table title=\'' + Correo + '\'border=0 width=500 id=table7 cellspacing=0 cellpadding=0><tr><td width=7 background=../graficos/caixa_lateral/fondo_superior_1.gif height=24>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_superior_2.gif><p align=center><font face=Verdana style=font-size: 12px; font-weight: 700 color=#FFFFFF>' + Titulo + '</font></p></td><td width=7 background=../graficos/caixa_lateral/fondo_superior_3.gif>&nbsp;</td></tr><tr><td background=../graficos/caixa_lateral/fondo_medio_1.gif>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_medio_2.gif height=200><div align=center><table border=0 width=90% cellspacing=0 cellpadding=0><tr><td><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + PorImpresora + '</td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b><a href=../aloxamento/presuposto.aspx?seguro=' + seguro + ' target=_blank class=menu_p>' + Imprimir + '</a></td><td class=boton_1_c></td></tr></table></div></td></tr></table></td></tr><tr><td height=26>&nbsp;</td></tr><tr><td><form name=enviar><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + PorCorreo + '</p></td><td><p style=margin-right: 12px><input type=text name=correo size=30 class=input_1 ></p></td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b><a href=# onclick=EnviaPresupuesto(document.enviar.elements[\'correo\'].value,' + seguro + ',\'' + Mensaje1 + '\',\'' + Mensaje2 + '\'); class=menu_p>' + Enviar + '</a></td><td class=boton_1_c></td></tr></table></div></td></tr></table></form></td></tr><tr><td height=40 valign=bottom><div align=center><table border=0 cellspacing=0 cellpadding=0 id=table18><tr><td class=boton_pedir onclick=quitaCapa(\'capapresupuesto1\');quitaCapa(\'capapresupuesto2\');><a href="javascript:void(0);" class="marino">' + Cerrar + '</a></td></tr></table></div></td></tr></table></div></td><td background=../graficos/caixa_lateral/fondo_medio_3.gif>&nbsp;</td></tr><tr><td height=7 background=../graficos/caixa_lateral/fondo_inferior_1.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_2.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_3.gif></td></tr></table>';
    }
    else{
        div_f2.innerHTML ='<table title=\'' + Aviso + '\' border=0 width=500 id=table7 cellspacing=0 cellpadding=0><tr><td width=7 background=../graficos/caixa_lateral/fondo_superior_1.gif height=24>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_superior_2.gif><p align=center><font face=Verdana style=font-size: 12px; font-weight: 700 color=#FFFFFF>' + Titulo + '</font></p></td><td width=7 background=../graficos/caixa_lateral/fondo_superior_3.gif>&nbsp;</td></tr><tr><td background=../graficos/caixa_lateral/fondo_medio_1.gif>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_medio_2.gif height=200><div align=center><table border=0 width=90% cellspacing=0 cellpadding=0><tr><td><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + PorImpresora + '</td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b><a href=../aloxamento/presuposto.aspx?seguro=' + seguro + ' target=_blank class=menu_p>' + Imprimir + '</a></td><td class=boton_1_c></td></tr></table></div></td></tr></table></td></tr><tr><td height=26>&nbsp;</td></tr><tr><td><form name=enviar><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + PorCorreo + '</p></td><td><p style=margin-right: 12px><input type=text name=correo size=30 class=input_1 disabled=disabled></p></td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b_disabled>' + Enviar + '</td><td class=boton_1_c></td></tr></table></div></td></tr></table></form></td></tr><tr><td height=40 valign=bottom><div align=center><table border=0 cellspacing=0 cellpadding=0 id=table18><tr><td class=boton_pedir onclick=quitaCapa(\'capapresupuesto1\');quitaCapa(\'capapresupuesto2\');><a href="javascript:void(0);" class="marino">' + Cerrar + '</a></td></tr></table></div></td></tr></table></div></td><td background=../graficos/caixa_lateral/fondo_medio_3.gif>&nbsp;</td></tr><tr><td height=7 background=../graficos/caixa_lateral/fondo_inferior_1.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_2.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_3.gif></td></tr></table>';
    }
}

function EnviaPresupuesto(CorreoDestino,seguro,Mensaje1,Mensaje2){
    //verificamos que el correo tenga el formato correcto: una arroba y un punto almenos

    if (CorreoDestino==''){
        alert(Mensaje1);
        return false;
    }
    
    var existearroba='false';
    var existepunto='false';
    for(i=0; i<CorreoDestino.length; i++){
        if (CorreoDestino.charAt(i)=='@'){
          existearroba='true';
          break;
       }
    }
    
    for(i=0; i<CorreoDestino.length; i++){
        if (CorreoDestino.charAt(i)=='.'){
          existepunto='true';
          break;
       }
    }

    if (existearroba=='false' || existepunto=='false'){
        alert(Mensaje2);
        return false;
    }
   
    document.enviar.method='post';
	document.enviar.action='../aloxamento/presuposto.aspx?enviar=' + CorreoDestino+ '&seguro=' + seguro;
	document.enviar.submit();
}

function overTD(td,color){td.bgColor=color;}
 
function outTD(td,color){td.style.cursor='default';td.bgColor=color;} 

function ValidarBuscarRes(MensajeNoCliente,MensajeNoAlojamiento,MensajeNoLocata,MensajeNoReferencia,MensajeCaracteresExtranos){

    switch (document.listado.RBP.value){ 
        case 'NC':
            if (document.listado.TB.value==''){
                alert(MensajeNoCliente);
                document.listado.TB.focus();
                return false;
            }
            for(i=0; i<document.listado.TB.value.length; i++){
               if (document.listado.TB.value.charAt(i)=='%'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\''){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\"'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='*'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='+'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
            }

        case 'NA':
            if (document.listado.TB.value==''){
                alert(MensajeNoAlojamiento);
                document.listado.TB.focus();
                return false;
            }
            for(i=0; i<document.listado.TB.value.length; i++){
               if (document.listado.TB.value.charAt(i)=='%'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\''){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\"'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='*'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='+'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
            }

        case 'LO':
            if (document.listado.TB.value==''){
                alert(MensajeNoLocata);
                document.listado.TB.focus();
                return false;
            }
            for(i=0; i<document.listado.TB.value.length; i++){
               if (document.listado.TB.value.charAt(i)=='%'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\''){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\"'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='*'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='+'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
            }

        case 'LM':
            if (document.listado.TB.value==''){
                alert(MensajeNoReferencia);
                document.listado.TB.focus();
                return false;
            }
            for(i=0; i<document.listado.TB.value.length; i++){
               if (document.listado.TB.value.charAt(i)=='%'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\''){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='\"'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='*'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
               if (document.listado.TB.value.charAt(i)=='+'){
                    alert(MensajeCaracteresExtranos);
                    document.listado.TB.focus();
                    return false;
               }
            }
    }

    document.listado.method='post';
	document.listado.action='index.aspx?pag=list_res';
	document.listado.submit();
}

function ValidarBuscarOfertas(mostrarenportada,MensajeFecha,MensajeDestino){
    
    /*Si no se está mostrando el combo de los eventos validamos las fechas*/
    if (document.buscar_ofertas.HayEventos.value=='False'){
        if (document.buscar_ofertas.Fecha1.value==''){
            alert(MensajeFecha);
            document.buscar_ofertas.Fecha1.focus();
            return false;
        }
        
        /* comprobamos que la fecha es válida */
        re=/^[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]$/
        if(document.buscar_ofertas.Fecha2.value.length==0 || !re.exec(document.buscar_ofertas.Fecha2.value)){
	        alert(MensajeFecha);
	        return false;
        }
        
        var d = new Date()
        /* la función tiene como entrada: año, mes, día */
        d.setFullYear(document.buscar_ofertas.Fecha2.value.substring(6,10),document.buscar_ofertas.Fecha2.value.substring(3,5)-1,document.buscar_ofertas.Fecha2.value.substring(0,2))

        /* ¿el mes del objeto Date es el mes introducido por el usuario? OJO: getMonth() devuelve el número de mes del 0 al 11
           ¿el día del objeto Date es el día introducido por el usuario? OJO: getDate() devuelve el día del mes */
        if(d.getMonth() != document.buscar_ofertas.Fecha2.value.substring(3,5)-1 || d.getDate() != document.buscar_ofertas.Fecha2.value.substring(0,2)){
	        alert(MensajeFecha);
	        return false;
        }
    }
    else{
        /*Si no hay nada seleccionado en el combo de los eventos validamos las fechas*/
        if (document.buscar_ofertas.evento.value=='0|-1'){
            if (document.buscar_ofertas.Fecha1.value==''){
                alert(MensajeFecha);
                document.buscar_ofertas.Fecha1.focus();
                return false;
            }
            
            /* comprobamos que la fecha es válida */
            re=/^[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]$/
            if(document.buscar_ofertas.Fecha2.value.length==0 || !re.exec(document.buscar_ofertas.Fecha2.value)){
	            alert(MensajeFecha);
	            return false;
            }
            
            var d = new Date()
            /* la función tiene como entrada: año, mes, día */
            d.setFullYear(document.buscar_ofertas.Fecha2.value.substring(6,10),document.buscar_ofertas.Fecha2.value.substring(3,5)-1,document.buscar_ofertas.Fecha2.value.substring(0,2))

            /* ¿el mes del objeto Date es el mes introducido por el usuario? OJO: getMonth() devuelve el número de mes del 0 al 11
               ¿el día del objeto Date es el día introducido por el usuario? OJO: getDate() devuelve el día del mes */
            if(d.getMonth() != document.buscar_ofertas.Fecha2.value.substring(3,5)-1 || d.getDate() != document.buscar_ofertas.Fecha2.value.substring(0,2)){
	            alert(MensajeFecha);
	            return false;
            }
        }
    }
    
    if (document.buscar_ofertas.alojamiento.value==''){
        if (document.buscar_ofertas.destino.value=="0"){
	        alert(MensajeDestino);
	        return false;
	    }
    }
    
    document.buscar_ofertas.method='post';
    if (mostrarenportada=='true'){
        document.buscar_ofertas.action='portada.aspx?seccion=resultado_ofertas_in&mostrarenportada=true';
    }
    else{
        document.buscar_ofertas.action='index.aspx?pag=resultado_ofertas_in';
    }
	document.buscar_ofertas.submit();
}

function ValidarImprimirListadoOfertas(Enviar,Correo,PosX,PosY,mostrarenportada,Mensaje,Titulo,TextoCorreo,TextoEnviar,Cerrar,Mensaje2,Mensaje3,EmailOk){

    var AlgunoMarcado = false;

    for (i=0;i<document.listado.elements.length;i++){
    	if(document.listado.elements[i].name == "ofertas"){
    	    if(document.listado.elements[i].type == "checkbox"){
    	        if (document.listado.elements[i].checked==1){
    	            AlgunoMarcado=true;
    	            break;
    	        }
    	    }
	    }
	}

    if (AlgunoMarcado==false){
        alert(Mensaje);
        return false;
    }

    if (Enviar=='true'){
        muestracapaenviolistadoofertas(Correo,PosX,PosY,mostrarenportada,Titulo,TextoCorreo,TextoEnviar,Cerrar,Mensaje2,Mensaje3,EmailOk);
    }
    else{
        if (mostrarenportada=='true'){
            document.listado.action="aloxamento/listado_ofertas_pdf.aspx"
        }
        else{
            document.listado.action="listado_ofertas_pdf.aspx"
        }
        
	    document.listado.submit();
	}
}

function muestracapaenviolistadoofertas(Correo,PosX,PosY,mostrarenportada,Titulo,TextoCorreo,Enviar,Cerrar,MensajeEscribaCorreo,MensajeCorreoIncorrecto,EmailOk){
    //creo 2 divs, uno ocupará toda la web (lo que se ve y lo que no) y el otro ocupará solo la pantalla visible y en este segundo centraremos la imagen
    var div_f1 = document.createElement('DIV');
    var div_f2 = document.createElement('DIV');
    
    //le asigno el class
    div_f1.className='capapresusemitrans';//translúcida
    div_f2.className='capapresu';//transparente
     
    //le asigno el id a la ventana
    div_f1.id = 'capapresupuesto1';
    div_f1.name='capapresupuesto1';

    div_f2.id = 'capapresupuesto2';
    div_f2.name='capapresupuesto2';

    div_f1.style.left = 0;
    div_f1.style.top = 0;
    div_f1.style.width = document.body.scrollWidth;
    div_f1.style.height = document.body.scrollHeight;

    div_f2.style.left = ((screen.width / 2) - (250));
	div_f2.style.top = ((screen.height / 2) - (150));
    div_f2.style.width = 500
    
    document.body.appendChild(div_f1);
    document.body.appendChild(div_f2);

    if (mostrarenportada=='true'){
        div_f2.innerHTML ='<table title=\'' + Correo + '\' border=0 width=500 id=table7 cellspacing=0 cellpadding=0><tr><td width=7 background=graficos/caixa_lateral/fondo_superior_1.gif height=24>&nbsp;</td><td background=graficos/caixa_lateral/fondo_superior_2.gif><p align=center><font face=Verdana style=font-size: 12px; font-weight: 700 color=#FFFFFF>' + Titulo + '</font></p></td><td width=7 background=graficos/caixa_lateral/fondo_superior_3.gif>&nbsp;</td></tr><tr><td background=graficos/caixa_lateral/fondo_medio_1.gif>&nbsp;</td><td background=graficos/caixa_lateral/fondo_medio_2.gif height=200><div align=center><table border=0 width=90% cellspacing=0 cellpadding=0><tr><td height=26>&nbsp;</td></tr><tr><td><form name=enviar><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + TextoCorreo + '</p></td><td><p style=margin-right: 12px><input type=text name=correo size=30 class=input_1 ></p></td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b><a href=# onclick=EnviaListadoOfertas(document.enviar.elements[\'correo\'].value,\'true\',\'' + MensajeEscribaCorreo + '\',\'' + MensajeCorreoIncorrecto + '\',\'' + EmailOk + '\'); class=menu_p>' + Enviar + '</a></td><td class=boton_1_c></td></tr></table></div></td></tr></table></form></td></tr><tr><td height=40 valign=bottom><div align=center><table border=0 cellspacing=0 cellpadding=0 id=table18><tr><td class=boton_pedir onclick=quitaCapa(\'capapresupuesto1\');quitaCapa(\'capapresupuesto2\');><a href="javascript:void(0);" class="marino">' + Cerrar + '</a></td></tr></table></div></td></tr></table></div></td><td background=graficos/caixa_lateral/fondo_medio_3.gif>&nbsp;</td></tr><tr><td height=7 background=graficos/caixa_lateral/fondo_inferior_1.gif></td><td background=graficos/caixa_lateral/fondo_inferior_2.gif></td><td background=graficos/caixa_lateral/fondo_inferior_3.gif></td></tr></table>';
    }
    else{
       div_f2.innerHTML ='<table title=\'' + Correo + '\' border=0 width=500 id=table7 cellspacing=0 cellpadding=0><tr><td width=7 background=../graficos/caixa_lateral/fondo_superior_1.gif height=24>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_superior_2.gif><p align=center><font face=Verdana style=font-size: 12px; font-weight: 700 color=#FFFFFF>' + Titulo + '</font></p></td><td width=7 background=../graficos/caixa_lateral/fondo_superior_3.gif>&nbsp;</td></tr><tr><td background=../graficos/caixa_lateral/fondo_medio_1.gif>&nbsp;</td><td background=../graficos/caixa_lateral/fondo_medio_2.gif height=200><div align=center><table border=0 width=90% cellspacing=0 cellpadding=0><tr><td height=26>&nbsp;</td></tr><tr><td><form name=enviar><table border=0 cellspacing=0 cellpadding=2><tr><td class=v_12_n_celeste><p style=margin-right: 12px>' + TextoCorreo + '</p></td><td><p style=margin-right: 12px><input type=text name=correo size=30 class=input_1 ></p></td><td><div align=center><table border=0 cellspacing=0 cellpadding=0 height=18><tr><td class=boton_1_a></td><td class=boton_1_b><a href=# onclick=EnviaListadoOfertas(document.enviar.elements[\'correo\'].value,\'false\',\'' + MensajeEscribaCorreo + '\',\'' + MensajeCorreoIncorrecto + '\',\'' + EmailOk + '\'); class=menu_p>' + Enviar + '</a></td><td class=boton_1_c></td></tr></table></div></td></tr></table></form></td></tr><tr><td height=40 valign=bottom><div align=center><table border=0 cellspacing=0 cellpadding=0 id=table18><tr><td class=boton_pedir onclick=quitaCapa(\'capapresupuesto1\');quitaCapa(\'capapresupuesto2\');><a href="javascript:void(0);" class="marino">' + Cerrar + '</a></td></tr></table></div></td></tr></table></div></td><td background=../graficos/caixa_lateral/fondo_medio_3.gif>&nbsp;</td></tr><tr><td height=7 background=../graficos/caixa_lateral/fondo_inferior_1.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_2.gif></td><td background=../graficos/caixa_lateral/fondo_inferior_3.gif></td></tr></table>'; 
    }
}

function EnviaListadoOfertas(CorreoDestino,mostrarenportada,MensajeEscribaCorreo,MensajeCorreoIncorrecto,EmailOk){

    //verificamos que el correo tenga el formato correcto: una arroba y un punto almenos

    if (CorreoDestino==''){
        alert(MensajeEscribaCorreo);
        return false;
    }
    
    var existearroba='false';
    var existepunto='false';
    for(i=0; i<CorreoDestino.length; i++){
        if (CorreoDestino.charAt(i)=='@'){
          existearroba='true';
          break;
       }
    }
    
    for(i=0; i<CorreoDestino.length; i++){
        if (CorreoDestino.charAt(i)=='.'){
          existepunto='true';
          break;
       }
    }

    if (existearroba=='false' || existepunto=='false'){
        alert(MensajeCorreoIncorrecto);
        return false;
    }
    
    var ofertas='';
    for (i=0;i<document.listado.elements.length;i++){
    	if(document.listado.elements[i].type == "checkbox"){
    	    if (document.listado.elements[i].name=="ofertas"){
    	        if (document.listado.elements[i].checked==1){
        	        ofertas = ofertas + document.listado.elements[i].value + ',';
                }
            }
    	}
    }
    ofertas = ofertas.substring(0,ofertas.length-1);
    if (mostrarenportada=='true'){
        ventana=window.open('aloxamento/listado_ofertas_pdf.aspx?enviar=' + CorreoDestino + '&Fecha1=' + document.listado.Fecha1.value + '&Fecha2=' + document.listado.Fecha2.value + '&Folleto=' + document.listado.Folleto.value + '&Tipo=' + document.listado.Tipo.value + '&Destino=' + document.listado.Destino.value + '&Zona=' + document.listado.Zona.value + '&ofertas=' + ofertas,'ventana','width=500,height=500,scrollbars=yes');
    }
    else{
        ventana=window.open('listado_ofertas_pdf.aspx?enviar=' + CorreoDestino + '&Fecha1=' + document.listado.Fecha1.value + '&Fecha2=' + document.listado.Fecha2.value + '&Folleto=' + document.listado.Folleto.value + '&Tipo=' + document.listado.Tipo.value + '&Destino=' + document.listado.Destino.value + '&Zona=' + document.listado.Zona.value + '&ofertas=' + ofertas,'ventana','width=500,height=500,scrollbars=yes');
    }
	ventana.close();
    alert(EmailOk);
}

function valida_login(){
    document.login.submit();    
}

function ValidarSolicitarClaves(MensajeObligatorios){

    if (document.registro.nombrecomercial.value==''){
        alert(MensajeObligatorios);
        document.registro.nombrecomercial.focus();
        return false;
    };
    
    if (document.registro.cif.value==''){
        alert(MensajeObligatorios);
        document.registro.cif.focus();
        return false;
    };
  
    if (document.registro.licencia.value==''){
        alert(MensajeObligatorios);
        document.registro.licencia.focus();
        return false;
    };
    if (document.registro.direccion.value==''){
        alert(MensajeObligatorios);
        document.registro.direccion.focus();
        return false;
    };
    
    if (document.registro.pais.value==''){
        alert(MensajeObligatorios);
        document.registro.pais.focus();
        return false;
    };
    
    if (document.registro.provincia.value==''){
        alert(MensajeObligatorios);
        document.registro.provincia.focus();
        return false;
    };
  
    if (document.registro.telefono.value==''){
        alert(MensajeObligatorios);
        document.registro.telefono.focus();
        return false;
    };
    
    if (document.registro.mail.value==''){
        alert(MensajeObligatorios);
        document.registro.mail.focus();
        return false;
    };
    
    if (document.registro.nombrecontacto.value==''){
        alert(MensajeObligatorios);
        document.registro.nombrecontacto.focus();
        return false;
    };

    document.registro.method='post';
	document.registro.action='portada.aspx?seccion=solicitar_codigos&solicitar=true';
	document.registro.submit();
}

function ValidarTrabajaConNosotros(Mensaje1,Mensaje2){

    if (document.formulario.nombre.value==''){
        alert(Mensaje1);
        document.formulario.nombre.focus();
        return false;
    };
    
    if (document.formulario.email.value==''){
        alert(Mensaje1);
        document.formulario.email.focus();
        return false;
    }
    else{
        var existearroba='false';
        var existepunto='false';
        for(i=0; i<document.formulario.email.value.length; i++){
            if (document.formulario.email.value.charAt(i)=='@'){
              existearroba='true';
              break;
           }
        }
        
        for(i=0; i<document.formulario.email.value.length; i++){
            if (document.formulario.email.value.charAt(i)=='.'){
              existepunto='true';
              break;
           }
        }

        if (existearroba=='false' || existepunto=='false'){
            alert(Mensaje2);
            document.formulario.email.focus();
            return false;
        }
    }
  
    if (document.formulario.comentario.value==''){
        alert(Mensaje1);
        document.formulario.comentario.focus();
        return false;
    };

    document.formulario.method='post';
	document.formulario.action='portada.aspx?seccion=trabaja&enviar=true';
	document.formulario.submit();
}

//Funcion que comprueba la extensión de un fichero pasado por parámetro, si la extensión no coincide se muestra un mensaje
function LimitAttach(tField,iType,Mensaje1,Mensaje2) {
    file=tField.value;
    
    if (iType==1) {
        extArray = new Array(".gif",".jpg",".png");
    }
    if (iType==2) {
        extArray = new Array(".swf");
    }
    if (iType==3) {
        extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
    }
    if (iType==4) {
        extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
    }
    if (iType==5) {
        extArray = new Array(".html",".htm",".shtml");
    }
    if (iType==6) {
        extArray = new Array(".doc",".xls",".ppt",".pdf",".odf");
    }
    allowSubmit = false;
    
    if (!file) return;
    
    while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1);
    
    ext = file.slice(file.indexOf(".")).toLowerCase();
    
    for (var i = 0; i < extArray.length; i++) {
        if (extArray[i] == ext) {
            allowSubmit = true;
        break;
        }
    }
    if (allowSubmit) {
    } else {
        tField.value="";
        alert(Mensaje1 + " " + (extArray.join(" ")) + "\n" + Mensaje2);
    }
}
function ValidarReposicionFolletos(Mensaje){
    var AlgunoCheckeado ='false';
    for (i=0;i<document.formulario.elements.length;i++){
    	if(document.formulario.elements[i].type == "checkbox"){
    	    if (document.formulario.elements[i].name.substring(0,8)=="folleto_"){
    	        if (document.formulario.elements[i].checked==1){
                    AlgunoCheckeado='true'
                    break;    	        
                }
            }
    	}
    }
    
    if (AlgunoCheckeado=='true'){
        document.formulario.method='post';
        document.formulario.action='index.aspx?pag=rep_folletos&enviar=true';
        document.formulario.submit();
    }
    else{
        alert(Mensaje)
    }
}

function Validar_CompVentas(Mensaje){

    if ( document.calenda.estancias.checked ==false && document.calenda.circuitos.checked==false && document.calenda.grupos.checked==false ){
        alert(Mensaje);
        return false;
    }

    document.calenda.submit();
}
