// convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

/*-----------------------------------
Determines browser
-----------------------------------*/
 // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1));
                //&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
   
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
  
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
	var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    var is_safari = (agt.indexOf("safari") != -1);    

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
	var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
	var is_opera7up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6);
   

    
    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
   
    var is_mac    = (agt.indexOf("mac")!=-1);

/*-----------------------------------
global variable initialization
-----------------------------------*/
var swapArray = new Array();  //global that holds swap images info

//= Determines layer ID depending on the browser

function getLayerRef(layerID) {
	if (is_nav && is_nav6up) {
		return document.getElementById(layerID);
	} else if (is_nav) {
		return document.layers[layerID];
	} else {
		return document.all[layerID];
	}
}
/*-----------------------------------
Called from the onLoad() inside the body tag 
Creates arrays for all images and references 
to the layers involved in the navigation     
-----------------------------------*/
function initialize() {
	parseLayers(document);
}

/*---------------------------------------
Called from initialize()
Automatically parse every layer in document,
determining which have swappable images, 
and (NS only) create references to every 
layer in the document
---------------------------------------*/
function parseLayers(str) {
	for (var i=0; i < str.images.length; i++) {
		if (str.images[i].name != "") {
			createImageObjects(str.images[i]);
		}
	}
	if (is_nav && !is_nav6up) {
		for (var i=0; i < str.layers.length; i++) {
		    var layRef = str.layers[i].name;
			layerArray[layRef] = new Object();
			layerArray[layRef].layerRef = str.layers[layRef];
			parseLayers(str.layers[i].document);
		}
	}
}

/*---------------------------------------
Called from the <a href> tag      
Swap image function for rollovers 
---------------------------------------*/
function swap(imgName, onoff, whichButton, type) {
	if ((whichButton == imgName) && (swapArray[imgName] != null)) {
		if (type == 'tabs') {
			(onoff == 'on') ? swapArray[imgName].layerRef.src = swapArray[imgName]['up'].src : swapArray[imgName].layerRef.src = swapArray[imgName]['up'].src;
		} else {
			(onoff == 'on') ? swapArray[imgName].layerRef.src = swapArray[imgName]['down'].src : swapArray[imgName].layerRef.src = swapArray[imgName]['down'].src;
		}
	} else if (swapArray[imgName] != null) {
		swapArray[imgName].layerRef.src = swapArray[imgName][onoff].src;
	}
}

/*---------------------------------------
Called from parseLayers()
Preloads and creates object references for swappable images
including _on state, _off state, and DOM image object path
---------------------------------------*/
function createImageObjects(imgObj) {
	var fnameExp = /(\.|_over\.|_down\.|_up\.)[^\.]*$/;
	var ftypeExp = /\.[^\.]*$/;   // regular expression used to split the filename string
	var srcString = imgObj.src;
	var extString = srcString.match(ftypeExp); // grab the extension
	var fnameString = srcString.split(fnameExp, 1);
	var imgRef = imgObj.name;	 
	swapArray[imgRef] = new Object();
	swapArray[imgRef].off = new Image();
	swapArray[imgRef].off.src = fnameString + extString;
	swapArray[imgRef].over = new Image();
	swapArray[imgRef].over.src = fnameString + "_over" + extString;
	swapArray[imgRef].down = new Image();
	swapArray[imgRef].down.src = fnameString + "_down" + extString;
	swapArray[imgRef].layerRef = imgObj;
	swapArray[imgRef].up = new Image();
	swapArray[imgRef].up.src = fnameString + "_up" + extString;
	swapArray[imgRef].layerRef = imgObj;
}

function swapGroup(imgName, group, type) {
	for (prop in swapArray) {
		if (prop.indexOf(group) != -1) {
      swap(prop, 'off');
		}
	}
	(type == "tabs") ? swap(imgName, 'up') : swap(imgName, 'down');
}

function launchWindow(URL, name) {
	newwin = window.open(URL,name,'location=0,status=0,menubar=0,toolbar=0,resizable=0,width=1024,height=718,left=0,top=0');
}
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2000 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

//----------------------------------------------------------------------------
// Code to determine the browser and version.
//----------------------------------------------------------------------------

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

//----------------------------------------------------------------------------
// Code for handling the menu bar and active button.
//----------------------------------------------------------------------------

var activeButton = null;

