//-------------------------------------------------------------//
//----- °øÅëÀ¸·Î »ç¿ëµÇ´Â Window, Document °ü·Ã ÇÔ¼ö ¸ðÀ½ -----//
//-------------------------------------------------------------//

// ÆäÀÌÁö ·Îµù½Ã 'on_loading()' ÇÔ¼ö È£Ãâ
//window.attachEvent("onload", on_loading);

function on_loading() {
    for (i = 0; i < document.links.length; i++) {
        var obj = document.links[i];
        if      (obj.addEventListener) obj.addEventListener("focus", oneblur, false);
        else if (obj.attachEvent)      obj.attachEvent("onfocus", oneblur);
    }
}
function oneblur(e) {
    var evt = e ? e : window.event;
    if      (evt.target)     evt.target.blur();
    else if (evt.srcElement) evt.srcElement.blur();
}


/**
 * body ÅÂ±×ÀÇ oncontextmenu ÀÌº¥Æ®¿¡ ´ëÇÑ Ã³¸®¸¦ ´ã´çÇÏ´Â ÇÔ¼ö.
 * °³¹ß½Ã true¸¦ ¸®ÅÏÇÏ°í, ¿î¿µ½Ã false¸¦ ¸®ÅÏÇÏµµ·Ï ÇÑ´Ù.
 * false¸¦ ¸®ÅÏÇÒ °æ¿ì¿¡´Â À¥ È­¸é¿¡¼­ ¿À¸¥ÂÊ ¸¶¿ì½º ¹öÆ°À» Å¬¸¯ÇßÀ» ¶§ ¸Þ´º°¡ ¶ßÁö ¾Ê´Â´Ù.
 */

document.oncontextmenu = getOncontextMenu;

function getOncontextMenu() {
    if (!event.srcElement.oncontextmenu) {
        return true;
    }
}

/**
 * body ÅÂ±×ÀÇ Status¿¡ ´ëÇÑ Ã³¸®¸¦ ´ã´çÇÏ´Â ÇÔ¼ö.
 * °³¹ß½Ã false¸¦ ¸®ÅÏÇÏ°í, ¿î¿µ½Ã true¸¦ ¸®ÅÏÇÏµµ·Ï ÇÑ´Ù.
 * true¸¦ ¸®ÅÏÇÒ °æ¿ì¿¡´Â À¥ È­¸éÀÇ »óÅÂÇ¥½ÃÁÙ¿¡ ¸µÅ©Á¤º¸°¡ ³ªÅ¸³ªÁö ¾Ê´Â´Ù.

function hidestatus() {
    window.status = '';
    return  true;
}

if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
document.onmouseover = hidestatus;
document.onmouseout  = hidestatus;
document.onkeydown = hidestatus;


setInterval('window.status=""', 1);

*/

// ÀÌ¹ÌÁö Swapping °ü·Ã ÇÔ¼ö ½ÃÀÛ
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_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_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_findObj(n, d) {  // v4.0
    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 && document.getElementById) x = document.getElementById(n);
    return x;
}
// ÀÌ¹ÌÁö Swapping °ü·Ã ÇÔ¼ö Á¾·á


// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå)
function flashWrite(url, w, h, id, bg, vars, 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='allowScriptAccess' value='always'/>" + 
    "<param name='movie'     value='" + url  + "' />" + 
    "<param name='FlashVars' value='" + vars + "' />" + 
    "<param name='wmode'     value='" + win  + "' />" + 
    "<param name='menu'      value='false'        />" + 
    "<param name='quality'   value='high'         />" + 
    "<param name='bgcolor'   value='" + bg + "'   />" + 
    "<embed src='" + url + "' FlashVars='" + vars + "' wmode='" + win + "' menu='false' quality='high' bgcolor='" + bg + "' width='" + w + "' height='" + h + "' name='" + id + "' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>" + 
    "</object>";

    // ÇÃ·¡½Ã ÄÚµå Ãâ·Â
    document.write(flashStr);
}

