function 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 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 delCookie(name, path, domain) {
  if (init_getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}
function RandomStr(TextLen) {
  content = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  ID = "";
  t = 0;
  while (TextLen > 0) {
    t = parseInt(Math.floor(61*Math.random()+1));
    ID += content.charAt(t); 
    TextLen--;
  }
  return ID;
}
function RandomWin(NameLen) {
  content = "0123456789";
  WinID = "W_";
  t = 0;
  while (NameLen > 0) {
    t = parseInt(Math.floor(10*Math.random()+1));
    WinID += content.charAt(t); 
    NameLen--;
  }
  return WinID;
}
function init() 
{
  if (top!=self) top.location=self.location;
  var main = "http://www.xtratrix.de/main.htm";
  var now = new Date();
  now.setTime(now.getTime() + 6 * 60 * 60 * 1000);
  var pages = getCookie("pagecounter");
  if (!pages) 
  {
    pages = 1; 
    sessn = RandomStr(10);
  } 
  else 
  {
    pages = parseInt(pages) + 1;
    sessn = getCookie("SessionID");
  }
  setCookie("pagecounter", pages, now, "/");
  setCookie("SessionID", sessn, now, "/");
  if (window.name != "W_____")
    if ((pages == 1) || (window.history.length == 0))
      window.name = RandomWin(4);
  load_it = "<img src=http://www.xtratrix.de/_coding/count.gif?S=";
  load_it += sessn;
  load_it += "&P=";
  load_it += pages.toString();
  load_it += "&W=";
  load_it += window.name;
  load_it += "&URL=";
  load_it += document.url;
  load_it += "></img>";
  document.getElementsByName("PTracker").innerHTML=load_it;
}