/* [MODIFIED] This code commented out, not needed for activate/deactivate
   on mouseover.

// Capture mouse clicks on the page so any active button can be
// deactivated.

if (browser.isIE)
  document.onmousedown = pageMousedown;
else
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var el;

  // If there is no active button, exit.

  if (activeButton == null)
    return;

  // Find the element that was clicked on.

  if (browser.isIE)
    el = window.event.srcElement;
  else
    el = (event.target.tagName ? event.target : event.target.parentNode);

  // If the active button was clicked on, exit.

  if (el == activeButton)
    return;

  // If the element is not part of a menu, reset and clear the active
  // button.

  if (getContainerWith(el, "DIV", "menu") == null) {
    resetButton(activeButton);
    activeButton = null;
  }
}

[END MODIFIED] */

function buttonClick(event, menuId) {

  var button;

  // Get the target button element.

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;
  // Blur focus from the link to remove that annoying outline.
 
  button.blur();

  // Associate the named menu to this button if not already done.
  // Additionally, initialize menu display.

  if (button.menu == null) {
    button.menu = document.getElementById(menuId);
    if (button.menu.isInitialized == null)
      menuInit(button.menu);
  }

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the button, if not already done.

  if (button.onmouseout == null)
    button.onmouseout = buttonOrMenuMouseout;

  // Exit if this button is the currently active one.

  if (button == activeButton)
    return false;

  // [END MODIFIED]

  // Reset the currently active button, if any.

  if (activeButton != null)
    resetButton(activeButton);

  // Activate this button, unless it was the currently active one.

  if (button != activeButton) {
    depressButton(button);
    activeButton = button;
  }
  else
    activeButton = null;

  return false;
}

function buttonMouseover(event, menuId) {

  var button;

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Activates this button's menu if no other is currently active.

  if (activeButton == null) {
    buttonClick(event, menuId);
    return;
  }

  // [END MODIFIED]

  // Find the target button element.

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  // If any other button menu is active, make this one active instead.

  if (activeButton != null && activeButton != button)
    buttonClick(event, menuId);
}

function depressButton(button) {

  var x, y;

  // Update the button's style class to make it look like it's
  // depressed.
	if (whichMenu != button) {
		button.className += " menuButtonActive";
	}

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the button, if not already done.

  if (button.onmouseout == null)
    button.onmouseout = buttonOrMenuMouseout;
  if (button.menu.onmouseout == null)
    button.menu.onmouseout = buttonOrMenuMouseout;

  // [END MODIFIED]

  // Position the associated drop down menu under the button and
  // show it.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;

  // For IE, adjust position.

  if (browser.isIE) {
    x += button.offsetParent.clientLeft;
    y += button.offsetParent.clientTop;
  }

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";
}

function resetButton(button) {

  // Restore the button's style class.

  removeClassName(button, "menuButtonActive");

  // Hide the button's menu, first closing any sub menus.

  if (button.menu != null) {
    closeSubMenu(button.menu);
    button.menu.style.visibility = "hidden";
	
  }
}

//----------------------------------------------------------------------------
// Code to handle the menus and sub menus.
//----------------------------------------------------------------------------

function menuMouseover(event) {
  var menu;
  // Find the target menu element.

  if (browser.isIE)
    menu = getContainerWith(window.event.srcElement, "DIV", "menu");
  else
    menu = event.currentTarget;

  // Close any active sub menu.

  if (menu.activeItem != null)
    closeSubMenu(menu);
}

