var NS4;
var IE4;
if (document.all) {
    IE4 = true;
    NS4 = false;
} else {
    IE4 = false;
    NS4 = true;
}

var isWin = (navigator.appVersion.indexOf("Win") != -1)
var UserAgentNameString = navigator.userAgent.toLowerCase();
var isIE = (UserAgentNameString.indexOf("msie") != -1) && (UserAgentNameString.indexOf("opera") == -1) && (UserAgentNameString.indexOf("webtv") == -1);


var frmMinHeight; // = 350;
var applyMinSize = false;
var frmMaxWidth;
var frmMaxHeight;
var applyMaxSize = false;

function setMinSize(width, height) {
    frmMinWidth = width;
    frmMinHeight = height
    applyMinSize = true;
}

function setMaxSize(width, height) {
    frmMaxWidth = width;
    frmMaxHeight = height
    applyMaxSize = true;
}


function resizeIframe(name) {
    if (name == null || name == "" || name == '[object]') {
        name = "myframeapps";
    }

    //alert(name);

    try {
        if (IE4) {
            var oBody   = document.frames(name).document.body;
        } else {
            var oBody = document.getElementById(name).contentDocument.body;
        }

        var oIFrame = document.getElementById(name);

        var frmWidth  = oBody.scrollWidth;
        var frmHeight = oBody.scrollHeight;

        if (applyMinSize) {
            //frmWidth  = Math.max(frmWidth, frmMinWidth);
            frmHeight = Math.max(frmHeight, frmMinHeight);
        }

        if (applyMaxSize) {
            //frmWidth  = Math.min(frmWidth, frmMaxWidth);
            frmHeight = Math.min(frmHeight, frmMaxHeight);
        }

        oIFrame.style.height = frmHeight;
        //oIFrame.style.width = frmWidth;

        //alert(frmHeight);
    } catch (e) {}
}

function parentResizeIframe(name) {
    if (parent && parent != this && parent.resizeIframe != null) {
        parent.resizeIframe(name);
    }
}




function addLoadEvent(func){
    /**
    var oldonload = window.onload;
    if(typeof window.onload != "function"){
        window.onload = func;
    }
    else{
        window.onload = function(){
            oldonload();
            func();
        }
    }

    /*/
    if (window.addEventListener) {
      window.addEventListener("load", func, false);
    } else if (window.attachEvent) {
      window.attachEvent("onload", func);
    } else {
      window.onload = func;
    }
    /**/

}



function autoBlur() {
    if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG")
    document.body.focus();
}

document.onfocusin=autoBlur;

/*
* ±â´É¼³¸í : iframeÀÇ ºÎ¸ðÃ¢ ÀÚµ¿¸®»çÀÌÂ¡
*/
function autoResizeiFrame() {
    /**/
    parentResizeIframe(self.name);
    widnowScrollTop();
    /*/
    if (parent.document.getElementById("myframeapps")) {
          var contentfr = parent.document.getElementById("myframeapps");
          //FIREFOX
          if (contentfr.contentDocument && contentfr.contentDocument.body.offsetHeight) {
               contentfr.height = contentfr.contentDocument.body.offsetHeight+16;
        //IE
        } else if (contentfr.Document && contentfr.Document.body.scrollHeight) {
            self.resizeTo(document.body.scrollWidth , document.body.scrollHeight);
          }
     }
    /**/
}


function autoResizeiFrameS() {
    /**/
    var fnm = self.name;
    parentResizeIframe(fnm);
    /*/
    var obj;
    if(parent != null) {
        obj = parent.document.all[self.name];
        if(obj != null) {
            obj.style.pixelHeight = self.document.body.scrollHeight;
        }
    }
    /**/
}

function autoResizeOnlyiFrame() {
    /**/
    var fnm = self.name;
    parentResizeIframe(fnm);
    /*/
    var obj;
    if(parent != null) {
        obj = parent.document.all[self.name];
        if(obj != null) {
            obj.style.pixelHeight = self.document.body.scrollHeight;
        }
    }
    /**/
}


