

okay = false;  // wait until variables are initialized

var preload = new Array (
);

var clockID = 0;

//
/////////////////////////////////////////////////////////
//

// find out what browser this is
with(navigator) {
  code = appCodeName;
  app = appName;
  version = appVersion;
  iver = parseInt(version);
  ua = userAgent;
  }

// this will work in "Mozilla" 3+ (includes MSIE 4)
if ( code == "Mozilla" && iver >= 3 )  okay = true;
else { okay = false; }

if(okay) {
  // compile the RegExp because we use it a lot
  var re = new RegExp();
  re.compile("[\\/.:\\-\\s]", "g");

  // preload the images
  for (var i = 0; i < preload.length; i++) {
    i_preload(preload[i]);
    //alert(preload[i]);
    }
  var preloaded = true
  }

// take a filename and make a legal variable name from it
function iname (img)
{
var s = img.replace(re, "_");
return s;
}

// preload the images
function i_preload(img)
{
if(img) {
  var imgn = iname(img);
  eval(imgn + " = new Image()");
  eval(imgn + ".src = '" + img + "'");
  }
return true;
}

// swap entry function
function swap (name, image)
{
   if(!okay) return true; // just leave unless okay

   // don't Try to do this before the preloading is finished
   if(preloaded) document.images[name].src = image;
   return true;
}

////////////////////////////////////////////////////////
//CLOCK FUNCTIONS
//
function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID = 0;
   }

   var tDate = new Date();

   var cHours   = tDate.getUTCHours();
   var cMinutes = tDate.getUTCMinutes();
   var cSeconds = tDate.getUTCSeconds();

   if(cSeconds < 10) {
      cSeconds = "0" + cSeconds;
   }
   if(cMinutes < 10) {
      cMinutes = "0" + cMinutes;
   }
   if(cHours < 10) {
      cHours = "0" + cHours;
   }

   document.theClock.theTime.value = ""
                                   + cHours + ":"
                                   + cMinutes + ":"
                                   + cSeconds + " GMT";

   clockID = setTimeout("UpdateClock()", 1000);
}

function StartClock() {
   clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID = 0;
   }
}

