
var secs=0;
var timerID = null;
var timerRunning = false;
var delay = 5000;
var lastid=0;
var resp;

urlRedir = window.location.protocol + "//" + window.location.host + "/"

pathArray = window.location.pathname.split( '/' );

newPathname = "";
for ( i = 0; i<=pathArray.length; i++ ) {
	newPathname += "../";
}

var url= newPathname + "balance.php";

function loadXMLDoc() {
	secs++;
	if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	} else { // code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	// Must be POST, with GET, IE doesn't work
	xmlhttp.open("POST",url,false);
	xmlhttp.send(null);
	resp="nothing";
	resp=xmlhttp.responseText;
	if (resp == "\r\ndisconnected") {
		alert ("For your security, you have been logged off due to inactivity. Please login again to continue.");
		window.location='' + urlRedir + 'my-account';
	}
	document.getElementById('loginsection').innerHTML=resp;
	timerRunning = true;
	timerID = window.setTimeout('loadXMLDoc("'+url+'")', delay);
	
}