function viewFla(obj) {
    var myObjectElement = document.createElement('<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="600" height="500">');

    var myParamElement1 = document.createElement('<param name= movie value='+obj+'>');
    var myParamElement2 = document.createElement('<param name="quality" value="high"></object>');

    myObjectElement.appendChild(myParamElement1);
    myObjectElement.appendChild(myParamElement2);

    namesvView.appendChild(myObjectElement);
}


// Äü¸Þ´º ¿òÁ÷ÀÓ
var stmnLEFT = 958;  
var stmnGAP1 = 223; 
var stmnGAP2 = 70;  
var stmnBASE = 223; 
var stmnActivateSpeed = 0; 
var stmnScrollSpeed   = 0; 

var stmnTimer; 

function RefreshStaticMenu()  { 
    var stmnStartPoint, stmnEndPoint, stmnRefreshTimer; 

    stmnStartPoint = parseInt(quickbar.style.top, 10); 
    stmnEndPoint = document.documentElement.scrollTop + stmnGAP2; 

    stmnLimit = parseInt(document.documentElement.scrollHeight) - parseInt(quickbar.offsetHeight) - 150; 
    if (stmnEndPoint > stmnLimit) stmnEndPoint = stmnLimit; 
    if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1; 

    stmnRefreshTimer = stmnActivateSpeed; 

    if (stmnStartPoint != stmnEndPoint) { 
        stmnScrollAmount = Math.ceil(Math.abs(stmnEndPoint - stmnStartPoint) / 15); 
        quickbar.style.top = parseInt(quickbar.style.top, 10) + ((stmnEndPoint < stmnStartPoint) ? -stmnScrollAmount : stmnScrollAmount); 
        stmnRefreshTimer = stmnScrollSpeed; 
    } 
    istmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer); 
} 

function InitializeStaticMenu() { 
    quickbar.style.left = stmnLEFT;
    quickbar.style.top = document.documentElement.scrollTop + stmnBASE; 
    RefreshStaticMenu(); 
}


// È­¸é Å©±â ¹× À§Ä¡ º¯°æ °ü·Ã ÇÔ¼ö -½ÃÀÛ
function onResizeWindow(argWidth) {
    // Document°¡ ¸ðµÎ ·ÎµùµÈ ÈÄ¿¡¸¸ ½ÇÇà
    if (document.body) {
        // Á¤È®ÇÑ ³ôÀÌ¸¦ ¾ò±â À§ÇØ ¸ÕÀú Window ³ÐÀÌ¸¦ º¯°æÇÏ¿© Object µéÀ» Àç Á¤·ÄÇÑ´Ù.
        window.resizeTo(argWidth, 0);
        // Window ³ôÀÌ¸¦ ±¸ÇÏ±â À§ÇØ DocumentÀÇ ¸¶Áö¸· ÇÏ´Ü¿¡ <SPAN> Object Ãß°¡
        var objBottom    = document.createElement("SPAN");
        var objReference = document.body.appendChild(objBottom);
        if (objReference) {
            // Ãß°¡µÈ <SPAN> Object¿Í DocumentÀÇ ³ôÀÌ Â÷ÀÌ¸¸Å­ Window ³ôÀÌ¸¦ º¯°æÇÑ´Ù.
            window.resizeBy(0, objReference.offsetTop - document.documentElement.clientHeight);
        }
    }
}


//----- ÇÊµåÇ×¸ñ Ã¼Å© ½ÃÀÛ -----------------------------//
// ¹®ÀÚ¿­ ÁËÃø °ø¹é Á¦°Å
function LTrim(argStr) {
    var idx, chrValue;

    for (idx = 0; idx < argStr.length; idx++) {
        chrValue = argStr.charAt(idx);

        if ((chrValue != " ") && (chrValue != "\r") && (chrValue != "\n"))
            break;
    }
    return argStr.substring(idx, argStr.length);
}

