// array to hold the swap images.
var swappedOut = new Array(), nSwappedOut = 0, pics = new Array();

function mout() {
  /***** supports multiple images *****/
  // no need to pass any arguments

    var i;
    
    for(i = 0; i < nSwappedOut; i++) {
        // swap all tracked images
        swappedOut[i].src = swappedOut[i].oldSrc;
    }
}

function mover() {
  /***** supports multiple images *****/
  // pass the arguments in as a list of place holder name
  // ie: mover('holder1', 'holder2', 'holder3');
  // it will find the extension and path of the original image
  // and use the same one for the new image
  // it will also assume that the mouseover image start with an 
  // underscore '_' character

    var i, j = 0, imgSwapped, args = mover.arguments, path = "", file = "", slash = 0;
    nSwappedOut = args.length;

    for(i = 0; i < nSwappedOut; i++)
    {
      imgSwapped = document.images[args[i]];  // gets the image
        
      if(imgSwapped != null)
      {
        // get the filename of the image
        slash = imgSwapped.src.lastIndexOf("index.html") + 1;
        file = imgSwapped.src.substring(slash);
        path = imgSwapped.src.substring(0, slash);

        // if the image is already m/o, then don't do it again
        if ( file.indexOf("_") != 0 )
        {
          // track all swapped images
          swappedOut[j++] = imgSwapped;
          imgSwapped.oldSrc = imgSwapped.src;
          imgSwapped.src = path + "_" + file;
        }
        else
        {
          nSwappedOut = 0;
        }
      }
    }
}

function preload() {
    if(document.images) {
        if(!document.pics)
            document.pics = new Array();

        var i
        var j = 0
        var args = preload.arguments;

        for(i = 0; i < args.length; i++) {
            if (args[i].indexOf("#") != 0) {
                document.pics[j] = new Image;
                document.pics[j++].src = args[i];
            }
        }
    }
}

var popupwin = null;

function popup(psize, url)
{
    var findx = psize.indexOf("x", 0);
    
    if(findx != -1)
    {
        //Found the character x, assume that the psize string contains an XxY notation
        var x = psize.substr(0, findx);
        var y = psize.substr(findx+1, psize.length-findx-1);

        dopopup(x, y, url, "_blank");
    }
    else
    {
        switch(psize)
        {
            case "TINY":
                dopopup(200, 120, url, "_blank");   
                break;
            case "SMALL":
                dopopup(320, 240, url, "_blank");
                break;
            case "MED":
                dopopup(640, 480, url, "_blank");
                break;
            case "BIG":
                dopopup(750, 500, url, "_blank");
                break;
            default:
                dopopup(580, 400, url, "_blank");
                break;
        }
    }
}

function dopopup(wx, wy, url, name)
{
    var nwidth = (window.screen.width / 2) - ((wx / 2) + 10);
    var nheight = (window.screen.height / 2) - ((wy / 2) + 50);

    popupwin = window.open(url, name, "location=no,directories=no,status=yes,menubar=no,toolbar=no,scrollbars=1,resizable=yes,height=" + wy + ",width=" + wx + ",left=" + nwidth + ",top=" + nheight + ",screenX=" + nwidth + ",screenY=" + nheight)
    popupwin.focus();
}

function inspect( obj )
{
  if ( ! obj )
  {
    ret = prompt ("Enter object", "document");
    obj = eval(ret);
  }

  var temp = "";
  for (x in obj)
  {
    temp += x + ": " + obj[x] + "\n";
    if ( temp.length > 700 )
    {
      alert(temp);temp='';
    }
  }
  alert (temp);
}

function outputdate( )
{
  // January 8th, 2002
  var txtmonth, txtday;

  var today = new Date();
  var month = today.getMonth();
  var day = today.getDate();
  var year = today.getFullYear();

  var days = new Array( "", 
                        "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th",
                        "th", "th", "th", "th", "th", "th", "th", "th", "th", "th",
                        "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th",
                        "st" );
  var months = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" );

  txtmonth = months[month];
  txtday = days[day];

  document.write( txtmonth + " " + day + "<sup>" + txtday + "</sup>, " + year );

}