//temp
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

function swap_main(imageURL) {
var mainImg = document.getElementById('gallery_picture');
mainImg.src = imageURL.getAttribute("href");
return false;
}

function galleryThumbs() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("rel") == "thumbnail") {
     anchor.target = "_blank";
	 var url = anchor.getAttribute("href");
	 //anchor.onmouseover=function() { swap_main(anchor.title, url); }
	 anchor.onclick = function () { return swap_main(this); }
	 anchor.title = anchor.title+" (opens in new window)";
	 }
 }
}
addLoadEvent(galleryThumbs);