// Cambia estos parametros
	 
	var seconds = 60; // el tiempo en que se refresca
	var divid = "cant_mensajes"; // el div que quieres actualizar!
	var url = "chequea_mensajes.php"; // el archivo que ira en el div
	 
	////////////////////////////////
	//
    // Refreshing the DIV
	//
	////////////////////////////////
	 
	function refreshdiv(){

	 
	// The XMLHttpRequest object
	 
	var xmlHttp;
	try{
	xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
	}
	catch (e){
	try{
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
	}
	catch (e){
	try{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e){
	alert("Tu explorador no soporta AJAX.");
	return false;
	}
	}
	}
	 
	// Timestamp for preventing IE caching the GET request
	var fetch_unix_timestamp ="";// lets declare the variable
	 
	fetch_unix_timestamp = function()
	{
	return parseInt(new Date().getTime().toString().substring(0, 10))
	}
	 
	var timestamp = fetch_unix_timestamp();
	var nocacheurl = url;
	 
	// The code...
	 
	xmlHttp.onreadystatechange=function(){		
	if(xmlHttp.readyState==4){
	document.getElementById(divid).innerHTML =xmlHttp.responseText;
	var interval = setInterval('refreshdiv()',seconds*1000);
	
	

	xmlHttp.onreadystatechange=function(){}//null produce un error de tipos en explorer 6
        xmlHttp.abort();
        xmlHttp=null;
        clearInterval(interval); 
	}
	}
	xmlHttp.open("GET",nocacheurl,true);
	xmlHttp.send(null);
	}
	 
	// Empieza la función de refrescar
	 
	window.onload = function startrefresh(){	
	var interval2 = setInterval('refreshdiv()',seconds*1000);
//	clearInterval(interval2);
	}
