// GNB
function gnbNavi() {
	var gnbNavi = document.getElementById("GNBWrap");
	subMenu = gnbNavi.getElementsByTagName("ul");
	for (i=0; i<subMenu.length; i++) {
		subMenu[i].style.display = "none";						// 전체 서브레이어 숨김.

		subLink = subMenu[i].getElementsByTagName("a");
		for (m=0; m<subLink.length; m++) {						// 서브메뉴 이미지 롤오버
			thismenu = subLink[m];
			thismenu.onmouseover = function() {
				subImage = this.getElementsByTagName("img")[0];
				if (subImage.src.indexOf("_on.gif") != -1) return false;
				subImage.src = subImage.src.replace(".gif","_on.gif");
			}
			subLink[m].onfocus = function() {
				subImage = this.getElementsByTagName("img")[0];
				if (subImage.src.indexOf("_on.gif") != -1) return false;
				subImage.src = subImage.src.replace(".gif","_on.gif");
			}
			subLink[m].onmouseout = function() {
				subImage = this.getElementsByTagName("img")[0];
				subImage.src = subImage.src.replace("_on.gif",".gif");
			}			
			subLink[m].onblur = function() {
				subImage = this.getElementsByTagName("img")[0];
				subImage.src = subImage.src.replace("_on.gif",".gif");
			}
		}
	}

	var gnbMenu = gnbNavi.getElementsByTagName("li");
	for (j=0; j<gnbMenu.length; j++) {
		if (gnbMenu[j].className == "GNB") {
			thismenu = gnbMenu[j].getElementsByTagName("a")[0];
			thismenu.onmouseover = function() {
				subMenu = gnbNavi.getElementsByTagName("ul");
				for (k=0; k<subMenu.length; k++) {
					subMenu[k].style.display = "none";
					subMenu[k].parentNode.style.zIndex = "0";
				}
				
				gnbImg = gnbNavi.getElementsByTagName("img");
				for (l=0; l<gnbImg.length; l++) {
					if (gnbImg[l].src.indexOf("_on.gif") != -1 ){
						gnbImg[l].src = gnbImg[l].src.replace("_on.gif",".gif");
					}
				}

				this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].src.replace(".gif","_on.gif");
				if (!this.parentNode.getElementsByTagName("ul")[0]) return false;
				this.parentNode.getElementsByTagName("ul")[0].style.display = "";
				this.parentNode.getElementsByTagName("ul")[0].parentNode.style.zIndex = "1";
				
			}
			thismenu.onfocus = function() {
				subMenu = gnbNavi.getElementsByTagName("ul");
				for (k=0; k<subMenu.length; k++) {
					subMenu[k].style.display = "none";
					subMenu[k].parentNode.style.zIndex = "0";
				}

				gnbImg = gnbNavi.getElementsByTagName("img");
				for (l=0; l<gnbImg.length; l++) {
					if (gnbImg[l].src.indexOf("_on.gif") != -1 ){
						gnbImg[l].src = gnbImg[l].src.replace("_on.gif",".gif");
					}
				}

				this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].src.replace(".gif","_on.gif");
				if (!this.parentNode.getElementsByTagName("ul")[0]) return false;
				this.parentNode.getElementsByTagName("ul")[0].style.display = "";
				this.parentNode.getElementsByTagName("ul")[0].parentNode.style.zIndex = "1";
			}
		}
	}	
}


// LNB
function imgMenuOver(containderID) {
	var objwrap = document.getElementById(containderID);
	var imgMenu = objwrap.getElementsByTagName("a");

	for (i=0; i<imgMenu.length; i++) {
		if(imgMenu[i].getElementsByTagName("img").length == 0) continue;

		if (imgMenu[i].getElementsByTagName("img")[0].src.indexOf("_on.gif") != -1 ) {
			continue;
		}
		imgMenu[i].onmouseover = function() {
			subImage = this.getElementsByTagName("img")[0];
			if (subImage.src.indexOf("_on.gif") != -1) return false;
			subImage.src = subImage.src.replace(".gif","_on.gif");
		}
		imgMenu[i].onfocus = function() {
			subImage = this.getElementsByTagName("img")[0];
			if (subImage.src.indexOf("_on.gif") != -1) return false;
			subImage.src = subImage.src.replace(".gif","_on.gif");
		}
		imgMenu[i].onmouseout = function() {
			subImage = this.getElementsByTagName("img")[0];
			subImage.src = subImage.src.replace("_on.gif", ".gif");
		}
		imgMenu[i].onblur = function() {
			subImage = this.getElementsByTagName("img")[0];
			subImage.src = subImage.src.replace("_on.gif", ".gif");
		}
	}
}

