setInterval ( "onlinelist()", 10000 );
					
function onlinelist() 
{
	var url = "/xml/online.xml";
	xmlHttp = GetXmlHttpObject( ViewOnlineList );
	xmlHttp.open("GET", url , true);
	xmlHttp.send( null );					
}			


function ViewOnlineList() 
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") 
	{
		if ( xmlHttp.status == 200 ) 
		{		
			var xmldoc = xmlHttp.responseXML;
			var online = xmldoc.getElementsByTagName('online').item(0);
			var items = online.getElementsByTagName("user");

			for (var iNode = 0; iNode < items.length; iNode++)
			{
				var sibl = "";
				var item = items[iNode];
				var name = item.getElementsByTagName("name")[0].firstChild.nodeValue;
			}
				var none = "none";
				
			if(name!=none)
			{	
				document.getElementById('online').innerHTML = sibl;
				OnlinePopup(name);
			}
		}
	} 
}

function OnlinePopup(user)
{
	myElement = document.getElementById("ce");
	if(myElement != null)
	{
		var hilfe = "<div class=\"popup3\"><img src=http://www.justchat.nl/images/no_avatar.jpg align=left border=0> <a href=\"/"+ user + "\">"+ user + "</a> <br>komt nu online op de website (beta).</div> <a href=\"#\" onClick=\"Close()\"><div class=\"popup4\"><b><small>MEMBER ONLINE</small></B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sluiten <img border=\"0\" src=\"/images/close-icon.jpg\" width=\"16\" height=\"16\"></div></a>";
		myElement.innerHTML=hilfe;
		
		setTimeout('Close()', 40000);   // delay 5 seconds before closing 

		
	}
}
	
function Close()
{
	myElement = document.getElementById("ce");
	if(myElement != null){myElement.innerHTML='';}
}	

function move_box(an, box) 
{
  var cleft = 0;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) 
  {
  	cleft += obj.offsetLeft;
  	ctop += obj.offsetTop;
  	obj = obj.offsetParent;
  }

  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) 
    {
      ctop += parseInt(
      document.body.currentStyle['marginTop']);
    }
  
   box.style.top = ctop + 'px';
}

function ClosePopup()
{
	myElement = document.getElementById("pop");
	if(myElement != null){myElement.innerHTML='';}
	toggle('blanket');
}

function toggle(div_id) 
{
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
