/*
===============================================================================
* Koons Common JS Style
===============================================================================
*/

// Image Bluring

function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;


// FloatMenu

var stmnGAP1 = 500;
var stmnGAP2 = 100;
//var stmnGAP3 = 300;
//var stmnGAP4= 50;
var stmnBASE = 400;
var stmnActivateSpeed = 200; 
var stmnScrollSpeed = 10; 

        function RefreshStaticMenu()
        {
                var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

                stmnStartPoint = parseInt(STATICMENU.style.top, 10);
                stmnEndPoint = document.body.scrollTop + stmnGAP2;
                if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

                if ( stmnStartPoint != stmnEndPoint ) {
                        stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
                        STATICMENU.style.top = parseInt(STATICMENU.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
                        stmnRefreshTimer = stmnScrollSpeed;
                }
                                         else {
                        stmnRefreshTimer = stmnActivateSpeed;
                }

                setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
        }




        function InitializeStaticMenu()
        {
                STATICMENU.style.top = document.body.scrollTop + stmnBASE;
                RefreshStaticMenu();
                }


// Dreamweaver 

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.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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
	
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;
	}
}
	
function MM_findObj(n, d) { //v3.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); return x;
}

// Popup

function winOpen (doc, wname, top, left, width, height) {
  window.open(doc, wname, 'scrollbars=no,resizable=no,top='+top+',left='+left+',width='+width+',height='+height);
}

function winOpen2 (doc, wname, top, left, width, height) {
  window.open(doc, wname, 'scrollbars=yes,resizable=no,top='+top+',left='+left+',width='+width+',height='+height);
}

function winOpen3 (UrId,ER_Year,ER_CH1,width,height){
 window.open("/lib/bimg.asp?UrId="+UrId+"&ER_Year="+ER_Year+"&ER_CH1="+ER_CH1, "view", 'scrollbars=no,resizable=no,width='+width+',height='+height);

}

// Layer

function layerdisplay(name,no,total) {
	for(var i = 0; i < total+1; i++) {
	  posi = name+i;
	  div1 = document.getElementById(posi);
		if ( no == i ) {
		 if(div1.style.display == 'block'){
			 div1.style.display = 'none';
		 }else{
			 div1.style.display = 'block';
		 }
		} else {
		 div1.style.display = 'none';
	  }
	}
}

function DisplayMenu(menu,tabNum,num) {
     for (i=1; i<=tabNum; i++){
		if (num == i) {
			thisMenu = eval(menu + num + ".style");
			thisMenu.display = "";
		}else{
			otherMenu = eval(menu + i + ".style"); 
			otherMenu.display = "none"; 
		}
	}
}

function layerhide( name ) {
  div1 = document.getElementById( name );
  div1.style.display = 'none';
}

// Location

function center(doc, wname, top, left, width, height){ 
    var x,y; 
    if (self.innerHeight) { 
        x = (screen.availWidth - self.innerWidth) / 2; 
        y = (screen.availHeight - self.innerHeight) / 2; 
    }else if (document.documentElement && document.documentElement.clientHeight) { 
        x = (screen.availWidth - document.documentElement.clientWidth) / 2; 
        y = (screen.availHeight - document.documentElement.clientHeight) / 2; 
    }else if (document.body) { 
        x = (screen.availWidth - document.body.clientWidth) / 2; 
        y = (screen.availHeight - document.body.clientHeight) / 2; 
    } 
    window.moveTo(x,y); 
} 


/*
===============================================================================
*  i.e patch
===============================================================================
*/

function flashWrite(url,w,h,id,bg,vars,win){ 

var flashStr= 
 "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+ 
 "<param name='allowScriptAccess' value='always' />"+ 
 "<param name='movie' value='"+url+"' />"+ 
 "<param name='FlashVars' value='"+vars+"' />"+ 
 "<param name='wmode' value='"+win+"' />"+ 
 "<param name='menu' value='false' />"+ 
 "<param name='quality' value='high' />"+ 
 "<param name='bgcolor' value='"+bg+"' />"+ 
 "<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
 "</object>"; 

 document.write(flashStr); 

} 
function aviPlay(src,w,h) { 
document.write('<embed src="'+src+'" width='+w+' height='+h+'>') 
} 

