function smartRollover() {
    if(document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");
        var inputs = document.getElementsByTagName("input");
        var replace=function(elm){
            if(elm.getAttribute("src").match("_off."))
            {
                elm.onmouseover = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                };
                elm.onmouseout = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                };
            }
        };

        for(var x=0;x<inputs.length;x++){
            if(inputs[x].getAttribute("type") == "image"){
                replace(inputs[x]);
            }
        }

        for(var i=0; i < images.length; i++) {
                replace(images[i]);
        }
    }
}

if(window.addEventListener) {
    window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
    window.attachEvent("onload", smartRollover);
}

