function GetXmlCollObject()
{
var xmlColl=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlColl=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlColl=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlColl=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlColl;
}

var xmlRec

function post(mes) 
{
	if(mes=='')
		return;
	showim(true);
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById('instantmessage').innerHTML = mes;
	}
	else {
		if (document.layers) { // Netscape 4
			document.instantmessage.innerHTML=mes;
		}
		else { // IE 4
			document.all.instantmessage.innerHTML=mes;
		}
	}
}

function showim(val) 
{
	if(val)
		var display='block';
	else
		var display='none';
		
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById('instantmessage').style.display = display;
	}
	else {
		if (document.layers) { // Netscape 4
			document.instantmessage.style.display = display;
		}
		else { // IE 4
			document.all.instantmessage.style.display = display;
		}
	}
}

function postMes() 
{ 
	if (xmlRec.readyState==4)
	{ 
		post(xmlRec.responseText);
	}
}

function ignore(id,token)
{
	xmlRec=GetXmlCollObject()
	if (xmlRec==null)
	{
		return;
	} 
	var uri ="/chatpost.php?ignore=1&token="+token+"&id="+id;
	xmlRec.open("GET",uri,true);
	xmlRec.send(null);
	showim(false);
	post('');
}

function startchat(id)
{
	window.open("/chat.php?id="+id, "blank","toolbar=no,resizable=no,scrollbars=no,location=no,directories=no,status=yes,fullscreen=no,menubar=no,width=350,height=250");
}
function chat(id,token)
{
	window.open("/chat.php?id="+id+"&token="+token, "blank","toolbar=no,resizable=no,scrollbars=no,location=no,directories=no,status=yes,fullscreen=no,menubar=no,width=350,height=250");
	showim(false);
	post('');
}