// Hover over an image to see larger version

function imageHover() {
	//hover over an a in id result-thumbs, change href of main-result-pic a's to hovered href and img to src of hovered img
	if (!document.getElementById) return false;
	if (!document.getElementById("result-thumbs")) return false;
	if (!document.getElementById("main-result-pic")) return false;
	var targetDiv = document.getElementById("main-result-pic");
	var targetImage = targetDiv.getElementsByTagName("IMG")[0];
	var targetAnchors = targetDiv.getElementsByTagName("A");
	var thumbDiv = document.getElementById("result-thumbs");
	var thumbAnchors = thumbDiv.getElementsByTagName("A");
	for (i=0;i<thumbAnchors.length;i++) {
		thumbAnchors[i].onmouseover = function() {
			targetImage.src = this.getElementsByTagName("IMG")[0].src;
			for (j=0;j<targetAnchors.length;j++) {
				targetAnchors[j].href = this.href;
			}
		}
	}
}

addLoadEvent(imageHover);

// Adds functions to window.onload

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