// ¹®ÀÚ¿­ÀÇ ¿ìÃø °ø¹é Á¦°Å
function RTrim(argStr) {
    var idx, chrValue;

    for (idx = argStr.length - 1; idx >= 0; idx--) {
        chrValue = argStr.charAt(idx);

        if ((chrValue != " ") && (chrValue != "\r") && (chrValue != "\n")) {
            break;
        }
    }
    return argStr.substring(0, idx + 1);
}

// ¹®ÀÚ¿­ÀÇ ÁÂ, ¿ìÃø °ø¹é Á¦°Å
function Trim(argStr) {
    return RTrim(LTrim(argStr));
}

// °ø¹é¹®ÀÚ¿­¿©ºÎ Ã¼Å©
function isEmpty(argObj) {
    var objStr = Trim(argObj.value);

    for (var inx = 0; inx < objStr.length; inx++) {

        if (objStr.substring(inx, inx + 1) != "") {
            return false;
        }
    }
    return true;
}

// Æ¯¼ö¹®ÀÚ Ã¼Å©
function isDomainName(argObj) {
    var objStrValue = Trim(argObj.value);

    if (objStrValue != "") {
        var word="`~!@#$%^&*()+=|\\<>,./?:\"'[]{}_";
        
        for (var w = 0; w < word.length; w++) {
            if (objStrValue.indexOf(word.substring(w, w+1)) >= 0) {
                return false;
            }
        }
    }
    return true;
}

// ÀÌ¸ÞÀÏ Á¤È®¼º Ã¼Å©
function isEmail(argObj)
{
    if (isEmpty(argObj))
        return (isEmail.arguments.length == 1) ? false : (isEmail.arguments[1] == true);

    // is s whitespace?
    if (isWhitespace(argObj))
        return false;

    var at = argObj.value.indexOf('@');
    if (at <= 0 || at == argObj.value.length-1) return false;

    var s1 = argObj.value.substring(0, at);
    var s2 = argObj.value.substring(at+1);

    //check mail id
    var idChar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.";
    for (var i = 0; i < s1.length; i++) {
        if (idChar.indexOf(s1.charAt(i)) == -1) return false;
    }

    //check mail server
    var isPrevDot = false;
    var svrChar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.";
    for (var i = 0; i < s2.length; i++) {
        if (svrChar.indexOf(s2.charAt(i)) == -1) {
            return false;
        }
        else if (s2.charAt(i) == '.') {
            if (isPrevDot)
                return false;
            else {
                if (i==0 || i==s2.length-1)
                    return false;
                isPrevDot = true;
            }
        }
        else
            isPrevDot = false;
    }
    return true;
}

// Check whether string s is white space string
function isWhitespace (argObj)
{
    // Is s empty?
    if (isEmpty(argObj)) return true;

    var whitespace = " \t\n\r";

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.
    for (var i = 0; i < argObj.value.length; i++) {
        // Check that current character isn't whitespace.
        if (whitespace.indexOf(argObj.value.charAt(i)) == -1)
            return false;
    }
    // All characters are whitespace.
    return true;
}


// ¸Þ¼¼Áö¸¦ Àü´ÞÇÏ°í ÇØ´ç ÆûÀ¸·Î Focus ÀÌµ¿
function ErrMsg(argObj, argMsg) {
    try {
       dlgErrorAlert(argMsg);
       try {argObj.focus();  } catch(errorObject) { }
       try {argObj.select(); } catch(errorObject) { }
       return false;
    }
    catch(errorObject) {
       showErrorDlg(errorObject);
    }
}

// alert ¸¦ »Ñ·ÁÁØ´Ù.
function dlgErrorAlert(argMsg) {
   alert(argMsg);
}



