//=====================================================================

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        yMenuFrom   = parseInt (divMenu.style.top, 10);
//        yMenuTo     = document.body.scrollTop + 30; // À§ÂÊ À§Ä¡
        yMenuTo     = document.body.scrollTop + 230; // À§ÂÊ À§Ä¡

        timeoutNextCheck = 500;

        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }


        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divLinkButton"].top += yOffset;
                else if ( bExplorer4plus )
                        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divMenu"].top += yOffset;
                else if ( bExplorer4plus )
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;

				if(parseInt (divMenu.style.top, 10) >  2000) {
					divMenu.style.top = "2000px"
					// ¿©±â¼­ 500ÀÇ ¼ýÀÚ°¡ ·¹ÀÌ¾îÀÇ ÃÖ´ë Y À§Ä¡ÀÓ
				}

                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
        MM_showHideLayers('Layer1','hide','','Layer2','','show');
		var y;

        // ÇÁ·¹ÀÓ ¿¡¼­ ¹þ¾î³ª°Ô ÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. ÇÁ·¹ÀÓ¿¡ ³ÖÀ¸·Á¸é »èÁ¦ÇÏ¼¼¿ä
       // if ( top.frames.length )
         //       top.location.href = self.location.href;

        // Æä¿¡Áö ·Îµù½Ã Æ÷Áö¼Ç
        if ( bNetscape4plus ) {
                document["divMenu"].top = top.pageYOffset + 300;
                document["divMenu"].visibility = "visible";
                //document["divLinkButton"].top = top.pageYOffset + top.innerHeight - 55;
                //document["divLinkButton"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                divMenu.style.top = document.body.scrollTop + 300;
                divMenu.style.visibility = "visible";
                //divLinkButton.style.top = document.body.scrollTop + document.body.clientHeight - 55;
                //divLinkButton.style.visibility = "visible";
        }

        // initializing UI update timer
        CheckUIElements();
        //if ( bExplorer4plus )
        //        setTimeout ( "FlashTitleStepIt(255)", 10 );
        return true;
}

//================================================================================================================================
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_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_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 f_include(a_chk, a_menu_depth ) {

        if(a_chk.toLowerCase() == 'select') {

            document.write("<DIV id=divMenu style=\"width:150px; height:380px; position:absolute; left:980px; top:300px; z-index:1;; visibility: visible\">");
            document.write("<table width='23' border='0' cellspacing='0' cellpadding='0'><tr>");
            document.write("<td><a href='http://enter.chungwoon.ac.kr/' target='_blank'><img src='images/1/sub_quick_right1.gif' width='23' height='80' border='0'></a></td></tr>");
            document.write("<tr><td><a href=\"javascript:openWindow('http://eagles.chungwoon.ac.kr/cutis/main.jsp', 1016, 710,true);\"><img src='images/1/sub_quick_right2.gif' width='23' height='130' border='0'></a></td></tr>");
            document.write("</table>");
			document.write("</DIV> ");
            document.write("<script language=javascript>OnLoad()</script>");	

       }  

    } //function - end
//================================================================================================================================