/*
* ±â´É¼³¸í : »ó´ÜÀ¸·Î ½ºÅ©·Ñ¸µ
* ºÎ°¡¼³¸í : IFrame³»¿¡¼­ ÆäÀÌÁö ÀÌµ¿½Ã ÆäÀÌÁö À§Ä¡°¡ Áß°£ºÎÅÍ º¸ÀÌ´Â °Í ¹æÁöÇÏ±â À§ÇØ...
*/
function windowScrollTop() {
    window.scrollTo(0,0);
}

function widnowScrollTop() {
    try { parent.scrollTo(0,0); } catch(e) {}
}


/*
* ±â´É¼³¸í : ÆË¾÷
* ÆÄ¶ó¹ÌÅÍ : URL, ÆË¾÷ÀÌ¸§, ¿ÞÂÊÀ§Ä¡, »ó´ÜÀ§Ä¡, ÆË¾÷°¡·Î»çÀÌÁî, ÆË¾÷¼¼·Î»çÀÌÁî, Åø¹Ù, ¸Þ´º¹Ù, »óÅÂ¹Ù, ½ºÅ©·Ñ¹Ù, ¸®»çÀÌÂ¡, ·ÎÄÉÀÌ¼Ç¹Ù
*/
function popup_window_common(url, name, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, location) {
    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';
    location_str = location ? 'yes' : 'no';
    var mdWindow = null;
    mdWindow = 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+',location='+location_str);
    if(!mdWindow){
        alert("ÆË¾÷Â÷´ÜÀ» ÇØÁ¦ÇØÁÖ¼¼¿ä.");
        return;
    }
    mdWindow.focus();
}


/*
* ±â´É¼³¸í : ÆË¾÷
* ÆÄ¶ó¹ÌÅÍ : URL
*/
function popup_window_common2(url) {
    var mdWindow = null;
    mdWindow = window.open(url);
    if(!mdWindow){
        alert("ÆË¾÷Â÷´ÜÀ» ÇØÁ¦ÇØÁÖ¼¼¿ä.");
        return false;
    }
    mdWindow.focus();
}


/*
* ·Î±×ÀÎ
* ÆÄ¶ó¹ÌÅÍ : ·Î±×ÀÎ/·Î±×¾Æ¿ô in,out), Å¸°Ù(_self, _parent)
*/
function login(flag, targetwindow) {

    var this_location = self.location.href;
    if (self.hiddenFrame != null && self.hiddenFrame != 'undefined') {
        this_location = parent.location.href;
    }

    this_location = encodeURIComponent(this_location);

    if (flag == 'in') {
        if(self.hiddenFrame == null || self.hiddenFrame == 'undefined') {
            self.location.href = '/apps/login.do?doprocess=loginform&loginUrl=' + this_location;
        } else {
            parent.location.href = '/content/mn800/mn800_010.jsp?doprocess=loginform&loginUrl=' + this_location;
        }
    } else {
        if(self.hiddenFrame == null || self.hiddenFrame == 'undefined') {
            parent.location.href = '/apps/login.do?doprocess=logout&loginUrl=' + this_location;
        } else {
            self.location.href = '/apps/login.do?doprocess=logout&loginUrl='+ this_location;
        }
    }
}

/*
function Login(state) {
    if (state == 'out') {
        var logouturl = '/apps/login.do?doprocess=logout';
        self.location.href = logouturl;
    } else {
        var loginurl = document.location.href;

        for (i=0; i<10; i++) {
            if (loginurl.indexOf('&') > -1)
                loginurl = loginurl.replace('&','!');
            else
                break;
        }

        var loginurl = '/content_kor/login/login.jsp?loginUrl='+loginurl;
        self.location.href = loginurl;
    }
}
*/


/*
* URL ÀÌµ¿
* Å¸°Ù, URL
*/
function moveUrl(targetwindow, moveurl) {
    targetwindow.location.href = moveurl;
}


