// Bill Weinman's Generic Rollover Engine
// (c) 2000 William E. Weinman
//
// http://bw.org/
//
// This program is free software. You may modify and distribute it
// as long as you include this notice in all copies.
//
// No other rights are granted. This program is not "public domain".
//

okay = false;  // wait until variables are initialized

var preload = new Array (

///////////////////////////////////////////////////
// list all your images here.
// Remember: No comma after the last image!
//

  "ws_rarecomics.gif", "ws_sorare.gif", "ws_foodshop.gif", "ws_barataeua.gif", "ws_thft.gif", "ws_thft.gif"

//
// you shouldn't need to modify anything
// below this line
///////////////////////////////////////////////////

  );

// 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]);
    }
  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;
}
