function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
function init(){
setTimeout (checkMessages,15000);

}
function checkMessages()
{
xmlHttp=GetXmlHttpObject();
var url="xmlhttp.php";
url=url+"?action=mymess";
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4)
{ 
{
if (xmlHttp.responseText.length >0)
{
reply=prompt(xmlHttp.responseText,"Respuesta..");
if (reply)
{
doReply(reply);
}
}
}
}
};
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
setTimeout(init,15000);

}
function doReply(reply)
{
xmlHttp=new GetXmlHttpObject();
var url="xmlhttp.php";
url=url+"?action=mymess_reply&message="+reply;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function createMessage(to)
{
xmlHttp=GetXmlHttpObject();
var url="xmlhttp.php";
text=prompt("Message",'');
if (text.length > 0)
{
url=url+"?action=mymess_create&message="+text+"&to="+to;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}