function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_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_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenu_blank(selObj,restore){ //v3.0
  eval("window.open='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function initBoardArticle (container_id)
{
	var container	= document.getElementById(container_id);
	var h3			= container.getElementsByTagName("h3");

	for (var i=0; i<h3.length; i++)
	{
		if (h3.item(i).id=="article_setting")
		{
			h3.item(i).id			= "js_" + h3.item(i).id;

			var set	= h3.item(i).getElementsByTagName("a").item(0);
				set.container	= h3;
				set.targetElement	= document.getElementById(h3.item(i).getElementsByTagName("a").item(0).href.split("#")[1]);
				set.targetElement.style.position	= "absolute";
				set.targetElement.style.display		= "none";
				set.targetElement.style.padding	= "0";
				set.onclick	= function ()
				{
					this.targetElement.style.display	= "block";
					return false;
				}

				continue;
		}

		h3.item(i).className	= "js_" + h3.item(i).className;
		h3.item(i).id			= "js_" + h3.item(i).id;

		var article	= h3.item(i).getElementsByTagName("a").item(0);
			article.container		= h3;
			article.targetElement	= document.getElementById(h3.item(i).getElementsByTagName("a").item(0).href.split("#")[1]);
			article.targetElement.style.display	= "none";
			article.onclick	= article.onfocus	= function ()
			{
				var current	= this.container.current;

				if (current!=this)
				{
					if (current)
					{
						current.targetElement.style.display	= "none";
						current.className	= "";
					}

					this.targetElement.style.display	= "block";
					this.className	= "menu_on";
					this.container.current	= this;
				}
				return false;

			};
			
			article.className	= "";

			if (!article.container.first) { article.container.first	= article;}
	}
	
	h3.first.onclick();
}



function setPng24(obj) {
	var useragent = navigator.userAgent;
	
	if ((useragent.indexOf('MSIE 6')>0) && (useragent.indexOf('MSIE 7')==-1)){
		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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* ÅÇ¸Þ´º Åä±Û */
function tabNavToggle(num) {
	document.getElementById('tabNav01').style.display = "none";
	document.getElementById('tabNav02').style.display = "none";
	document.getElementById('tabNav03').style.display = "none";
	document.getElementById('tabNav0' + num).style.display = "block";
}

//¼­ºê¸Þ´º Åä±Û
var openMenuID="";	// ¿­·ÁÀÖ´Â ID¸¦ ÀúÀåÇÔ

function toggleSubMenu(idStr){
	mObj=document.getElementById(idStr);
	if(mObj){
		if (mObj.style.display=="none"){
			if(openMenuID){
				document.getElementById(openMenuID).style.display="none";
			}
			mObj.style.display="block";
			openMenuID=idStr;
		}else if (mObj.style.display=="block"){
			mObj.style.display="none";
			openMenuID="";
		}
	}
}

/*	±ÛÀÚÈ®´ëÃà¼Ò */	
var currentFontSize = 2;
 
function zoomUtil(state){
	var idx = currentFontSize;
	var arrFontSize = new Array();
	
	arrFontSize[0] = "9px";
	arrFontSize[1] = "11px";
	arrFontSize[2] = "12px";
	arrFontSize[3] = "13px";
	arrFontSize[4] = "14px";
	arrFontSize[5] = "15px";
	arrFontSize[6] = "16px";
	
	if(state == "plus"){		
		if(currentFontSize < 6 ){				
			idx = currentFontSize + 1;
			currentFontSize = idx;
		}
	}else if (state == "default"){
		idx = 2;
		currentFontSize = idx;
	}else if (state == "minus"){			
		if( currentFontSize >= 1){
			idx = currentFontSize - 1;
			currentFontSize = idx;
		}	
	}		
	
	if(navigator.userAgent.indexOf("MSIE") != -1){
		document.body.style.fontSize = arrFontSize[idx];
	}else{
		document.getElementsByTagName("BODY").style.fontSize = arrFontSize[idx];
	}
	
	return false;
}

String.prototype.toInteger = function() {
	return this.replace(/[^0-9]/g, '') * 1;
}

//Äü¸Þ´º ½ºÅ©¸³Æ®
function followBanner(div_id, origin_top, limit_top, margin_top){
	var d, t, s, g, target_height;
	origin_top *= 1;
	limit_top *= 1;
	margin_top *= 1;
	
	d = document.getElementById(div_id);
	s = document.documentElement.scrollTop + "";
	
	target_height = s.toInteger() + margin_top;
	if(target_height < limit_top) {
		target_height = origin_top;
	}
	
	t = d.style.top.toInteger();
	
	if(t != target_height) {
		g = Math.ceil((t - target_height) / 5);
		if(g > 50) {
			g = 50;
		} else if (g < -50) {
			g = -50;
		}
		d.style.top = (t - g) + "px";
	}
	setTimeout("followBanner('"+div_id+"', '"+origin_top+"', '"+limit_top+"', '"+margin_top+"');", 1);
}

// rollover
function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;



function changeToFlash (src, w, h)
{
	if (src)
	{
		var str	= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + w + '" height="' + h + '">'
				+ '<param name="movie" value="' + src + '" />'
				+ '<param name="wmode" value="transparent" />'
				+ '<!--[if !IE]> <-->\n'
				+ '<object type="application/x-shockwave-flash" data="' + src + '" width="' + w + '" height="' + h + '">'
				+ '<param name="wmode" value="transparent" />'
				+ '</object>'
				+ '\n<!--> <![endif]-->'
				+ '</object>';

				document.write(str);
	}
}

function vod_player(obj,url,width,height){
 var em_URL = "<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='"+obj+"'  width='"+width+"' height='"+height+"'>";
 em_URL += "<param NAME='Filename' value='"+url+"'>";
 em_URL += "<PARAM NAME='AutoSize' value='0'>";
 em_URL += "<PARAM NAME='AutoStart' value='0'>";
 em_URL += "<PARAM NAME='PlayCount' VALUE=0>";
 em_URL += "<PARAM NAME='Rate' VALUE=1>";
 em_URL += "<param NAME='TransparentAtStart' VALUE='0'>";
 em_URL += "<param NAME='SendkeyboardEvents' VALUE='1'>";
 em_URL += "<param name='mute' value='false'>";
 em_URL += "<PARAM NAME='EnableContextMenu' VALUE='0'>";
 em_URL += "<PARAM NAME='volume' VALUE='80'>";
 em_URL += "<PARAM NAME='ShowStatusBar' VALUE='0'>";
 em_URL += "<PARAM NAME='ShowControls' VALUE='1'>";
 em_URL += "<param name='EnableFullScreenControls' value='1'>"; 
 em_URL += "</object>"; 

 document.write(em_URL);
} 

function MediaControl(obj,n) { 
    var MediaPlayer = document.getElementById(obj); 
    switch (n) { 
        case 0 : MediaPlayer.Stop(); break; 
        case 1 : MediaPlayer.Play(); break; 
        case 2 : MediaPlayer.Pause(); break; 
        default : MediaPlayer.Stop(); 
    } 
}  
