function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function pag_noticia(pagina,aprobacion,fecha,hora,tipo,ruta){
	contenedor = document.getElementById('listado');
	ajax=nuevoAjax();
	ajax.open("POST", ruta+"pag_noticia.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("&pagina="+pagina+"&aprobacion="+aprobacion+"&fecha="+fecha+"&hora="+hora+"&tipo="+tipo+"&ruta="+ruta)
}

function pag_encuesta(pagina,ruta){
	contenedor = document.getElementById('listado');
	ajax=nuevoAjax();
	ajax.open("POST", ruta+"pag_encuesta.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("&pagina="+pagina+"&ruta="+ruta)
}

function pag_galeria(pagina){
	contenedor = document.getElementById('listado');
	ajax=nuevoAjax();
	ajax.open("POST", "pag_galeria.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("&pagina="+pagina)
}

function pag_cartelera(pagina){
	contenedor = document.getElementById('listado');
	ajax=nuevoAjax();
	ajax.open("POST", "pag_cartelera.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("&pagina="+pagina)
}

function ValidaVoto()
{
	for (i=0;i<document.frmEncuesta.voto.length;i++) {
		if (document.frmEncuesta.voto[i].checked) {
			user_input = document.frmEncuesta.voto[i].value;
			return true;		
		}
	}
	alert("Debes seleccionar una opción de la encuesta");
		return false;		
}

