// JavaScript Document

function addOnload(newFunction) {
	var oldOnload = window.onload;
	
	if (typeof oldOnload == "function") {
		window.onload = function() {
			if (oldOnload) {
				oldOnload();
			}
			newFunction();
		}
	}
	else {
		window.onload = newFunction;
	} 
}

addOnload(updateimages);

function updateimages() {
	allImages = document.getElementsByTagName("img");
	for (i=0; i<allImages.length; i++)
		if (allImages[i].src.indexOf("tmb")>-1) {
			allImages[i].onclick = getImage;}
}

function getImage() {
	imageLocation = this.src;
	tStart = imageLocation.lastIndexOf("tmb.jpg");

	imageLocation = imageLocation.substring(0,tStart)+".jpg";
	document.getElementById("preview").src = imageLocation;
}
