//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NEXON GATE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function gate(Id, interval, to) {
    var obj = document.getElementById('gate_menu');
		var bt = document.getElementById('bt_gate');
    var H, step = 4;

    if (obj == null) return;
    if (to == undefined) { // user clicking
        if (obj._slideStart == true) return;
        if (obj._expand == true) {
            to = 0;
            obj.style.overflow = "hidden";
						bt.src = "link_top_table_btn.png";
        } else {
            obj.style.height = "";
            obj.style.overflow = "";
            obj.style.display = "block";
            to = obj.offsetHeight; // ÀÌ°ÅÀÌ°Å
            obj.style.overflow = "hidden";
            obj.style.height = "1px";
						bt.src = "link_top_table_btn.png";
        }
        obj._slideStart = true;
    }
    
    step             = ((to > 0) ? 1:-1) * step;
    interval         = ((interval==undefined)?1:interval);

    obj.style.height = (H=((H=(isNaN(H=parseInt(obj.style.height))?0:H))+step<0)?0:H+step)+"px";
    
    
    if (H <= 0) {
        obj.style.display = "none";
        obj.style.overflow = "hidden";
        obj._expand = false;
        obj._slideStart = false;
    } else if (to > 0 && H >= to) {
        obj.style.display = "block";
        obj.style.overflow = "visible";
        obj.style.height = H + "px";
        obj._expand = true;
        obj._slideStart = false;
    } else {
        setTimeout("gate('"+Id+"' , "+interval+", "+to+")", interval);
    }
}

