function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function addClass(element,value) {
  if (!element.className) {
    element.className = value;
  } else {
    newClassName = element.className;
    newClassName+= " ";
    newClassName+= value;
    element.className = newClassName;
  }
}

function stripeTables() {
  if (!document.getElementsByTagName) return false;
  var tables = document.getElementsByTagName("table");
  for (var i=0; i<tables.length; i++) {
    var odd = false;
    var rows = tables[i].getElementsByTagName("tr");
    for (var j=0; j<rows.length; j++) {
      if (odd == true) {
        addClass(rows[j],"odd");
        odd = false;
      } else {
        odd = true;
      }
    }
  }
}

function highlightRows() {
  if(!document.getElementsByTagName) return false;
  var rows = document.getElementsByTagName("tr");
  for (var i=0; i<rows.length; i++) {
    rows[i].oldClassName = rows[i].className
    rows[i].onmouseover = function() {
      addClass(this,"highlight");
    }
    rows[i].onmouseout = function() {
      this.className = this.oldClassName
    }
  }
}

addLoadEvent(stripeTables);
addLoadEvent(highlightRows);

// CSS and DHTML powered ImageGallery  
// Created in April 2004 by Dasme - dasme *at* dasme.org
//  - http://dasme.org/imagegal/
//
// Script based on ideas from Jeremy Keith and AListApart.com
// http://www.alistapart.com/articles/imagegallery/

function DOMCall(name) {
	if (document.layers) 
		return document.layers[name];
	else if (document.all)
		return document.all[name];
	else if (document.getElementById)
		return document.getElementById(name);
}
function showPic (whichpic) {
	DOMCall('placeholder').src = whichpic.href;
	if (whichpic.title) {
		DOMCall('imageCaption').innerHTML = whichpic.title;
		DOMCall('imageCaption').className = "";
	} else {
		DOMCall('imageCaption').className = "hidden";
	}
 	return false;
}

function clickedImage (whichpic) {
	imageUrl = whichpic.src;  // grab the url of the medium image.
	imageName = imageUrl.replace(/img\/gallery\/medium\/image/, "gallery/");
	imageName = imageName.replace(/.png/, "");
	imageName = imageName.replace(/.gif/, "");
	imageName = imageName.replace(/.jpg/, "");
	imageWindow = window.open(imageName+".html",'imageWin','resizable=yes,width=640,height=480');  // popup the image in a new window
}

function switchPage(pageId) {
DOMCall('page1').className = "hidden";
DOMCall('page2').className = "hidden";
DOMCall('page3').className = "hidden";
DOMCall('page4').className = "hidden";

DOMCall(pageId).className = "asdasd"; // set the current page to junk so it becomes visible
}