// ÆË¾÷ È­¸é ¶ç¿ì±â(Modaless)
function onOpenPopupWin(argURI, argWinName, argWidth, argHeight, argTop, argLeft, argScroll) {
    var resultWindow = null;

    var windowW   = (argWidth  != null) ? argWidth  : 15;
    var windowH   = (argHeight != null) ? argHeight : 15;
    var windowX   = (argTop    != null) ? argTop    : 0;
    var windowY   = (argLeft   != null) ? argLeft   : 0;
    var argScroll = (argScroll != null) ? argScroll : "yes";

    resultWindow = window.open(argURI, argWinName,
        "top  ="+ windowX +", " + "left  ="+ windowY +", " +
        "width="+ windowW +", " + "height="+ windowH +", " +
        "resizable=no, scrollbars="+ argScroll +", directories=no, " +
        "location=no, toolbar=no, menubar=no");

    resultWindow.focus();

    return resultWindow;
}

// ÆË¾÷ È­¸é ¶ç¿ì±â(Modal)
function onOpenPopupModalWin(argURI, argParameter, argWidth, argHeight, argFeatures) {
    var resultValue = null;

    var windowW = (argWidth  != null) ? argWidth  : 15;
    var windowH = (argHeight != null) ? argHeight : 15;

    resultValue = window.showModalDialog(argURI, argParameter,
        "dialogWidth:" + windowW + "px; " + "dialogHeight:" + windowH + "px; " +
        "dialogHide:yes; center:yes; scroll:no; status:no; resizable:no; " + argFeatures);

    return resultValue;
}


