// JavaScript Document

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

function prepareGallery() {
	if (!document.getElementsByTagName) return false;
	if (!document.getElementById) return false;
	if (!document.getElementById("imagegallery")) return false;
	var gallery = document.getElementById("imagegallery");
	var links = gallery.getElementsByTagName("a");
	for ( var i=0; i < links.length; i++) {
		links[i].onmouseover = function() {
		return showPic(this); 
		 }
	links[i].onkeypress = links[i].onmouseover;
	links[i].onclick = links[i].onmouseover;
	}
	
}

function showPic(whichpic) {
	var source = whichpic.getAttribute("href");
	var placeholder = document.getElementById("placeholder");
	placeholder.setAttribute("src",source);
	var text = whichpic.getAttribute("title");
	placeholder.setAttribute("title",text); 
	var description = document.getElementById("imgdescription");
	description.firstChild.nodeValue = text;
return false;
}

addLoadEvent(prepareGallery);

