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

addLoadEvent(prepareGallery);
        


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);
        }
    }
}
function showPic(whichpic) {
    if (!document.getElementById("placeholder")) return true;
    var source = whichpic.getAttribute("href");
    var howide = whichpic.getAttribute("width");
    var placeholder = document.getElementById("placeholder");
    placeholder.setAttribute("width",howide);
    placeholder.setAttribute("height",410);
    placeholder.setAttribute("src",source);
    if (!document.getElementById("description")) return false;
    var text = whichpic.getAttribute("title") ?
    whichpic.getAttribute("title") : "";
    var description = document.getElementById("description");
    description.firstChild.nodeValue = text;
    return false;
}