function webStats_setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function webStats_getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function webStats_deleteCookie(name, path, domain) {
  if (webStats_getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 04-Jan-01 00:00:01 GMT";
  }
}

function webStats_fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

var oldcky = webStats_getCookie('binarywebstats');
if (oldcky == null)
{
	var dt = new Date();
	dt.setYear(dt.getYear() + 1);
	var randomnum = Math.round(Math.random()*1000000);
	webStats_setCookie('binarywebstats', randomnum, dt, '/', document.domain, false);
	var cky = randomnum;
}
else
{
	var cky = oldcky;
}
var sw;
var sh;
if (!window.screen.width){sw=window.screen.availWidth} else {sw=window.screen.width}
if (!window.screen.height){sh=window.screen.availHeight} else {sh=window.screen.height}
var PostStr = "http://webstats.binarysystems.co.za/track.php?";
    PostStr = PostStr + "DN="  + escape(document.domain);
    PostStr = PostStr + "&PT=" + escape(document.title);
    PostStr = PostStr + "&WP=" + escape(document.location.pathname);
    PostStr = PostStr + "&RP=" + escape(document.referrer);
    PostStr = PostStr + "&CKY="+ escape(cky);
    PostStr = PostStr + "&BN=" + escape(navigator.appName);
    PostStr = PostStr + "&BV=" + escape(navigator.appVersion);
    PostStr = PostStr + "&WPO="+ escape(document.location.search);
    PostStr = PostStr + "&SC=" + window.screen.colorDepth;
    PostStr = PostStr + "&SW=" + sw;
    PostStr = PostStr + "&SH=" + sh;
document.write('<img width="1" height="1" src="' + PostStr +'">');
