/****************************************************************************
AJAX Funktionalität für das "reverse" Login
create : 30.05.07  m.philipps
V1     : 30.05.07
		 initial release
***************************************************************************/


function handleHttpResponse() {
  if (http.readyState == 4) {
    // Split the comma delimited response into an array
    results = http.responseText;
    if (results != "") {
	    //window.location.reload();
	    }
    }
}

function updateLoginState() {
if (document.getElementById('user')) {
	http = null;
	http = getHTTPObject();
	http.onreadystatechange = handleHttpResponse;
	http.open("GET","/OnlineMappen/PHP-Files/checkuser.php",true);
	http.send(null);
	}
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

//window.captureEvents(Event.FOCUS);
window.onfocus = updateLoginState;