// Accsos usuario
function verifica_usuario(){
	var u=document.getElementById("user").value;
	var p=document.getElementById("pass").value;
	document.getElementById("load_user").innerHTML="Verificando...";
	url="includes/load_user.php?u="+u+"&p="+p;
 	new Ajax.Updater('load_user', 
        	url, { 
              method: 'get', 
              evalScripts:true 
                     
        }); 

}

function quien_soy(valor){
	if(valor==1)
		{
		document.getElementById("quien_nombre").innerHTML="Nombre:";
		document.getElementById("quien_ape1").innerHTML="1er apellido:";
		document.getElementById("quien_ape2").innerHTML="2&ordm; apellido:";
		}
	if(valor==2)
		{
		document.getElementById("quien_nombre").innerHTML="Agencia:";
		document.getElementById("quien_ape1").innerHTML="CIF:";
		document.getElementById("quien_ape2").innerHTML="Pers. Contacto:";
		}
	if(valor==3)
		{
		document.getElementById("quien_nombre").innerHTML="Empresa:";
		document.getElementById("quien_ape1").innerHTML="CIF:";
		document.getElementById("quien_ape2").innerHTML="Pers. Contacto:";
		}
}

// JavaScript Document
function reload_select(valor){
	document.getElementById("select_vuelos").innerHTML="Cargando...";
	url="includes/select.php?from="+valor;
 	new Ajax.Updater('select_vuelos', 
        	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
	
}

function reload_pais_select(valor){
	document.getElementById("select_hotel").innerHTML="Cargando...";
	url="includes/selectp.php?from="+valor;
 	new Ajax.Updater('select_hotel', 
        	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
	
}
function reload_prv_select(valor,pi){
	
	document.getElementById("select_hotelp").innerHTML="Cargando...";
	url="includes/selectl.php?prv="+valor+"&pi="+pi;
	new Ajax.Updater('select_hotelp', 
        	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
	
}

function busca_vuelos_ux(){
	var origen=document.getElementById("origen").options[document.getElementById("origen").selectedIndex].value;
	var destino=document.getElementById("destino").options[document.getElementById("destino").selectedIndex].value;
	var pax=document.getElementById("n_pasajeros").options[document.getElementById("n_pasajeros").selectedIndex].value;
	var fecha=document.getElementById("dateField").value;
	var url="includes/ux_request.php?dep="+origen+"&arr="+destino+"&day="+fecha+"&pax="+pax;
	
	document.getElementById("TabbedPanels1").style.display="none";
	document.getElementById("contenido_vuelos").style.display="block";
	document.getElementById("titulo_vuelo").innerHTML="";
	document.getElementById("resultado_vuelos").innerHTML="Cargando...";   
	new Ajax.Updater('resultado_vuelos', 
      	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
}

function busca_hoteles(){
	var pais=document.getElementById("porigen").options[document.getElementById("porigen").selectedIndex].value;
	var prv=document.getElementById("pdestino").options[document.getElementById("pdestino").selectedIndex].value;
	var loc=document.getElementById("ldestino").options[document.getElementById("ldestino").selectedIndex].value;
	var tipo=document.getElementById("tipo_h").options[document.getElementById("tipo_h").selectedIndex].value;
	var noche=document.getElementById("noches").options[document.getElementById("noches").selectedIndex].value;
	var fecha=document.getElementById("dateField").value;
	var url="includes/ht_request.php?pais="+pais+"&prv="+prv+"&loc="+loc+"&day="+fecha+"&tipo="+tipo+"&noche="+noche;
	
	document.getElementById("TabbedPanels1").style.display="none";
	document.getElementById("contenido_vuelos").style.display="block";
	document.getElementById("titulo_vuelo").innerHTML="";
	document.getElementById("resultado_vuelos").innerHTML="Cargando...";   
	new Ajax.Updater('resultado_vuelos', 
      	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
}

function Anadir_vuelo(datos,bonos,euros,pax){
	document.getElementById("cesta_compra").innerHTML="Cargando...";  
	var url="includes/vuelos_select.php?data="+datos+"&b="+bonos+"&e="+euros+"&p="+pax;
	new Ajax.Updater('cesta_compra', 
      	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
}
function Anadir_hotel(datos,bonos,euros,pax){
	document.getElementById("cesta_compra").innerHTML="Cargando...";  
	var url="includes/vuelos_select.php?data="+datos+"&b="+bonos+"&e="+euros+"&p="+pax;
	new Ajax.Updater('cesta_compra', 
      	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
}

function Borrar_vuelo(id){
	document.getElementById("cesta_compra").innerHTML="Cargando...";  
	var url="includes/vuelos_select.php?id="+id;
	new Ajax.Updater('cesta_compra', 
      	url, { 
              method: 'get', 
              evalScripts:true 
                     
        });  	
}
function comparepass(){
	if(document.buytalonair.pass1.value!=document.buytalonair.pass2.value){
		alert("las contraseņas no coinciden");	
		document.buytalonair.pass2.value="";
	}
}
function showcod(valor){
	document.buytalonair.c_postal1.value=valor;
}

function comprobar_edad(valor){
	if(document.getElementById(valor).value<18){
		alert("El pasajero no puede ser menos de edad");
		document.getElementById(valor).value="";
	}
}

function openDialog(info){
	Dialog.alert({url: "privacidad/"+info+".inc.php", options: {method: 'get'}}, 
            {className: "alphacube", width:570, height:400, okLabel: "Cerrar"});	
}