//##############################################################################
//# ÇÁ·Î±×·¥ID : base.js
//# ÆäÀÌÁö¼³¸í : ¸ðµç »çÀÌÆ® °øÅë ½ºÅ©¸³Æ®
//# È­¸é¼³°èÀÚ : arthur-park
//# À¥µðÀÚÀÌ³Ê : arthur-park
//# ÇÁ·Î±×·¡¸Ó : arthur-park
//#
//#
//# °ËÁõ °ü·Ã
//# ------------> jsIsIE()                                    ===> ºê¶ó¿ìÀú CHECK
//# ------------> jsIsEmpty( i_str )                          ===> °ø¹é¹®ÀÚ¿­ CHECK
//# ------------> jsIsLetter( i_str )                         ===> ¹®ÀÚ CHECK
//# ------------> jsIsDigit( i_str )                          ===> ¼ýÀÚ CHECK
//# ------------> jsIsHangeul( i_str )                        ===> ÇÑ±Û CHECK
//#
//#
//# ¹®ÀÚ¿­Ã³¸® °ü·Ã
//# ------------> jsTrim( i_str )                             ===> ÁÂ¿ì°ø¹é Á¦°Å
//# ------------> jsParseProperty( i_props, i_token )         ===> ÇÁ·ÎÆÛÆ¼ ÆÄ½Ì
//#
//#
//# ¿¤¸®¸ÕÆ®,°´Ã¼ °ü·Ã
//# ------------> jsGetPosition_X( i_ele )                    ===> BODY¸¦ ±âÁØÀ¸·Î ¿¤¸®¸ÕÆ®ÀÇ XÁÂÇ¥ °è»ê
//# ------------> jsGetPosition_Y( i_ele )                    ===> BODY¸¦ ±âÁØÀ¸·Î ¿¤¸®¸ÕÆ®ÀÇ YÁÂÇ¥ °è»ê
//# ------------> jsGetElementsByClass( i_cls, i_tag, i_pid ) ===> Å¬·¡½º ÀÌ¸§À¸·Î ¿¤¸®¸ÕÆ® °Ë»ö
//# ------------> jsIgnoreWhiteSpace( i_node )                ===> ºó ÅØ½ºÆ®³ëµå Á¦°Å
//# ------------> jsChangeOrder( i_pid, i_ele, i_dir )        ===> ¿¤¸®¸ÕÆ® À§Ä¡ ÀÌµ¿
//# ------------> jsCreateLayer( i_id, i_src, i_is_file )     ===> ·¹ÀÌ¾î »ý¼º
//# ------------> jsInsertFlash( i_url, i_props )             ===> ÇÃ·¡½Ã »ðÀÔ
//#
//#
//# AJAX °ü·Ã
//# ------------> jsCreateXMLHTTP()                           ===> XMLHTTP °´Ã¼ »ý¼º
//# ------------> jsGetSource( i_url )                        ===> ÆÄÀÏ ³»¿ë ÃßÃâ
//# ------------> jsInclude( i_url, i_id )                    ===> ÆÄÀÏ ÀÎÅ¬·çµå
//##############################################################################


//==============================================================================
// Á¤±Ô½Ä Á¤ÀÇ
//==============================================================================
var JS_CONST_REGEXP_DIGIT   = /^[0-9]+$/;
var JS_CONST_REGEXP_ENGLISH = /^[a-zA-Z]+$/;
var JS_CONST_REGEXP_HANGEUL = /^[¤¡-¤¾°¡-ÆR]+$/;
var JS_CONST_REGEXP_TRIM    = /(^[\s]*)|([\s]*$)/g;



