function getXmlHttp() {
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
      xmlhttp = false;
    }
  }

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function onLineUsers(id, locate) {
	var xmlHttp;
	xmlHttp = getXmlHttp();

	xmlHttp.onreadystatechange = function()  {
		if (xmlHttp.readyState == "4") {
		}
	}

	xmlHttp.open('GET', '/project/components/ajax/onLineUsers.php?id='+id+'&locate='+locate+'&rand='+Math.random(), true);
	xmlHttp.send(null);
}

function showOnLineUsers() {
	var xmlHttp;
	xmlHttp = getXmlHttp();

	xmlHttp.onreadystatechange = function()  {
	    if (xmlHttp.readyState == "4") {
			var json = eval( "(" + xmlHttp.responseText + ")" );

			var sReturnData = json.returnData;

			document.getElementById("spanOfOnLineUsers").innerHTML = sReturnData;
		}
		else {
			document.getElementById("spanOfOnLineUsers").innerHTML	=	'<img src="/project/components/images/ajax_loading.gif" border="0" /><br /><br />';
		}
	}

	xmlHttp.open('GET', '/project/components/ajax/spanOfOnLineUsers.php?rand='+Math.random(), true);
	xmlHttp.send(null);
}


function getListOfPortalLinks(id) {
	var xmlHttp;
	xmlHttp = getXmlHttp();

	xmlHttp.onreadystatechange = function()  {
	    if (xmlHttp.readyState == "4") {
			var json = eval( "(" + xmlHttp.responseText + ")" );

			var sReturnData = json.returnData;
			if (sReturnData != "") {
				document.getElementById("spanOfListOfPortalLinks").innerHTML = "<br /><br />"+sReturnData;
			}
			else {
				document.getElementById("spanOfListOfPortalLinks").innerHTML = "<br /><br /><b style='color:red;'>информация не найдена</b>";
			}
		}
		else {
			document.getElementById("spanOfListOfPortalLinks").innerHTML	=	'<br /><br /><img src="/project/components/images/ajax_loading.gif" border="0" /><br /><br />';
		}
	}

	xmlHttp.open('GET', '/project/components/ajax/getPortalLinks.php?id='+id+'rand='+Math.random(), true);
	xmlHttp.send(null);
}

