/*////////////////////////  À¥Á¢±Ù¼º ³×ÀÌ°ÔÀÌ¼Ç  /////////////////////////*/

//±Û·Î¹ú ³×ºñ°ÔÀÌ¼Ç(2Depth ¸Þ´º±×·ì)¿¡ ´ëÇÑ ¸¶¿ì½º ¶Ç´Â Å°º¸µå ¹ÝÀÀ(º¸ÀÓ/¼û±è)¼³Á¤
function menuD2block(id) {
	for(num=1; num<=8; num++) document.getElementById('D2MG'+num).style.display='none'; //D2MG1~D2MG5 ±îÁö ¼û±ä ´ÙÀ½
	document.getElementById(id).style.display='block'; //ÇØ´ç ID¸¸ º¸ÀÓ
}

//·ÎÄÃ ³×ºñ°ÔÀÌ¼Ç(4Depth ¸Þ´º±×·ì)¿¡ ´ëÇÑ ¸¶¿ì½º ¶Ç´Â Å°º¸µå ¹ÝÀÀ(º¸ÀÓ/¼û±è)¼³Á¤
function menuD4MGblock(id) {
	for(num=1; num<=4; num++) document.getElementById('D4MG'+num).style.display='none'; //D4MG1~D4MG5 ±îÁö ¼û±ä ´ÙÀ½
	document.getElementById(id).style.display='block'; //ÇØ´ç ID¸¸ º¸ÀÓ
}

// ÇöÀç ÆäÀÌÁöÀÇ ¸Þ´º »óÅÂ Ç¥½Ã(ÆíÀÇ»ó ¸ðµÎ ¾ð´õ¶óÀÎÀ¸·Î ¼³Á¤µÇ¾î ÀÖÀ¸¸ç body onLoad ½Ã ½ÇÇàµÊ)
function menuD1on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD2on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD3on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD4on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD5on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD6on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD7on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD8on(id) {
	document.getElementById(id).style.textDecoration='underline';
}
function menuD9on(id) {
	document.getElementById(id).style.textDecoration='underline';
}


function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(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_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_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;
}

/*main menu*/
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(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_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_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;
}

/*menu*/
function gNaviCtl(t)	{
	var target = "sNavi0" + t;
	for(var i=1; i<=7; i++)	{
		var a = "sNavi0" + i;
			if (document.getElementById(a) != null)
			{
				document.getElementById(a).style.display='none';
				document.getElementById('mNaviImg0'+i).src='/home/english/images/menu0'+i+'.gif';
			}
		}
	document.getElementById(target).style.display='block';
	document.getElementById('mNaviImg0'+t).src='/home/english/images/menu0'+t+'_over.gif';
	}

	function gNaviCtlOut(t)	{
	var target = "sNavi0" + t;
	for(var i=1; i<=7; i++)	{
		var a = "sNavi0" + i;
			if (document.getElementById(a) != null)
			{
				document.getElementById(a).style.display='none';
				document.getElementById('mNaviImg0'+i).src='/home/english/images/menu0'+i+'.gif';
			}
		}
	document.getElementById(target).style.display='block';
	document.getElementById('mNaviImg0'+t).src='/home/english/images/menu0'+t+'_over.gif';
	}

function getStyleObject(objectId) {
  if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
   }
   else if (document.layers && document.layers[objectId]) {
    return document.layers[objectId];
   } else {
    return false;
   }
}

function getObject(objectId) {
  if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId);
   }
   else if (document.all && document.all(objectId)) {
    return document.all(objectId);
   }
   else if (document.layers && document.layers[objectId]) {
    return document.layers[objectId];
   } else {
    return false;
   }
}
function getIframDocument(iframeObject) {
    if(navigator.appName.indexOf("Internet Explorer") == -1) {
        return iframeObject.contentDocument
   }  else {
        return iframeObject.Document
   }
}
function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return (document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
    var base = new Date(0);
    var skew = base.getTime(); // dawn of (Unix) time - should be 0
    if (skew > 0) // Except on the Mac - ahead of its time
        date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}