//==============================================================================
// °ËÁõ °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ºê¶ó¿ìÀú CHECK
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIsIE()
     * @return
     *     ºê¶ó¿ìÀú°¡ IEÀÎÁöÀÇ ³í¸®°ª
     * @description
     *     ºÒ¿ÏÀü... ³ªÁß¿¡ ·ÎÁ÷ Ãß°¡...
     */
    function jsIsIE() {
        return ( navigator.userAgent.toLowerCase().indexOf("msie") != -1 );
    }


    //--------------------------------------------------------------------------
    // °ø¹é¹®ÀÚ¿­ CHECK
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIsEmpty( i_str )
     * @param
     *     i_str ¹®ÀÚ¿­
     * @return
     *     °ø¹é¹®ÀÚ¿­ÀÎÁöÀÇ ³í¸®°ª
     */
    function jsIsEmpty( i_str ) {
        if ( i_str == null ) return true;

        return ( i_str.replace(/^\s|\s$/, "").length == 0 );
    }


    //--------------------------------------------------------------------------
    // ¹®ÀÚ CHECK
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIsLetter( i_str )
     * @param
     *     i_str ¹®ÀÚ¿­
     * @return
     *     ¹®ÀÚÀÎÁöÀÇ ³í¸®°ª
     * @description
     *     °ªÀÇ ¹üÀ§´Â [a-z], [A-Z]
     */
    function jsIsLetter( i_str ) {
        if ( i_str == null ) return false;

        return /^[a-zA-Z]+$/.test(i_str);
    }


    //--------------------------------------------------------------------------
    // ¼ýÀÚ CHECK
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIsDigit( i_str )
     * @param
     *     i_str ¹®ÀÚ¿­
     * @return
     *     ¼ýÀÚÀÎÁöÀÇ ³í¸®°ª
     * @description
     *     °ªÀÇ ¹üÀ§´Â [0-9]
     */
    function jsIsDigit( i_str ) {
        if ( i_str == null ) return false;

        return /^\d+$/.test(i_str);
    }


    //--------------------------------------------------------------------------
    // ÇÑ±Û CHECK
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIsHangeul( i_str )
     * @param
     *     i_str ¹®ÀÚ¿­
     * @return
     *     ÇÑ±ÛÀÎÁöÀÇ ³í¸®°ª
     * @description
     *     °ªÀÇ ¹üÀ§´Â [¤¡-¤¾], [°¡-ÆR]
     */
    function jsIsHangeul( i_str ) {
        if ( i_str == null ) return false;

        return /^[¤¡-¤¾°¡-ÆR]+$/.test(i_str);
    }


//==============================================================================
// ¹®ÀÚ¿­Ã³¸® °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ÁÂ¿ì°ø¹é Á¦°Å
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsTrim( i_str )
     * @param
     *     i_str ¹®ÀÚ¿­
     * @return
     *     ÁÂ¿ì°ø¹éÀÌ Á¦°ÅµÈ ¹®ÀÚ¿­
     */
    function jsTrim( i_str ) {
        if ( i_str == null ) return null;

        return i_str.replace(/^\s|\s$/, "");
    }


    //--------------------------------------------------------------------------
    // ÇÁ·ÎÆÛÆ¼ ÆÄ½Ì
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsParseProperty( i_props, i_token )
     * @use
     *     jsIsEmpty( i_str )
     * @param
     *     i_str   ÇÁ·ÎÆÛÆ¼Çü½Ä ¹®ÀÚ¿­
     *     i_token ±¸ºÐÀÚ
     * @return
     *     Å°¿Í °ªÀ¸·Î ÀÌ·ç¾îÁø ´ÙÂ÷¿ø ¹è¿­º¯¼ö
     * @description
     *     i_propsÀÇ Çü½ÄÀº "key=value"¿Í °°ÀÌ ÀÛ¼ºÇÏ¸ç ±¸ºÐÀÚ´Â ","°¡ µðÆúÆ®ÀÌ´Ù.
     *     "@return.get( i_key, i_def )"·Î °ªÀ» ¾òÀ» ¼ö ÀÖ´Ù.
     *
     *     ex) test = jsParseProperty("width=100&height=200&top=50", "&")
     *         test.get("width")  ==> 100
     *         test.get("height") ==> 200
     *         test.get("top")    ==> 50
     */
    function jsParseProperty( i_str, i_token ) {
        var props = new Array();

        // ÆÄ½Ì
        if ( jsIsEmpty(i_str) == false ) {
             var list = i_str.replace(/\s/g, "").split(i_token != null ? i_token : ",");
             var cnt  = 0;

             for ( var i=0; i < list.length; i++ ) {
                   if ( list[i].indexOf("=") != -1 ) {
                        var item = list[i].split("=");

                        if ( jsIsEmpty(item[0]) == false ) {
                             props[cnt] = new Array(item[0], item[1]);
                             cnt++;
                        }
                   }
             }
        }

        // GetÇÔ¼ö Ãß°¡
        props.get = function( i_key, i_def ) {
            for ( var i=0; i < this.length; i++ ) {
                  if ( this[i][0] == i_key ) {
                       return this[i][1];
                  }
            }

            return i_def;
        }

        return props;
    }


