//Browser Support Code

function timedCount() {
	var t = 3;
	var tme = 1000 * 60 * t;
	setInterval ("ajaxRunner()", tme);
}

if (window.addEventListener) {
	window.addEventListener('load', timedCount, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', timedCount);
}

function ajaxRunner(filename, additionalparams, returnID){
	if (filename == null) {
		filename = "files/ajax/ajax_login.php";
	}
	
	if (additionalparams == null) {
		additionalparams = '';
	}

	var query = filename + '?' + additionalparams;
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				// it is probably just a good idea 
				// to let them disappear from here
				// the alternative is to show them a message
				// alert("Your Session has timed out. Refresh this page to stay logged in.");
				// return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			if ((returnID != '') && (returnID != null)) {
				var ajaxDisplay = document.getElementById(returnID);
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
			}
		}
	}
		
	ajaxRequest.open("GET", query, true);
	ajaxRequest.send(null); 
}


