function createXMLHttpRequest() 
{
	try { return new XMLHttpRequest(); } catch(e) {}
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	alert("XMLHttpRequest not supported");
	return null;
}

function ConfirmUpdate()
{
  	var answer = confirm("Keep my session active ?");
	if (answer)
	{
		var xhReq = createXMLHttpRequest();
		xhReq.open("get", "profile.php?r=1", true);
		xhReq.onreadystatechange = function() {
			if (xhReq.readyState != 4)  { return; }
			var serverResponse = xhReq.responseText;
			SetTimer();
		};
		xhReq.send(null);
	}	
}   

function SetTimer()
{
  //set timer to call function to confirm update 
  setTimeout("ConfirmUpdate()",1000*60*50);
}
      
//start the timer
SetTimer();