
function OpenWin(url) {
 window.open(url,"lec_win",'toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=720,height=600,background="#000000"');
}

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 writeflash(width,height,src){ 
 document.write("<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="+width+" height="+height+"><param name=movie value="+src+"><param name=quality value=high ><embed src="+src+" quality=high  pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width="+width+" height="+height+"><PARAM NAME=wmode VALUE=transparent></embed></object>");
}



// ¸¶¿ì½º·Ñ¿À¹ö
function over_img(pPath, pName){
    document.images[pName].src = pPath;
}
function out_img(pPath, pName){
    document.images[pName].src = pPath;
}

// change the select box style
function ItemAdd(objname, textname, valuename)
{
	var obj = document.getElementById(objname);
	obj.add(new Option(document.getElementById(textname).value,document.getElementById(valuename).value));
	obj.reInitializeSelectBox();
}

function ItemChange(obj)
{
	alert(obj.options[obj.selectedIndex].value);
}


function openImage(s){
    //
    // º¯¼ö Á¤ÀÇ
    // 
    srcImg = new Image();
    clientWidth = screen.width;
    clientHeight = screen.height;
    srcImg.src = s;
//
// ¿­·Á´Â ÆÄÀÏÀ» ÀÌ¸§
//
    var srcFileName = srcImg.src.substr(srcImg.src.lastIndexOf("/")+1, srcImg.src.length);
    //
    // »õÃ¢ ¶ç¿ì°í ÀÌ¹ÌÁö »ðÀÔ
    //
    win = window.open("","","width=15,height=15,scrollbars=no,resizable=no,left="+(clientWidth/2-15)+",top="+(clientHeight/2-15)+"");
    win.document.writeln("<html>");
    win.document.writeln("<head>");
    win.document.writeln("<title>"+document.title+" ["+srcFileName+"]</title>");
    win.document.writeln("</head>");
    win.document.writeln("<body style='margin:0px;' bgcolor='#333333'>");
    win.document.writeln("<table border='0' cellpadding='0' cellspacing='0' style='cursor:hand' onclick='self.close()'>");
    win.document.writeln(" <tr>");
    win.document.writeln("  <td align='center'><img src="+s+" name='winImg' style='cursor:hand' onclick='self.close()' alt='Å¬¸¯ÇÏ¸é »ç¶óÁý´Ï´Ù'></td>");
    win.document.writeln(" </tr>");
    win.document.writeln("</table>");
    win.document.writeln("</body>");
    win.document.writeln("</html>");

    srcImg = win.document.winImg;
    //
    // ÀÌ¹ÌÁö°¡ ¸ðµÎ ·ÎµùµÉ¶§±îÁö ±â´Ù¸²
    //
    while(true)
            if(srcImg.readyState == "complete")
                    break;
    
    //
    // »õÃ¢ÀÇ Å©±â ¼³Á¤
    //
    var winWidth = srcImg.width+10;
    var winHeight = srcImg.height+29;
    //
    // »õÃ¢ÀÌ ¶ç¿öÁú À§Ä¡ ¼³Á¤
    //
    var left = (clientWidth/2)-(srcImg.width/2);
    var top = (clientHeight/2)-(srcImg.height/2);
    //
    // ÀÌ¹ÌÁöÀÇ Å©±â overflow È®ÀÎÈÄ »õÃ¢ÀÇ Å©±â¿Í À§Ä¡ Àç¼³Á¤
    //
    if(clientWidth <= srcImg.width){
            winWidth = clientWidth;
            left = 0;
            win.document.body.scroll = "auto";
    }
    if(clientHeight <= srcImg.height){
            winHeight = clientHeight-30;
            top = 0;
            win.document.body.scroll = "auto";
    }
    //
    // ÀÌ¹ÌÁö·ÎµùÀÌ ³¡³µÀ½À¸·Î ÀÌ¹ÌÁöÀÇ Å©±â¸¦ »ç¿ëÇÒ¼ö ÀÖ´Ù.
    // ÇØ´ç ÀÌ¹ÌÁöÀÇ »çÀÌÁî¿¡ ¸Â°Ô À©µµ¿ì¸¦ Àç¼³Á¤ÇÑ´Ù.
    win.moveTo(left, top);
    win.resizeTo(winWidth, winHeight);
}
// 081108 µðÀÚÀÌ³Ê  ÇÃ·¡½Ã ºí·° ¾ø¾Ö ÁÖ±â


 function flashload(flsName,flsWidth,flsHeigt)

