function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("-of."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("-of.", "-on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("-on.", "-of."));
				}
				images[i].onclick = function() {
					window.onunload = function(){
						var images2 = document.getElementsByTagName("img");
						for(var j=0; j < images2.length; j++) {
							if(images2[j].getAttribute("src").match("-on.")) {
								images2[j].setAttribute("src", images2[j].getAttribute("src").replace("-on.", "-of."));
							}
						}
					}
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}
