/* === btn rollover === */

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(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."));
				}
			}
		}
	}
}

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

/* === END btn rollover === */


/* === check all box === */
function checkAllType (fn,en,num) {
    var fn;
	var en;
	var num;
    with (document.forms[fn]) {
        if (elements[en].checked) {
            for (i=0; i<num; i++) {
                elements[en + "[" + i + "]"].checked = true;
            }
        } else {
            for (i=0; i<num; i++) {
                elements[en + "[" + i + "]"].checked = false;
            }
        }
    }
}
/* === check all box === */


/* === change display tab === */

function chgTab (tgt,id,img){
    var tgtTab = document.getElementById(tgt + "Tab");
    var tgtInfo = document.getElementById(tgt + "Info");
    var menu = id.split(",");
    for (var i=0; i<menu.length; i++){
        document.getElementById(menu[i] + "Tab").style.backgroundImage = "url('/" + img + "_close.gif')";
        document.getElementById(menu[i] + "Info").style.display = "none";
    }
    tgtTab.style.backgroundImage = "url('/" + img + "_open.gif')";
    tgtInfo.style.display = "block";
}

/* === END change display tab === */

/* === change display tab img === */

function chgImgTab (tgt,id,img,tabimg){
    var tgtTab = document.getElementById(tgt + "Tab");
    var tgtInfo = document.getElementById(tgt + "Info");
    var tgtImg = document.getElementById(tgt + "Img");
    var menu = id.split(",");
    for (var i=0; i<menu.length; i++){
        document.getElementById(menu[i] + "Tab").style.backgroundImage = "url('/" + img + "_close.gif')";
        document.getElementById(menu[i] + "Info").style.display = "none";
        document.getElementById(menu[i] + "Img").src = document.getElementById(menu[i] + "Img").src.replace("_open.gif", "_close.gif");
    }
    tgtTab.style.backgroundImage = "url('/" + img + "_open.gif')";
    tgtInfo.style.display = "block";
    tgtImg.src = "/" + tabimg + "_open.gif";
}

/* === END change display tab img === */


/* === change display sct === */

function chgDspSct (tgt, id, disp, img) {

    var tgt = document.getElementById(tgt);
    var x = document.getElementById(id);

    downImg = new Image().src = "/" + img + "_open.gif";

    if (x.style.display == "none") {
        x.style.display = disp;
        tgt.style.backgroundImage = "url('/" + img + "_open.gif')";
    } else {
        x.style.display = "none";
        tgt.style.backgroundImage = "url('/" + img + "_close.gif')";

    }
}

/* === END change display sct === */


/* === popup window === */
// onclick="popup('URL','windowName','toolbar','width','height'); return false"

function popup (win_url, win_name, win_toolbar, win_width, win_height) {
		if (win_name == '') {
			window.name = "popup";
		}
    var win_data = "toolbar=" + win_toolbar + ",status=" + win_toolbar + ",menubar=" + win_toolbar + ",scrollbars=1,resizable=1,width=" + win_width + ",height=" + win_height;
    WinOpen = window.open (win_url,win_name,win_data) ;
    WinOpen.focus();
}
/* === END popup window === */
