function ventana(url){
	var ancho = window.screen.availWidth;
	var alto = window.screen.availHeight;
	window.open(url, "_blank", "width="+ancho+", height="+alto+",location=no, scrollbars=yes, toolbar=no, fullscreen=yes,resizable=yes");
}

function nuevoAjax() { 
	var xmlhttp=false; 
	try { 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e){ 
		try{ // Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 	      
	return xmlhttp; 
}

function disponibles(fecha,ubicacion,horai,horaf){
	elemento1=document.getElementById(ubicacion);		
	v1=elemento1.value;
	elemento2=document.getElementById(horai);		
	v2=elemento2.value;	
	elemento3=document.getElementById(horaf);		
	v3=elemento3.value;
	if(v1=="Fuera Sede Comarcal" && v2!="" && v3!=""){
		document.getElementById("disponible").value='1';
		document.getElementById("registro").disabled=false;
	}
	else if (v1!="Fuera Sede Comarcal" && v2!="" && v3!=""){
		var aleatorio=Math.random();
		ajax=nuevoAjax();
		ajax.open("GET", "disponibilidad.php?ubicacion="+v1+"&horai="+v2+"&horaf="+v3+"&fecha="+fecha+"&nocache="+aleatorio, true);
		ajax.onreadystatechange=function() { 			
			if (ajax.readyState==4){ 				
				if(ajax.responseText!='1'){
					//document.getElementById("disponibilidad").innerHTML=ajax.responseText;
					document.getElementById("disponibilidad").innerHTML="El emplazamiento seleccionado no está disponible en ese horario";
				}
				else{					
					document.getElementById("disponibilidad").innerHTML="&nbsp;";
					document.getElementById("disponible").value='1';
					document.getElementById("registro").disabled=false;
				}
			} 
		}	
		ajax.send(null);   		
	}
	else{
		alert("Se deben introducir los valores correspondientes al evento....");
	}
}