/*
* ±â´É¼³¸í : ÇÃ·¡½¬ »ðÀÔ
* ÆÄ¶ó¹ÌÅÍ : ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, À©µµ¿ì¸ðµå
*/
function insertFlash(url, w, h, id, bg, win){
    document.write(makeFlashTags(url, w, h, id, bg, win));
}

function makeFlashTags(url, w, h, id, bg, win) {
    var flashStr=
        "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
        "<param name='movie' value='"+url+"' />"+
        "<param name='wmode' value='"+win+"' />"+
        "<param name='menu' value='false' />"+
        "<param name='quality' value='high' />"+
        "<param name='bgcolor' value='"+bg+"' />"+
        "<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' "+
        " pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
        "</object>";
    return flashStr;
}

/*
* ±â´É¼³¸í : ÇÃ·¡½¬ »ðÀÔ
* ÆÄ¶ó¹ÌÅÍ : ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, À©µµ¿ì¸ðµå
*/
function insertVr(pro, w, h, id){
    document.write(makeVrTags(pro, w, h, id));
}

function makeVrTags(pro, w, h, id) {
    var VrStr=
        "<object classid='CLSID:5B7D322B-F7AB-496F-86F5-3607C0365C6A' codebase='VSPanoViewer.cab#version=2,6,0,1' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
        "<param name='project' value='"+pro+"' />"+
        "</object>";
    return VrStr;
}

/*
* ±â´É¼³¸í : ½ºÅ©¸³Æ® »ðÀÔ
* ÆÄ¶ó¹ÌÅÍ : ½ºÅ©¸³Æ®
*/
function insertScript(val){
    document.write(val);
}


/*
* ±â´É¼³¸í : ÅØ½ºÆ® Area Validater (ajax)
* ÆÄ¶ó¹ÌÅÍ :     chkFrm        : Ã¼Å©ÇÒ ÆûÀÌ¸§
             maxSize    : ÃÖ´ë°ª
             rtnFrm        : ÇöÀç ¹®ÀÚ±æÀÌ¸¦ Ç¥ÇöÇÒ Æû
*/
function countByte(chkFrm, maxSize, rtnFrm) {
    var str = chkFrm.value;
    var paramName1 = encodeURIComponent("maxSize");        // euc-kr ÀÎÄÚµù
    var paramValue1 = encodeURIComponent(maxSize);        // euc-kr ÀÎÄÚµù
    var paramName2 = encodeURIComponent("inputStr");    // euc-kr ÀÎÄÚµù
    var paramValue2 = encodeURIComponent(str);            // euc-kr ÀÎÄÚµù
    var url = '/common/etc/calculateByte.jsp?' +paramName1+ '=' +paramValue1+ '&' +paramName2+ '='+paramValue2;
    request.open("GET", url, true);
    request.onreadystatechange = function() {
        if (request.readyState == 4) {
            if (request.status == 200) {
                var response = request.responseText;
                if (rtnFrm!=null) {
                    rtnFrm.value = response;
                }
            } else {
                alert("Error: status code is " + request.status);
            }
        }
    }
    request.send(null);

    if(rtnFrm.value > maxSize) {
        chkFrm.blur();
        chkFrm.focus();
        alert("ÀÔ·Â¹üÀ§¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.");
        countChar(chkFrm, maxSize, rtnFrm);
    }
}


