
function topMenuOff(n) {
	var div_num = n;

	switch (n)
	{
		case 1: div_num = 8; break;
		case 2: div_num = 6; break;
		case 3: div_num = 5; break;
		case 4: div_num = 17; break;
		case 5: div_num = 6; break;
		case 6: div_num = 10; break;
	} 
	
	for (var i=1; i<=div_num; i++)
	{
		document.getElementById("m0"+n+"sub"+i).src = "/etri2010/images/image/menu0"+n+"_sub"+i+"_off.gif";
	}
}

function topMenuOn(n, i) {  
	document.getElementById("m0"+n+"sub"+i).src = "/etri2010/images/image/menu0"+n+"_sub"+i+"_on.gif";
}


function top2menuView(a) 
{ 
	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=''+a;
	} else {
		ann=''+a;
	}
	if (a=0) { 
	} else { 
		if (top1Menu) { 
			top1Menu.getElementsByTagName("img")[0].src="/etri2010/images/image/menu0" + ann + "_on.gif";
			if (top2Menu) { 
				top2Menu.style.display = 'inline'; 
			}
		}
	}
}

function top2menuHide(a) 
{
	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");
	top2MenuCurr = document.getElementById("top2m");
	if(a<10){ann=''+a;} else {ann=''+a;}
	if (top1Menu) { 
		top1Menu.getElementsByTagName("img")[0].src="/etri2010/images/image/menu0" + ann + "_off.gif";
			if (top2Menu) {
				top2Menu.style.display = 'none';
			}
			if (top1MenuCurr) { 
				top1MenuCurr.getElementsByTagName("img")[0].src = "/etri2010/images/image/menu01_off.gif";
			}
			if (top2MenuCurr) { 
				top2MenuCurr.style.display = 'inline';
			}
	}
}

function top2menuHideAll() //2차메뉴모두감추기
{
	top1menuEl = 5;
	//top1menuEl = document.getElementById("top1menu").childNodes;
	for (i=1;i<=top1menuEl.length;i++) { 
		top1Menu = document.getElementById("top1m"+i);
		top2Menu = document.getElementById("top2m"+i);
		if(i<10){inn=''+i;} else {inn=''+i;}
		if (top1Menu) { 
			top1Menu.getElementsByTagName("img")[0].src="/etri2010/images/image/menu0" + inn + "_off.gif";
				if (top2Menu) {
					top2Menu.style.display = 'none';
				}
		}
	}
}
function initTopMenu() {
	//top1menuEl = document.getElementById("top1menu").childNodes;
	//for (i=1;i<=top1menuEl.length;i++) {
	for (i=1;i<=6;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;
			}
		}
	}
	top2MenuCurrAct = document.getElementById("top2mm");
	if (top2MenuCurrAct) { 
		top2MenuCurrActA = top2MenuCurrAct.getElementsByTagName("a")[0];
		var thisClassName = top2MenuCurrActA.className;
		(thisClassName)? top2MenuCurrActA.className= thisClassName+" on" : top2MenuCurrActA.className="on";
	}
}
initTopMenu();	//1,2차메뉴롤오버함수할당
top2menuHide();	//페이지로드시현재위치1차메뉴활성