//==============================================================================
// ¿¤¸®¸ÕÆ®,°´Ã¼ °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ¿¤¸®¸ÕÆ® °ª ÁÂ¿ì°ø¹é Á¦°Å
    //--------------------------------------------------------------------------
    /***
     * @function
     *      jsTrimElement(i_ele)
     * @param
     *      i_ele ¿¤¸®¸ÕÆ®
     * @return
     *      ÁÂ¿ì°ø¹éÀÌ Á¦°ÅµÈ ¿¤¸®¸ÕÆ®ÀÇ °ª
     */
    function jsTrimElement(i_ele) {
        i_ele.value = i_ele.value.replace(JS_CONST_REGEXP_TRIM,"");

        return i_ele.value;
    }



    //--------------------------------------------------------------------------
    // BODY¸¦ ±âÁØÀ¸·Î ¿¤¸®¸ÕÆ®ÀÇ XÁÂÇ¥ °è»ê
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsGetPosition_X( i_ele )
     * @param
     *     i_ele ¿¤¸®¸ÕÆ®
     * @return
     *     ¿¤¸®¸ÕÆ®ÀÇ XÁÂÇ¥
     */
    function jsGetPosition_X( i_ele ) {
        var x = 0;

        if ( i_ele != null ) {
             do {
                     x     += i_ele.offsetLeft;
                     i_ele  = i_ele.offsetParent;

             }
             while ( i_ele != document.body );
        }

        return x;
    }


    //--------------------------------------------------------------------------
    // BODY¸¦ ±âÁØÀ¸·Î ¿¤¸®¸ÕÆ®ÀÇ YÁÂÇ¥ °è»ê
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsGetPosition_Y( i_ele )
     * @param
     *     i_ele ¿¤¸®¸ÕÆ®
     * @return
     *     ¿¤¸®¸ÕÆ®ÀÇ YÁÂÇ¥
     */
    function jsGetPosition_Y( i_ele ) {
        var y = 0;

        if ( i_ele != null ) {
             do {
                     y     += i_ele.offsetTop;
                     i_ele  = i_ele.offsetParent;
             }
             while ( i_ele != document.body );
        }

        return y;
    }


    //--------------------------------------------------------------------------
    // Å¬·¡½º ÀÌ¸§À¸·Î ¿¤¸®¸ÕÆ® °Ë»ö
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsGetElementByClass( i_cls, i_tag, i_pid )
     * @use
     *     jsIsEmpty( i_str )
     * @param
     *     i_cls Å¬·¡½º ÀÌ¸§
     *     i_tag ÅÂ±× ÀÌ¸§
     *     i_pid ºÎ¸ð id
     * @return
     *     °Ë»öµÈ ¿¤¸®¸ÕÆ®°¡ ÀúÀåµÈ ¹è¿­º¯¼ö
     */
    function jsGetElementsByClass( i_cls, i_tag, i_pid ) {
        var list = new Array();

        if ( jsIsEmpty(i_cls) == false ) {
             var parent = document.getElementById(i_pid);
             var eles   = (parent != null ? parent : document).getElementsByTagName(i_tag != null ? i_tag : "*");
             var cnt    = 0;

             for ( var i=0; i < eles.length; i++ ) {
                   if ( eles[i].className.match(i_cls) ) {
                        list[cnt] = eles[i];
                        cnt++;
                   }
             }
        }

        return list;
    }


    //--------------------------------------------------------------------------
    // ºó ÅØ½ºÆ®³ëµå Á¦°Å
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsIgnoreWhiteSpace( i_ele )
     * @param
     *     i_ele ¿¤¸®¸ÕÆ®
     * @description
     *     xml¹®¼­ µî¿¡¼­ ºñ¾îÀÖ´Â ÅØ½ºÆ®³ëµå¸¦ Á¦°Å
     */
    function jsIgnoreWhiteSpace( i_ele ) {
        for ( var i=0; i < i_ele.childNodes.length; i++ ) {
              var node = i_ele.childNodes[i];

              if ( (node.nodeType == 3) && (node.nodeValue.replace(/\s/g, "").length == 0) ) {
                   i_ele.removeChild(node);
                   i--;
              }
              else {
                   jsIgnoreWhiteSpace(node);
              }
        }
    }


    //--------------------------------------------------------------------------
    // ¿¤¸®¸ÕÆ® À§Ä¡ ÀÌµ¿
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsChangeOrder( i_ele, i_dir )
     * @param
     *     i_ele ¿¤¸®¸ÕÆ®
     *     i_dir ¹æÇâ (PREV/NEXT)
     */
    function jsChangeOrder( i_ele, i_dir ) {
        var parent = i_ele.parentNode;

        switch ( i_dir ) {
            case "PREV":
                 var prev = i_ele.previousSibling;

                 // ÀÌÀü ¿¤¸®¸ÕÆ® CHECK
                 while ( prev != null ) {
                         if ( prev.style.display != "none" ) {
                              break;
                         }
                         else {
                              prev = prev.previousSibling;
                         }
                 }

                 // ÀÌÀü À§Ä¡·Î ÀÌµ¿
                 if ( prev != null ) {
                      parent.removeChild(i_ele);
                      parent.insertBefore(i_ele, prev);
                 }
                 break;

            case "NEXT":
                 var next = i_ele.nextSibling;

                 // ´ÙÀ½ ¿¤¸®¸ÕÆ® CHECK
                 while ( next != null ) {
                         if ( next.style.display != "none" ) {
                              break;
                         }
                         else {
                              next = next.nextSibling;
                         }
                 }

                 // ´ÙÀ½ À§Ä¡·Î ÀÌµ¿
                 if ( next != null ) {
                      parent.removeChild(i_ele);

                      if ( next.nextSibling == null ) {
                           parent.appendChild(i_ele);
                      }
                      else {
                           parent.insertBefore(i_ele, next.nextSibling);
                      }
                 }
                 break;
        }
    }


    //--------------------------------------------------------------------------
    // ·¹ÀÌ¾î »ý¼º
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsCreateLayer( i_id, i_src, i_is_file )
     * @param
     *     i_id      ¿¤¸®¸ÕÆ® ID
     *     i_src     ÄÁÅÙÃ÷ ¼Ò½º
     *     i_is_file ÄÁÅÙÃ÷(ÆÄÀÏ/ÅØ½ºÆ®) ÆÇ´Ü ³í¸®°ª
     * @return
     *     ·¹ÀÌ¾î(IFrame) ¿¤¸®¸ÕÆ®
     * @description
     *     select¿Í °ãÄ¡´Â ¹®Á¦¶§¹®¿¡ IFrameÀ¸·Î ·¹ÀÌ¾î¸¦ ±¸¼º
     */
    function jsCreateLayer( i_id, i_src, i_is_file ) {
        var layer = document.getElementById(i_id);

        if ( layer == null ) {
             // »ý¼º
             layer = document.createElement("iframe");

             // ¼Ó¼ºÁ¤ÀÇ
             layer.id               = i_id;
             layer.frameBorder      = 0;
             layer.style.display    = "none";
             layer.style.position   = "absolute";
             layer.style.background = "#FFFFFF";

             // µî·Ï
             document.body.appendChild(layer);

             // ÄÁÅÙÃ÷
             if ( i_is_file ) {
                  layer.src = i_src;
             }
             else {
                  layer.contentWindow.document.open();
                  layer.contentWindow.document.write(i_src);
                  layer.contentWindow.document.close();
             }
        }

        return layer;
    }