/*
* ±â´É¼³¸í : ÅØ½ºÆ® Area Validater
* ÆÄ¶ó¹ÌÅÍ :     chkFrm        : Ã¼Å©ÇÒ ÆûÀÌ¸§
             maxSize    : ÃÖ´ë°ª
             rtnFrm        : ÇöÀç ¹®ÀÚ±æÀÌ¸¦ Ç¥ÇöÇÒ Æû
*/
function checkChar(chkfrm, chksize, rtnfrm){
    var str, msg;
    var len = 0;
    var temp;
    var count = 0;

    msg = chkfrm.value;
    str = new String(msg);
    len = str.length;

    for (k=0 ; k<len ; k++){
        temp = str.charAt(k);

        if (escape(temp).length > 4) {
            count += 3;
        } else if (temp == '\r' && str.charAt(k+1) == '\n') { // \r\nÀÏ °æ¿ì
            count += 2;
        } else if (temp != '\n') {
            count++;
        }
    }

    rtnfrm.value = count;

    if(count > chksize) {
        chkfrm.blur();
        chkfrm.focus();
        alert(chksize + "Byte ±îÁö¸¸ µî·ÏÀÌ °¡´ÉÇÕ´Ï´Ù.");
        countChar(chkfrm, chksize, rtnfrm);
    }
}


/*
* ±â´É¼³¸í : ÅØ½ºÆ® Area Validater (¹®ÀÚ±æÀÌ Ä«¿îÆ®)
* ÆÄ¶ó¹ÌÅÍ :     chkFrm        : Ã¼Å©ÇÒ ÆûÀÌ¸§
             maxSize    : ÃÖ´ë°ª
             rtnFrm        : ÇöÀç ¹®ÀÚ±æÀÌ¸¦ Ç¥ÇöÇÒ Æû
*/
function countChar(chkfrm, chksize, rtnfrm) {
    var str,msg;
    var len=0;
    var temp;
    var count;
    count = 0;

    msg = chkfrm.value;
    str = new String(msg);
    len = str.length;

    for(k=0 ; k<len ; k++) {
        temp = str.charAt(k);

        if(escape(temp).length > 4) {
            count += 3;
        } else if (temp == '\r' && str.charAt(k+1) == '\n') { // \r\nÀÏ °æ¿ì
            count += 2;
        } else if(temp != '\n') {
            count++;
        }
        if(count > chksize) {
            str = str.substring(0,k);
            break;
        }
    }
    chkfrm.value = str;
    checkChar(chkfrm, chksize, rtnfrm);
}

// ¹ýÀÎ¹øÈ£ Á¡°Ë (¼ýÀÚ¸¸À¸·Î ÆÄ¶ó¹ÌÅÍ¸¦ ¹Þ¾ÒÀ»¶§)
function gf_chkCorpNo(value){
    var data = value;
    var digit = 0;
    if(data.length != 12) {
          return false;
     } else {
        sumMod   =    0;
        summode += parseInt(data.substring(0 ,1 )) * 1;
        summode += parseInt(data.substring(1 ,2 )) * 2;
        summode += parseInt(data.substring(2 ,3 )) * 1;
        summode += parseInt(data.substring(3 ,4 )) * 3;
        summode += parseInt(data.substring(4 ,5 )) * 1;
        summode += parseInt(data.substring(5 ,6 )) * 2;
        summode += parseInt(data.substring(6 ,7 )) * 1;
        summode += parseInt(data.substring(7 ,8 )) * 2;
        summode += parseInt(data.substring(8 ,9 )) * 1;
        summode += parseInt(data.substring(9 ,10)) * 2;
        summode += parseInt(data.substring(10,11)) * 1;
        summode += parseInt(data.substring(11,12)) * 2;

        digit = 10 - (summode % 10) > 9 ? 0 :  10 - (summode % 10);

        if (parseInt(data.substring(12,13)) != digit) {
            return false;
        }
     }
     return true;
}

// Àç¿Ü±¹ÀÎ ¹øÈ£ Ã¼Å©
function checkForeignNo(fgnno) {
    var sum=0;
    var odd=0;
    buf = new Array(13);
    for(i=0; i<13; i++) { buf[i]=parseInt(fgnno.charAt(i)); }
    odd = buf[7]*10 + buf[8];
    if(odd%2 != 0) { return false; }
    if( (buf[11]!=6) && (buf[11]!=7) && (buf[11]!=8) && (buf[11]!=9) ) {
        return false;
    }
    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for(i=0, sum=0; i<12; i++) { sum += (buf[i] *= multipliers[i]); }
    sum = 11 - (sum%11);
    if(sum >= 10) { sum -= 10; }
    sum += 2;
    if(sum >= 10) { sum -= 10; }
    if(sum != buf[12]) { return false }
    return true;
}