function menuItemMouseover(event, menuId) {

  var item, menu, x, y;

  // Find the target item element and its parent menu element.

  if (browser.isIE)
    item = getContainerWith(window.event.srcElement, "A", "menuItem");
  else
    item = event.currentTarget;
  menu = getContainerWith(item, "DIV", "menu");

  // Close any active sub menu and mark this one as active.

  if (menu.activeItem != null)
    closeSubMenu(menu);
  menu.activeItem = item;

  // Highlight the item element.

  item.className += " menuItemHighlight";

  // Initialize the sub menu, if not already done.

  if (item.subMenu == null) {
    item.subMenu = document.getElementById(menuId);
    if (item.subMenu.isInitialized == null)
      menuInit(item.subMenu);
  }

  // [MODIFIED] Added for activate/deactivate on mouseover.

  // Set mouseout event handler for the sub menu, if not already done.

  if (item.subMenu.onmouseout == null)
    item.subMenu.onmouseout = buttonOrMenuMouseout;

  // [END MODIFIED]

  // Get position for submenu based on the menu item.

  x = getPageOffsetLeft(item) + item.offsetWidth;
  y = getPageOffsetTop(item);

  // Adjust position to fit in view.

  var maxX, maxY;

  if (browser.isNS) {
    maxX = window.scrollX + window.innerWidth;
    maxY = window.scrollY + window.innerHeight;
  }
  if (browser.isIE) {
    maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
      (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
    maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
      (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
  }
  maxX -= item.subMenu.offsetWidth;
  maxY -= item.subMenu.offsetHeight;

  if (x > maxX)
    x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
      + (menu.offsetWidth - item.offsetWidth));
  y = Math.max(0, Math.min(y, maxY));

  // Position and show the sub menu.

  item.subMenu.style.left = x + "px";
  item.subMenu.style.top  = y + "px";
  item.subMenu.style.visibility = "visible";

  // Stop the event from bubbling.

  if (browser.isIE)
    window.event.cancelBubble = true;
  else
    event.stopPropagation();
}

function closeSubMenu(menu) {

  if (menu == null || menu.activeItem == null)
    return;

  // Recursively close any sub menus.

  if (menu.activeItem.subMenu != null) {
    closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility = "hidden";
    menu.activeItem.subMenu = null;
  }
  removeClassName(menu.activeItem, "menuItemHighlight");
  menu.activeItem = null;
}

// [MODIFIED] Added for activate/deactivate on mouseover. Handler for mouseout
// event on buttons and menus.

function buttonOrMenuMouseout(event) {
  var el;

  // If there is no active button, exit.

  if (activeButton == null)
    return;

  // Find the element the mouse is moving to.

  if (browser.isIE)
    el = window.event.toElement;
  else if (event.relatedTarget != null)
      el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);

  // If the element is not part of a menu, reset the active button.

  if (getContainerWith(el, "DIV", "menu") == null) {
    resetButton(activeButton);
    activeButton = null;
  }
}

// [END MODIFIED]

//----------------------------------------------------------------------------
// Code to initialize menus.
//----------------------------------------------------------------------------

