// CAMPSITE STATS -- (c) 2005 John Pye -- You are at 99.245.124.118
var cs_pub, cs_iss, cs_sec, cs_art, cs_usr, cs_tpc, cs_lang;
d = document; w=window;var pot_img = 'http://stats.tol.org/image.php';
pot_img += '?c=' + (pot_client?pot_client:0);
pot_img += '&cs=' + (w.cs_pub?cs_pub:0) + ',' + (w.cs_iss?cs_iss:0) + ',' + (w.cs_sec?cs_sec:0) + ',' + (w.cs_tpc?cs_tpc:0) + ',' + (w.cs_art?cs_art:0) + ',' + (w.cs_lang?cs_lang:0);
pot_img += '&d=' + escape(d.URL);
pot_img += '&t=' + escape(d.title);
if(w.cs_srch)pot_img += '&s=' + escape(cs_srch);
if(w.cs_usr) pot_img += '&u=' + cs_usr;
if(d.referrer) pot_img += '&r=' + b64enc(d.referrer);
d.write('<img width=1 height=1 border=0 src="'+pot_img+'"><br>');

function b64enc(s) {
  var c = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  var bits, dual, i=0, o='';

  while(s.length >= i + 3) {
    bits = (s.charCodeAt(i++) & 0xff) <<16 |
           (s.charCodeAt(i++) & 0xff) <<8 |
            s.charCodeAt(i++) & 0xff;

    o += c.charAt((bits & 0x00fc0000) >>18) +
              c.charAt((bits & 0x0003f000) >>12) +
              c.charAt((bits & 0x00000fc0) >> 6) +
              c.charAt((bits & 0x0000003f));
  }

  if(s.length -i > 0 && s.length -i < 3) {
    dual = Boolean(s.length -i -1);

    bits = ((s.charCodeAt(i++) & 0xff) <<16) |
           (dual ? (s.charCodeAt(i) & 0xff) <<8 : 0);

    o += c.charAt((bits & 0x00fc0000) >>18) +
              c.charAt((bits & 0x0003f000) >>12) +
              (dual ? c.charAt((bits & 0x00000fc0) >>6) : '=') +
              '=';
  }

  return(o);
}

