function WM_preloadImages() {

/*
WM_preloadImages()
Loads images into the browser's cache for later use.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}

// --------------------------------------------------------------
// rewriteLayer v1.0 (February 08, 2001)
//
// A cross browser compatable function for the re-writting of a
// DIV tag's contents.
//
// Tested for: IE5.x, NS4.x, NS6.x
//
// by Martin Honnen
// taken from FAQTS
// http://www.faqts.com/knowledge_base/view.phtml/aid/867/fid/128
// --------------------------------------------------------------

function rewriteLayer (idOrPath, html) {
	if (document.layers) {
		var l = idOrPath.indexOf('.') != -1 ? eval(idOrPath) : document[idOrPath];
		if (!l.ol) {
			var ol = l.ol = new Layer (l.clip.width, l);
			ol.clip.width = l.clip.width;
			ol.clip.height = l.clip.height;
			ol.bgColor = l.bgColor;
			l.visibility = 'hide';
			ol.visibility = 'show';
		} // if
	    var ol = l.ol;
	    ol.document.open();
	    ol.document.write(html);
	    ol.document.close();
	} else if (document.all || document.getElementById) {
		var p = idOrPath.indexOf('.');
		var id = p != -1 ? 
		idOrPath.substring(idOrPath.lastIndexOf('.') + 1) : idOrPath;
		if (document.all) {
			document.all[id].innerHTML = html;
		} else {
			var l = document.getElementById(id);
			var r = document.createRange();
			r.setStartAfter(l);
			var docFrag = r.createContextualFragment(html);
			while (l.hasChildNodes()) {
				l.removeChild(l.firstChild);
			} // while
			l.appendChild(docFrag);
		} // else..if
	} // if
} // function..rewriteLayer


