if ( typeof addLoadListener != 'function' )
{
  /* copied from The Javascript Anthology, p.15 */
  function addLoadListener(fn)
  {
    if ( typeof window.addEventListener != 'undefined' )
    {
      window.addEventListener('load', fn, false);
    }
    else if ( typeof document.addEventListener != 'undefined' )
    {
      document.addEventListener('load', fn, false);
    }
    else if ( typeof window.attachEvent != 'undefined' )
    {
      window.attachEvent('onload', fn);
    }
    else
    {
      var oldfn = window.onload;
      if ( typeof window.onload != 'function' )
      {
        window.onload = fn;
      }
      else
      {
        window.onload = function()
        {
          oldfn();
          fn();
        };
      }
    } /* done with all onload possibilities */
  } /* done defining addLoadListener */
} /* done ensuring addLoadListener exists */

var ib;
var zat = String.fromCharCode(3*8 /*+4*3*7*/ + 8*/*34**/5);
var whereami = document.location.toString();
var pre = ( whereami.indexOf('http://') < 0 ? 0 : 7 /* length of http:// */ );
pre += ( whereami.indexOf('www.') < 0 ? 0 : 4 );
var loc = whereami.indexOf('/', pre);
var angle = whereami.substring(pre,loc++).toLowerCase();
var loc2 = whereami.indexOf('/', loc);
var nome = whereami.substring(loc,loc2).toLowerCase();

function applemsg()
{
return "You can cont"+/*"r"+*/"act me at "+nome+zat+angle+
       ".\nSe"+/*"re"*/"nd"+/*"ipitous"*/" ma"+/*"levolently f"*/
       "il"+/*"illed*/" now?\n";
}
function japple()
{
var msg=applemsg();
if ( confirm(msg) )
   apple(nome,angle)
}

var nw = null; // the new window

function prejapple()
{
if ( navigator.appName.indexOf("Internet Explorer") >= 0 )
  { // IE can't handle the document.write!
  japple();
  return;
  }

if ( nw && !nw.closed )
  {
  nw.focus();
  return;
  }

var msg = applemsg();
nw = window.open("about:blank","_blank",
                     "channelmode=no,directories=no,location=no,menubar=no,status=no,height=150,width=300,scrollbars=yes",
                     false);
nw.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n'
  + '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">\n'
  + '<head>\n'
  + '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n'
  + '<meta http-equiv="Content-Style-Type" content="text/css" />\n'
  + '<meta http-equiv="Content-Script-Type" content="text/javascript" />\n'
  //+ '<link rel="stylesheet" type="text/css" href="/DesktopManager/DesktopManager.css" />\n'
  + '<script src="/DesktopManager/japple.js" type="text/javascript"></script>\n'
  + '<title>' + msg.substring(8,15) + '</title>\n'
  + '</head>\n\n');
nw.document.write('\n<body onload="document.getElementById(\'msg\').innerHTML=applemsg()">\n');
//nw.document.write('<script type="text/javascript">\n<!--\n'
//  + 'document.write("<p>"+applemsg()+"</p>\\n");\n//-->\n</script>\n');
nw.document.write('<p id="msg"></p>\n');
nw.document.write('\n<form action="" onsubmit="return false;">\n'
  + '<p><button type="button" onclick="window.close();">Cancel</button> '
  + '<button type="button" onclick="apple(nome,angle); window.close();">OK</button></p>\n'
  + '</form>\n');
nw.document.write('\n</body>\n</html>\n');
nw.document.close();
nw.focus();
}

function apple(nome,angle)
{
var string="mai"/*+"s oui, bien sur i"*/+"l"/*+" a dit "*/+
       "to:"+nome+zat+angle+"";
document.location=string
}

if ( typeof attachEventListener != 'function' )
{
  /* copied from The Javascript Anthology, p. 234 */
  function attachEventListener(target, eventType, functionRef, capture)
  {
    if ( typeof target.addEventListener != "undefined" )
    {
      target.addEventListener(eventType, functionRef, capture);
    }
    else if ( typeof target.attachEvent != "undefined" )
    {
      target.attachEvent("on" + eventType, functionRef);
    }
    else
    {
      eventType = "on" + eventType;

      if ( typeof target[eventType] == "function" )
      {
        var oldListener = target[eventType];

        target[eventType] = function()
        {
          oldListener();

          return functionRef();
        };
      }
      else
      {
        target[eventType] = functionRef;
      }
    } /* done figuring out how to attach EventListener */
  } /* done defining attachEventListener */
}

function addQuestions()
{
  var par = document.getElementById("questions");
  var content = document.createElement("p");
  var anchor = document.createElement("a");
  attachEventListener(anchor, "click", prejapple, false);
  attachEventListener(anchor, "mouseover",
                      function () { window.status="Just ask!"; },
                      false);
  attachEventListener(anchor, "mouseout",
                      function () { window.status=""; },
                      false);
  anchor.appendChild(document.createTextNode("Questions?"));
  content.appendChild(anchor);
  par.appendChild(content);
}

addLoadListener(addQuestions);
