var x,y;


document.onclick = getpos;


function getpos(e) 
{
	x = (document.all) ? window.event.clientX + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.clientY + document.body.scrollTop  : e.pageY;
	
	x2 = Math.round((1280-943)/2 - (getSize()-943)/2);
	x = x + x2;

	var http = null;
	http = erzXMLHttpRequestObject()
	if (http != null) 
	{
		var linid = document.getElementById("linid").value;
		http.open("GET", "/ajax.php?action=heatmap_write&x="+x+"&y="+y+"&linid="+linid, true);
		http.send(null);
	}
}

function getSize() {
    var myWidth = 0, myHeight = 0;
 
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    return myWidth;
}