function SetCookie (name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +  (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
    path = "/";
    if (GetCookie(name)) {
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


    //document.onkeypress = getKey;

    function getKey(keyStroke) {
        isNetscape=(document.layers);
        eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
        which = String.fromCharCode(eventChooser).toLowerCase();
        which2 = eventChooser;

        var el=event.srcElement;

        if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA"))
        {
            if(which == "+" )
                zoomInOut('zoom', 'in');
            else if(which == "-" )
                zoomInOut('zoom', 'out');
        }

    }

    var zoomRate = 10;
    var maxRate = 300;
    var minRate = 100;
    var divMenu_left;

    function zoomInOut(contentid, how) {

        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            document.all[contentid].style.zoom = GetCookie("zoomVal");
            STATICMENU.style.zoom = GetCookie("zoomVal");
            currZoom=GetCookie("zoomVal");
        }
        else{
            document.all[contentid].style.zoom = '100%';
            STATICMENU.style.zoom = '100%';
            currZoom = '100%';
        }

        if (((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
            return;
        }

        if (how == "in") {
            document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)+zoomRate+'%';
            STATICMENU.style.zoom = parseInt(STATICMENU.style.zoom)+zoomRate+'%';

        }
        else {
            document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)-zoomRate+'%';
            STATICMENU.style.zoom = parseInt(STATICMENU.style.zoom)-zoomRate+'%';
        }

        expires = new Date();
        expires.setTime(expires.getTime() + 24 * 60 * 60 * 365 * 5);
        SetCookie("zoomVal",document.all[contentid].style.zoom,expires,"/","","");
        //SetCookie("SeatLeft",STATICMENU.style.left,expires,"/","","");

        GoZoomLeft();
    }

    function GoZoom(contentid){
        var rate = parseInt(GetCookie("zoomVal")) - 100;

        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            document.all[contentid].style.zoom = GetCookie("zoomVal");
            STATICMENU.style.zoom = GetCookie("zoomVal");
            currZoom=GetCookie("zoomVal");
        }
        else{
            document.all[contentid].style.zoom = '100%';
            STATICMENU.style.zoom = '100%';
            currZoom = '100%';
        }
        GoZoomLeft();
    }

    function GoZoomMain(contentid){
        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            document.all[contentid].style.zoom = GetCookie("zoomVal");
            currZoom=GetCookie("zoomVal");
        }
        else{
            document.all[contentid].style.zoom = '100%';
            currZoom = '100%';
        }
    }

    function GoZoomLeft(){
        var rate = 0 ;

        if(GetCookie("zoomVal") != null && GetCookie("zoomVal") != ""){
            rate = parseInt(GetCookie("zoomVal")) - 100;
        }
        document.all['STATICMENU'].style.top = 3*rate ;
        document.all['STATICMENU'].style.left = 1.3*rate;
    }

/*
	//¸¶¿ì½º ¿À¸¥ÂÊ ¹öÆ° ±ÝÁö
 function clickMouse() {       
         if ((event.button == 2) || (event.button == 3)) {
              return (false);
         }     
    }     
    function clickKey() {
         if((event.shiftKey) && (event.keyCode == 121)) {          
              return false;
         }     
    }     
    function noAction() {
         return false;
    }
    document.onmousedown=clickMouse;
    document.onkeydown=clickKey;
    document.oncontextmenu=noAction;
    document.ondragstart=noAction;
    document.onselectstart=noAction;
*/



/************* ÇÁ¸°Æ® ÇÏ±â ±â´É  ******************/
/**
* bool String::trim(void)
* ÇØ´ç ½ºÆ®¸µÀÇ ¾ÕµÚ °ø¹éÀ» Á¦°Å ÇÑ´Ù
*/
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function removeAnchor(content) 
{
    content = content.replace(/<[aA](.*?)>/gi,""); //<a href¿¡ Æ÷ÇÔµÊ ¸ðµç ³»¿ë Á¦°Å 
    content = content.replace(/<(\/)?[aA]>/gi,""); //</a>ÅÂ±× Á¦°Å 

    content = content.replace(/<form(.*?)>/gi,"");    // form ÅÂ±× Á¦°Å
    content = content.replace(/<(\/)?form>/gi,"");

    content = content.replace(/<FORM(.*?)>/gi,"");  // form ÅÂ±× Á¦°Å
    content = content.replace(/<(\/)?FORM>/gi,"");
    
    return content;
}

function printContentHTML()
{    
    var screen_width    = screen.availWidth;
    var screen_height   = screen.availHeight;
    var pop_width           = 753;
    var pop_height      = 600;
    var top                 = (screen_height - pop_height) / 2; 
    var left                    = (screen_width - pop_width) / 2;   
    var param = "scrollbars=yes, width=" + pop_width + ", height=" + pop_height + ", top=" + top + ", left=" + left;            
    var win = window.open("/home/common/print_english.jsp", "_printhtml_", param);         
}    



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}