var lreq = false;
try {
  lreq = new XMLHttpRequest();
} catch (trymicrosoft) {
  try {
    lreq = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
    try {
      lreq = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (failed) {
      lreq = false;
    }  
  }
}

StayLive();
setInterval("StayLive()", 15000);

function StayLive() {
	var url = ".?p=ajax&a=staylive";
	var params="url=" + encodeURIComponent(window.location);
	lreq.open("POST", url, false);
	lreq.onreadystatechange = StayLiveReturn;
	lreq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
	lreq.send(params);
	return false;
}

function StayLiveReturn() {
	if (lreq.readyState == 4)
		if (lreq.status == 200) {
			if (lreq.responseText=="ok") {
			} else {
				alert(lreq.responseText);
			}
		}
		else if (lreq.status == 404)
			alert("Request URL does not exist");
}

