document.getElementsByClassName = function (className) {
    var i, j, eltClass;
    var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
    var objCN = new Array();
    for (i = 0; i < objAll.length; i++) {
        eltClass = objAll[i].className.split(/\s+/);
        for (j = 0; j < eltClass.length; j++) {
            if (eltClass[j] == className) {
                objCN.push(objAll[i]);
                break;
            }
        }
    }
    return objCN;
}

function smartRollover() {
	if(document.getElementsByClassName) {
		var images = document.getElementsByClassName("hover");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match(".gif"))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace(".gif", "_on.gif"));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.gif", ".gif"));
				}
				images[i].onclick = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.gif", ".gif"));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}
