var check_mun = 1;
function top2menuView(a) //2차메뉴보기
{
	//alert(check_mun);
	if(!(check_mun ==0)){
	if(this.id){
		eidStr = this.id;
		eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length);
		a = parseInt(eidNum);
	}
	top2menuHideAll();
	top1Menu = document.getElementById("top1m"+a);
	top2Menu = document.getElementById("top2m"+a);
	//if(a<10){ann='0'+a;} else {ann=''+a;}
	ann=a;
	if (a=0) { //메인은2차메뉴활성화안함
	} else {
		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src="/img/topmenu/topmenu" + ann + "on.gif";
			if (top2Menu) { top2Menu.style.display = 'inline'; }
		}
	}
} else {
	check_mun = 1;
	
}
}

function top2menuHide(a) //2차메뉴감추기
{
	if(this.id){
		eidStr = this.id;
		eidNum=eidStr.substring(eidStr.lastIndexOf("m",eidStr.length)+1,eidStr.length);
		a = parseInt(eidNum);
	}
	top2menuHideAll();
	top1Menu = document.getElementById("top1m"+a);
	top2Menu = document.getElementById("top2m"+a);
	top1MenuCurr = document.getElementById("top1m<?=$d1n?>");
	top2MenuCurr = document.getElementById("top2m<?=$d1n?>");
	//if(a<10){ann='0'+a;} else {ann=''+a;}
	ann=a;
	if (top1Menu) {
		top1Menu.getElementsByTagName("img")[0].src="/img/topmenu/topmenu" + ann + ".gif";
		if (top2Menu) { top2Menu.style.display = 'none'; }
		if (top1MenuCurr) { top1MenuCurr.getElementsByTagName("img")[0].src = "/img/topmenu/topmenu<?=$d1n?>on.gif"; }
		if (top2MenuCurr) { top2MenuCurr.style.display = 'inline'; }
	}
}

function top2menuHideAll() //2차메뉴모두감추기
{
	top1menuEl = document.getElementById("top1menu").getElementsByTagName("ul");
	for (i=1;i<=top1menuEl.length;i++)
	{
		top1Menu = document.getElementById("top1m"+i);
		top2Menu = document.getElementById("top2m"+i);
		//if(i<10){inn='0'+i;} else {inn=''+i;}
		inn=i;
		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src="/img/topmenu/topmenu" + inn + ".gif";
			if (top2Menu) { top2Menu.style.display = 'none'; }
		}
	}
}

function initTopMenu() {
 	top1menuEl = document.getElementById("top1menu").getElementsByTagName("ul");
	for (i=1;i<=top1menuEl.length;i++){
		top1Menu = document.getElementById("top1m"+i);
		top2Menu = document.getElementById("top2m"+i);
		if (top1Menu) {
			top1Menu.onmouseover = top1Menu.onfocus = top2menuView;
			top1Menu.onmouseout = top2menuHide;
			if (top2Menu) {
				top2Menu.onmouseover = top2Menu.onfocus = top2menuView;
				top2Menu.onmouseout = top2menuHide;
			}
		}
	}
}
function top2Dep(a,b){
	var str = document.getElementById("top2m"+a).getElementsByTagName("a")[b];
}




// 이미지 오버 공통 함수
function imgOver(oImg){
 var reg = new RegExp('_off');
 oImg.src = oImg.src.replace(reg,'_on');
}
// 이미지 아웃 공통 함수
function imgOut(oImg){
 var reg = new RegExp('_on');
 oImg.src = oImg.src.replace(reg,'_off');
}


