if(visitviewer_uid == null) var visitviewer_uid = ''; var ADDR = 'http://www.visitviewer.com/'; var isIE = document.all ? true : false; if (!isIE) document.captureEvents(Event.MOUSEMOVE); function getViewport() { var width; var height; if (typeof window.innerWidth != 'undefined') { width = window.innerWidth; height = window.innerHeight; } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else { width = document.getElementsByTagName('body')[0].clientWidth; height = document.getElementsByTagName('body')[0].clientHeight; } return {width: width, height: height}; } document.onclick = function(e) { var _scrollX = document.body.scrollLeft; var _scrollY = document.body.scrollTop; var _x; var _y; if (!isIE) { _x = e.pageX; _y = e.pageY; } if (isIE) { _x = event.clientX + document.body.scrollLeft; _y = event.clientY + document.body.scrollTop; } var viewport = getViewport(); _x = _x / viewport['width'] * 100; _y = _y / viewport['height'] * 100; if(visitviewer_uid == null || visitviewer_uid == '') return true; //var _title = encodeURIComponent(document.title); var xmlRequestObj = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); xmlRequestObj.open("POST", ADDR + "click.php", true); xmlRequestObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //var payload = "click=true&clickx=" + _x + "&clicky=" + _y + "&scrollx=" + _scrollX + "&scrolly=" + _scrollY + "&visitviewer_uid=" + visitviewer_uid + "&title=" + _title; var payload = "click=true&clickx=" + _x + "&clicky=" + _y + "&scrollx=" + _scrollX + "&scrolly=" + _scrollY + "&visitviewer_uid=" + visitviewer_uid; xmlRequestObj.send(payload); return true; }