{



	var wirtTxt = " <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="+flsWidth+" height="+flsHeigt+" id=\"sub_menu_2\" align=\"middle\">"

				+ " <param name=\"movie\" value="+flsName+" /> "

				+ " <param name=\"quality\" value=\"high\" />"

				+ " <PARAM NAME=\"wmode\" VALUE=\"transparent\">"

				+ " <embed src="+flsName+" quality=\"high\" bgcolor=\"#ffffff\" width="+flsWidth+" height="+flsHeigt+" name=\"sub_menu_2\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"

				+ " </object>"

	document.write(wirtTxt);

}
 
 function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
 {
   toolbar_str = toolbar ? 'yes' : 'no';
   menubar_str = menubar ? 'yes' : 'no';
   statusbar_str = statusbar ? 'yes' : 'no';
   scrollbar_str = scrollbar ? 'yes' : 'no';
   resizable_str = resizable ? 'yes' : 'no';
   window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
 }

 function trim(str){
 	str = this != window ? this : str; 
 	return str.replace(/^\s+/g,'').replace(/\s+$/g,'');
 }

 //¼ýÀÚ¸¸ ÀÔ·Â¹ÞÀ½
 function numbersonly(e) { 
     var key; 
     var keychar; 

     if (window.event) { 
        // IE¿¡¼­ ÀÌº¥Æ®¸¦ È®ÀÎÇÏ±â À§ÇÑ ¼³Á¤ 
         key = window.event.keyCode; 
     } else if (e) { 
       // FireFox¿¡¼­ ÀÌº¥Æ®¸¦ È®ÀÎÇÏ±â À§ÇÑ ¼³Á¤ 
         key = e.which; 
     } else { 
         return true; 
     } 

     keychar = String.fromCharCode(key); 

     if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) 
             || (key == 27)) { 
         return true; 
     } else if ((("0123456789").indexOf(keychar) > -1)) { 
         return true; 
     } else {
         return false; 
     }
 }

 //¼ýÀÚ¸¸ ÀÔ·Â¹ÞÀ½
 function numberspointonly(e) { 
     var key; 
     var keychar; 

     if (window.event) { 
        // IE¿¡¼­ ÀÌº¥Æ®¸¦ È®ÀÎÇÏ±â À§ÇÑ ¼³Á¤ 
         key = window.event.keyCode; 
     } else if (e) { 
       // FireFox¿¡¼­ ÀÌº¥Æ®¸¦ È®ÀÎÇÏ±â À§ÇÑ ¼³Á¤ 
         key = e.which; 
     } else { 
         return true; 
     } 

     keychar = String.fromCharCode(key); 

     if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) 
             || (key == 27) || (key == 46)) { 
         return true; 
     } else if ((("0123456789.").indexOf(keychar) > -1)) { 
         return true; 
     } else {
         return false; 
     }
 }

 // ÇÁ¸°Æ®
 function commPrint(){
 	var htmlStr = document.getElementById("contents_wrap").innerHTML;
 	
 	open_window('prtPage','','10','10','800','680', 0, 0, 0, 1, 0);
 	var prtFrm = document.prtFrm;
 	prtFrm.pContents.value = htmlStr;
 	prtFrm.target = "prtPage";
 	prtFrm.action = "/print/commonPrint.php";
 	prtFrm.submit();
 	
 }


 //½º¸¶Æ®¿¡µðÅÍ  ¸®¼Â
 function onReset(){
 	frm = document.gform;
 	oEditors.getById["content"].exec("SET_IR", [frm.content.value]); 
 	frm.reset();
 }


// ¸ñ·Ï»óÀÚ 
function goto_url(fid, targ, opt) {
	var obj = document.getElementById(fid);
	var url = obj.options[obj.selectedIndex].value;
	if(targ) {
		window.open(url, targ, opt);
	} else {
		location.href = url;
	}
}


function go(val){

	if(val==null || val=='') return false;

	var win = window.open(val,'newwin','top=0, left=0, menubar=yes, resizable=yes, location=yes, scrollbars=yes, status=yes, toolbar=yes');
	win.focus();
}

//ÇÃ·¡½Ã ¹× ¹Ìµð¾îÇÃ·¹ÀÌ¾î
var GLOBAL_URL = "";
var GLOBAL_HTTP_SCHEME = "http";
var ACTIVEX_PATCH = new Object();
ACTIVEX_PATCH.write = function(url,width,height,type)
{
	if (null == type)
	{
		ACTIVEX_PATCH._writeFlashPlayer(url,width,height);
	}
	else
	{
		ACTIVEX_PATCH._writeWMPlayer(url,width,height);
	}
}