function SWFLoader(width, height, dir, num1, num2, num3, url1, url2, url3, url4, url5) {
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+width+"' height='"+height+"'>");
	document.write("<param name='allowScriptAccess' value='always'>");
	document.write("<param name='allowFullScreen' value='false'>");
	document.write("<param name='movie' value='"+dir+"'>");
	document.write("<param name='quality' value='high'>");
	document.write("<param name='wmode' value='transparent'>");
	document.write("<param name='base' value='.'>");
	document.write("<param name=FlashVars value='mmenu="+num1+"&smenu="+num2+"&tmenu="+num3+"&url1="+url1+"&url2="+url2+"&url3="+url3+"&url4="+url4+"&url5="+url5+"' />");
	document.write("<embed base='.' src='"+dir+"' name='wmode' value='transparent' FlashVars='mmenu="+num1+"&smenu="+num2+"&tmenu="+num3+"url1="+url1+"&url2="+url2+"&url3="+url3+"&url4="+url4+"&url5="+url5+"' quality='high' width='"+width+"' height='"+height+"' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' name='wmode' value='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>");
	document.write("</object>");
}


//#########################################################################################################


//ÇÏ·çµ¿¾È ¿­Áö¾ÊÀ½

function setCookie( name, value, expiredays )
{
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function closeWin()
{
    if ( document.forms[0].Notice.checked )
        setCookie( "popup", "ok" ,1);
    self.close();
}

function notice_getCookie( name ) 
{ 
        var nameOfCookie = name + "="; 
        var x = 0; 
        while ( x <= document.cookie.length ) 
        { 
                var y = (x+nameOfCookie.length); 
                if ( document.cookie.substring( x, y ) == nameOfCookie ) { 
                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
                                endOfCookie = document.cookie.length; 
                        return unescape( document.cookie.substring( y, endOfCookie ) ); 
                } 
                x = document.cookie.indexOf( " ", x ) + 1; 
                if ( x == 0 ) 
                        break; 
        } 
        return ""; 
} 

function chng_bg(obj){
obj.bgColor='#FFFFFF'; 
}

function chng_back(n_obj){
n_obj.bgColor='#DBE9F6'; 
}
/*
/////////// ÆË¾÷ html ¿¡ »ðÀÔºÎºÐ :
<form>
<table cellpadding="0" cellspacing="0" width="415">
 <tr>
  <td><img src="/popup/popup_box.jpg"></td>
 </tr>
   <tr>
  <td bgcolor="#EDEDED" height="40" valign="top">
  <table cellpadding="0" cellspacing="0" width="415" align="center">
   <tr>
    <td height="40" align="right" align="center">
     <input type="checkbox" name="Notice" onClick="closeWin();">
     <font face="µ¸¿ò" size="2" color="#343434">ÇÏ·ç µ¿¾È ¿­Áö ¾ÊÀ½</font>
             <a href="#" onClick="javascript:history.onclick=closeWin()"
                                         style="font-family:±¼¸²Ã¼;font-size:9pt;background-color:#ffffff;color:#3300cc;">[´Ý±â]</a>
     </td>    
   </tr>
  </table></td>
   </tr>
</table>
</form>

/////////// ÆË¾÷¶ç¿ì´Â html ¿¡ »ðÀÔºÎºÐ :
<script language="JavaScript"> 
<!-- JavaScript 
if ( notice_getCookie( "popup" ) != "ok" ) 
{ 
 window.open('/popup/popup.html','_blank','toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable=no,width=460,height=580');
} 
// - JavaScript - --> 
*/

/*
===============================================================================
*  ¾ÆÀÌÇÁ·¹ÀÓ ÀÚµ¿Å©±â ½ÇÇà
===============================================================================
*/

function IFrameResize(na) {
	eval("var PF = "+na+".document.body");
	var CF = document.all[na];
	CF.style.height = PF.scrollHeight + (PF.offsetHeight - PF.clientHeight)+20;
	CF.style.width = PF.scrollWidth + (PF.offsetWidth - PF.clientWidth);
	//alert(CF.style.width);
}

function setColor(obj) {
	for(i=1; i<10; i++) {
		if(i==8) continue;
		if(i==obj) {	
			document.all['menu0'+i].src = "/image/topmenu00"+i+".gif";
			//document.all['menu0'+i].style.backgroundColor="#e8e8e8";
			//if(obj<6)
				//document.all['Layer'+i].style.backgroundColor="#E6E6E6";
		}
		else {
			document.all['menu0'+i].src = "/image/topmenu0"+i+".gif";
			//document.all['menu0'+i].style.backgroundColor="#ffffff";
		}
	}
}
function setBGColor(obj) {
	var id = document.getElementById("List_"+obj).style.backgroundColor="#ECEAC6";
}
function comebackBGColor(obj) {
	var id = document.getElementById("List_"+obj).style.backgroundColor="#FFFFFF";
}

function change_img(sub01) {	
	hey();
	eval(popup).src = "/image/arrow2.gif";
	//document.all[change_img.arguments[0]].src = "/image/arrow2.gif";
}
