document.onmousedown = OnmouseDown

function OnmouseDown( e )
{
	if (e === undefined)
	{
		e = window.event;	
	}
	var x = e.clientX;
	var y = e.clientY;
	var w = document.clientWidth !== undefined ? document.clientWidth : window.innerWidth;
	var h = document.clientHeight !== undefined ? document.clientHeight : window.innerHeight;
	var scrollx = window.pageXOffset === undefined ? document.scrollLeft : window.pageXOffset;
	var scrolly = window.pageYOffset === undefined ? document.scrollTop : window.pageYOffset;
		
	var url = "/stats.php?action=click&x=" + (x + scrollx) + "&y=" + (y + scrolly) + "&w=" + w + "&h=" + h + "&u=" + window.location;
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.open( "GET", url, true );
	xmlHttp.send( null );
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
