/* Å¾¸Þ´º ºÎºÐ ½ÃÀÛ */
function gnbNavi() {
	var gnbNavi = document.getElementById("gnb");
	subMenu = gnbNavi.getElementsByTagName("ul");
	for (i=0; i<subMenu.length; i++) {
		if(i != 0){
			subMenu[i].style.display = "none";						// ÀüÃ¼ ¼­ºê·¹ÀÌ¾î ¼û±è.
		}else{
			gnbImg2 = gnbNavi.getElementsByTagName("img");
			gnbImg2[0].src = gnbImg2[0].src.replace(".gif","_on.gif");
		}
		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_menu") {
			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";
			}
		}
	}	
}
/* Å¾¸Þ´º ºÎºÐ ³¡ */

/* ¼­ºê ½ºÅ©¸³Æ® */
function gnbNaviSub() {
	var gnbNavi = document.getElementById("gnb");
	subMenu = gnbNavi.getElementsByTagName("ul");

	var currentMainMenuUrl = location.href;
	var currentMainMenuIndex = 0;
	var currentMainMenuImgIndex = 0;
	if(location.href.indexOf("/8sights/") > -1) {
		currentMainMenuIndex = 0;
		currentMainMenuImgIndex = 0;		
	} else if(location.href.indexOf("/tourism/") > -1) {
		currentMainMenuIndex = 1;
		currentMainMenuImgIndex = 10;		
	} else if(location.href.indexOf("/tour_info/") > -1) {
		currentMainMenuIndex = 2;
		currentMainMenuImgIndex = 17;		
	} else if(location.href.indexOf("/lodging/") > -1) {
		currentMainMenuIndex = 3;
		currentMainMenuImgIndex = 24;		
	} else if(location.href.indexOf("/food/") > -1) {
		currentMainMenuIndex = 4;
		currentMainMenuImgIndex = 31;		
	} else if(location.href.indexOf("/culture/") > -1) {
		currentMainMenuIndex = 5;
		currentMainMenuImgIndex = 34;		
	} else if(location.href.indexOf("/shopping/") > -1) {
		currentMainMenuIndex = 6;
		currentMainMenuImgIndex = 41;		
	} else if(location.href.indexOf("/community/") > -1) {
		currentMainMenuIndex = 7;
		currentMainMenuImgIndex = 48;		
	}


	for (i=0; i<subMenu.length; i++) {
		if(i != currentMainMenuIndex){
			subMenu[i].style.display = "none";						// ÀüÃ¼ ¼­ºê·¹ÀÌ¾î ¼û±è.
		}else{
			gnbImg2 = gnbNavi.getElementsByTagName("img");
			gnbImg2[currentMainMenuImgIndex].src = gnbImg2[currentMainMenuImgIndex].src.replace(".gif","_on.gif");
		}
		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_menu") {
			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";
			}
		}
	}	
}

