function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function swapImages(theLink, theBigLink){
	var mainPic = document.getElementById("mainPic");
	mainPic.setAttribute("src", theLink);
}

function getPics(){
	if (!document.getElementsByTagName) return false;
	if (!document.getElementById) return false;
	var theLinks = document.getElementsByTagName("a");
	for (var i=0; i<theLinks.length; i++){
		var theClass = theLinks[i].className;
		if (theClass == "thumbnail"){
			theLinks[i].onclick=function(){
				var theHref = this.getAttribute("href");
				var theTitle = this.getAttribute("title");
				swapImages(theHref, theTitle);
				return false;
			}
		}
	}
	
}
addLoadEvent(getPics);

