function validarSala() {

	var nombre=document.f.nombre.value;
	//var email_privado=document.f.email_privado.value;
	var aforo=document.f.aforo.value;
	var direccion=document.f.direccion.value;
	var numero=document.f.numero.value;
	var ciudad=document.f.ciudad.value;
	var provincia=document.f.provincia.value;
	var licencia=document.f.licencia.value;
	var num_conciertos=document.f.num_conciertos.value;
	var anyo_inicio=document.f.anyo_inicio.value;
	var contacto_nombre=document.f.contacto_nombre.value;
	var contacto_telefono=document.f.contacto_telefono.value;
	var contacto_email=document.f.contacto_email.value;
	var prog_nombre=document.f.prog_nombre.value;
	var prog_telefono=document.f.prog_telefono.value;
	var resp_nombre=document.f.resp_nombre.value;
	var resp_telefono=document.f.resp_telefono.value;
	/*var adm_nombre=document.f.adm_nombre.value;
	var adm_telefono=document.f.adm_telefono.value;*/
	var equipo_sonido=document.f.equipo_sonido.value;
	var pert_assoc=document.f.pert_assoc.value;
	var pert_host=document.f.pert_host.value;
	var paga_sgae=document.f.paga_sgae.value;
	var paga_agedi=document.f.paga_agedi.value;
	
	if (nombre==''){
		alert('El nombre es obligatorio');
		return false;
	}
	/*if (email_privado==''){
		alert('El email privado es obligatorio');
		return false;
	}*/
	if (aforo==''){
		alert('El aforo es obligatorio');
		return false;
	}
	if (direccion==''){
		alert('La direccion es obligatoria');
		return false;
	}
	if (numero==''){
		alert('El numero es obligatorio');
		return false;
	}
	if (ciudad==''){
		alert('La ciudad es obligatoria');
		return false;
	}
	if (provincia==''){
		alert('La provincia es obligatoria');
		return false;
	}
	if (licencia==''){
		alert('El tipo de licencia es obligatorio');
		return false;
	}
	if (num_conciertos==''){
		alert('El numero de conciertos es obligatorio');
		return false;
	}
	if (anyo_inicio==''){
		alert('El aņo de inicio es obligatorio');
		return false;
	}
	if (contacto_nombre==''){
		alert('El nombre del contacto es obligatorio');
		return false;
	}
	if (contacto_telefono==''){
		alert('El telefono del contacto es obligatorio');
		return false;
	}
	if (contacto_email==''){
		alert('El email del contacto es obligatorio');
		return false;
	}
	if (prog_nombre==''){
		alert('El nombre del programador es obligatorio');
		return false;
	}
	if (prog_telefono==''){
		alert('El telefono del programador es obligatorio');
		return false;
	}
	if (resp_nombre==''){
		alert('El nombre del responsable es obligatorio');
		return false;
	}
	if (resp_telefono==''){
		alert('El telefono del responsable es obligatorio');
		return false;
	}
	/*if (adm_nombre==''){
		alert('El nombre de adminitracion es obligatorio');
		return false;
	}
	if (adm_telefono==''){
		alert('El telefono de administracion es obligatorio');
		return false;
	}*/
	if (equipo_sonido==''){
		alert('Indique si tiene equipo de sonido propio');
		return false;
	}
	if (pert_assoc==''){
		alert('Indique si pertenece a alguna asociacion de salas');
		return false;
	}
	if (pert_host==''){
		alert('Indique si pertenece a alguna asociacion de hosteleria');
		return false;
	}
	if (paga_sgae==''){
		alert('Indique si paga a SGAE');
		return false;
	}
	if (paga_agedi==''){
		alert('Indique si paga a Agedi/AIE');
		return false;
	}
	return true;
}

function buscarSalas() {

var xmlHttp;
try{
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }catch (e){
	  // Internet Explorer
	  try{
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }catch (e){
		    try{
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		      }catch (e){
			      alert("Your browser does not support AJAX!");
			      return false;
		      }
		    }
	}
	  
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.getElementById('res_select').innerHTML="";
      if (xmlHttp.responseText!=""){
	      document.getElementById('resultado').style.display='block';
	      document.getElementById('res_ficha').innerHTML='';
	      document.getElementById('res_select').innerHTML=xmlHttp.responseText;
      } else {
	    document.getElementById('resultado').style.display='none';
      	alert('No se han encontrado resultados');
      	}
      }
    }
  prov=escape(document.getElementById('provincia').value);
  aforo=document.getElementById('aforo').value;
  xmlHttp.open("GET","includes/salas_selects.php?prov="+prov+"&aforo="+aforo,true);
  xmlHttp.send(null);
}


function verFicha() {

var xmlHttp;
try{
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }catch (e){
	  // Internet Explorer
	  try{
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }catch (e){
		    try{
		      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		      }catch (e){
			      alert("Your browser does not support AJAX!");
			      return false;
		      }
		    }
	}
	  
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.getElementById('res_ficha').innerHTML='';
      if (xmlHttp.responseText!="")
      	document.getElementById('res_ficha').innerHTML=xmlHttp.responseText;
      else alert ('Sala no encontrada');
      }
    }
  ficha=document.getElementById('resultados').value;
  xmlHttp.open("GET","includes/salas_ficha.php?id_sala="+ficha,true);
  xmlHttp.send(null);
 }