//var theserver = 'www.kungfu.uklinux.net';
//var theserver = 'elm:5080';
var theserver=location.host;

function extra_escape (s) {
var ch
s = escape(s)
while ((ch = s.indexOf('+')) > 0) s = s.substr(0, ch) + '%2B' + s.substr(ch+1, s.length)
while ((ch = s.indexOf('/')) > 0) s = s.substr(0, ch) + '%2F' + s.substr(ch+1, s.length)
return s
}

function js_referrer_getCookie() {
var label = 'VisitID';
var labellen = label.length;
var cLen = document.cookie.length;
var i=0;
var cEnd = -2;
while (i<cLen) {
var j=i+labellen;
if (document.cookie.substring(i,j)==label){
cEnd = document.cookie.indexOf(";",j);
if (cEnd==-1) {
cEnd = document.cookie.length;
}
return unescape(document.cookie.substring(j+1,cEnd));
}
i++;
}
return "";
}

function writeCounter(status, docReferrer) {
//if ((docReferrer == "") || (docReferrer == 'undefined')) docReferrer = document.referrer;
docReferrer ? null : docReferrer = document.referrer;
var appn = navigator.appName;
if (appn == "Microsoft Internet Explorer") appn='ie';
if (appn == "Netscape") appn='ns';
if (navigator.userAgent.indexOf('Opera') != -1) appn = 'op';
var appver = parseFloat(navigator.appVersion);
var loc_href = window.location.pathname;
var plat = navigator.platform;
var myCookie = js_referrer_getCookie();
if (appn == "ie") {
var bH=document.body.scrollHeight;
var bW=document.body.scrollWidth;
}
else {
var bH=window.innerHeight;
var bW=window.innerWidth;
}
//screen.pixelDepth
var nDoubleSlash = docReferrer.indexOf("//")+2;
if (nDoubleSlash == 1) nDoubleSlash = 0;	// should have one though 1 = (-1 + 2)
var nStart = docReferrer.indexOf("/", nDoubleSlash);

if (nStart <= 0) {
var host = docReferrer.slice(nDoubleSlash);
var pn = '';
}
else {
var host = docReferrer.slice(nDoubleSlash, nStart);
var pn = docReferrer.slice(nStart);
}
var strS="<img src='http://"+theserver+"/cgi-bin/counter.pl?" + status
+"&host="+escape(host)
+"&ref="+escape(pn)
+"&an="+escape(appn)
+"&av="+escape(appver)
+"&plat="+escape(plat)
+"&cke="+escape(myCookie)
+"&pg="+extra_escape(loc_href)
+"&je="+((navigator.javaEnabled() == 'true') ? 1 : 0)
+"&sh="+screen.height
+"&sw="+screen.width
+"&cd="+screen.colorDepth
+"&bH="+bH
+"&bW="+bW
+"' border=0>";	//width=1 height=1

document.write(strS);
}
