//funciones ajax
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 ejecutarJS(id,html) {
	//document.getElementById('mensajes').innerHTML="";
	mydiv = document.getElementById(id);
	JS= html.split('[[JS]]');
	if(JS.length>1) {
		mydiv.innerHTML=JS[0]
		for(a=1;a<JS.length;a++) {
			eval(JS[a]);
		}
		
	} else {
		mydiv.innerHTML=html
	}
}

function cargarNoticias(aņo,id) {
	mdu=nuevoAjax();
	mdu.open("GET", "ajax/noticias.php?q="+aņo+"&q1="+id+ "&dummy=" + new Date().getTime(),true);
	mdu.onreadystatechange=function() {
		if (mdu.readyState==4) {
			ejecutarJS("otrasNoticias",mdu.responseText);
		}
	}
	mdu.send(null);
}

function mostrarNoticia(id) {
	mdu=nuevoAjax();
	mdu.open("GET", "ajax/nota.php?q="+id+"&dummy=" + new Date().getTime(),true);
	mdu.onreadystatechange=function() {
		if (mdu.readyState==4) {
			ejecutarJS("noticiaPrincipal",mdu.responseText);
		}
	}
	mdu.send(null);
}