function gateLoad(){
	gate("gate_menu");
	setTimeout("gate('gate_menu')", 2000);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ÇÃ·¡½Ã Ãâ·Â
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var TopcurMenu, LeftcurMenu;

function ViewFlash(URL,width,height,vars,bgColor,winmode,curmenu) { //(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, º¯¼ö, ¹è°æ»ö, À©µµ¿ì¸ðµå)

	var id=URL.split("/")[URL.split("/").length-1].split(".")[0];
	if(vars==null) vars='';
	if(bgColor==null) bgColor='#FFFFFF';
	if(winmode==null) winmode='transparent';  //wmode¼Ó¼º=window,opaque,transparent

	document.write("	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' "); 
	document.write("		width='"+width+"' height='"+height+"' id='"+id+"' align='middle'> ");
	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie' 						value='"+URL+"' /> ");
	document.write("	<param name='FlashVars' 				value='"+vars+"' /> ");
	document.write("	<param name='wmode' 						value='"+winmode+"' /> ");
	document.write("	<param name='menu' 							value='false' /> ");
	document.write("	<param name='quality'						value='high' /> ");
	document.write("	<param name='scale'							value='noscale' /> ");
	document.write("	<param name='salign'						value='lt' /> ");
	document.write("	<param name='bgcolor'						value='"+bgColor+"' /> ");
	document.write("	<embed src='"+URL+"' flashVars='"+vars+"' wmode='"+winmode+"' menu='false' quality='high' scale='noscale' salign='lt'");
	document.write("		bgcolor='"+bgColor+"' width='"+width+"' height='"+height+"' name='"+id+"' align='middle' ");
	document.write("		allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> ");
	document.write("	</object> ");
}

function Show_flash(_fileName_,_width_,_height_)
{
	var _object_ = "";
	_object_ ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+_width_+'" height="'+_height_+'" id="'+_fileName_+'" align="middle">';
	_object_ += '<param name="allowScriptAccess" value="sameDomain" />';
	_object_ += '<param name="movie" value="flash/'+_fileName_+'.swf" />';
	_object_ += '<param name="quality" value="high" />';	
	_object_ += '<param name="wmode" value="transparent" />';	
	_object_ += '<param name="bgcolor" value="#6d0f0a" />';	
	_object_ += '<embed src="flash/'+_fileName_+'.swf" wmode="transparent" quality="high" bgcolor="#6d0f0a" width="'+_width_+'" height="'+_height_+'" name="'+_fileName_+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';	
	_object_ += '</object>';
	
	document.write(_object_);
}


/* ÆäÀÌÁö »ç¿ë ¹æ¹ý (º¯¼ö,¹è°æ»ö,À©µµ¿ì¸ðµå »ý·«°¡´É)
<script>ViewFlash('URL','Width','Height','VARS','BGC','WINMODE')</script>
*/


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// µ¿¿µ»ó Àç»ý
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ViewMediaPlayer(id, name, width, height, showcontrols, autostart, autorewind, autosize, autoresize, transparentatstart, loop, url) {

	document.write("<object id='"+id+"' codeBase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' "); 
	document.write("		type='application/x-oleobject' standby='Loading Microsoft Windows Media Player components...' "); 
	document.write("		width='"+width+"' height='"+height+"' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' name='"+name+"'> ");
	document.write("	<param name='ShowControls' 				value='"+showcontrols+"'> ");
	document.write("	<param name='AutoStart' 					value='"+autostart+"'> ");
	document.write("	<param name='AutoRewind'					value='"+autorewind+"'> ");
	document.write("	<param name='Autosize'				 		value='"+autosize+"'> ");
	document.write("	<param name='AutoResize' 					value='"+autoresize+"'> ");
	document.write("	<param name='TransparentAtStart' 	value='"+transparentatstart+"'> ");
	document.write("	<param name='loop' 								value='"+loop+"'> ");
	document.write("	<param name='Filename'						value='"+url+"'> ");
	document.write("	<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' "); 
	document.write("		id='"+id+"' name='"+name+"' showpositioncontrols='0' showcontrols='"+showcontrols+"' autosize='"+autosize+"' autostart='"+autostart+"' showdisplay='0' ");
	document.write("		showstatusbar='0' showtracker='1' loop='1' width='"+width+"'  height='"+height+"' src='"+url+"'></embed> "); 
	document.write("</object> ");
}

function media_play(id) 
{
  document.getElementById(id).play()
}

function media_stop(id)
{
  document.getElementById(id).stop()
}

function media_pause(id)
{
  document.getElementById(id).pause()
}

/* ÆäÀÌÁö »ç¿ë ¹æ¹ý
<script>ViewMediaPlayer('id','name','width','height','showcontrols','autostart','autorewind','autosize','autoresize','transparentatstart','loop','url')</script>
*/


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Ã¼Å©¹Ú½º
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if(browserName == "Netscape" && browserVer >= 3){ init = "net"; }
else { init = "ie"; }


if(((init == "net")&&(browserVer >=3))||((init == "ie")&&(browserVer >= 4))){

 sn_on=new Image;
 sn_off=new Image;
 sn_on.src= "/img/common/chk_name_on.gif";
 sn_off.src= "/img/common/chk_name_off.gif";

 ss_on=new Image;
 ss_off=new Image;
 ss_on.src= "/img/common/chk_title_on.gif";
 ss_off.src= "/img/common/chk_title_off.gif";

 sc_on=new Image;
 sc_off=new Image;
 sc_on.src= "/img/common/chk_content_on.gif";
 sc_off.src= "/img/common/chk_content_off.gif";

}

function OnOff(name) {
if(((init == "net")&&(browserVer >=3))||((init == "ie")&&(browserVer >= 4))) {
  if(document.search[name].value=='on')
  {
   document.search[name].value='off';
   ImgSrc=eval(name+"_off.src");
   document[name].src=ImgSrc;
  }
  else
  {
   document.search[name].value='on';
   ImgSrc=eval(name+"_on.src");
   document[name].src=ImgSrc;
  }
 }
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ·Ñ¿À¹ö
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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_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_findObj(n, d) { //v4.0
		  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 && document.getElementById) x=document.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_reloadPage(init) {  //reloads the window if Nav4 resized
		  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
		MM_reloadPage(true);
		
		
		function MM_showHideLayers() { //v3.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; }
		}
		
		var g_oPopup	= null;
		var g_bTry		= false;

		function MM_openBrWindow(theURL,winName,features) { //v2.0
		  g_oPopup = window.open(theURL,winName,features);

		  setTimeout( reSizeMargin , 10 );
		}


		function reSizeMargin()
		{
			try{
				g_bTry	= true;

				g_oPopup.document.body.topMargin	= 0;
				g_oPopup.document.body.leftMargin	= 0;

				g_bTry	= false;

			}catch(e){

				if( true == g_bTry )
				{
					setTimeout( reSizeMargin , 100 );
				}
			}
		}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Å¸ÀÌÆ²ÇÃ·¡½Ã
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function Title_swf(){
		if(LeftcurMenu == null) LeftcurMenu='1';
		title_num = LeftcurMenu.charAt(0);
		cur_num = LeftcurMenu.charAt(1);
		ViewFlash("/img/swf/sub_title0"+ title_num +".swf","675","130","curTitle="+ cur_num +"","#ffffff", "");
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ÆË¾÷
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function Win_open(url, name, w, h){
	window.open(url, name, "scrollbars=no, resizable=no, width="+w+", height="+h+"");
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// top¹öÆ°
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function scrollLayer(p_obj_name, p_gap_point, t_point) 
{ 
    var top_point, start_point, end_point, timer; 

    var obj_layer   = document.getElementById(p_obj_name);  // ·¹ÀÌ¾î ¿ÀºêÁ§Æ®

    top_point   = obj_layer.style.top;
    start_point = parseInt(top_point, 10); 
    end_point   = (parseInt(document.body.clientHeight) - p_gap_point) + parseInt(document.body.scrollTop); 
    limit_point = parseInt(document.body.scrollHeight) - parseInt(obj_layer.offsetHeight) -10; 

    if ( end_point > limit_point )  end_point = limit_point; 
		if ( end_point < t_point)	end_point = t_point;
    if ( end_point < top_point )    end_point = top_point; 

    if ( start_point != end_point ) 
    { 
        scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 15 ); 
        obj_layer.style.top = parseInt(top_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
    } 

    timer = setTimeout ("scrollLayer('" + p_obj_name + "', " + p_gap_point + ", " + t_point +");", 5); 
} 

function gotop(){
  document.body.scrollTop=0;
 }


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// top¹öÆ°_Ã¤¿ëÁ¤º¸
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function scrollLayer2(p_obj_name, p_gap_point, t_point) 
{ 
    var top_point, start_point, end_point, timer; 

    var obj_layer   = document.getElementById(p_obj_name);  // ·¹ÀÌ¾î ¿ÀºêÁ§Æ®

    top_point   = obj_layer.style.top;
    start_point = parseInt(top_point, 10);
    end_point   = (parseInt(document.documentElement.clientHeight) - p_gap_point) + parseInt(document.documentElement.scrollTop); 
    limit_point = parseInt(document.documentElement.scrollHeight) - parseInt(obj_layer.offsetHeight) -10; 

    if ( end_point > limit_point )  end_point = limit_point; 
		if ( end_point < t_point)	end_point = t_point;
    if ( end_point < top_point )    end_point = top_point; 

    if ( start_point != end_point ) 
    { 
        scroll_amount = Math.ceil( Math.abs( end_point - start_point ) / 15 ); 
        obj_layer.style.top = parseInt(top_point, 10) + ( ( end_point < start_point ) ? -scroll_amount : scroll_amount ); 
    } 

    timer = setTimeout ("scrollLayer2('" + p_obj_name + "', " + p_gap_point + ", " + t_point +");", 5); 
} 

function gotop2(){
  document.documentElement.scrollTop=0;
 }
 
 //1107 Ãß°¡ // 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// tab ¾×¼Ç
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function tab_action(obj1, obj2) { //obj1:tab±¸ºÐÀÚ, obj2:¼±ÅÃµÇ´Âtab

		for(i=0;i<=(eval(obj1).length-1);i++){
			if(eval(obj1)[obj2-1] == eval(obj1)[i]){
				eval(obj1)[i].style.display="block";
			}
			else{
				eval(obj1)[i].style.display="none";
			}
		}
	}