// JavaScript Document

function rollover() {
    if (document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");
        for (var i=0; i < images.length; i++) {
            if (images[i].getAttribute("src") && images[i].getAttribute("src").match("_off.")) {
                images[i].onmouseover = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                }
                images[i].onmouseout = function() {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                }
            }
        }
    }
}

function is_active() {
	if (document.getElementsByTagName) {
		var url = location.href.replace(/^http:\/\/[^\/]+/, "");
		var images = document.getElementsByTagName("img");
        for (var i=0; i < images.length; i++) {
            if (images[i].getAttribute("src") && images[i].getAttribute("src").match("_off.")) {
				var a = images[i].parentNode;
				var href = a.getAttribute("href").replace(/^http:\/\/[^\/]+/, "");
				if ( url == href ) {
                    images[i].setAttribute("src", images[i].getAttribute("src").replace("_off.", "_on."));
					images[i].onmouseout = function() {
						return false;
					}
				}
            }
        }
	}
}

function set_active( target ) {
	if (document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
        for (var i=0; i < images.length; i++) {
            if (images[i].getAttribute("src") && images[i].getAttribute("src").match("_off.")) {
				var a = images[i].parentNode;
				var href = a.getAttribute("href").replace(/^http:\/\/[^\/]+/, "");
				if ( target == href ) {
                    images[i].setAttribute("src", images[i].getAttribute("src").replace("_off.", "_on."));
					images[i].onmouseout = function() {
						return false;
					}
				}
            }
        }
	}
}

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