
function keycheck(events){
	if(events.keyCode==13){
		return true;
	}else{
		return false;
	}
}

/* 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";
	}
}
/* roll over-out image */
function menuOver() {
	if(this.src.substring(this.src.length-9) != "_on.gif")
		this.src = this.src.replace(".gif", "_on.gif");
		this.src = this.src.replace("_on_on.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");
}

/* 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");
				im.item(0).src = im.item(0).src.replace("_on_on.gif", "_on.gif");				
			}
			else {
				var anchor = menuEl.item(i).getElementsByTagName("a");
				anchor(0).style.fontWeight = "bold";
				anchor(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) {
	topMenuOut(el.getElementsByTagName("img").item(0));
	if(el.id == "top-menu" + depth1) {
		topMenuOver(el.getElementsByTagName("img").item(0));
	}
}
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("navi_wrap");
	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);
		}
		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) {
			imgEl.item(0).onmouseover = menuOver;
			imgEl.item(0).onmouseout = menuOut;
			imgEl.item(0).onfocus = menuOver;
			imgEl.item(0).onblur = menuOut;
		}
	}
}
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("navi_wrap");
	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 topEl3 = topnav.getElementsByTagName("li");
	for(i = 0 , seq = 1; i < topEl3.length ; i++){
		if(topEl3[i].id.substring(0,8) == "position") {
			if(depth1 == seq) topEl3[i].style.display = "block";
			else topEl3[i].style.display = "none";
			seq++;
		}
	}
	
	var topEl2 = topnav.getElementsByTagName("a");
	for(i = 0 , seq = 0; i < topEl2.length ; i++){
		if(topEl2[i].id.substring(0,13) == "top-menu-head") {
			topEl2[i].onmouseover =  selectTopmenuByMenuId;
			topEl2[i].onfocus = selectTopmenuByMenuId;
			if ( seq+1 == depth1) {
				topEl2[i].onmouseover();
				topEl2[i].onfocus();
			}
			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 menuElItm = menuEl.item(i);
		var imgEl = menuElItm.getElementsByTagName("img");
		if(imgEl == null || imgEl.length == 0) continue;
		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;
		}
	}
}

/*  ¸ÞÀÎ È­¸é °Ô½ÃÆÇ ¸¶¿ì½º ÀÌº¥Æ® Ã³¸® */
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.onmouseover = tabMenuClick;
		
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onmouseover();
}
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 menu **/
function initMoving(target,quickLeft) {
	if (!target)
		return false;

	var obj = target;

	obj.initTop = 250;
	obj.initLeft = quickLeft;
	obj.bottomLimit = document.documentElement.scrollHeight - 280;
	obj.topLimit = 1;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	obj.style.left = obj.left + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 0;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 500;
		}
	}
	obj.move = setInterval(function() {
		pos = obj.getTop() + obj.getHeight() * (1.5 / 10) - 15;

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit
		if (pos < obj.topLimit)
			pos = obj.topLimit

		interval = obj.top - pos;
		obj.top = obj.top - interval * (1.5 / 10) ;
		obj.style.top = obj.top + "px";
	}, 40)
}


/** quick menu **/



/** 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)
}

*/

/** text-overflow:ellipsis **/
				window.onload = function() {
			
				if (!document.getBoxObjectFor || !window.openDialog) return;
			
				var sNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
				var xml =  document.createElementNS(sNS , 'window');
				var label = document.createElementNS(sNS, 'description');
				label.setAttribute('crop','end');
			
				xml.appendChild(label); 
			
				var fn = function(el) {
			
					var xml2 =  xml.cloneNode(true);
					var dd = document.createElement('div');
					xml2.firstChild.setAttribute('value', el.textContent);
					
					el.innerHTML = '<span class="ellipsis-phantom">' + el.innerHTML + '</span>';
					el.appendChild(xml2);
					
				};
				
				var a = document.getElementsByTagName('*');
				for(var i=0; el = a[i]; i++) {
					if (/(^|\s)ellipsis(\s|$)/.test(el.className))
						fn(el);
				};
			
			};

//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 MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}


function writeFlash(fPath,w,h) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 		  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + w + '" height="' + h+ '">');
	document.write('<param name="movie" value="' + fPath+ '">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="quality" value="high">');
	document.write('<embed src="' + fPath + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed></object>');
}

function flash(id, width, height){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id=ShockwaveFlash1>'
+'<param name="movie" value="'+id+'">'
+'<param name="quality" value="high">'
+'<param name="wmode" value="transparent">'
+'<embed wmode="transparent" src="'+id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash"></embed>'
+'</object>');
}


