var start=-1,end=-1;
var url=document.URL;
var rel_path;

// Find postion of the first slash(beginning of relative-path) and the lastdot(for cutting the file extension)
for(var i=7;i<url.length;i++)
{
	// Is this char the first slash (after the hostname)?
	if(url.charAt(i)=="/" && start==-1) start=i;
	
	// Or is it a dot? -> maybe file extension
	if(url.charAt(i)==".") end=i;
}

// Cut the string and replace all slashes with -
rel_path = url.substr(start,end-start).replace("/","-");
rel_path = url.substr(start,end-start).replace("/","-");

rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
rel_path = rel_path.replace("/","-");
// document.write (end
// Write image tag

// ADAM EDITED ONLY BELOW THIS LINE
// THIS WAS THE ORIGINAL CODE
//  
// document.cookie = "Apache = 127.0.0.1; expires = Thu,31-Dec-2020 00:00:00GMT;"
//
//document.write("<img src=\"http://202.181.20.30/counter/counter.php?digit=glow&page=" + rel_path + "\" >");
//
//--------------------------------------------------------------

var cookieData = readCookie("cook");

if (cookieData == "x627582" | cookieData == "x327316" | cookieData ==
"780752"  | cookieData == "130585" | cookieData == "288522" | cookieData ==
"657483" | cookieData == "462044" ){
	//location.href = "http://www.radio-active.net.au/web/teamtrack/c/index.html";
	location.href = location.href.replace ("/teamtrack/","/tt/");
}

if( cookieData == null ) {
    
    var n = "cook";
    var exp = 365;
    var v = "";
    for(var i = 0; i < 6; i++) 
	v += Math.floor( Math.random() * 10 )
    createCookie( n, v, exp );
    cookieData = readCookie("cook");
}

// encoded URL
//document.write("<img src=\"http://202.181.20.30/counter/counter.php?cookie="
//+ cookieData + "&amp;digit=glow&amp;page=" + rel_path + "\" >");

//   var awstatsscreenlogger="screen.gif";
//   document.write('<img src="http://202.181.20.30/'+awstatsscreenlogger+'?w='+screen.width+'&h='+screen.height+'" border=0 width=0 height=0>');


// UN-encoded URL
// document.write("<img src=\"http://202.181.20.30/counter/counter.php?cookie=" + cookieData + "&digit=glow&page=" + rel_path + "\" >");

function createCookie( name, value, days ) {
	
    if (days) {
	var date = new Date();
	date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) );
	var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for( var i = 0 ; i < ca.length ; i++) {
	var c = ca[i];
	while( c.charAt(0) == ' ' ) c = c.substring( 1, c.length );
	if( c.indexOf( nameEQ ) == 0 ) 
	    return c.substring( nameEQ.length, c.length );
    }
    return null;
}