function menuInit(menu) {

  var itemList, spanList;
  var textEl, arrowEl;
  var itemWidth;
  var w, dw;
  var i, j;

  // For IE, replace arrow characters.

  if (browser.isIE) {
    menu.style.lineHeight = "2.5ex";
    spanList = menu.getElementsByTagName("SPAN");
    for (i = 0; i < spanList.length; i++)
      if (hasClassName(spanList[i], "menuItemArrow")) {
        spanList[i].style.fontFamily = "Webdings";
        spanList[i].firstChild.nodeValue = "4";
      }
  }

  // Find the width of a menu item.

  itemList = menu.getElementsByTagName("A");
  if (itemList.length > 0)
    itemWidth = itemList[0].offsetWidth;
  else
    return;

  // For items with arrows, add padding to item text to make the
  // arrows flush right.

  for (i = 0; i < itemList.length; i++) {
    spanList = itemList[i].getElementsByTagName("SPAN");
    textEl  = null;
    arrowEl = null;
    for (j = 0; j < spanList.length; j++) {
      if (hasClassName(spanList[j], "menuItemText"))
        textEl = spanList[j];
      if (hasClassName(spanList[j], "menuItemArrow"))
        arrowEl = spanList[j];
    }
    if (textEl != null && arrowEl != null) {
      textEl.style.paddingRight = (itemWidth 
        - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
      // For Opera, remove the negative right margin to fix a display bug.
      if (browser.isOP)
        arrowEl.style.marginRight = "0px";
    }
  }

  // Fix IE hover problem by setting an explicit width on first item of
  // the menu.

  if (browser.isIE) {
    w = itemList[0].offsetWidth;
    itemList[0].style.width = w + "px";
    dw = itemList[0].offsetWidth - w;
    w -= dw;
    itemList[0].style.width = w + "px";
  }

  // Mark menu as initialized.

  menu.isInitialized = true;
}

//----------------------------------------------------------------------------
// General utility functions.
//----------------------------------------------------------------------------

function getContainerWith(node, tagName, className) {

  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.

  while (node != null) {
    if (node.tagName != null && node.tagName == tagName &&
        hasClassName(node, className))
      return node;
    node = node.parentNode;
  }

  return node;
}

function hasClassName(el, name) {

  var i, list;

  // Return true if the given element currently has the given class
  // name.

  list = el.className.split(" ");
  for (i = 0; i < list.length; i++)
    if (list[i] == name)
      return true;

  return false;
}

function removeClassName(el, name) {

  var i, curList, newList;

  if (el.className == null)
    return;

  // Remove the given class name from the element's className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
      newList.push(curList[i]);
  el.className = newList.join(" ");
}

function getPageOffsetLeft(el) {

  var x;

  // Return the x coordinate of an element relative to the page.

  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}

// Change the tool to whatever you clicked on

function downstate(buttonname,toolname) {
	document.getElementById(whichMenu).className = 'menuButton';
	document.getElementById(whichTool).className = 'menuItem';
	//alert(document.getElementById(whichTool + 'tooltips') + ', ' + whichTool + 'tooltips'+ ', ' + document.getElementById(whichTool + 'tooltips').style.display);
	document.getElementById(whichTool + 'tooltip').style.display = 'none';
	document.getElementById(whichTool + 'tooltipname').style.display = 'none';
	
	if (toolname) {
		whichTool = toolname;
		document.getElementById(whichTool).className = 'menuItemDown';
	}
	whichMenu = buttonname;
	document.getElementById(whichMenu).className = 'menuButtonDown';
	document.getElementById(whichTool + 'tooltip').style.display = 'inline';
	document.getElementById(whichTool + 'tooltipname').style.display = 'inline';
	//alert(whichTool + 'tooltips'+ ', ' + document.getElementById(whichTool + 'tooltips').style.display);
	if (whichTOOL != "spacerTOOL") {
		swapGroup("spacerTOOL","TOOL");
		whichTOOL = "spacerTOOL";
	}
}


//toggle that navpanel
toggleNavPanel = function() {
	if (navPanelVisible) {
		document.getElementById("navtrigger").className = "navtrigger triggeroff";
		document.getElementById("navpanel").style.display = "none";
		navPanelVisible = false;
	} else {
		document.getElementById("navtrigger").className = "navtrigger triggeractive";
		document.getElementById("navpanel").style.display = "block";
		navPanelVisible = true;
	}
}

//slider functionality

	var startSlidePosition = 0;
	var sliderIconDiv;
	var sliderIconImgHeight;
	var sliderIconImgWidth;
	var sliderHeight;
	var sliderWidth;
	var actualSliderHeight;
	var endSlidePosition;
	var minValue;
	var maxValue;
	var intervalValue;
	var sliderValue;
	var wheelAmount;

	var isDragging = false;
	var currentY, startingY;
	var threshold = 5;

	var currentSliderPosition;

function pos2Val(pos) {
pos -= startSlidePosition;
var percentage = endSlidePosition - startSlidePosition;
var myPercent = pos / percentage;
var val = minValue + ((maxValue - minValue) * myPercent);
return val;
	}
	function val2Pos(val) {
val = val - minValue;
var percentage = maxValue-minValue;
var myPercent = val / percentage;
var pos = startSlidePosition + ((endSlidePosition - startSlidePosition) * myPercent);
return pos;
}

function getSliderPos() {
var absLeng = sliderIconDiv.offsetTop - startSlidePosition;
var absRang = maxValue - minValue;
return (absLeng * absRang/actualSliderHeight) + minValue;
}

function getLocFromMouse() {
var diff = event.clientY - startingY;
			var y = parseInt(currentSliderPosition) + diff;
			if (y > endSlidePosition)
				y = endSlidePosition;
			if (y < startSlidePosition)
				y = startSlidePosition;
			return y;
}

function roundOff(val) {
val = parseFloat(val);
if (isNaN(val))
				return minValue;
val = Math.round(val / intervalValue) * intervalValue;
val = Math.round(val*10000)/10000;
if (val < minValue)
				val = minValue;
if (val > maxValue)
				val = maxValue;
return val;
}

function onChangeByClick(e) {
var loc = event.offsetY;
var value = pos2Val(loc);
value = roundOff(value);
if (value != sliderValue) {
				sliderValue = value;
				sliderIconDiv.style.top = loc + (sliderIconImgHeight/2);
}
}

function onMouseWheelEvent() {
var val = parseFloat(sliderValue);
if (event.wheelDelta > 0) {
					val -= wheelAmount;
} else {
		val += wheelAmount;
}
val = roundOff(val);
updatePosition(val);
}

function onChangeBySlide(e) {
var loc = getLocFromMouse(e);
var value = pos2Val(loc);
value = roundOff(value);
if (value != sliderValue) {
	sliderValue = value;
				sliderIconDiv.style.top = loc;
}
}

function updatePosition(newVal) {
	if (newVal != sliderValue) {
		if( newVal >= minValue && newVal <= maxValue) {
			var newPos = val2Pos(newVal);
			sliderValue = newVal;
			sliderIconDiv.style.top = newPos;
		}
	}
}

function sliderMouseDown(e){
	if(sliderIconDiv && !isDragging){
		isDragging=true;
		currentY = document.body.scrollTop +event.clientY;
		startingY = currentY;
		currentSliderPosition = sliderIconDiv.offsetTop;
		updatePosition( pos2Val(currentSliderPosition) );
		return false;
	}
	return true;
}

function sliderMouseMove(e){
	if(sliderIconDiv && isDragging){
		if(currentY!=event.clientY){
			onChangeBySlide(e);
			currentY = event.clientY;
		}
		return false;
	}
	return true;
}

function sliderMouseUp(e){
	if(sliderIconDiv && isDragging){
		isDragging = false;
		var pos = getSliderPos();
		currentY = event.clientY;
		return false;
	}
	return true;
}

function init() {
	sliderIconImgHeight = 13;
	sliderIconImgWidth = 17;
	sliderHeight = 214;
	sliderWidth = 5;
	minValue = 0;
	maxValue = 100;
	intervalValue = 1;
	sliderValue = 0;
	wheelAmount = 5;
	startSlidePosition = 0;
	var sliderImg = "graphics/zoom_slider.gif";
	var sliderBgImg = "graphics/zoom_bar.gif";
	var defaultValue = 50;
	createSliderHTML(1, sliderImg, sliderBgImg, "targetDiv");

	// values calculated based on slider creation and intial values
	actualSliderHeight = sliderHeight - sliderIconImgHeight;
	endSlidePosition = startSlidePosition + sliderHeight;
	updatePosition(defaultValue);
}

function setupMouseEvents(slideDiv, barDiv, supportDiv) {
	slideDiv.onmousedown = sliderMouseDown;
	slideDiv.onmousemove = sliderMouseMove;
	slideDiv.onmouseup = sliderMouseUp;

	supportDiv.onmousewheel = onMouseWheelEvent;
	barDiv.onclick = onChangeByClick;
}

function createSliderHTML(id, sliderImg, sliderBgImg, targetDiv) {

	var html = '<div style="position:relative; left: -5px; top: 5px;"><img src="graphics/zoom_minus.gif" width="11" height="5" alt="in" style="position:absolute;left:0;top:0;" />';
	html += '<div id="supportDiv_' + id +'" style="position:absolute;left:3px;top:9px;" >';
	html += '<div style="position:absolute;z-index:999;left:-6px;" id="sliderImg_' + id +'" >';
	html += '<img name="sliderImg" src="'+ sliderImg + '" border=0 width=' + sliderIconImgWidth +' height=' + sliderIconImgHeight +' ></div>';
	html += '<div id="sliderBar_' + id +'" style="position:absolute; left:0; top:0; width: ' + sliderWidth + '; height: ' + sliderHeight +'; clip:rect(0 ' + sliderWidth + ' ' + sliderHeight +' 0); background-image: url(' + sliderBgImg + '); background-repeat:repeat-y;z-index:998;">';
	html += '</div></div><img src="graphics/zoom_plus.gif" width="11" height="11" alt="out" style="position:absolute;left:0;top:227px;" /></div>';

	document.getElementById(targetDiv).innerHTML = html;
	// setup correct div references
	sliderIconDiv = document.getElementById("sliderImg_" + id);
	var sliderBarDiv = document.getElementById("sliderBar_" + id);
	var sliderSupportDiv = document.getElementById("supportDiv_" + id);
	// setup mouse events
	setupMouseEvents(sliderIconDiv, sliderBarDiv, sliderSupportDiv);
}

//zebra table striping

// this function is needed to work around 
// a bug in IE related to element attributes
function hasClass(obj) {
	var result = false;
	if (obj.getAttributeNode("class") != null) {
			result = obj.getAttributeNode("class").value;
	}
	return result;
}

function stripe(id) {
	// the flag we'll use to keep track of 
	// whether the current row is odd or even
	var even = false;

	// if arguments are provided to specify the colours
	// of the even & odd rows, then use the them;
	// otherwise use the following defaults:
	var evenColor = arguments[1] ? arguments[1] : "#fff";
	var oddColor = arguments[2] ? arguments[2] : "#eee";

	// obtain a reference to the desired table
	// if no such table exists, abort
	var table = document.getElementById(id);
	if (! table) { return; }

	// by definition, tables can have more than one tbody
	// element, so we'll have to get the list of child
	// &lt;tbody&gt;s 
	var tbodies = table.getElementsByTagName("tbody");

	// and iterate through them...
	for (var h = 0; h < tbodies.length; h++) {

	// find all the &lt;tr&gt; elements... 
		var trs = tbodies[h].getElementsByTagName("tr");
		
		// ... and iterate through them
		for (var i = 0; i < trs.length; i++) {

			// avoid rows that have a class attribute
			// or backgroundColor style
			if (! hasClass(trs[i]) &&
					! trs[i].style.backgroundColor) {

				// get all the cells in this row...
				var tds = trs[i].getElementsByTagName("td");
			
				// and iterate through them...
				for (var j = 0; j < tds.length; j++) {
			
					var mytd = tds[j];

					// avoid cells that have a class attribute
					// or backgroundColor style
					if (! hasClass(mytd) &&
							! mytd.style.backgroundColor) {

						mytd.style.backgroundColor =
							even ? evenColor : oddColor;
					
					}
				}
			}
			// flip from odd to even, or vice-versa
			even =	! even;
		}
	}
}


window.onload = function() {
	initialize();
	//scan page for anything with a "swapping" class, then assign them all mouseovers, mousedowns, etc.
	for (da = 0; da <document.getElementsByTagName("a").length; da++){
		daNode = document.getElementsByTagName("a")[da];
		if (daNode.className.indexOf("swapping") != -1){
			daNode.onmouseover = function(){
				swap(this.firstChild.name,'over');
			}
			daNode.onmouseout = function(){
				swap(this.firstChild.name,'off');
			}
			daNode.onmousedown = function(){
				swap(this.firstChild.name,'down');
			}
			daNode.onmouseup = function(){
				swap(this.firstChild.name,'over');
			}
		}
	}
	//set up toolbar to do its radio button thing, too
	if(typeof(window["whichTOOL"]) != "undefined" && document.getElementById("TOOLS")){
		for (da = 0; da <document.getElementById("TOOLS").getElementsByTagName("a").length; da++){
			daNode = document.getElementById("TOOLS").getElementsByTagName("a")[da];
			if (daNode.className.indexOf("groupswap") != -1){
				daNode.onmouseover = function(){
					swap(this.firstChild.name,'over',whichTOOL);
				}
				daNode.onmouseout = function(){
					swap(this.firstChild.name,'off',whichTOOL);
				}
				daNode.onmousedown = function(){
					swapGroup(this.firstChild.name,'TOOL');
					whichTOOL = this.firstChild.name;
				}
			}
		}
	}
	//do the same for ZOOMs
	if(typeof(window["whichZOOM"]) != "undefined" && document.getElementById("ZOOMS")){
		for (da = 0; da <document.getElementById("ZOOM").getElementsByTagName("a").length; da++){
			daNode = document.getElementById("ZOOM").getElementsByTagName("a")[da];
			if (daNode.className.indexOf("groupswap") != -1){
				daNode.onmouseover = function(){
					swap(this.firstChild.name,'over',whichZOOM);
				}
				daNode.onmouseout = function(){
					swap(this.firstChild.name,'off',whichZOOM);
				}
				daNode.onmousedown = function(){
					swapGroup(this.firstChild.name,'ZOOM');
					whichZOOM = this.firstChild.name;
				}
			}
		}
	}
	/*tabs have to be treated slightly differently; they may have "up" states.
	upstates are defined within the tabs page as true or false as "upTabs".*/
	if(typeof(window["whichTAB"]) != "undefined" && document.getElementById("TABS")){
		for (da = 0; da <document.getElementById("TABS").getElementsByTagName("a").length; da++){
			daNode = document.getElementById("TABS").getElementsByTagName("a")[da];
			setUp = (upTabs)?"tabs":"";
			if (daNode.className.indexOf("groupswap") != -1){
				daNode.onmouseover = function(){
					swap(this.firstChild.name,'over',whichTAB,setUp);
				}
				daNode.onmouseout = function(){
					swap(this.firstChild.name,'off',whichTAB,setUp);
				}
				daNode.onmousedown = function(){
					swap(this.firstChild.name,'down',whichTAB,setUp);
				}
				daNode.onclick = function(){
					swapGroup(this.firstChild.name,'TAB',setUp);
					whichTAB = this.firstChild.name;
				}
				daNode.onmouseup = function(){
					swap(this.firstChild.name,'up',whichTAB,setUp);
				}
			}
		}
	}
}