// JavaScript Document
/*
* Obtiene una instancia del objeto XMLHttpRequerest.
*/
function GetXMLHttpRequest()
{
	if(window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
	}
	else
	{
		xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');	
	}	
	return xmlhttp;
}

/*
* Carga contenido AJAX.
*/
function loadAjax(method, url, async, handler)
{
	xmlhttp = GetXMLHttpRequest();
	xmlhttp.onreadystatechange = handler;
	xmlhttp.open(method, url, true);
	xmlhttp.send();	
}

function showNoticia(n)
{
	var handler = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			document.getElementById('noticiabody').innerHTML = xmlhttp.responseText;
		}
	}
	loadAjax('GET', 'noticia-home.php?noticia=' + n, true, handler);
}
