/********************************************************
	Written By	: Seung-joon Lee (newbie79@gmail.com)
	Created On	: 2006.03.10
	Modified	: 2006.03.31
	File		: embed_control.js
	Version     : 0.4
	embed ActiveX control for IE 6.0, FF 1.5, Opera 8

*********************************************************/


/*
	[ Example ]

		<!-- sample -->
		<script type="text/javascript" src="embed_control.js"></script>
		<comment id="rr">
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="297" height="297">
				<param name="movie" value="sample.swf">
				<param name="play" value="true">
				<param name="loop" value="true">
				<param name="quality" value="high">
				<embed width="100" height="100" src="sample.swf" play="true" loop="true" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>
			</object>
		</comment>
		<SCRIPT LANGUAGE="JavaScript">embedControl( rr );</SCRIPT>


		<!-- flash player sample -->
		<script type="text/javascript" src="embed_control.js"></script>
		<SCRIPT LANGUAGE="JavaScript">embedFlashPlayer("http://www.test.com/sample.swf", true, true, "300", "300", "");</SCRIPT>


		<!-- windows media player sample -->
		<script type="text/javascript" src="embed_control.js"></script>
		<SCRIPT LANGUAGE="JavaScript">embedMediaPlayer("sample.wmv", true, true, true, true, "100", "100", "");</SCRIPT>
*/

/************************ PROTOTYPE FUNCTIONS **************************/


function embedControl( elementObject )
{
	var str = elementObject.innerHTML;
	elementObject.removeNode(true);

	document.write( str );
}

// Flash player
function embedFlashPlayer( movieUrl, autoPlay, loop, width, height, flashObjectId )
{
	var autoPlayValue = (true == autoPlay) ? "true" : "false";
	var loopValue = (true == loop) ? "true" : "false";
	
	var str = "<object id=\"" + flashObjectId + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + width + "\" height=\"" + height + "\">";
	str += "<param name=\"movie\" value=\"" + movieUrl + "\">";
	str += "<param name=\"wmode\" value=\"transparent\">";
	str += "<param name=\"quality\" value=\"high\">";
	str += "<embed width=\"" + width + "\" height=\"" + height + "\" src=\"" + movieUrl + "\" wmode=\"transparent\" play=\"" + autoPlayValue + "\" loop=\"" + loopValue + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
	str += "</object>";

	document.write( str );
}

// Flash player
function embedFlashPlayer( movieUrl, autoPlay, loop, width, height, flashObjectId )
{
	var autoPlayValue = (true == autoPlay) ? "true" : "false";
	var loopValue = (true == loop) ? "true" : "false";
	
	var str = "<object id=\"" + flashObjectId + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + width + "\" height=\"" + height + "\">";
	str += "<param name=\"movie\" value=\"" + movieUrl + "\">";
	str += "<param name=\"play\" value=\"" + autoPlayValue + "\">";
	str += "<param name=\"loop\" value=\"" + loopValue + "\">";
	str += "<param name=\"quality\" value=\"high\">";
	str += "<embed width=\"" + width + "\" height=\"" + height + "\" src=\"" + movieUrl + "\" play=\"" + autoPlayValue + "\" loop=\"" + loopValue + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
	str += "</object>";

	document.write( str );
}

// Windows Media player
function embedMediaPlayer( mediaUrl, showControls, autoPlay, loop, autoSize, width, height, mediaObjectId )
{
	var showControlsValue = (true == showControls) ? "true" : "false";
	var autoPlayValue = (true == autoPlay) ? "true" : "false";
	var autoSizeValue = (true == autoSize) ? "true" : "false";

	var str = "<object";
	str += ( "" == mediaObjectId ) ? "" : " id=\"" + mediaObjectId + "\"";
	str += ( "" == width || true == autoSize ) ? "" : " width=\"" + width + "\"";
	str += ( "" == height || true == autoSize ) ? "" : " height=\"" + height + "\"";
	str += " classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\">";
	str += "<param name=\"FileName\" value=\"" + mediaUrl + "\">";
	str += "<param name=\"AutoStart\" value=\"" + autoPlayValue + "\">";
	str += "<param name=\"ShowTracker\" value=\"" + showControlsValue + "\">";
	str += "<param name=\"ShowControls\" value=\"" + showControlsValue + "\">";
	str += "<param name=\"ShowGotoBar\" value=\"false\">";
	str += "<param name=\"ShowDisplay\" value=\"false\">";
	str += "<param name=\"ShowStatusBar\" value=\"" + showControlsValue + "\">";
	str += "<param name=\"AutoSize\" value=\"" + autoSizeValue + "\">";
	str += (false == loop) ? "" : "<param name=\"PlayCount\" value=\"0\">";
	str += "<embed";
	str += ( "" == width || true == autoSize ) ? "" : " width=\"" + width + "\"";
	str += ( "" == height || true == autoSize ) ? "" : " height=\"" + height + "\"";
	str += ( false == loop ) ? "" : " PlayCount=\"0\"";
	str += " src=\"" + mediaUrl + "\" AutoStart=\"" + autoPlayValue + "\" ShowTracker=\"" + showControlsValue + "\" ShowControls=\"" + showControlsValue + "\" ShowGotoBar=\"false\" ShowDisplay=\"false\" ShowStatusBar=\"" + showControlsValue + "\" AutoSize=\"" + autoSizeValue + "\" pluginspage=\"http://www.microsoft.com/windows/windowsmedia/download/\"></embed>";
	str += "</object>";

	document.write( str );
}

var mFirst=[8,15];
 var mFont;
 var mZoom;
 var cFont;
 var moFirst, mClass;
 var initFlag = false;

 function chgWindow(d,v) {
  
   if(v == "1.0") {    /* 초기화 */
       mZoom = readCookie("cZoom");
       d.body.style.zoom = mZoom;
   } else if(d.body.style.zoom == '' ){
    if (v > 1) {
     d.body.style.zoom = v ;
    }
   } else {
    var fSize = parseFloat(d.body.style.zoom);

    if (fSize > 2.0 ) {
     if (v < 1) {
      d.body.style.zoom *= v;
     }
 //    d.body.style.zoom = 2.0; // 이이상은 작동 않하게
    } else if ( fSize < 1 ) {
     if (v > 1) {
      d.body.style.zoom = 1 ;
     }
 //    d.body.style.zoom = 1;  // 이이하는 작동 않하게
    } else {
     d.body.style.zoom *= v;
    }
  
   }
  

 }

 function zoom_parent(n) {
  var mFont=readCookie("cFont");
  try {
   if(mFont == undefined)
    mFont=12;
   mFont=parseInt(mFont);
  } catch(e) {mFont=12;}
  n=parseInt(n);
  mFont+=n;

  var class_name="main01";

  if (mFont<mFirst[0]) mFont=mFirst[0];
  if (mFont>mFirst[1]) mFont=mFirst[1];

 
  moFirst=parent.document.getElementsByTagName("td");

  mClass=class_name ? class_name : "Sfont";
  
  objs=moFirst;
  for (i=0;i<objs.length;i++) {
   try {

    objs[i].style.fontSize=mFont+'pt';

    if (initFlag) moFirst[i]=objs[i];
   } catch(e) {}
  }

 
  moFirst=parent.document.getElementsByTagName("a");

  mClass=class_name ? class_name : "Sfont";

  objs=moFirst;
  for (i=0;i<objs.length;i++) {
   try {
    objs[i].style.fontSize=mFont+'pt';
    if (initFlag) moFirst[i]=objs[i];
   } catch(e) {}
  }

 }