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 yMenu1From, yMenu1To, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        if ( bNetscape4plus ) { // ³×Ã÷ÄÉÀÌÇÁ ¿ë ¼³Á¤
                //yButtonFrom = document["divLinkButton"].top;
                //yButtonTo   = top.pageYOffset + top.innerHeight - 55;
                yMenu1From   = document["top_layer"].top;
                yMenu1To     = top.pageYOffset + 10;   //50 À§ÂÊ À§Ä¡
        }
        else if ( bExplorer4plus ) {  // IE ¿ë ¼³Á¤
                //yButtonFrom = parseInt (divLinkButton.style.top, 10);
                //yButtonTo   = document.body.scrollTop + document.body.clientHeight - 55;
                yMenu1From   = parseInt (top_layer.style.top, 10);
                yMenu1To     = document.body.scrollTop + 107; // 50À§ÂÊ À§Ä¡
        }

        timeoutNextCheck = 500;

        if ( Math.abs (yButtonFrom - (yMenu1To + 107)) < 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 ( yMenu1From != yMenu1To ) {
                yOffset = Math.ceil( Math.abs( yMenu1To - yMenu1From ) / 20 );
                if ( yMenu1To < yMenu1From )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["top_layer"].top += yOffset;
                else if ( bExplorer4plus )
                        top_layer.style.top = parseInt (top_layer.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function MovePosition()
{
        
		var y;

        // ÇÁ·¹ÀÓ ¿¡¼­ ¹þ¾î³ª°Ô ÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. ÇÁ·¹ÀÓ¿¡ ³ÖÀ¸·Á¸é »èÁ¦ÇÏ¼¼¿ä
        if ( top.frames.length )
         //       top.location.href = self.location.href;

        // Æä¿¡Áö ·Îµù½Ã Æ÷Áö¼Ç
        if ( bNetscape4plus ) {
                document["top_layer"].top = top.pageYOffset + 300;
                document["top_layer"].visibility = "visible";
                //document["divLinkButton"].top = top.pageYOffset + top.innerHeight - 55;
                //document["divLinkButton"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                top_layer.style.top = document.body.scrollTop + 300;
                top_layer.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 funcSwapImage(imageName, bHilite) {
// DUMB Netscape doesn't see img names if they're inside a <div which has an id
// if they're just in <div></div> - it's okay, but that's not the case :\
// Workaround (using layers) was provided by Kostya. Tnx man :)
        if ( bExplorer4plus ) {
                document.images[imageName].src = "images/" + imageName + (bHilite == 1 ? "_hi.gif" : "_lo.gif");
        }
        else if ( bNetscape4plus ) {
                document.layers["top_layer"].document.images[imageName].src = "images/" + imageName + (bHilite == 1 ? "_hi.gif" : "_lo.gif");
        }
        return false;
}
function OpenWindow(url,name,width,height) {
	window.open(url,name,"width=325,height=285,scrollbars=no");
}

function  viewMediaPlayer(sURL, sName, sFeatures){ 

 //¹Ìµð¾î ÇÃ·¹ÀÌ¾î ¿ÀºêÁ§Æ®¸¦ »Ñ·ÁÁÝ´Ï´Ù. 
 //¹Ìµð¾î ÇÃ·¹ÀÌ¾î ¹öÀüÀº 7~10 ¹öÀü¿¡ È£È¯µÇ´Â ¿ÀºêÁ§Æ®ID¸¦ »ç¿ëÇÕ´Ï´Ù. 
 var WMPCID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"; 

 var sFeature; 
 var sWidth  = "100%"; 
 var sHeight  = "100%"; 
 var pmBoolean; 
 var sTempArray; 
 var sParamTag = ""; 

 sFeature = sFeatures.split(/\s*,\s*/); 
 for (var i=0; i< sFeature.length ; i++) 
 { 
  sTempArray = sFeature[i].split(/\s*=\s*/); 
  if (sTempArray[0].toLowerCase() == "width"){ 
  //³ÐÀÌ 
  sWidth = sTempArray[1]; 
  }else if (sTempArray[0].toLowerCase() == "height"){ 
  //³ôÀÌ 
  sHeight = sTempArray[1]; 
  }else{ 
  //±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸® 
  if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){ 
    pmBoolean = "true"; 
  }else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){ 
    pmBoolean = "false"; 
  }else{ 
    pmBoolean = sTempArray[1]; 
  } 
  sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag; 
  } 
 } 

 document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+WMPCID+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject' VIEWASTEXT onerror='onerr();'>"); 
 document.write("<PARAM NAME='URL'VALUE='" + sURL + "'>"); 
 document.write(sParamTag); 
 document.write('<PARAM NAME="rate" VALUE="1">');
 document.write('<PARAM NAME="balance" VALUE="0">');
 document.write('<PARAM NAME="currentPosition" VALUE="0">');
 document.write('<PARAM NAME="playCount" VALUE="1">');
 document.write('<PARAM NAME="autoStart" VALUE="1">');
 document.write('<PARAM NAME="currentMarker" VALUE="0">');
 document.write('<PARAM NAME="invokeURLs" VALUE="1">');
 document.write('<PARAM NAME="volume" VALUE="70">');
 document.write('<PARAM NAME="mute" VALUE="0">');
 document.write('<PARAM NAME="uiMode" VALUE="full">');
 document.write('<PARAM NAME="stretchToFit" VALUE="1">');
 document.write('<PARAM NAME="enabled" VALUE="1">');
 document.write('<PARAM NAME="enableContextMenu" VALUE="1">');
 document.write('<PARAM NAME="fullScreen" VALUE="0">');
 document.write('<PARAM NAME="SAMIFilename" VALUE="">');
 document.write('<PARAM NAME="captioningID" VALUE="">');
 document.write('<param name="SelectionStart" value="-1">');
 document.write('<param name="SendOpenStateChangeEvents" value="true">');
 document.write('<param name="SendPlayStateChangeEvents" value="true">');
 document.write('<param name="EnablePositionControls" value="true">');
 document.write('<param name="EnableTracker" value="ture">');
 document.write("</OBJECT>"); 

} 

function  viewFlash(sURL, sName, sFeatures ,sMode){ 

 //ÇÃ·¡½Ã ActiveX ¿ÀºêÁ§Æ®¸¦ »Ñ·ÁÁÝ´Ï´Ù. 
 var FLASHCAB = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"; 
 var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000"; 
 var FLASHVER = "8,0,0,0"; 

 var sFeature; 
 var sWidth  = "100%"; 
 var sHeight  = "100%"; 
 var pmBoolean = "false"; 
 var sTempArray; 
 var sParamTag = ""; 

 sFeature = sFeatures.split(/\s*,\s*/); 
 for (var i=0; i< sFeature.length ; i++) 
 { 
  sTempArray = sFeature[i].split(/\s*=\s*/); 
  if (sTempArray[0].toLowerCase() == "width"){ 
  //³ÐÀÌ 
  sWidth = sTempArray[1]; 
  }else if (sTempArray[0].toLowerCase() == "height"){ 
  //³ôÀÌ 
  sHeight = sTempArray[1]; 
  }else{ 
  //±âÅ¸ ÆÄ¶ó¸ÞÅÍ Ã³¸® 
  if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){ 
    pmBoolean = "true"; 
  }else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){ 
    pmBoolean = "false"; 
  }else{ 
    pmBoolean = sTempArray[1]; 
  } 
  sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag; 
  } 
 } 

 document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+FLASHCID+"' CODEBASE='"+FLASHCAB+"#version="+FLASHVER+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"'>"); 
 document.write("<PARAM NAME='movie' VALUE='" + sURL + "'>"); 
 document.write("<PARAM NAME='wmode' VALUE='" + sMode + "'>"); 
 document.write(sParamTag); 
 document.write("<EMBED SRC='"+sURL+"' MENU='false' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' ID='"+sName+"' NAME='"+sName+"' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' />") 
 document.write("</OBJECT>"); 
} 