// ÁÖ¹Î¹øÈ£ Ã¼Å©
function checkJuminNo(juminno) {
    if(juminno=="" || juminno==null || juminno.length!=13) {
        return false;
    }
    var jumin1 = juminno.substr(0,6);
    var jumin2 = juminno.substr(6,7);
    var yy     = jumin1.substr(0,2);    // ³âµµ
    var mm     = jumin1.substr(2,2);    // ¿ù
    var dd     = jumin1.substr(4,2);    // ÀÏ
    var genda  = jumin2.substr(0,1);    // ¼ºº°
    var msg, ss, cc;

    // ¼ýÀÚ°¡ ¾Æ´Ñ °ÍÀ» ÀÔ·ÂÇÑ °æ¿ì
    if (!isNumeric(jumin1)) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // ±æÀÌ°¡ 6ÀÌ ¾Æ´Ñ °æ¿ì
    if (jumin1.length != 6) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ±âº» ±¸¼º °Ë»ç
    if (yy < "00" || yy > "99" ||
        mm < "01" || mm > "12" ||
        dd < "01" || dd > "31") {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // ¼ýÀÚ°¡ ¾Æ´Ñ °ÍÀ» ÀÔ·ÂÇÑ °æ¿ì
    if (!isNumeric(jumin2)) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // ±æÀÌ°¡ 7ÀÌ ¾Æ´Ñ °æ¿ì
    if (jumin2.length != 7) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // ¼ºº°ºÎºÐÀÌ 1 ~ 4 °¡ ¾Æ´Ñ °æ¿ì
    if (genda < "1" || genda > "4") {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // ¿¬µµ °è»ê - 1 ¶Ç´Â 2: 1900³â´ë, 3 ¶Ç´Â 4: 2000³â´ë
    cc = (genda == "1" || genda == "2") ? "19" : "20";
    // Ã¹¹øÂ° ÀÚ·á¿¡¼­ ¿¬¿ùÀÏ(YYMMDD) Çü½Ä Áß ³¯Â¥ Çü½Ä °Ë»ç
    if (isYYYYMMDD(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    // Check Digit °Ë»ç
    if (!isSSN(jumin1, jumin2)) {
        alert("ÀÔ·ÂÇÑ ÁÖ¹Îµî·Ï¹øÈ£¸¦ °ËÅäÇÑ ÈÄ, ´Ù½Ã ÀÔ·ÂÇÏ¼¼¿ä.");
        return false;
    }
    return true;
}

// »ç¾÷ÀÚµî·Ï¹øÈ£ Ã¼Å©
function checkBizNo(vencod) {
    var sum = 0;
    var getlist =new Array(10);
    var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
    for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); }
    for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
    sum = sum + parseInt((getlist[8]*5)/10);
    sidliy = sum % 10;
    sidchk = 0;
    if(sidliy != 0) { sidchk = 10 - sidliy; }
    else { sidchk = 0; }
    if(sidchk != getlist[9]) { return false; }
    return true;
}

function isYYYYMMDD(y, m, d) {
    switch (m) {
    case 2:    // 2¿ùÀÇ °æ¿ì
        if (d > 29) return false;
        if (d == 29) {
            // 2¿ù 29ÀÇ °æ¿ì ´çÇØ°¡ À±³âÀÎÁö¸¦ È®ÀÎ
            if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
                return false;
        }
        break;
    case 4:    // ÀÛÀº ´ÞÀÇ °æ¿ì
    case 6:
    case 9:
    case 11:
        if (d == 31) return false;
    }
    // Å« ´ÞÀÇ °æ¿ì
    return true;
}

function isNumeric(s) {
    for (i=0; i<s.length; i++) {
        c = s.substr(i, 1);
        if (c < "0" || c > "9") return false;
    }
    return true;
}

function isLeapYear(y) {
    if (y < 100)
    y = y + 1900;
    if ( (y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0) ) {
        return true;
    } else {
        return false;
    }
}

function getNumberOfDate(yy, mm) {
    month = new Array(29,31,28,31,30,31,30,31,31,30,31,30,31);
    if (mm == 2 && isLeapYear(yy)) mm = 0;
    return month[mm];
}

function isSSN(s1, s2) {
    n = 2;
    sum = 0;
    for (i=0; i<s1.length; i++)
        sum += parseInt(s1.substr(i, 1)) * n++;
    for (i=0; i<s2.length-1; i++) {
        sum += parseInt(s2.substr(i, 1)) * n++;
        if (n == 10) n = 2;
    }
    c = 11 - sum % 11;
    if (c == 11) c = 1;
    if (c == 10) c = 0;
    if (c != parseInt(s2.substr(6, 1))) return false;
    else return true;
}



/*
* ±â´É¼³¸í : Ä«¿îÅÍ ¼öÁ¤ ÆäÀÌÁö ÀÌµ¿ (°ü¸®ÀÚ)
* ÆÄ¶ó¹ÌÅÍ : cmUrl        : ÀÌµ¿°æ·Î
*/
function setCounter(cmurl) {
    var v_url='/content/mn900/mn900_100.jsp';
    popup_window_common(v_url, 'COUNTERWINDOW', 50, 300, 650, 600, 0, 0, 0, 1, 1, 0);
}

if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement) {
    HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode) {
        switch (where) {
        case 'beforeBegin':
            this.parentNode.insertBefore(parsedNode,this)
            break;
        case 'afterBegin':
            this.insertBefore(parsedNode,this.firstChild);
            break;
        case 'beforeEnd':
            this.appendChild(parsedNode);
            break;
        case 'afterEnd':
            if (this.nextSibling) {
                this.parentNode.insertBefore(parsedNode,this.nextSibling);
            } else {
                this.parentNode.appendChild(parsedNode);
            }
            break;
        }
    }

    HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var parsedHTML = r.createContextualFragment(htmlStr);
        this.insertAdjacentElement(where,parsedHTML)
    }

    HTMLElement.prototype.insertAdjacentText = function(where,txtStr) {
        var parsedText = document.createTextNode(txtStr)
        this.insertAdjacentElement(where,parsedText)
    }
}


