
/* roll over-out image */
function menuOver() {
	if(this.src.substring(this.src.length-7) != "_on.gif")
		this.src = this.src.replace(".gif", "_on.gif");
}
function menuClick() {
	if(this.id.indexOf("menu-image") > -1) {
		var submenu = document.getElementById("menu" + this.id.substring(10));
		var uls = submenu.getElementsByTagName("ul");
		if(uls.length>0){
			if(uls[0].style.display == "none")
				uls[0].style.display = "block";
			else
				uls[0].style.display = "none";
		}
	}
}
function menuOut() {
	this.src = this.src.replace("_on.gif", ".gif");
}

function menuOverA() {
	this.style.fontWeight = "bold";
	this.style.textDecoration = "underline";
}
function menuOutA() {
	this.style.fontWeight = "";
	this.style.textDecoration = "none";
}
/* Tab over,out */
function initImgEffect(ImgEls,SelImg) {
	
	MenuImg = document.getElementById(ImgEls).getElementsByTagName("img");
	MenuImgLen = MenuImg.length;

	for (i=0; i<MenuImgLen; i++) {
		MenuImg.item(i).onmouseover = menuOver;
		MenuImg.item(i).onmouseout = menuOut;
		if (i == SelImg) {
			MenuImg.item(i).onmouseover();
			MenuImg.item(i).onmouseover = null;
			MenuImg.item(i).onmouseout = null;
		}
	}
}

function selectTab(num,more) {
	var tab = document.getElementById("notice"); if(tab == null) return;
	var uls = tab.getElementsByTagName("ul"); if(uls == null) return;
	
	for(var i = 0 , k  = 0 ; i < uls.length ; i++){
		if(uls[i].id == "list") {
			if(k == num) uls[i].style.display = "block";
			else uls[i].style.display = "none";
			k++;
		}
	}
	
	var m = document.getElementById("notice_more"); if(m == null) return;
	m.href=more;
	MenuImg = document.getElementById("notice_tab").getElementsByTagName("img");
	MenuImgLen = MenuImg.length;
	for (i=0; i<MenuImgLen; i++) {
		MenuImg.item(i).onmouseover = menuOver;
		MenuImg.item(i).onmouseout = menuOut;
		if (i == num) {
			MenuImg.item(i).onmouseover();
			MenuImg.item(i).onmouseover = null;
			MenuImg.item(i).onmouseout = null;
		}
		else {
			MenuImg.item(i).onmouseout();
		}
	}
}

