function buttonOver() {
    thewrap = document.getElementById('content');
    buttons = thewrap.getElementsByTagName('input');
    for (i = 0; i < buttons.length; i++) {
        if(buttons[i].getAttribute('type') == 'image') {
            buttons[i].onmouseover = function() {
                this.src = this.src.substring(0, this.src.length - 4) + "2.jpg";
            }
            buttons[i].onmouseout = function() {
                if (this.src.substring( (this.src.length - 5) , (this.src.length) ) == "2.jpg" ) {
                    this.src = this.src.substring(0, this.src.length - 5) + ".jpg";
                }
            }
        }
    }
}

function imageOver() {
    thewrap = document.getElementById('content');
    images = thewrap.getElementsByTagName('img');
    for (i = 0; i < images.length; i++) {
        if(images[i].className.substring(0, 5) == "hover") {
            images[i].onmouseover = function() {
                this.src = this.src.substring(0, this.src.length - 4) + "2.jpg";
            }
            images[i].onmouseout = function() {
                if (this.src.substring( (this.src.length - 5) , (this.src.length) ) == "2.jpg" ) {
                    this.src = this.src.substring(0, this.src.length - 5) + ".jpg";
                }
            }
        }
    }
}


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


addLoadEvent(buttonOver);
addLoadEvent(imageOver);