// JavaScript Document

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/


function updateconnections()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="connections_ajax.php";
xmlHttp.onreadystatechange = function(){ stateChanged(); };
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/*function chatwin(id){
document.getElementById("onlinechat"+id).style.visibility="visible";
document.getElementById("chatnotify").style.visibility="visible";
}
*/
function updatechat(recid)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="chat_messages_ajax.php?recid="+recid;
xmlHttp.onreadystatechange = function(){ stateChanged5(); };
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function updatechat_allusers()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  }
  var url="chatnotify-ajax.php";
//  alert(url);
xmlHttp.onreadystatechange = function(){ stateChanged9(); };
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function updateonlineconnections()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="online_connections_ajax.php";
xmlHttp.onreadystatechange = function(){ stateChanged3(); };
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function updateonlinestatus()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	var url="status_update_ajax.php";
//	alert(url);
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function updateonlinestatus_allusers()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	var url="check-alluser-status.php";
//	alert(url);
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function sessionDestroy()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	var url="session_destroy.php";
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function sendmsg(recid)
{
	xmlHttp=GetXmlHttpObject()
	var message = document.frmchat.txtmsg.value;
	var rec_id = recid;
	if (xmlHttp==null)
	  {
	  alert ("Browser does not support HTTP Request")
	  return
	  } 
	var url="chat_messages_update.php?rec_id="+rec_id+"&message="+message;
	xmlHttp.onreadystatechange = function(){ stateChanged2(); };
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("conn").innerHTML =xmlHttp.responseText;            
	} 
}

function stateChanged3() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("onconn").innerHTML =xmlHttp.responseText;            
	} 
}

function stateChanged5() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("chatmessages").innerHTML =xmlHttp.responseText;            
	} 
}

function stateChanged9() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
//	alert(xmlHttp.responseText);
		document.getElementById("chatnotify").innerHTML =xmlHttp.responseText;            
	} 
}

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;
}