if(typeof String != "undefined" && !String.prototype.htmlChars) {
    String.prototype.htmlChars = function() {
        var result = this.replace(result, '&', '&amp;');
        result     = this.replace(result, '<', '&lt;');
        result     = this.replace(result, '>', '&gt;');
        result     = this.replace(result, '#', '&#35;');
        result     = this.replace(result, '"', '&quot;');
        result     = this.replace(result, '\'', '&#39;');
        return result;
    }

    String.prototype.trim = function() { return this.replace(/(^\s+)|(\s+$)/g, ""); }
    String.prototype.ltrim = function() { return this.replace(/^\s+/g, ""); }
    String.prototype.rtrim = function() { return this.replace(/\s+$/g, ""); }
    String.prototype.cut = function(len, tail) {
        var str = this;
        var l = 0;
        for (var i=0; i<str.length; i++) {
            l += (str.charCodeAt(i) > 128) ? 2 : 1;
            if (l > len) return str.substring(0,i) + tail;
        }
        return str;
    }
    
    String.prototype.bytes = function() {
        var str = this;
        var l = 0;
        for (var i=0; i<str.length; i++) {
            l += (str.charCodeAt(i) > 128) ? 2 : 1;
        }
        return l;
    }
    
    
    String.prototype.stripTags = function() {
        var result = this;
        var pos1 = result.indexOf('<');
        if(pos1 == -1) return result;
    
        var pos2 = result.indexOf('>', pos1);
        if(pos2 == -1) return result;
    
        return result.substr(0, pos1) + result.substr(pos2+1).stripTags();
    }
    
    String.prototype.replaceAll = function(from, to) {
        var returnStr = this;
        var tempStr = this.toLowerCase();
        var fromStr = from.toLowerCase();
        var count = fromStr.length;
    
        while( tempStr.indexOf( fromStr ) >= 0 ) {
            var word = returnStr.substr( tempStr.indexOf( fromStr ), count );
            tempStr = tempStr.replace( from, to );
            returnStr = returnStr.replace( word, to );
        }
        return returnStr;
    }
}