ACTIVEX_PATCH._writeWMPlayer = function(url,width,height,id)
{
	document.write('<object id="MediaPlayer1" name="MediaPlayer1" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"');
	document.write('codebase="'+GLOBAL_HTTP_SCHEME+'://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"');
	document.write('standby="..."  type="application/x-oleobject"');
	document.write('bgcolor="DarkBlue" width="'+width+'" height="'+height+'">');
	document.write('<param name="AutoStart" value="0">');
	document.write('<param name="AutoSize" value="1">');
	document.write('<param name="AnimationAtStart" value="1">');
	document.write('<param name="DisplayMode" value="1">');
	document.write('<param name="Enabled" value="true">');
	document.write('<param name="Filename" value="'+url+'">');
	document.write('<param name="ShowControls" value="1">');
	document.write('<param name="ShowAudioControls" value="0">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowGotoBar" value="0">');
	document.write('<param name="ShowPositionControls" value="0">');
	document.write('<param name="ShowStatusBar" value="0">');
	document.write('<param name="ShowCaptioning" value="0">');
	document.write('<param name="Tracker" value="0">');
	document.write('<param name="TransparentAtStart" value="0">');
	document.write('<param name="Volume" value="0">');
	document.write('<embed type="application/x-mplayer2" pluginspage="'+GLOBAL_HTTP_SCHEME+'://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"');
	document.write('id="NSPlay" name="MediaPlayer1" displaysize="4" autosize="1"  showcontrols="1"');
	document.write('showdisplay="0" showstatusbar="0"  width="'+width+'" height="'+height+'" src="'+url+'"');
	document.write('autostart="0"></embed>');
	document.write('</object>');
}

ACTIVEX_PATCH._writeFlashPlayer = function(url,width,height,id)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+GLOBAL_HTTP_SCHEME+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'" id="main_index" align="middle">');
	document.write('<param name="movie" value="'+GLOBAL_URL+url+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="menu" value="false">');
	//document.write('<param name="FlashVars" value="'+pageNum+'">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="'+GLOBAL_URL+url+'" width="'+width+'" height="'+height+'" quality="high" pluginspage="'+GLOBAL_HTTP_SCHEME+'://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false"></embed>');
	document.write('</object>');
}



//±ÛÀÚ È®´ë Ãà¼Ò


defsize = 9;
function zoom_it(n) {
	defsize += n;
	if(defsize < 15 && defsize > 5) {
		objs = document.getElementById("contents") ;
		objs.style.fontSize = defsize + "pt";
		try{
			var iframe = document.getElementById('contents') ;
			var doc = ( !! iframe.contentWindow ? iframe.contentWindow : iframe.contentDocument ).document ;
			var fontSize = doc.getElementById('contents') ;
			fontSize.style.fontSize = (defsize+2) + "pt";
		}catch(E){}
	} else {
		defsize += -n;
	}
}



//È­¸éÈ®´ë,Ãà¼Ò
var rate_zoom = 10; //Áõ°¨À²
var rate_max = 160; //ÃÖ´ëÈ®´ëÀ²
var rate_min = 100; //ÃÖ¼ÒÃà¼ÒÀ²
var curr_zoom = "100%";

function get_cookie_zooom(name) {
	if(document.cookie != "") {
		zoomc = document.cookie.split("; ");
		for(var i=0; i < zoomc.length; i++) {
			zoomv = zoomc[i].split("=");
			if(zoomv[0] == name) {
				return  unescape(zoomv[1]);
			}
		}
	} else {
		return "";
	}
}

function set_cookie_zoom(name,value) {
	document.cookie = name + "=" + escape(value) + ";";
}

function set_zoom(canvas_id,how) {
/*
	if(get_cookie_zooom("ck_zoom") != null && get_cookie_zooom("ck_zoom") != "" && get_cookie_zooom("ck_zoom") != "undefined"){
		document.body.style.zoom = get_cookie_zooom("ck_zoom");
		curr_zoom = get_cookie_zooom("ck_zoom");
	} else {
		document.body.style.zoom = "100%";
		curr_zoom = "100%";
	}
*/
	document.body.style.zoom = curr_zoom;

	if(((how == "in") && (parseInt(curr_zoom) >= rate_max)) || ((how == "out") && (parseInt(curr_zoom) <= rate_min)) ) {
		return;
	}
	if(how == "in") {
		document.body.style.zoom = parseInt(document.body.style.zoom) + rate_zoom + "%";
	} else if (how == "default") {
		document.body.style.zoom = "100%";
	} else {
		document.body.style.zoom = parseInt(document.body.style.zoom) - rate_zoom + "%";
	}
//		set_cookie_zoom("ck_zoom",document.body.style.zoom);
	curr_zoom = document.body.style.zoom;
}