// --------------------------------------------------
// ÅëÇÕ°Ë»ö
//---------------------------------------------------
function goSearchTop() {
    var f = document.topFrm;

    if (isEmpty(f.qt)) {
      ErrMsg(f.qt, "°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
      return false;
    }
    
    f.target = "_blank";
    f.action = "http://search.kisa.or.kr/RSA/front/Search.jsp";
    return true;
}

// --------------------------------------------------
// µî·Ï´ëÇàÀÚ ¼ö¼ö·á È­¸é ÆË¾÷
//---------------------------------------------------
function onAgencyFeePop() {
    onOpenPopupWin("/KR/dmreg/agency/agencyFeePop.jsp","feePop", "1024", "1200", "0", "0", "no")
}



//******************************************************************************************
//
// ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ ±âÁ¸ »ç¿ëÇÏ´ø javascript ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ
//
//*******************************************************************************************


//fontSize Defalut
var fontSize = 12;
//fontColorIndex Defalut(0Àº ±ÛÀÚ»ö)
var fontColorIndex = 0;
//fontColorIndex Defalut(0Àº ¹ÙÅÁ»ö)
var bgColorIndex = 0;

//±ÛÀÚ»ö ¹è¿­
fontColor = new Array();
fontColor[0] = "";
fontColor[1] = "";
fontColor[2] = "#ffff00";
fontColor[3] = "#ffffff";
fontColor[4] = "#6666ff";
fontColor[5] = "#ff6666";
fontColor[6] = "#ff66ff";
fontColor[7] = "#66ff66";

//¹è°æ»ö ¹è¿­
bgColor = new Array();
bgColor[0] = "";
bgColor[1] = "";
bgColor[2] = "#000000";
bgColor[3] = "#6666ff";
bgColor[4] = "#ff6666";
bgColor[5] = "#ff66ff";
bgColor[6] = "#66ff66";


/*----------------------------------------------------------------------------*/
/* NAME : f_playinput()                                                       */
/* DESC : ¼­ºêÆäÀÌÁö¿¡¼­ »ç¿ëÀÚ°¡ ÀÔ·ÂÇÑ ÅØ½ºÆ®¸¦ À½¼ºÀ¸·Î ÇÕ¼ºÇÏ¿© Àç»ýÇÑ´Ù. */
/*----------------------------------------------------------------------------*/
function f_playinput(inText) {
    if(readCookie("voiceStart")== "start") {
        sRes = sBot.IsAvailable();
        if (sRes == 1) {
            sBot.OnSendText(inText);
        }
    }
}



/*----------------------------------------------------------------------------*/
/* NAME : f_setInit()                                                         */
/* DESC : È­¸éÀÌ Ã³À½ LoadµÇ¾úÀ» ¶§ ½ÇÇàµÇ´Â ÇÔ¼ö(±ÛÀÚ°ü·Ã)                   */

/*----------------------------------------------------------------------------*/
function f_setInit() {
    
    if (readCookie("fontSize").length == 0)
        setCookie("fontSize", 12, 1);
    else
        fontSize = readCookie("fontSize");
        
    if (readCookie("fontColorIndex").length == 0)
        setCookie("fontColorIndex", 0, 1);
    else
        fontColorIndex = readCookie("fontColorIndex");
    
    
    if (readCookie("bgColorIndex").length == 0)
        setCookie("bgColorIndex", 0, 1);
    else
        bgColorIndex = readCookie("bgColorIndex");

    if (readCookie("fontSize")== 12 && readCookie("fontColorIndex")==0 && readCookie("bgColorIndex") == 0) {
    
    }
    else {
        f_setFace();
    }
}

var fontSize       = 12; //fontSize Defalut
var fontColorIndex = 0 ; //fontColorIndex Defalut(0Àº ±ÛÀÚ»ö)
var bgColorIndex   = 0 ; //fontColorIndex Defalut(0Àº ¹ÙÅÁ»ö)

/*----------------------------------------------------------------------------*/
/* NAME : f_fontPlus()                                                        */
/* DESC : ±ÛÀÚÅ©±â¸¦ Å©°Ô                                                     */
/*----------------------------------------------------------------------------*/
function f_fontPlus() {
    if (fontSize < 18) {
        fontSize = parseInt(fontSize) + 2;      
        f_setFace();
        f_playinput("±ÛÀÚ Å©±â " + fontSize);
    }
    return true;
}

/*----------------------------------------------------------------------------*/
/* NAME : f_fontMinus()                                                       */
/* DESC : ±ÛÀÚÅ©±â¸¦ ÀÛ°Ô                                                     */
/*----------------------------------------------------------------------------*/
function f_fontMinus() {
    if (fontSize > 11) {
        fontSize = parseInt(fontSize) - 2;      
        f_setFace();
        f_playinput("±ÛÀÚ Å©±â " + fontSize);
    }
    return true;
}

/*----------------------------------------------------------------------------*/
/* NAME : f_setFontColor1()                                                   */
/* DESC : ±ÛÀÚ»ö º¯°æ(key Event½Ã)                                            */

/*----------------------------------------------------------------------------*/
function f_setFontColor1(param) {
    var keyCode = window.event.keyCode;
    if (keyCode == 13){
        if (param >= 0 && param <= 7) {
            fontColorIndex = param;
            f_setFace();
        }       
    }
}

/*----------------------------------------------------------------------------*/
/* NAME : f_setFontColor2()                                                   */
/* DESC : ±ÛÀÚ»ö º¯°æ                                                         */

/*----------------------------------------------------------------------------*/
function f_setFontColor2(param) {
    if (param >= 0 && param <= 7) {
        fontColorIndex = param;
        f_setFace();
    }
}

/*----------------------------------------------------------------------------*/
/* NAME : f_setBgColor1()                                                     */
/* DESC : ¹è°æ»ö º¯°æ(key Event½Ã)                                            */

/*----------------------------------------------------------------------------*/
function f_setBgColor1(param) {
    var keyCode = window.event.keyCode;
    if (keyCode == 13) {
        if (param >= 0 && param <= 6) {
            bgColorIndex = param;
            f_setFace();        
        }
    }
}   

/*----------------------------------------------------------------------------*/
/* NAME : f_setBgColor2()                                                     */
/* DESC : ¹è°æ»ö º¯°æ                                                         */
/*----------------------------------------------------------------------------*/
function f_setBgColor2(param) {
    if (param >= 0 && param <= 6) {
        bgColorIndex = param;
        f_setFace();        
    }
}

/*----------------------------------------------------------------------------*/
/* NAME : f_setFace()                                                         */
/* DESC : ±ÛÀÚÅ©±â, ±ÛÀÚ»ö, ¹è°æ»ö ¼³Á¤                                       */
/*----------------------------------------------------------------------------*/
function f_setFace() {
    var objs_td     = new Array();
    var objs_a      = new Array();
    var objs_span   = new Array();
    var objs_p      = new Array();

    objs_td = document.getElementsByTagName("td");
    objs_a = document.getElementsByTagName("a");
    objs_span = document.getElementsByTagName("span");
    objs_p = document.getElementsByTagName("P");

    for (i = 0; i < objs_td.length; i++) {
        objs_td[i].style.fontSize        = fontSize + 'px';
        objs_td[i].style.color           = fontColor[fontColorIndex];
        objs_td[i].style.backgroundColor = bgColor[bgColorIndex];
    }
    for (i = 0; i < objs_a.length; i++) {
        objs_a[i].style.fontSize = fontSize + 'px';
        objs_a[i].style.color    = fontColor[fontColorIndex];
    } 
    for (i = 0; i < objs_span.length; i++) {
        objs_span[i].style.fontSize = fontSize + 'px';
        objs_span[i].style.color    = fontColor[fontColorIndex];
    } 
    for (i = 0; i < objs_p.length; i++) {
        objs_p[i].style.fontSize = fontSize + 'px';
        objs_p[i].style.color    = fontColor[fontColorIndex];
    }
    
    if (document.all['select2'] == "[object]") {
        document.all['select2'].selectedIndex = parseInt(fontColorIndex);
        document.all['select'].selectedIndex  = parseInt(bgColorIndex);
    }

    setCookie("fontSize"      , fontSize      , 1);
    setCookie("fontColorIndex", fontColorIndex, 1);
    setCookie("bgColorIndex"  , bgColorIndex  , 1); 
}


function readCookie(str) {
    var key = str + "=" ;
    var key_len = key.length ;
    var cookie_len = document.cookie.length;
    var i = 0;

    while (i < cookie_len) {
        var j = i + key_len;
        if (document.cookie.substring( i, j) == key) {
            var cookie_end = document.cookie.indexOf(";",j);

            if (cookie_end == -1) {
                cookie_end = document.cookie.length;
            }
            return document.cookie.substring(j,cookie_end);
        }
        i++
    }
    return ""
}

/*------------------------------------------------------------------*/
/*  Æã¼Ç¸í   : setCookie                                            */
/*  ³»¿ë¼³¸í : ÄíÅ°°ªÀ» ¼³Á¤ÇÑ´Ù.                                   */
/*  È£Ãâ ¸ðµâ¸í                                                     */
/*      1) html        :                                            */
/*      2) JSP/servlet :                                            */
/*      3) script func.:                                            */
/*  ¸Å°³º¯¼ö  : key°ª, value°ª, ÄíÅ° À¯È¿ÀÏÀÚ-1                     */
/*  Æ¯ÀÌ»çÇ×  :                                                     */
/*------------------------------------------------------------------*/
function setCookie( key, value, term){
    var expire = new Date();  
    expire.setDate( expire.getDate() + term);
    document.cookie = key + "=" + escape( value) + "; path=/; expires=" + expire.toGMTString() + ";";
}


function SaveCookie(name, value, expire) { 
    var eDate = new Date(); 
    eDate.setDate(eDate.getDate() + expire); 
    document.cookie = name + "=" + value + "; expires=" +  eDate.toGMTString()+ "; path=/"; 
} 
