
/* 
## By: Gilberto Ramos
## E-mail: sdjbm17@gmail.com
## Cel.: +595981721264
*/
	
	/*###### FUNCIONES  
	   		BUSCADOR ######*/
	   
	function requestBusquedaInfo(ubicacion){
		var sBuscar = document.getElementById("txtBuscarNoticia").value;
		if (sBuscar.length > 0){
			if (typeof oXmlHttp == "undefined") {
				oXmlHttp = zXmlHttp.createRequest();
			}else if(oXmlHttp.readyState != 0) {
				oXmlHttp.abort();
			}
			oXmlHttp.open("get", "GetBusquedaResult.php?search=" + sBuscar + "&place=" + ubicacion, true);
			oXmlHttp.onreadystatechange = function () {
				if(oXmlHttp.readyState == 4){
					if(oXmlHttp.status == 200){
						document.getElementById("displayResult").style.display = "block";
						displayBusquedaInfo(oXmlHttp.responseText);
						if (document.getElementById("displayResult").innerHTML == "Ningun resultado para su busqueda."){
							setTimeout("ocultar()",5000);
						} else {
							setTimeout("ocultar()",15000);	
						}
					} else {
						displayCustomerInfo("Se produjo un error: " + oXmlHttp.responseText);
					}
				}
			};
			oXmlHttp.send(null);
		}else {
			var displayResult1 = document.getElementById("displayResult");
			displayResult1.innerHTML = "Por favor, ingrese datos para la b&uacute;squeda.";
			document.getElementById("displayResult").style.display = "block";
			setTimeout("ocultar()",5000);
		}
	}
	
	function displayBusquedaInfo(sText){
		var displayResult = document.getElementById("displayResult");
		displayResult.innerHTML = sText;
	}
	
	function ocultar(){
		document.getElementById("displayResult").style.display = "none";
	}
	
	/*###### FUNCIONES  
	   HORARIO DE EXAMENES ######*/
	   
	function requestHorarioInfo(idCarrera){
		var sCarrera = idCarrera;
		if (typeof oXmlHttp == "undefined") {
			oXmlHttp = zXmlHttp.createRequest();
		}else if(oXmlHttp.readyState != 0) {
			oXmlHttp.abort();
		}
		oXmlHttp.open("get", "GetHorarioResult.php?id=" + sCarrera, true);
		oXmlHttp.onreadystatechange = function () {
			if(oXmlHttp.readyState == 4){
				if(oXmlHttp.status == 200){
					document.getElementById("HorarioResult").style.display = "block";
					displayHorarioInfo(oXmlHttp.responseText);
				} else {
					displayCustomerInfo("Se produjo un error: " + oXmlHttp.responseText);
				}
			}
		};
		oXmlHttp.send(null);
	}
	
	function displayHorarioInfo(sText){
		var displayResult = document.getElementById("HorarioResult");
		displayResult.innerHTML = sText;
	}
