var idx_2menu = "";

function setTop2menu(idx){
	idx_2menu = idx;
	top2menuView(idx);
}
function top2menuView(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);
	if(a<10){ann='0'+a;} else {ann=''+a;}
	if (a=0) { //메인은2차메뉴활성화안함
	} else {
		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src="/image/"+img+"/menu" + ann + "_on.png";
//			top1Menu.style.textDecoration="underline"; //텍스트일때
//			top1Menu.style.fontWeight="bold"; //텍스트일때
//			top1Menu.style.letterSpacing="-1px"; //텍스트일때
			if (top2Menu) { top2Menu.style.display = 'inline'; }
		}
	}
}
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("top1m0");
	top2MenuCurr = document.getElementById("top2m0");
	if(a<10){ann='0'+a;} else {ann=''+a;}
	if (top1Menu) {
		top1Menu.getElementsByTagName("img")[0].src="/image/"+img+"/menu" + ann + ".png";
//		top1Menu.style.textDecoration="none"; //텍스트일때
//		top1Menu.style.fontWeight="normal"; //텍스트일때
//		top1Menu.style.letterSpacing="0"; //텍스트일때
		if (top2Menu) { top2Menu.style.display = 'none'; }
		if (top1MenuCurr) {
			top1MenuCurr.getElementsByTagName("img")[0].src = "/image/"+img+"/top1m00on.gif";
//			top1MenuCurr.style.textDecoration="underline"; //텍스트일때
//			top1MenuCurr.style.fontWeight="bold"; //텍스트일때
//			top1MenuCurr.style.letterSpacing="-1px"; //텍스트일때
		}
		if (top2MenuCurr) { top2MenuCurr.style.display = 'inline'; }
	}
	top2menuView(idx_2menu);

}
function top2menuHideAll() //2차메뉴모두감추기
{

	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='0'+i;} else {inn=''+i;}
		if (top1Menu) {
			top1Menu.getElementsByTagName("img")[0].src="/image/"+img+"/menu" + inn + ".png";
//			top1Menu.style.textDecoration="none"; //텍스트일때
//			top1Menu.style.fontWeight="normal"; //텍스트일때
//			top1Menu.style.letterSpacing="0"; //텍스트일때
			if (top2Menu) { top2Menu.style.display = 'none'; }
		}
	}
}
var img = "";
function initTopMenu(img_src) {
	img = img_src;

 	top1menuEl = document.getElementById("top1menu").childNodes;
		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;
			}
		}
	}
	top2MenuCurrAct = document.getElementById(""); // top 2차메뉴 활성화
	if (top2MenuCurrAct) {
		top2MenuCurrActA = top2MenuCurrAct.getElementsByTagName("a")[0];
		var thisClassName = top2MenuCurrActA.className;
		(thisClassName)? top2MenuCurrActA.className= thisClassName+" on" : top2MenuCurrActA.className="on";
	}
}



// 탭메뉴 공통적으로 사용
//ex) tabOn(1,1,'이미지경로');
moreLink = new Array(6);
moreClick = new Array(6);
for (i=0;i<6;i++) {
	moreLink[i] = new Array(6);
	moreClick[i] = new Array(6);
}
moreLink[0][0]="#n"; moreClick[0][0]=""; //
moreLink[0][1]="#n"; moreClick[0][1]=""; //
moreLink[0][2]="#n"; moreClick[0][2]=""; //
moreLink[1][0]="#n"; moreClick[1][0]=""; //
moreLink[1][1]="#n"; moreClick[1][1]=""; //
moreLink[1][2]="#n"; moreClick[1][2]=""; //
moreLink[1][3]="#n"; moreClick[1][3]=""; //

function tabOn(tabid,a, com) {

	for (i=1;i<=10;i++) {
		if(i<10){inn="0"+i;} else {inn=""+i;}
		tabMenu = document.getElementById("tab"+tabid+"m"+i);
		tabContent = document.getElementById("tab"+tabid+"c"+i);
		if (tabMenu) { //객체가존재하면
			if (tabMenu.tagName=="IMG") { tabMenu.src="../image/"+com+"/"+"tab"+tabid+"m"+inn+".gif"; } //이미지일때
			if (tabMenu.tagName=="A") { //앵커일때
				tabMenu.style.background="transparent url(../image/"+com+"/tab"+tabid+"mbg.gif) no-repeat";
				tabMenu.style.padding="1px 0 0 0";
				tabMenu.style.fontWeight="normal";
				}
		}
		if (tabContent) { tabContent.style.display="none"; }
	}
	if(a<10){ann="0"+a;} else {ann=""+a;}
	tabMenu = document.getElementById("tab"+tabid+"m"+a);
	tabContent = document.getElementById("tab"+tabid+"c"+a);
//	alert(tabMenu.tagName);
	if (tabMenu) { //객체가존재하면
		if (tabMenu.tagName=="IMG") { tabMenu.src="../image/"+com+"/"+"tab"+tabid+"m"+ann+"on.gif"; } //이미지일때
		if (tabMenu.tagName=="A") { //앵커일때
			tabMenu.style.background="transparent url(../image/"+com+"/tab"+tabid+"mbgon.gif) no-repeat";
			tabMenu.style.padding="2px 0 0 0";
			tabMenu.style.fontWeight="bold";
			}
	}
	if (tabContent) { tabContent.style.display="block"; }
	tabMore = document.getElementById("tab"+tabid+"more");
	if (tabMore) {
		tabMore.href = moreLink[tabid-1][a-1];
		tabMore.onclick = moreClick[tabid-1][a-1];
	}
}


// 보이기감추기
//ex) displayOff('idName','idName'); displayOn('idName','idName'); //인수 개수에 상관없다.
function displayOn() {
	var i,j,a=displayOn.arguments;
	for(i=0;i<a.length;i++) {
		obj = document.getElementById(a[i]);
		if (obj) { obj.style.display = "block"; }
	}
}
function displayOff() {
	var i,j,a=displayOff.arguments;
	for(i=0;i<a.length;i++) {
		obj = document.getElementById(a[i]);
		if (obj) { obj.style.display = "none"; }
	}
}




function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



//팝업링크
function newpop(page, target){
	
	if("" == target){
		location.href=page;
	}else{
		window.open(page, target);
	}
}

//게시판 링크
function fn_bbsURL(id, seq, key, menu_id){
	location.href="../bbs/BbsAction.do?cmd=BbsKView&CT_ID="+id+"&BOARD_SEQ="+seq+"&menu_key="+key+"&menu_id="+menu_id;
}

//게시판 링크 -의사일정
function fn_bbsURL_Sch(id, key, menu_id, year, month){
	
    if(month < 10) month = "0"+month;	
	location.href="../bbs/BbsAction.do?cmd=BbsKList&CT_ID="+id+"&menu_key="+key+"&menu_id="+menu_id+"&scYear="+year+"&scMonth="+month;
}

//로그인
function login(){
	var fm = document.fmParam;
	if(fm.id.value ==''){
		alert('아이디를 입력해주세요');
		fm.id.focus();
		return false;
	}

	if(fm.password.value ==''){
		alert('비밀번호를 입력해주세요');
		fm.password.focus();
		return false;
	}

	//fm.submit();
}

// 신문 onscroll 스크립트 에러로 삭제



function fl_view(objhtml){
	document.write(objhtml);
}

// 플래쉬 점선 없애는 스크립트
