function smartRollover() {
    if(document.getElementsByTagName) {
        var tags = ["img","input"];
        for( var i=0; i<tags.length; i++ ) {
            var el = document.getElementsByTagName(tags[i]);
            for(var j=0; j<el.length; j++) {
                var attr = el[j].getAttribute("src");
                var preLoad = new Image(); 
                preLoad.src = attr;
                if( attr ) {
                    if(el[j].getAttribute("src").match("mylesson_add_off.") ||
					   el[j].getAttribute("src").match("button_mouse_off.") ||
					   el[j].getAttribute("src").match("tab_free_off.") ||
					   el[j].getAttribute("src").match("tab_initial_off.") ||
					   el[j].getAttribute("src").match("tab_area_off.") ||
					   el[j].getAttribute("src").match("button_add_off.") ||
					   el[j].getAttribute("src").match("button_write_top_off.") ||
					   el[j].getAttribute("src").match("button_write_off.") ||
					   el[j].getAttribute("src").match("lect_button_off.") ||
					   el[j].getAttribute("src").match("navi_button_off.")) {
                        el[j].onmouseover = function() {
                            this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                        }
                        el[j].onmouseout = function() {
                            this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                        }
                    }
                }
            }
        }
    }
}  
if(window.addEventListener) {  
  window.addEventListener("load", smartRollover, false);  
}
else if(window.attachEvent) {  
  window.attachEvent("onload", smartRollover);
}

