//function to allow more than one window.onload event
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// Prepare Image Gallery
function prepareGallery() {
	var galleryList = document.getElementById("thumbs");
	var images = galleryList.getElementsByTagName("img");
	
	for (i=0;i<images.length;i++) {
		images[i].onmouseover = showPic; //onclick
		images[i].style.cursor = "pointer";
		};
	
	function showPic() {
		var source = this.getAttribute("name");
		var title = this.getAttribute("title");
		var caption = document.getElementById("caption");
		var placeholder = document.getElementById("placeholder");
		placeholder.setAttribute("src",source);
		caption.innerHTML = title;
	};
}
addLoadEvent(prepareGallery);