var fullURL = location.href;
var splitIndex = fullURL.indexOf('/',7);
var currentHost = "";

if(splitIndex != -1) {
    currentHost = fullURL.substring(0, splitIndex);
} else {
    currentHost = fullURL;
}

function truncateSelfHost(strValue, tURL) {
    urlRe = /([\/|\?|\||\.|\*|\^|\$|\+|\(|\)|\[|\]|\{|\}|\-])/g;
    tURL = tURL.replace(urlRe, "\\$1");

    eval("repRe = /("+tURL+")/gi");
    strValue = strValue.replace(repRe, "");
    return strValue;
}

function truncateSelfURL(strValue, tURL) {
    urlRe = /([\/|\?|\||\.|\*|\^|\$|\+|\(|\)|\[|\]|\{|\}|\-])/g;
    tURL = tURL.replace(urlRe, "\\$1");

    eval("repRe = /(<a[ ]+href=[ ]*[\"']*)("+tURL+")(#[^>]*>)/gi");
    strValue = strValue.replace(repRe, "$1$3");
    return strValue;
}

function truncateEditorURL(strValue) {
    return truncateSelfURL(strValue, currentHost+"/common/editor/editor.jsp");
}

function editorSave(strValue) {
    temp = strValue;
    temp = truncateEditorURL(temp);
    temp = truncateSelfURL(temp, fullURL);
    temp = truncateSelfHost(temp, currentHost);
    return temp;
}

// frame ¾È¿¡¼­ F5¸¦ ´­·¶À» ¶§ ¸ÞÀÎÈ­¸éÀ¸·Î °¡´Â °ÍÀ» ¹æÁöÇÑ´Ù.
if (NS4) {
    document.captureEvents(Event.KEYDOWN)
    document.onkeydown = trapRefresh;
} else if (IE4) {
    document.onkeydown = trapRefresh;
}

function trapRefresh(e) {
    var event;
    if (window.event) event = window.event;
    else event = e;

    if (event.keyCode == 116) {
        if (window.event) {
            event.keyCode = 0;
        }
        event.cancelBubble = true;
        event.returnValue = false;
        document.location.reload();
    }
}

function hideStatus() {
    try {
        window.status = '';
    } catch(e) {
    }
    return true;
}

if(document.layers) {
    try { document.captureEvents(Event.mouseover | Event.mouseout); } catch(e) {}
}

try {
    document.onmouseover=hideStatus;
    document.onmouseout=hideStatus;
} catch(e) {
}

function isBrowserIE7() {
    var is_ie = false;

    if(isIE) {
        try {
            bid = "msie ";
            s = UserAgentNameString.indexOf(bid, 0) + bid.length;
            e = UserAgentNameString.indexOf(";", s);
            
            v = UserAgentNameString.substring(s, e);
  
            vi = parseInt(v);

            if(vi > 6) {
                is_ie = true;
            }
        } catch(e) {}
    }
    return is_ie;
}

function fitWindowWithImage(ivo) {
    iWidth = (NS4)?window.innerWidth:document.body.clientWidth; 
    iHeight = (NS4)?window.innerHeight:document.body.clientHeight; 
    iWidth = ivo.width - iWidth + 40; 
    iHeight = ivo.height - iHeight + 40; 
    window.resizeBy(iWidth, iHeight); 
}