//==============================================================================
// ÄÁÅÙÃ÷ °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // ÆË¾÷
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsPopup(i_url, i_name, i_str)
     * @use
     *     jsIsEmpty(i_url)
     *     jsParseProperty(i_str, i_token)
     * @param
     *     i_url      ÆÄÀÏ°æ·Î
     *     i_name     À©µµ¿ì ÀÌ¸§
     *     i_str      ÇÁ·ÎÆÛÆ¼Çü½Ä ¹®ÀÚ¿­
     * @description
     *     i_strÀÇ ÇüÅÂ´Â "width=100, height=100" °ú °°ÀÌ ÀÛ¼ºÇÑ´Ù.
     *     - top        À§Ä¡ Y          (0)
     *     - left       À§Ä¡ X          (200)
     *     - width      ³ÐÀÌ            (0)
     *     - height     ³ôÀÌ            (0)
     *     - titlebar   Å¸ÀÌÆ²¹Ù À¯¹«   (no)
     *     - toolbar    Åø¹Ù À¯¹«       (no)
     *     - menubar    ¸Þ´º¹Ù À¯¹«     (no)
     *     - location   ÁÖ¼ÒÃ¢ À¯¹«     (no)
     *     - status     »óÅÂÃ¢ À¯¹«     (no)
     *     - resizable  »çÀÌÁîÁ¶Á¤ À¯¹« (no)
     *     - scrollbars ½ºÅ©·Ñ¹Ù À¯¹«   (no)
     */
    function jsPopup(i_url, i_name, i_str) {
        if (jsIsEmpty(i_name)) i_name = "_blank";

        var props = jsParseProperty(i_str, ",");
        var param = "";

        param += "top="         + props.get("top",         "0")   + ", ";
        param += "left="        + props.get("left",        "200") + ", ";
        param += "width="       + props.get("width",       "0")   + ", ";
        param += "height="      + props.get("height",      "0")   + ", ";
        param += "titlebar="    + props.get("titlebar",    "no")  + ", ";
        param += "toolbar="     + props.get("toolbar",     "no")  + ", ";
        param += "menubar="     + props.get("menubar",     "no")  + ", ";
        param += "location="    + props.get("location",    "no")  + ", ";
        param += "status="      + props.get("status",      "no")  + ", ";
        param += "resizable="   + props.get("resizable",   "no")  + ", ";
        param += "scrollbars="  + props.get("scrollbars",  "yes") + ", ";
        param += "copyhistory=" + props.get("copyhistory", "no")  + "  ";

        window.open(i_url, i_name, param);

        return i_name;
    }

    //--------------------------------------------------------------------------
    // ÇÃ·¡½Ã »ðÀÔ
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsInsertFlash( i_url, i_props )
     * @use
     *     jsIsIE()
     *     jsParseProperty( i_props, i_token )
     * @param
     *     i_url   ÆÄÀÏ°æ·Î
     *     i_props ÇÁ·ÎÆÛÆ¼Çü½Ä ¹®ÀÚ¿­
     * @description
     *     i_propsÀÇ ÇüÅÂ´Â "width=100, height=100, align=middle" °ú °°ÀÌ ÀÛ¼ºÇÑ´Ù.
     *     - width   ³ÐÀÌ       (100%)
     *     - height  ³ôÀÌ       (100%)
     *     - align   Á¤·Ä       (middle)
     *     - quality È­Áú       (high)
     *     - bgcolor ¹é±×¶ó¿îµå (#FFFFFF)
     *     - wmode   Åõ¸íµµ     (window)
     */
    function jsInsertFlash( i_url, i_props ) {
        var html  = null;
        var type  = null;
        var props = jsParseProperty(i_props, ",");

        if ( jsIsIE() ) {
             type = "classid='clsid:D27CDB6E-AE6D-11CF-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'";
        }
        else {
             type = "type='application/x-shockwave-flash' data='" + i_url + "'";
        }

        html = "<object " + type + " width='" + props.get("width", "100%") + "' height='" + props.get("height", "100%") + "' align='" + props.get("align", "middle") + "'>" + "\n" +
               "    <param name='movie'             value='" + i_url                           + "'>                                                                      " + "\n" +
               "    <param name='quality'           value='" + props.get("quality", "high")    + "'>                                                                      " + "\n" +
               "    <param name='bgcolor'           value='" + props.get("bgcolor", "#FFFFFF") + "'>                                                                      " + "\n" +
               "    <param name='wmode'             value='" + props.get("wmode"  , "window")  + "'>                                                                      " + "\n" +
               "    <param name='allowScriptAccess' value='sameDomain'>                                                                                                   " + "\n" +
               "</object>                                                                                                                                                 " + "\n";

        document.write(html);
    }


//==============================================================================
// AJAX °ü·Ã
//==============================================================================
    //--------------------------------------------------------------------------
    // XMLHTTP °´Ã¼ »ý¼º
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsCreateXMLHTTP()
     * @return
     *     XMLHTTP °´Ã¼
     * @description
     *     Å×½ºÆ®¿ëÀ¸·Î¸¸ »ç¿ëÇÏ°í, ½Ç »õ¹ß½Ã¿¡´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù.
     */
    function jsCreateXMLHTTP() {
        var req = false;

        if ( window.XMLHttpRequest ) {
             try {
                     req = new XMLHttpRequest();
             }
             catch ( e ) {
                     req = false;
             }
        }
        else if ( window.ActiveXObject ) {
             try {
                     req = new ActiveXObject("Msxml2.XMLHTTP");
             }
             catch ( e ) {
                 try {
                         req = new ActiveXObject("Microsoft.XMLHTTP");
                 }
                 catch ( e ) {
                         req = false;
                 }
             }
        }

        return req;
    }


    //--------------------------------------------------------------------------
    // ÆÄÀÏ ³»¿ë ÃßÃâ
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsGetSource( i_url )
     * @use
     *     jsIsIE()
     *     jsCreateXMLHTTP()
     * @param
     *     i_url ÆÄÀÏ°æ·Î
     * @return
     *     XML°´Ã¼ ¶Ç´Â ÆÄÀÏÀÇ ³»¿ë
     * @description
     *     ´ë»ó ÆÄÀÏÀÇ Çü½ÄÀÌ UTF-8 Çü½ÄÀÌ¾î¾ß Á¤»óÀûÀ¸·Î ÀÛµ¿
     *     Å×½ºÆ®¿ëÀ¸·Î¸¸ »ç¿ëÇÏ°í, ½Ç °³¹ß½Ã¿¡´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù.
     * @TODO
     *     onreadystatechange ±¸Çö
     */
    function jsGetSource( i_url ) {
        if ( jsIsEmpty(i_url) ) return "<strong style='color:#FF0000;'>url is empty</strong>";

        var src = null;
        var ext = i_url.substring(i_url.lastIndexOf(".") + 1).toLowerCase();
        var req = jsCreateXMLHTTP();

        try {
                req.open("Get", i_url, false);
                req.send(null);

                switch ( ext ) {
                    // XMLÆÄÀÏ Ã³¸®
                    case "xml":
                         src = req.responseXML;

                         if ( (src.hasChildNodes == false) && jsIsIE() ) {
                              src = new ActiveXObject("Microsoft.XMLDOM");
                              src.load(i_url);
                         }
                         break;

                    // ±âº» Ã³¸®
                    default:
                         src = req.responseText;
                         break;
                }
        }
        catch ( e ) {
                return "<strong style='color:#FF0000;'>" + e.message + "</strong>";
        }

        return src;
    }


    //--------------------------------------------------------------------------
    // ÆÄÀÏ ÀÎÅ¬·çµå
    //--------------------------------------------------------------------------
    /***
     * @function
     *     jsInclude( i_url, i_id )
     * @use
     *     jsGetSource( i_url )
     * @param
     *     i_url ÆÄÀÏ°æ·Î
     *     i_id  ¿¤¸®¸ÕÆ® ID
     * @description
     *     ´ë»ó ÆÄÀÏÀÇ Çü½ÄÀÌ UTF-8 Çü½ÄÀÌ¾î¾ß Á¤»óÀûÀ¸·Î ÀÛµ¿
     *     Å×½ºÆ®¿ëÀ¸·Î¸¸ »ç¿ëÇÏ°í, ½Ç °³¹ß½Ã¿¡´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù.
     */
    function jsInclude( i_url, i_id ) {
        var src = jsGetSource(i_url);
        var ele = document.getElementById(i_id);

        // <body> ¾ÈÀÇ ³»¿ë¸¸ ÃßÃâ
        if ( src.indexOf("<body") != -1 ) {
             var head = src.indexOf(">", content.indexOf("<body")) + 1;
             var tail = src.indexOf("</body>");

             src = src.substring(head, tail);
        }

        // ¼Ò½º »ðÀÔ
        if ( ele != null ) {
             ele.innerHTML = src;
        }
        else {
             document.write(src);
        }
    }