/* leftmenu over,out */
function initSubmenuByMenuId(depth1, depth2, depth3,depth4, menuId) {
	selectDepth1 = "menu" + depth1 + "-" + depth2;
	selectDepth2 = "menu" + depth1 + "-" + depth2 + "-" + depth3;
	selectDepth3 = "menu" + depth1 + "-" + depth2 + "-" + depth3 + "-" + depth4;
	
	nav = document.getElementById(menuId);
	if(!nav) return;
	menuEl = nav.getElementsByTagName("li");	
		
	
	for(i = 0; i < menuEl.length; i++) {
		if (menuEl.item(i).id == selectDepth1 || menuEl.item(i).id == selectDepth2  || menuEl.item(i).id == selectDepth3  ) {
			var im = menuEl.item(i).getElementsByTagName("img");
			if(im && im.length > 0 ) {
				im.item(0).src = im.item(0).src.replace(".gif", "_on.gif");
			}
			else {
				var aEl = menuEl.item(i).getElementsByTagName("a");
				if(aEl.length > 0 ) {
					aEl.item(0).style.fontWeight = "bold";
					aEl.item(0).style.textDecoration = "underline";
				}
				
			}
		} else {
			var im = menuEl.item(i).getElementsByTagName("img");
			if( im == null || im.length == 0)  continue;
			im.item(0).onmouseover = menuOver;
			im.item(0).onmouseout = menuOut;
			im.item(0).onfocus = menuOver;
			im.item(0).onblur = menuOut;
			im.item(0).onclick = menuClick;
			if (menuEl.item(i).getElementsByTagName("ul").item(0)) {
				menuEl.item(i).getElementsByTagName("ul").item(0).style.display = "none";
			}
		}
	}	
	
	menuId = "menu" + depth1;
	initTopmenuByMenuId(depth1,depth2,depth3,depth4,menuId);
}
function initTopMenu(el,depth1) {
	var imgs = el.getElementsByTagName("img");
	if(imgs && imgs.length > 0) {
		topMenuOut(imgs.item(0));
		if(el.id == "top-menu" + depth1) {
			topMenuOver(imgs.item(0));
		}
	} else {
		topMenuOutA(el.getElementsByTagName("a").item(0));
		if(el.id == "top-menu" + depth1) {
			topMenuOverA(el.getElementsByTagName("a").item(0));
		}
	}
}
function topMenuOverA(a) {
	if(a) {
		a.style.fontWeight = "bold";
		a.style.textDecoration = "none";
		a.style.color = "#d8e3fb";
	}
}
function topMenuOutA(a) {
	if(a) {
		a.style.fontWeight =  "";
		a.style.textDecoration = "none";
		a.style.color = "#FFFFFF";
	}
}
function topMenuOver(img) {
	img.src = img.src.replace(".gif", "_on.gif");
}
function topMenuOut(img) {
	img.src = img.src.replace("_on.gif", ".gif");
}
function selectTopmenuByMenuId() {
	var depth1 = this.id.substring("top-menu-head".length,this.id.length);
	var menuId = "sub-menu" + depth1;		
	var selectDepth1 = "top-" + depth1 + "-1";
	var topnav = document.getElementById("lnb");
	if(!topnav) return;
	var topEl = topnav.getElementsByTagName("ul");
	for(i = 0 ; i < topEl.length ; i++){
		if(topEl[i].id.substring(0,12) == "top-sub-menu") {
			topEl[i].style.display = "none";
		}
	}
	var topEl2 = topnav.getElementsByTagName("li");
	for(i = 0 , seq = 1; i < topEl2.length ; i++){
		if(topEl2[i].id.substring(0,8) == "top-menu") {
			initTopMenu(topEl2[i],depth1);
		}
	}
	var topEl2 = topnav.getElementsByTagName("li");
    for(i = 0 , seq = 1; i < topEl2.length ; i++){
        if(topEl2[i].id.substring(0,8) == "top-menu") {
            initTopMenu(topEl2[i],depth1);
        }
        if(topEl2[i].id.substring(0,8) == "position") {
            if(depth1 == seq) topEl2[i].style.display = "block";
            else topEl2[i].style.display = "none";
            seq++;
        }
    }

	
	var nav = document.getElementById("top-" + menuId);
	if(!nav) return;
	nav.style.display = "block";
	menuEl = nav.getElementsByTagName("li");
	for(i = 0; i < menuEl.length; i++) {
		var imgEl = menuEl.item(i).getElementsByTagName("img");
		if(imgEl != null && imgEl.length>0) {
			if(imgEl.item(0).src.substring(imgEl.item(0).src.length-7) == "_on.gif") {
				imgEl.item(0).onmouseover = menuOver;
				imgEl.item(0).onmouseout = null;
				imgEl.item(0).onfocus = menuOver;
				imgEl.item(0).onblur = null;
			}
			else {
				imgEl.item(0).onmouseover = menuOver;
				imgEl.item(0).onmouseout = menuOut;
				imgEl.item(0).onfocus = menuOver;
				imgEl.item(0).onblur = menuOut;
			}
		} 
		else {
			var aEl = menuEl.item(i).getElementsByTagName("a");
			if(!aEl || aEl.length == 0 )  continue;
			if(aEl.item(0).style.fontWeight == "bold" || aEl.item(0).style.fontWeight == "BOLD" ) {
				aEl.item(0).onmouseover = menuOverA;
				aEl.item(0).onmouseout = null;
				aEl.item(0).onfocus = menuOverA;
				aEl.item(0).onblur = null;
			}
			else {
				aEl.item(0).onmouseover = menuOverA;
				aEl.item(0).onmouseout = menuOutA;
				aEl.item(0).onfocus = menuOverA;
				aEl.item(0).onblur = menuOutA;
			}
		}
	}
}
function initTopmenuByMenuId(depth1, depth2, depth3, depth4, menuId) {

	var selectDepth1 = "top-" + depth1 + "-" + depth2;
	var selectDepth2 = "top-" + depth1 + "-" + depth2 + "-" + depth3;
	var selectDepth3 = "top-" + depth1 + "-" + depth2 + "-" + depth3 + "-" + depth4;
	var topnav = document.getElementById("lnb");
	if(!topnav) return;
	var topEl = topnav.getElementsByTagName("ul");	
	for(var i = 0 ; i < topEl.length ; i++){
		if(topEl[i].id.substring(0,12) == "top-sub-menu") {
			topEl[i].style.display = "none";
		}
	}
	
	var topEl2 = topnav.getElementsByTagName("a");
	for(i = 0 ; i < topEl2.length ; i++){
		if(topEl2[i].id.substring(0,13) == "top-menu-head" ) {
			topEl2[i].onmouseover =  selectTopmenuByMenuId;
			topEl2[i].onfocus = selectTopmenuByMenuId;
			if ( topEl2[i].id.substring(13) == depth1 ) {
				topEl2[i].onmouseover();
				topEl2[i].onfocus();
			}
		}
	}
	
	var nav = document.getElementById("top-" + menuId);
	if(!nav) return;
	nav.style.display = "block";
	menuEl = nav.getElementsByTagName("li");
	for(i = 0; i < menuEl.length; i++) {
		var menuElItm = menuEl.item(i);
		var imgEl = menuElItm.getElementsByTagName("img");
		if(imgEl.length > 0 ) {
			var itm = imgEl.item(0);
			if (menuElItm.id == selectDepth1 || menuElItm.id == selectDepth2  || menuElItm.id == selectDepth3  ) {			
				itm.src = itm.src.replace(".gif", "_on.gif");
				itm.onmouseover = null;
				itm.onmouseout = null;
				itm.onfocus = null;
				itm.onblur = null;
			}
			else {
				itm.onmouseover = menuOver;
				itm.onmouseout = menuOut;
				itm.onfocus = menuOver;
				itm.onblur = menuOut;
			}
		} else { 
			
			var aEl = menuElItm.getElementsByTagName("a");
			var itm = aEl.item(0);
			if (menuElItm.id == selectDepth1 || menuElItm.id == selectDepth2  || menuElItm.id == selectDepth3  ) {			
				itm.style.fontWeight = "bold";
				itm.style.textDecoration = "underline";
				itm.onmouseover = null;
				itm.onmouseout = null;
				itm.onfocus = null;
				itm.onblur = null;
			}
			else {
				itm.onmouseover = menuOverA;
				itm.onmouseout = menuOutA;
				itm.onfocus = menuOverA;
				itm.onblur = menuOutA;
			}
		}
	}
}

