window.onerror = null;

function Mod_Date (doc)
{
  IE4 = (document.all) ? 1 : 0;
  if (!doc || IE4)
  {
    doc = document;
  }
  else
  {
    doc = doc.document;
  }
  D = doc.lastModified;
//alert (D);

// D = "Sun Jan 14 14:09:03 2001";  // Linux
// D = "Mon 15 Jan 2001 08:46:45 PM MET";  // Solaris

//  I = D.indexOf (":"); 
  M = new Date (D); //.substr (0, I-2));
// alert (M);
  MM = "0" + (M.getMonth () + 1);
  DD = "0" + M.getDate ();
  YY = 2000 + (M.getYear () % 100);
  doc.write (YY, "-", MM.substring (MM.length - 2, 3), "-", DD.substring (DD.length - 2, 3));
}

//--------------------------------------------
// scramble mail-address
function sm (m, offs, enc)
{
  var s = "";
  for (i = 0; i < m.length; i++)
  {
    var c = m.charCodeAt (i); 
    o = enc ? 0x5F - offs - i : offs + i;
    s = s + String.fromCharCode ((((c - 0x20) + o) % 0x5F) + 0x20);
  }
  document.write (s);
}

//---------------------------------------
function Acc_Link (GIF)
{
  Ref = document.referrer;
  
  cgi = "";
  if (Ref.substring (0, 22) == "http://www14.aname.net")
  {
    cgi = "/~sourceco";
  }
  Uniq = Math.random ();
  Par = '&ref=' + escape (Ref);
  if (parseInt (navigator.appVersion) >= 4)
  {
    Par = Par + '&screen=' + screen.width + 'x' + screen.height + 'x' + screen.colorDepth;
  }
  if (GIF == "1")
  {
    document.write ('<IMG SRC="', cgi, '/cgi-bin/count.pl?GIF=1&', Uniq, '&', Par, '">');
  }
  else
  {
    document.write ('<IMG SRC="', cgi, '/cgi-bin/count.pl?GIF=0&', Uniq, '&', Par, '" WIDTH="1" HEIGHT="1">');
  }
}

//---------------------------------------

function Sokoban_Link (Button)
{
  Par = 'ref=' + escape (document.referrer);
  if (parseInt (navigator.appVersion) >= 4)
  {
    Par = Par + '&screen=' + screen.width + 'x' + screen.height + 'x' + screen.colorDepth;
  }
  document.write ('<a href="http://www.sourcecode.se/cgi-bin/load_sokoban.pl?', Par, '">');
  document.write (Button);
  document.write ('</a>\n');
}
