/** Code by www.labsmedia.com */function addEvtListener(c,b,a){if(document.addEventListener){if(c){c.addEventListener(b,a,false)}else{addEventListener(b,a,false)}}else{if(attachEvent){if(c){c.attachEvent("on"+b,a)}else{attachEvent("on"+b,a)}}}}var clickHeatGroup="",clickHeatSite="",clickHeatServer="",clickHeatLastIframe=-1,clickHeatTime=0,clickHeatQuota=-1,clickHeatBrowser="",clickHeatDocument="",clickHeatWait=500,clickHeatLocalWait=0,clickHeatDebug=(document.location.href.indexOf("debugclickheat")!==-1);function showClickHeatDebug(a){if(clickHeatDebug===true){document.getElementById("clickHeatDebuggerSpan").innerHTML=a;document.getElementById("clickHeatDebuggerDiv").style.display="block"}}function catchClickHeat(m){var n,b,i,g,j,l,a,t,q,d,p,o,s=false,u=false;try{showClickHeatDebug("Gathering click data...");if(clickHeatQuota===0){showClickHeatDebug("Click not logged: quota reached");return true}if(clickHeatGroup===""){showClickHeatDebug("Click not logged: group name empty (clickHeatGroup)");return true}if(!m){m=window.event
}n=m.which||m.button;b=m.srcElement||null;if(n===0){showClickHeatDebug("Click not logged: no button pressed");return true}if(b!==null&&b.tagName.toLowerCase()==="iframe"){if(b.sourceIndex===clickHeatLastIframe){showClickHeatDebug("Click not logged: same iframe (a click on iframe opens a popup and popup is closed => iframe gets the focus again)");return true}clickHeatLastIframe=b.sourceIndex}else{clickHeatLastIframe=-1}i=m.clientX;g=m.clientY;j=clickHeatDocument.clientWidth||window.innerWidth;l=clickHeatDocument.clientHeight||window.innerHeight;a=window.pageXOffset||clickHeatDocument.scrollLeft;t=window.pageYOffset||clickHeatDocument.scrollTop;if(i>j||g>l){showClickHeatDebug("Click not logged: out of document (should be a click on scrollbars)");return true}q=new Date();if(q.getTime()-clickHeatTime<1000){showClickHeatDebug("Click not logged: at least 1 second between clicks");return true}clickHeatTime=q.getTime();if(clickHeatQuota>0){clickHeatQuota=clickHeatQuota-1}o="s="+clickHeatSite+"&g="+clickHeatGroup+"&x="+(i+a)+"&y="+(g+t)+"&w="+j+"&b="+clickHeatBrowser+"&c="+n+"&random="+Date();
showClickHeatDebug("Ready to send click data...");if(clickHeatServer.indexOf("http")!==0){try{u=new ActiveXObject("Msxml2.XMLHTTP")}catch(r){try{u=new ActiveXObject("Microsoft.XMLHTTP")}catch(k){u=null}}if(!u&&typeof(XMLHttpRequest)!=="undefined"){u=new XMLHttpRequest()}if(u){if(clickHeatDebug===true){u.onreadystatechange=function(){if(u.readyState===4){if(u.status===200){showClickHeatDebug("Click recorded at "+clickHeatServer+" with the following parameters:<br/>x = "+(i+a)+" ("+i+"px from left + "+a+"px of horizontal scrolling)<br/>y = "+(g+t)+" ("+g+"px from top + "+t+"px of vertical scrolling)<br/>width = "+j+"<br/>browser = "+clickHeatBrowser+"<br/>click = "+n+"<br/>site = "+clickHeatSite+"<br/>group = "+clickHeatGroup+"<br/><br/>Server answer: "+u.responseText)}else{if(u.status===404){showClickHeatDebug("click.php was not found at: "+(clickHeatServer!==""?clickHeatServer:"/clickheat/click.php")+" please set clickHeatServer value")}else{showClickHeatDebug("click.php returned a status code "+u.status+" with the following error: "+u.responseText)
}}clickHeatLocalWait=0}}}u.open("GET",clickHeatServer+"?"+o,true);u.setRequestHeader("Connection","close");u.send(null);s=true}}if(s===false){if(clickHeatDebug===true){showClickHeatDebug("Click recorded at "+clickHeatServer+" with the following parameters:<br/>x = "+(i+a)+" ("+i+"px from left + "+a+"px of horizontal scrolling)<br/>y = "+(g+t)+" ("+g+"px from top + "+t+"px of vertical scrolling)<br/>width = "+j+"<br/>browser = "+clickHeatBrowser+"<br/>click = "+n+"<br/>site = "+clickHeatSite+"<br/>group = "+clickHeatGroup+'<br/><br/>Server answer:<br/><iframe src="'+clickHeatServer+"?"+o+'" width="700" height="60"></iframe>')}else{p=new Image();p.src=clickHeatServer+"?"+o}}d=new Date();clickHeatLocalWait=d.getTime()+clickHeatWait;while(clickHeatLocalWait>d.getTime()){d=new Date()}}catch(f){showClickHeatDebug("An error occurred while processing click (Javascript error): "+f.message)}return true}function initClickHeat(){var d,f,a,c,e,g;if(clickHeatDebug===true){g=document.createElement("div");
g.id="clickHeatDebuggerDiv";g.style.padding="5px";g.style.display="none";g.style.position="absolute";g.style.top="200px";g.style.left="200px";g.style.border="1px solid #888";g.style.backgroundColor="#eee";g.style.zIndex=99;g.innerHTML='<strong>ClickHeat debug: <a href="#" onmouseover="document.getElementById(\'clickHeatDebuggerDiv\').style.display = \'none\'; return false">Rollover to close</a></strong><br/><br/><span id="clickHeatDebuggerSpan"></span>';document.body.appendChild(g)}if(clickHeatGroup===""||clickHeatServer===""){showClickHeatDebug("ClickHeat NOT initialised: either clickHeatGroup or clickHeatServer is empty");return false}e=document.location.protocol+"//"+document.location.host;if(clickHeatServer.indexOf(e)===0){clickHeatServer=clickHeatServer.substring(e.length,clickHeatServer.length)}addEvtListener(document,"mousedown",catchClickHeat);f=document.getElementsByTagName("iframe");for(d=0;d<f.length;d+=1){addEvtListener(f[d],"focus",catchClickHeat)}clickHeatDocument=document.documentElement&&document.documentElement.clientHeight!==0?document.documentElement:document.body;
a=navigator.userAgent?navigator.userAgent.toLowerCase().replace(/-/g,""):"";c=["chrome","firefox","safari","msie","opera"];clickHeatBrowser="unknown";for(d=0;d<c.length;d+=1){if(a.indexOf(c[d])!==-1){clickHeatBrowser=c[d];break}}showClickHeatDebug("ClickHeat initialised with:<br/>site = "+clickHeatSite+"<br/>group = "+clickHeatGroup+"<br/>server = "+clickHeatServer+"<br/>quota = "+(clickHeatQuota===-1?"unlimited":clickHeatQuota)+"<br/><br/>browser = "+clickHeatBrowser+"<br/><strong>Click in a blank area (not on a link) to test ClickHeat</strong>")};
