var imgsrc="http://174.143.238.31/t";
var loadtime=new Date().getTime();
var lastc = loadtime;
var testing=false;
var ctr=false;
var scriptname1="clickme.php";
var scriptname2="renavigator.aspx";
var numlink=0;
//var c=getcamp();
var c = ttag ;
var g = "";
//g=getgroup();
var uid=0;
var vis=0;
var ct=0;
var adstr="";
var mlstr = "";
var mlen=100;
var moint = 500;
var fmot=0;
var gmpt=0;
var kybt=0;
var olddiv=null;
var checkm=false;
var typ="ddc";
var mouseX, mouseY;
var kybdstr="";
var mostr="";
var olink="";

function gmp(e)
{
gmpt=1;
if (!e)
var e = window.event||window.Event;

if('undefined'!=typeof e.pageX)
{
mouseX = e.pageX;
mouseY = e.pageY;
}
else
{
mouseX = e.clientX + document.body.scrollLeft;
mouseY = e.clientY + document.body.scrollTop;
}

}

function fmo(){
	fmot=1;
	if(mostr.length < mlen && typeof mouseX != 'undefined' && typeof mouseY != 'undefined'){
	        mostr = mostr + mouseX + ":"+mouseY+ ",";
	}
}

function kybd(e){
	kybt=1;
	var kyb = (window.event) ? event.keyCode : e.keyCode;

	if(kybdstr.length < mlen && typeof kyb != 'undefined'){
		kybdstr = kybdstr + kyb + ",";

	}	
	
}

if(window.Event && document.captureEvents)
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = gmp;

document.onkeyup = kybd;


function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );
  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}


function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


function ZZzzzZZzz(naptime) {
	var sleeping=true;
	var now= new Date;
	var alarm;
	var startingMSeconds = now.getTime();
	while(sleeping) {
		alarm=new Date();
		alarmMSeconds = alarm.getTime();
		if(alarmMSeconds - startingMSeconds > naptime) { sleeping = false; }
	}
	return sleeping;
}

function exitctr(){
	var ctrtime = (new Date().getTime() - loadtime);  //number of milliseconds
		if(! get_cookie("ct")){
			ct = 0;
			set_cookie("ct",ct,2020,01,01);
		} else {
			var ct = get_cookie("ct");
		}
		var i='<img src="'+imgsrc+'?exit=true&uid='+uid+'&c='+c+'&g='+g+'&ctrtime='+
			ctrtime+'&nlink='+numlink+
			'&vis='+vis+'&ct='+ct+
			'&refstr='+escape(document.referrer)+'&dom='+
			escape(window.location)+'&adstr='+escape(adstr)+'&mstr='+escape(mlstr)+
			'&mostr='+escape(mostr)+'&checkm='+checkm+'&kybdstr='+kybdstr+'&typ='+typ+
			'&fmot='+fmot+'&kybt='+kybt+'&gmpt='+gmpt+
			'" />';
			if (!ctr) {
				var newdiv=document.createElement('div');
				newdiv.innerHTML = i;
	        		document.body.appendChild(newdiv);
			} 
		// document.write(i);
		// Delay 300ms
		ZZzzzZZzz(300);
		return true;
}

function addmElement(e){
	if(!e) { e = window.event; }
	var hrefstring = this.href;
  	var results = hrefstring.match ( 'http:\/\/([^\/]*)\/' );
        var results2 = hrefstring.match ( '.*[\&\?]host=([^\&]*).*' );
	var results3 = hrefstring.match ('.*[\&\?]keywords=([^\&]*).*' );
	var t =new Date().getTime();
	var d = t - lastc;
	lastc = t;

  if ( results2 ){
	mlstr += results2[1] + ":" + d+",";
  } else if(results3){
	mlstr += results3[1] + ":"+d+",";	
  } else if(results) { 
   	mlstr += results[1] + ":"+d+",";
  } else {
	mlstr += hrefstring.substring(0,15) + ":"+d+",";
  }


	return true;
}