/*  메인 화면 게시판 마우스 이벤트 처리 */
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);		
		thismenu.onclick = tabMenuClick;
		
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}
function tabMenuClick() {
	currentmenu = this.container.current;
	if (currentmenu != this) {
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";
			if (currentmenu.imgEl) {
				currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
			} else {
				currentmenu.className = currentmenu.className.replace(" on", "");
			}
		}

		this.targetEl.style.display = "block";
		if (this.imgEl) {
			this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
		} else {
			this.className += " on";
		}
		this.container.current = this;
	}
	return false;
}


/** quick **/
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 40)
}

//IE Flicker Bug (function(){ /*Use Object Detection to detect IE6*/ var m = document.uniqueID /*IE*/ && document.compatMode /*>=IE6*/ && !window.XMLHttpRequest /*<=IE6*/ && document.execCommand ; try{ if(!!m){ m("BackgroundImageCache", false, true) /* = IE6 only */ } }catch(oh){}; })(); //png function setPng24(obj) { obj.width=obj.height=1; obj.className=obj.className.replace(/\bpng24\b/i,''); obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" obj.src=''; return ''; }

// 프린트스크립트
function contentPrint() { 
	var windowLeft = (screen.width-665)/2;
//	var windowTop = (screen.height-480)/2;
	var windowTop = 20;
	var printURL = "/include/printpage.html";
	 window.open(printURL,"content",'width=665, height=620, menubar=yes, scrollbars=yes,status=no,resizable=yes,top=' + windowTop + ',left=' + windowLeft + '');
}


//바로가기
function goUri(uri,target) { 
	if(uri!="") { window.open(uri,target); }
}
//목록상자바로가기
function goSelect(form,target) {

	var myindex=form.uri.selectedIndex
	myUri = form.uri.options[myindex].value;
	if(myUri!="") window.open(myUri,target);
}
//목록상자바로가기2
function goSelectAction(form,target) {
	var myUri = form.uri.value;
	if(myUri!="") { 
		form.action=myUri;
		form.target=target;
		form.submit();
	}
}


function getvodWMV7(murl,mw,mh) //WMPlayer ver7 이상
{
	(mw)? mw = mw : mw = 280;
	(mh)? mh = mh : mh = 280;
	document.writeln('<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=6,4,7,1112"');//IE 전용 ActiveX
	document.writeln(' id="player" width="'+ mw +'" height="'+ mh +'">');//IE : 크기를 %로 하면 마우스 오버해야 보임.
	document.writeln('<param name="url" value="'+ murl +'" /> ');
	document.writeln('<param name="autoStart" value="false" />');
	document.writeln('<param name="uiMode" value="full" />');
	document.writeln('<param name="stretchToFit" value="false" />');
	document.writeln('<param name="fullScreen" value="false" />');
	document.writeln('<!--[if !IE]>-->');//IE 조건주석문 - 없으면 IE6에서 2번 보임.
	document.writeln('<object type="video/x-ms-wmv" data="'+ murl +'" width="'+ mw +'" height="'+ mh +'">');//FF,Op,Sf 사용.. parameter 부분지원
	document.writeln('<param name="controller" value="true" />');
	document.writeln('<param name="autostart" value="false" />'); //Vista FF, Op WMP11 지원
	document.writeln('<div>동영상파일 : <a tabindex="0" href="'+ murl +'">'+ murl +'</a></div>');//대체콘텐츠
	document.writeln('</object>');
	document.writeln('<!--<![endif]-->');
	document.writeln('');//여기에 대체콘텐츠를 두면 안됨
	document.writeln('</object>');
}

// 팝업 스크립트
function attachFile(winURL){
 window.open(winURL,"newWin","width=442px, height=396px");}

/* toggle */
function showBx(id) {
	var obj = document.getElementById(id);
	if(obj) {
		if(obj.style.display == "none" || obj.style.display == "") obj.style.display = "block";
		else obj.style.display = "none";
	}
}
// 내용 폴딩을 위한 펑션
	function show(id) {
	for(num=1; num<=7; num++) document.getElementById('a'+num).style.display="none";// Q&A 개수
	document.getElementById(id).style.display="block";
	}


// 이미지 팝업창
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  }

//파일 다운로드 페이지 

function fileDown(fnm)
{
	var fFrm = document.fileFrm;
	fFrm.file_nm.value=fnm;
	fFrm.submit();
}