isBusy = false;
//variable AJAX para interacción de estado de directos
if (window.XMLHttpRequest){
	xmlC = new XMLHttpRequest();
	xmlC.onreadystatechange=nextChatStatusRequest;
    }
else {
	try{
		xmlC = new ActiveXObject("Microsoft.XMLHTTP");
		xmlC.onreadystatechange=nextChatStatusRequest;
	}catch(e){}
}

function checkChatStatus(){
	try{
		clearTimeout(ID_CSTAT);
	}catch(e){}
	//llamada al script que nos da la situación actual de la radio
	//alert(HOSTPATH + 'getChatStatus.php')
	xmlC.open('GET',HOSTPATH + 'getChatStatus.php',true);
	xmlC.onreadystatechange=nextChatStatusRequest;
	xmlC.send('');
}

function nextChatStatusRequest(){
	if(xmlC.readyState==4) {
		//var t='';for(var i in xml)  t+=' '+i;alert(t);
		
		if(xmlC.status == 200) {
			var obN=xmlC.responseXML.documentElement.getElementsByTagName('num_persons').item(0);
			var obM=xmlC.responseXML.documentElement.getElementsByTagName('last_message').item(0);
			var ob_chat_msg = document.getElementById('last_chat_message');
			var ob_chat_per = document.getElementById('num_chat_persons');
			ob_chat_msg.innerHTML = obM.firstChild.nodeValue;
			ob_chat_per.innerHTML = obN.firstChild.nodeValue;
			//alert(ob_chat_msg.innerHTML+" "+ob_chat_per.innerHTML)

		}
		//proceso completado, cargamos dentro de un tiempo (30s) otra vez
		ID_CSTAT=setTimeout("checkChatStatus()",15000);	
	}
}