function addElems(e) {
	if (!e) { e = window.event; }
	var hrefstring = this.href;
	var ctrtime = (new Date().getTime() - loadtime);  //number of milliseconds
	if(hrefstring.indexOf(scriptname1) > 0 || hrefstring.indexOf(scriptname2) > 0 || testing){
		ctr=true;
        	olink = this.href;
		//var checkm = false;
        	if(mostr == "" && mlstr == "" && kybdstr == ""){
        		//var answer = confirm("Please hit confirm to verify you are a human clicking on this ad.");
			checkm = true;
       	         if(answer){
       	        	checkm = true; 
		 } else {
                        //add variable that indicates hitting cancel
                        //don't follow link
			checkm = true;
       	         }
	        } else {
			checkm = true;
		}


			

		if(! get_cookie("ct")){
			ct = 1;
			set_cookie("ct",ct,2020,01,01);
		} else {
			var ct = get_cookie("ct");
			ct++;
			set_cookie("ct",ct,2020,01,01);
		}

		var i='<img src="'+imgsrc+'?ctrtime='+ctrtime+'&uid='+uid+'&c='+c+'&g='+g+'&nlink='+numlink+
			'&vis='+vis+'&ct='+ct+
			'&addlink='+escape(hrefstring)+
			'&refstr='+escape(document.referrer)+'&dom='+escape(window.location)+
			'&adstr='+escape(adstr)+'&mstr='+escape(mlstr)+
			'&mostr='+escape(mostr)+'&checkm='+checkm+'&kybdstr='+kybdstr+'&typ='+typ+
			'&fmot='+fmot+'&kybt='+kybt+'&gmpt='+gmpt+
			'" />';
	        var newdiv=document.createElement('div');
	        newdiv.innerHTML = i;
		if (olddiv == null) {
	        	document.body.appendChild(newdiv);
		} else {
			document.body.replaceChild(newdiv,olddiv);
		}
		olddiv=newdiv;
		

		// document.write(i);
		// Delay 300ms
		ZZzzzZZzz(300);

		return checkm;
	
	}
	return true;
}


function modAllHrefs() {
        var anchors=document.getElementsByTagName("a");
        for (var i = 0; i < anchors.length; i++) {
		var hrefstr=anchors[i].href;
		if(hrefstr.indexOf(scriptname1) > 0 || hrefstr.indexOf(scriptname2) > 0 || testing ){
			numlink++;
  			var results = hrefstr.match ( '[^\&\?]*host=([^\&]*).*' );
			var h=""
			if(results){
				h = results[1];
			} else {
				//alternative
				h = anchors[i].innerHTML;
				var hres = h.match ( '(.*\..*\..*)' );
				if(hres){
					h = hres[1];
				} else { 
				h = hrefstr.substring(0,15);
				}
			}
			adstr = adstr + "," + h.replace(","," ");

		}
			// Is this W3C or IE		
			if (window.addEventListener) {
                	anchors[i].addEventListener("click",addElems,false);
			anchors[i].addEventListener("mouseover",addmElement,false);
			} else if(window.attacheEvent)  { 
                	anchors[i].attachEvent("onclick",addElems);
			anchors[i].attachEvent("onmouseover",addmElement);
			} else {
			anchors[i].onclick = addElems;
			anchors[i].onmouseover = addmElement;
			}
        }
}

if( ! get_cookie("uid" )){


	var r1 = Math.floor(Math.random()*1000000);
	var r2 = Math.floor(Math.random()*1000000);
	var r3 = Math.floor(Math.random()*1000000);
	var r4 = Math.floor(Math.random()*1000000);

	var r = "" + r1 + "." + r2 + "." + r3 + "." + r4;
	set_cookie("uid",r,2020,01,01);
	var uid= get_cookie("uid");


} else {

	var uid = get_cookie("uid");
	

}

if(! get_cookie("vis")){
	vis = 1;
	set_cookie("vis",vis,2020,01,01);
} else {
		vis = get_cookie("vis");
	if(olddiv == null){
		vis++;
		set_cookie("vis",vis,2020,01,01);
	}
}

// Is this W3C or IE
if (window.addEventListener) {
	window.addEventListener("load",modAllHrefs,false);
	window.addEventListener("unload",exitctr,false);
} else if(window.attachEvent){
	window.attachEvent("onload",modAllHrefs);
	window.attachEvent("onunload",exitctr);
} else {
	window.onload = modAllHrefs;
	window.onunload = exitctr;
}

var mint = setInterval("fmo()",moint);




