var xmlHttp

xmlhttp=null

// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
	xmlhttp=new XMLHttpRequest()
}

// code for IE
else if (window.ActiveXObject)
{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}

if (xmlhttp!=null)
{

	var number_of_seconds=0;
	
	function startClock(){ 
		number_of_seconds=number_of_seconds+1;
		setTimeout("startClock()", 1000);
	} 
	
	startClock();
	
	function showtime() {
		// Build the URL to connect to
		var url = "time/save_time.php?url=" + escape(location.href) + "&time=" + escape(number_of_seconds);
		
		// Open a connection to the server
		xmlhttp.open("GET", url, true);
		
		// Send the request
		xmlhttp.send(null);
		
		//alert("You spent " + number_of_seconds + " seconds on " + location.href);
	}
	
	window.onunload=showtime;

}
