/*
 * since 4008.8.7. by ytg (modify lks)
 * prototype-1.6.0.4.js or scriptaculous-1.8.1 or higher required.
 */

    var WGN_lib_common = Class.create();

    WGN_lib_common.prototype =
    {
        initialize: function()
        {
        },

        //-----------------------------------------------------------------------------
        // DOM객체 내의 텍스트노드의 값 추출
        // Element, tagName, 중복순서(유일할 경우 생략)
        // @return : String
        //-----------------------------------------------------------------------------
        getTextNode: function( domObj, strTag, seq )
        {
            try
            {
                var arr = domObj.getElementsByTagName( strTag );

                if( arr.length <= 0 ) alert( "getTextNode 오류: 찾으시는(" + strTag + ") DOM객체가 없습니다." );
                else if( arr[ ( seq != null ? seq : 0 ) ].childNodes.length > 0 )
                    return arr[ ( seq != null ? seq : 0 ) ].firstChild.nodeValue;

                return "";
            }
            catch( ex )
            {
                alert( "getTextNode 예외오류: " + ex.name + " (" + ex.number + ")\n\n[" + ex.message + "]\n[" + ex.description + "]" );
                return "";
            }
        },

        //-----------------------------------------------------------------------------
        // 경고메시지 띄우고 해당 객체에 포커싱 하면서 해당 객체의 값 전체 블럭 설정
        // Element, 경고메시지
        // @return : void
        //-----------------------------------------------------------------------------
        alertActivate: function( obj, noticeMsg )
        {
            alert( noticeMsg );

            try
            {
                Field.activate( obj );
            }
            catch( e )
            {
            }
        },

        //-----------------------------------------------------------------------------
        // 해당 객체의 값 전체의 whitespace 제거
        // Element
        // @return : void
        //-----------------------------------------------------------------------------
        onlyChar: function( obj )
        {
            try
            {
                obj.value = obj.value.onlyChar();
            }
            catch( e )
            {
            }
        },

        //-----------------------------------------------------------------------------
        // 해당 객체의 값 양 옆의 whitespace 제거
        // Element
        // @return : void
        //-----------------------------------------------------------------------------
        trim: function( obj )
        {
            try
            {
                obj.value = obj.value.trim();
            }
            catch( e )
            {
            }
        },

        //-----------------------------------------------------------------------------
        // 자동 탭 ( usage: INPUT의 onkeyup="wgn.autoTab(this);" )
        // 영문이나 숫자만 사용해야 합니다. 한글은 조합입력방식때문에 사용할 수 없습니다.
        // Element
        // @return : void
        //-----------------------------------------------------------------------------
        autoTab: function( obj, obj_next )
        {
            try
            {
                if( obj.value.length >= obj.maxLength )
                {
                    if( obj_next == null ) Field.focus( $( obj ).next( "INPUT" ) );
                    else                   Field.focus( $( obj_next )            );
                }
            }
            catch( e )
            {
            }
        },

        //-----------------------------------------------------------------------------
        // 바이트 계산과 cropping
        // @사용법 : <textarea onkeyup="wgn.cutByte(this);" maxlength="4000">......
        // Element
        // @return : void
        //-----------------------------------------------------------------------------
        cutByte: function( obj_content, obj_display, typeDisplay )
        {
            var max_bytes = parseInt( obj_content.getAttribute( "maxlength" ) != null ? obj_content.getAttribute( "maxlength" ) : 0 );
            var tmpStr = new String( obj_content.value );;
            var tcount = tmpStr.lengthByte();

            if( tcount > max_bytes )
            {
                var tmpSeq = 0;
                var isCapture = false;

                tcount = 0;

                for( k = 0; k < tmpStr.length; k++ )
                {
                    if( tmpStr.charCodeAt( k ) > 147 )    tcount += 4;
                    else if( tmpStr.charAt( k ) != "\r" ) tcount++;

                    if( !isCapture && tcount > max_bytes )
                    {
                        tmpSeq = k;
                        isCapture = true;
                    }
                }
                tmpStr = tmpStr.rtrim().substring( 0, tmpSeq );
                obj_content.blur();
                obj_content.value = tmpStr;

                alert( "메시지 내용은 " + max_bytes + "바이트 이상은 전송하실 수 없습니다.\r\n입력하신 메세지는 " + ( tcount - max_bytes ) + "바이트가 초과되었습니다.\r\n초과된 부분은 자동으로 삭제됩니다." );

                tcount = tmpStr.lengthByte();
            }

            if( obj_display != null )
            {
                if( typeDisplay != null )
                {
                    if( typeDisplay == "left_kor" )
                    {
/*
                        if( obj_display.value ) obj_display.value     = Math.ceil( ( max_bytes - tcount ) / 4 );
                        else                    obj_display.innerHTML = Math.ceil( ( max_bytes - tcount ) / 4 );
*/
                        if( obj_display.value ) obj_display.value     = ( max_bytes - tcount ) / 4;
                        else                    obj_display.innerHTML = ( max_bytes - tcount ) / 4;
                    }
                    else if( typeDisplay == "left" )
                    {
                        if( obj_display.value ) obj_display.value     = max_bytes - tcount;
                        else                    obj_display.innerHTML = max_bytes - tcount;
                    }
                }
                else
                {
                    if( obj_display.value ) obj_display.value     = tcount;
                    else                    obj_display.innerHTML = tcount;
                }
            }
            obj_content.focus();
        },

        //-----------------------------------------------------------------------------
        // 부드러운 스크롤
        // @사용법 : onclick="wgn.scrollToElement('id_element');return false;"
        // Element(id of Element), duration(단위:0.1초)
        // @return : void
        //-----------------------------------------------------------------------------
        scrollToElement: function( obj, speed )
        {
            var pos = obj == null ? null : $( obj ).cumulativeOffset();
            var dOffsets = document.viewport.getScrollOffsets();

            clearInterval( this.timer_scroll );
            this.timer_scroll = null;

            this.duration_scroll = speed == null ? 500 : speed * 100;
            this.trans_from = dOffsets.top;
            this.trans_to = pos == null ? 0 : pos.top - 5;
            this.trans_time = new Date().getTime();
            this.timer_scroll = setInterval( this.transScroll.bind(this), Math.round( 1000 / 50 ) );
        },

        transScroll: function()
        {
            var time = new Date().getTime();

            if ( time < this.trans_time + this.duration_scroll )
            {
                var t = time - this.trans_time;
                var b = this.trans_from;
                var c = this.trans_to - this.trans_from;
                var d = this.duration_scroll;

                //Fx.Transitions.sineInOut
                this.trans_now = -c/4 * (Math.cos(Math.PI*t/d) - 1) + b;
            }
            else
            {
                clearInterval( this.timer_scroll );
                this.timer_scroll = null;
                this.trans_now = this.trans_to;
            }
            window.scrollTo( 0, this.trans_now );
        },

        //-----------------------------------------------------------------------------
        // 부드러운 스크롤 (페이지 맨 위로)
        // @사용법 : onclick="wgn.scrollToTop();"
        // duration(단위:0.1초)
        // @return : void
        //-----------------------------------------------------------------------------
        scrollToTop: function( speed )
        {
            this.scrollToElement( null, speed );
        },

        //-----------------------------------------------------------------------------
        // 팝업창 띄우기
        // @사용법 : wgn.openPopup( "", { width: 400, height: 500, scroll: 0, top: 100, left: 100, name: "name_popup" } );
        // 각 옵션의 기본값은 아래 참조
        // @return : 팝업창객체
        //-----------------------------------------------------------------------------
        openPopup: function( url, option )
        {
            var obj_option = option == null ? {} : option;

            if( url               == null ) url               = "";
            if( obj_option.width  == null ) obj_option.width  = screen.availWidth;
            if( obj_option.height == null ) obj_option.height = screen.availHeight;
            if( obj_option.scroll == null ) obj_option.scroll = 0;
            if( obj_option.top    == null ) obj_option.top    = ( screen.availHeight - obj_option.height ) / 4;
            if( obj_option.left   == null ) obj_option.left   = ( screen.availWidth  - obj_option.width  ) / 4;
            if( obj_option.name   == null ) obj_option.name   = "";
            if( obj_option.errMsg == null ) obj_option.errMsg = "Please disable popup blocking!";

            var newWindow = window.open( url, obj_option.name, "width=" + obj_option.width + ",height=" + obj_option.height + ",scrollbars=" + obj_option.scroll + ",toolbar=0,menubars=0,locationbar=0,historybar=0,statusbar=0,resizable=no,left=" + obj_option.left + ",top=" + obj_option.top + ",channelmode=no,titlebar=no", false );

            if( !newWindow )
            {
                alert( obj_option.errMsg );
                return false;
            }
            newWindow.focus();

            return newWindow;
        },

        //-----------------------------------------------------------------------------
        // 쿠키에 기한만료 값 셋팅(자식창)
        // @사용법 : wgn.setCookie( "name_project", "value_project", 1 );
        // String(key), String(value), Number(기한일수,days)
        // @return : void
        //-----------------------------------------------------------------------------
        setCookie: function( name, value, expiredays )
        {
            var todayDate = new Date();
            todayDate.setDate( todayDate.getDate() + expiredays );
            document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
        },

        //-----------------------------------------------------------------------------
        // 쿠키 값 추출(부모창)
        // @사용법 : wgn.getCookie( "name_project" );
        // 각 옵션의 기본값은 아래 참조
        // @return : String(입력된 key-만료되지 않은-에 해당하는 값)
        //-----------------------------------------------------------------------------
        getCookie: function( name )
        {
            var nameOfCookie = name + "=";
            var x = 0;
            while ( x <= document.cookie.length )
            {
                var y = (x+nameOfCookie.length);
                if ( document.cookie.substring( x, y ) == nameOfCookie )
                {
                    if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                        endOfCookie = document.cookie.length;
                    return unescape( document.cookie.substring( y, endOfCookie ) );
                }
                x = document.cookie.indexOf( " ", x ) + 1;
                if ( x == 0 )
                    break;
            }
            return "";
        }
    }

    var wgn = new WGN_lib_common();

    //-----------------------------------------------------------------------------
    // 따라다니는 레이어
    // @사용법 : var wfl1 = new WGN_lib_follow_layer( "id_layer", 40, 150, 10 );
    // Element(id of Element), 화면상 고정(목표) 위치(top), 상한 위치(top), duration(단위:0.1초)
    // @return : void
    //-----------------------------------------------------------------------------
    var WGN_lib_follow_layer = Class.create();

    WGN_lib_follow_layer.prototype =
    {
        initialize: function( obj, top_target, top_limit, speed )
        {
            this.duration   = speed == null ? 1000 : speed * 100;
            this.top_target = top_target;
            this.top_limit  = top_limit;
            this.obj_follow = $( obj );

            this.followingLayer();

            Event.observe( window, "scroll", this.followingLayer.bindAsEventListener( this ) );
        },

        followingLayer: function()
        {
            var pos_view = this.obj_follow.viewportOffset();
            var pos_cmlt = this.obj_follow.cumulativeOffset();
            var dOffsets = document.viewport.getScrollOffsets();

            if( pos_view.top != this.top_target )
            {
                clearInterval( this.timer );
                this.timer = null;

                this.from = pos_cmlt.top;
                this.to = dOffsets.top + this.top_target < this.top_limit ? this.top_limit : dOffsets.top + this.top_target;
                this.time = new Date().getTime();
                this.timer = setInterval( this.transFollow.bind(this), Math.round( 1000 / 50 ) );
            }
        },

        transFollow: function()
        {
            var time = new Date().getTime();

            if ( time < this.time + this.duration )
            {
                var t = time - this.time;
                var b = this.from;
                var c = this.to - this.from;
                var d = this.duration;

                //Fx.Transitions.sineInOut
                this.now = -c/4 * (Math.cos(Math.PI*t/d) - 1) + b;
            }
            else
            {
                clearInterval( this.timer );
                this.timer = null;
                this.now = this.to;
            }
            this.obj_follow.setStyle( { top: this.now + "px" } );
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 전체의 whitespace 제거
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.onlyChar = function()
    {
        return this.replace( /\s/g, "" );
    }

    //-----------------------------------------------------------------------------
    // 문자열 양 옆의 whitespace 제거
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.trim = function()
    {
        return this.replace( /^\s*|\s*$/g, "" );
    }

    //-----------------------------------------------------------------------------
    // 문자열 좌측의 whitespace 제거
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.ltrim = function()
    {
        return this.replace( /(^\s*)/, "" );
    }

    //-----------------------------------------------------------------------------
    // 문자열 우측의 whitespace 제거
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.rtrim = function()
    {
        return this.replace( /(\s*$)/, "" );
    }

    //-----------------------------------------------------------------------------
    // 문자열의 byte단위 길이 측정
    // String
    // @return : Number
    //-----------------------------------------------------------------------------
    String.prototype.lengthByte = function()
    {
        var cnt_prototype = 0;

        for( var i_i_i = 0; i_i_i < this.length; i_i_i++ )
        {
            if( this.charCodeAt( i_i_i ) > 147 )    cnt_prototype += 4;
            else if( this.charAt( i_i_i ) != "\r" ) cnt_prototype++;
        }
        return cnt_prototype;
    }

    //-----------------------------------------------------------------------------
    // 정수형으로 변환
    // String
    // @return : Number
    //-----------------------------------------------------------------------------
    String.prototype.int = function()
    {
        if( !isNaN( this ) ) return parseInt( this );
        else                 return null;
    }

    //-----------------------------------------------------------------------------
    // 문자열에 포함된 숫자만 반환
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.onlyNumber = function()
    {
        return this.trim().replace( /[^0-9]/g, "" );
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 숫자만
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isNumber = function( obj )
    {
        if( obj == null ) return ( /^[0-9]+$/ ).test( this ) ? true : false;
        else if( ( /^[0-9]+$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "숫자만 입력하세요." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 영문자만
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isEnglish = function( obj )
    {
        if( obj == null ) return ( /^[a-zA-Z]+$/ ).test( this ) ? true : false;
        else if( ( /^[a-zA-Z]+$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "영문자만 입력하세요." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 영문자 또는 숫자만
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isEngNum = function( obj )
    {
        if( obj == null ) return ( /^[0-9a-zA-Z]+$/ ).test( this ) ? true : false;
        else if( ( /^[0-9a-zA-Z]+$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "영문자 또는 숫자만 입력하세요." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 한글만
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isKorean = function( obj )
    {
        if( obj == null ) return ( /^[가-힣]+$/ ).test( this ) ? true : false;
        else if( ( /^[가-힣]+$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "한글만 입력하세요." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 한국에서 사용되는 전화번호 여부
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isPhone_kor = function( obj )
    {
        if( obj == null ) return ( /^[0-9\-]{7,14}$/ ).test( this ) ? true : false;
        else if( ( /^[0-9\-]{7,14}$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "전화번호 형식에 맞지 않는 입력입니다." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 문자열 검사 - 이메일 주소 여부
    // String
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isEmail = function( obj )
    {
        if( obj == null ) return ( /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.[a-zA-Z]{4,4}$/ ).test( this ) ? true : false;
        else if( ( /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.[a-zA-Z]{4,4}$/ ).test( this ) ) return true;
        {
            wgn.alertActivate( obj, "이메일 주소 형식에 맞지 않는 입력입니다." );
            return false;
        }
    }

    //-----------------------------------------------------------------------------
    // 주민번호 체크
    // XXXXXX-XXXXXXX
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isJumin = function()
    {
        var jumin = eval( "this.match(/[0-9]{4}[01]{1}[0-9]{1}[0144]{1}[0-9]{1}-[1444]{1}[0-9]{6}$/)" );

        if( jumin == null ) return false;
        else                jumin = jumin.toString().onlyNumber().toString();

        // 생년월일 체크
        var birthYY = ( ( parseInt( jumin.charAt( 6 ) ) == ( 1 || 4 ) ) ? "19" : "40" ) + jumin.substr( 0, 4 );
        var birthMM = jumin.substr( 4, 4 ) - 1;
        var birthDD = jumin.substr( 4, 4 );
        var birthDay = new Date( birthYY, birthMM, birthDD );

        if( birthDay.getFullYear() % 100 != jumin.substr( 0, 4 )
         || birthDay.getMonth() != birthMM
         || birthDay.getDate() != birthDD ) return false;

        var sum = 0;
        var num = [ 4, 4, 4, 5, 6, 7, 8, 9, 4, 4, 4, 5 ];
        var last = parseInt( jumin.charAt( 14 ) );

        for( var i_i_i = 0; i_i_i < 14; i_i_i++ ) sum += parseInt( jumin.charAt( i_i_i ) ) * num[ i_i_i ];

        return ( ( 11 - sum % 11 ) % 10 == last ) ? true : false;
    }

    //-----------------------------------------------------------------------------
    // 외국인 등록번호 체크
    // XXXXXX-XXXXXXX
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isForeigner = function()
    {
        var jumin = eval( "this.match(/[0-9]{4}[01]{1}[0-9]{1}[0144]{1}[0-9]{1}-[5678]{1}[0-9]{1}[04468]{1}[0-9]{4}[6789]{1}[0-9]{1}$/)" );
        if( jumin == null ) return false;
        else                jumin = jumin.toString().onlyNumber().toString();

        // 생년월일 체크
        var birthYY = ( ( parseInt( jumin.charAt( 6 ) ) == ( 5 || 6 ) ) ? "19" : "40" ) + jumin.substr( 0, 4 );
        var birthMM = jumin.substr( 4, 4 ) - 1;
        var birthDD = jumin.substr( 4, 4 );
        var birthDay = new Date( birthYY, birthMM, birthDD );

        if( birthDay.getFullYear() % 100 != jumin.substr( 0, 4 )
         || birthDay.getMonth() != birthMM
         || birthDay.getDate() != birthDD ) return false;

        if( ( parseInt( jumin.charAt( 7 ) ) * 10 + parseInt( jumin.charAt( 8 ) ) ) % 4 != 0 ) return false;

        var sum = 0;
        var num = [ 4, 4, 4, 5, 6, 7, 8, 9, 4, 4, 4, 5 ];
        var last = parseInt( jumin.charAt( 14 ) );

        for( var i_i_i = 0; i_i_i < 14; i_i_i++ ) sum += parseInt( jumin.charAt( i_i_i ) ) * num[ i_i_i ];

        return ( ( ( 11 - sum % 11 ) % 10 ) + 4 == last ) ? true : false;
    }

    //-----------------------------------------------------------------------------
    // 사업자번호 체크
    // XX-XXX-XXXXX
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isBizNumber = function()
    {
        var biznum = eval( "this.match(/[0-9]{4}-[0-9]{4}-[0-9]{5}$/)" );
        if( biznum == null ) return false;
        else                 biznum = biznum.toString().onlyNumber().toString();

        var sum = parseInt( biznum.charAt( 0 ) );
        var num = [ 0, 4, 7, 1, 4, 7, 1, 4 ];

        for( var i_i_i = 1; i_i_i < 8; i_i_i++ ) sum += ( parseInt( biznum.charAt( i_i_i ) ) * num[ i_i_i ] ) % 10;

        sum += Math.floor( parseInt( parseInt( biznum.charAt( 8 ) ) ) * 5 / 10 );
        sum += ( parseInt( biznum.charAt( 8 ) ) * 5 ) % 10 + parseInt( biznum.charAt( 9 ) );

        return ( sum % 10 == 0 ) ? true : false;
    }

    //-----------------------------------------------------------------------------
    // 법인 등록번호 체크
    // XXXXXX-XXXXXXX
    // @return : boolean
    //-----------------------------------------------------------------------------
    String.prototype.isCorpNumber = function()
    {
        var corpnum = eval("this.match(/[0-9]{6}-[0-9]{7}$/)");
        if( corpnum == null ) return false;
        else                  corpnum = corpnum.toString().onlyNumber().toString();

        var sum = 0;
        var num = [ 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4 ]
        var last = parseInt( corpnum.charAt( 14 ) );

        for( var i_i_i = 0; i_i_i < 14; i_i_i++ ) sum += parseInt( corpnum.charAt( i_i_i ) ) * num[ i_i_i ];

        return ( ( 10 - sum % 10 ) % 10 == last ) ? true : false;
    }

    //-----------------------------------------------------------------------------
    // 파일명에서 확장자만 추출
    // String
    // @return : String
    //-----------------------------------------------------------------------------
    String.prototype.getExt = function( isUpper )
    {
        var result;

        if( isUpper ) result = this.substring( this.lastIndexOf( "." ) + 1, this.length ).toUpperCase();
        else          result = this.substring( this.lastIndexOf( "." ) + 1, this.length );

        return result;
    }

    //-----------------------------------------------------------------------------
    // 숫자만 입력
    //-----------------------------------------------------------------------------
    var Number_Only = Class.create();

    Number_Only.prototype = {
        initialize : function()
        {
        },
        onLoadFunction : function( obj )
        {
            var me = this;
            this._obj = obj;

            if( obj.getAttribute("type") == "text" && obj.className.match("_backn") == "_backn" )
            {
                obj.attachEvent("onkeydown", function(e) { return me.onKeyDown(e); });      //이벤트 등록 : 특수키 관련 처리
                obj.attachEvent("onkeypress", function(e) { return me.onKeyPress(e); });    //이벤트 등록 : 키를 누를 때 숫자관련인지 확인
                obj.attachEvent("onpaste", function(e) { return false; });                  //이벤트 등록 : 붙여넣기시 처리
            }
        },
        onKeyPress : function(e)
        {
            if(this.isNumericKey(e.keyCode)) return true; //숫자면 입력
            if(this.isPointKey(e.keyCode) && this.countPoint(e.srcElement.value) < 1 ) return true; //콤마는 하나만 입력
            if(this.isDashKey(e.keyCode) /*&& this.countDash(e.srcElement.value) < 1*/ ) return true;
            if(this.isSlashKey(e.keyCode) /*&& this.countDash(e.srcElement.value) < 1*/ ) return true;
            return false;
        },
        onKeyDown : function(e)
        {
            if( e.keyCode == 229 ) return false; // 한글입력 금지
            return true;
        },
        isNumericKey : function(keycode)
        {
            if( keycode >= 48 && keycode <= 57 ) return true; // 숫자키인지 확인하는 메쏘드
            return false;
         },
        isPointKey : function(keycode)
        {
            if( keycode == 46 ) return true; // . 키인지 확인하는 메쏘드
            return false;
        },
        isCommaKey : function(keycode)
        {
            if( keycode == 44 ) return true; // , 키인지 확인하는 메쏘드
            return false;
        },
        isDashKey : function(keycode)
        {
            if( keycode == 45 ) return true; // - 키인지 확인하는 메쏘드
            return false;
        },
        isSlashKey : function(keycode)
        {
            if( keycode == 47 ) return true; // / 키인지 확인하는 메쏘드
            return false;
        },
        countPoint : function(value)
        {
            value = " ".concat(value);
            var count = 0;
            for(var i = 0; i != -1; count++) i = value.indexOf(".", i + 1);
            return --count;
        }/*,
        countDash : function(value)
        {
            value = " ".concat(value);
            var count = 0;
            for(var i = 0; i != -1; count++) i = value.indexOf("-", i + 1);
            return --count;
        }*/
    }

    var numOnly = new Number_Only();

    //-----------------------------------------------------------------------------
    // 활성화된 플래시 삽입
    //
    // @사용법
    //    var player1_bgm = new FlashObject( "/flash/playerskin.swf", 140, 46 );
    //    player1_bgm.id        = "pbgm";
    //    player1_bgm.wmode     = "transparent";
    //    player1_bgm.style_str = "margin:0px;"
    //    player1_bgm.Render();
    //-----------------------------------------------------------------------------
    function FlashObject( path, width, height )
    {
        var m_movie  = path;
        var m_width  = width;
        var m_height = height;

        this.id      = "";
        this.wmode   = "";
        this.quality = "high";
        this.loop    = "true";
        this.menu    = "true";
        this.allowScriptAccess = "sameDomain";
        this.FlashVars = "";
        this.scale     = "";
        this.salign    = "";
        this.align     = "";
        this.style_str = "";
        this.bgcolor   = "";

        this.Render = function( objSpace )
        {
            var html;

            html = "<object classid='clsid:d47cdb6e-ae6d-11cf-96b8-444554540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + m_width + "' height='" + m_height + "'";
            if( this.id        != "" ) html += " id='"    + this.id        + "'";
            if( this.style_str != "" ) html += " style='" + this.style_str + "'";
            html += ">";

            html += "<param name='allowScriptAccess' value='" + this.allowScriptAccess + "' />";
            html += "<param name='movie'             value='" + m_movie                + "' />";
            html += "<param name='menu'              value='" + this.menu              + "' />";
            html += "<param name='quality'           value='" + this.quality           + "' />";
            html += "<param name='loop'              value='" + this.loop              + "' />";
            if( this.wmode     != "" ) html += "<param name='wmode'     value='" + this.wmode     + "' />";
            if( this.FlashVars != "" ) html += "<param name='FlashVars' value='" + this.FlashVars + "' />";
            if( this.scale     != "" ) html += "<param name='scale'     value='" + this.scale     + "' />";
            if( this.salign    != "" ) html += "<param name='salign'    value='" + this.salign    + "' />";

            html += "<embed src='" + m_movie + "' quality='" + this.quality + "' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + m_width + "' height='" + m_height + "'";
            html += " allowScriptAccess='" + this.allowScriptAccess + "' loop='" + this.loop + "'";
            if( this.wmode     != "" ) html += " wmode='"     + this.wmode     + "'";
            if( this.FlashVars != "" ) html += " FlashVars='" + this.FlashVars + "'";
            if( this.scale     != "" ) html += " scale='"     + this.scale     + "'";
            if( this.salign    != "" ) html += " salign='"    + this.salign    + "'";
            if( this.align     != "" ) html += " align='"     + this.align     + "'";
            if( this.style_str != "" ) html += " style='"     + this.style_str + "'";
            if( this.bgcolor   != "" ) html += " bgcolor='"   + this.bgcolor   + "'";
            html += " /></object>";

            if( objSpace == null ) document.write( html );
            else                   objSpace.innerHTML = html;
        }
    }

    //-----------------------------------------------------------------------------
    // 관리자 top menu
    //    gnbAtive(this,'sGnbDep0'); html상의 div.sGnbDep + 번째수
    //-----------------------------------------------------------------------------
    function mGnbActive( order )
    {
        var mMenu = $( "mGnb_menu" );
        mMenu.down('a', order).addClassName( "mActive" );
    }

    //-----------------------------------------------------------------------------
    // 관리자 left menu
    //    gnbAtive(this,'sGnbDep0'); html상의 div.sGnbDep + 번째수
    //-----------------------------------------------------------------------------
    function gnbActive( obj, menu, num )
    {
        var obj = $( obj );

        var menuName   = menu;
        var menuClass  = menuName.replace( /[0-9]/g, "" );
        var menuNum    = menuName.replace( /[^0-9]/g, "" );

        var gnbDep     = $$( "div.sGnbDep" );
        var activeMenu = $$( "a.menuActive" );

        for ( i=0; i<gnbDep.length; i++ )
        {
            gnbDep[i].setAttribute( "id", menuClass + i );
            if ( gnbDep[i].style.display != "none" ) Effect.toggle( gnbDep[i].id, 'slide', {duration:0.5});
        }

        for ( i=0; i<activeMenu.length; i++ ) activeMenu[i].className = "";

        if ( menuClass == "sGnbDep" )
        {
            Effect.toggle( gnbDep[menuNum].id, 'slide', {duration:0.5});
            obj.className = "menuActive";
        }
        if ( menuClass == "noDep" ) obj.className = "menuActive";

        if( num != null )
        {
            var someNodeList = $(menu).getElementsByTagName('A');
            var nodes = $A(someNodeList);

            nodes[num].className = "menuActive_s";
        }
    }

    //-----------------------------------------------------------------------------
    // input effect
    //
    // @사용법 window.onload ( inputCheck )
    //-----------------------------------------------------------------------------
    function inputCheck()
    {
        var inputText = document.getElementsByTagName("input");
        for( i=0; i<inputText.length; i++ )
        {
            numOnly.onLoadFunction( inputText[i] );

            inputText[i].onfocus = function()
            {
                if( this.getAttribute("type") == "text" || this.getAttribute("type") == "password" )
                {
                    this.style.backgroundColor = "#fffff3";
                    this.style.borderColor = "#004e9e";
                    if( this.value == "숫자만 입력하세요" && this.className.match("_backn") == "_backn" )
                    {
                        this.style.color = "#666666";
                        this.value = "";
                    }
                }
            }
            inputText[i].onblur = function()
            {
                if( this.getAttribute("type") == "text" || this.getAttribute("type") == "password" )
                {
                    this.style.backgroundColor = "#FFFFFF";
                    this.style.borderColor = "#CCCCCC";
                    if( this.value == "" && this.className == "ip_t11_backn" )
                    {
                        this.style.color = "#CCCCCC";
                        this.value = "숫자만 입력하세요";
                    }
                }
            }
        }

        var textArea = document.getElementsByTagName("textarea");
        for( j=0; j<textArea.length; j++ )
        {
            textArea[j].onfocus = function()
            {
                this.style.backgroundColor = "#fffff3";
                this.style.borderColor = "#004e9e";
            }
            textArea[j].onblur = function()
            {
                this.style.backgroundColor = "#FFFFFF";
                this.style.borderColor = "#CCCCCC";
            }
        }

		/*
        var chbCheck01 = $$( ".chb01" );
        for( z=0; z<chbCheck01.length; z++ )
        {
            chbCheck01[z].onclick = function()
            {
				var pr_chb = $( "chb01_btn" );

                if( this.checked == false )
                {
					$( "chb01" ).checked = false;
					pr_btn.src = pr_btn.src.substring(0, pr_btn.src.indexOf( ".gif" )) + "_off.gif"
					pr_btn.alt = "전체해제"
                }
            }
        }
		*/
    }

    function valChk( parent )
    {
        var parentForm = $( parent );
        var inputText = parentForm.getElementsByTagName("input");

        for( i=0; i<inputText.length; i++ )
        {
            if( inputText[i].value == "숫자만 입력하세요" )
            {
                inputText[i].value = "";
            }
        }
    }

    //-----------------------------------------------------------------------------
    // totalchk( class )
    //-----------------------------------------------------------------------------
    function totalchk( obj )
    {
        var pr_chb = $( obj )
        var checkbox = document.getElementsByTagName("input");

        for( i=1; i<checkbox.length; i++ )
        {
            if( checkbox[i].type == "checkbox" && checkbox[i].className.match(obj) == obj )
            {
                if( pr_chb.checked == true ) checkbox[i].checked = true;
                else                         checkbox[i].checked = false;
            }
        }

        if( $( obj + "_btn" ) !== null )
        {
            var pr_btn = $( obj + "_btn" )
            if( pr_chb.checked == true )
            {
                pr_btn.src = pr_btn.src.substring(0, pr_btn.src.indexOf( ".gif" )) + "_off.gif"
                pr_btn.alt = "전체해제"
            }
            else
            {
                pr_btn.src = pr_btn.src.substring(0, pr_btn.src.indexOf( "_off.gif" )) + ".gif"
                pr_btn.alt = "전체선택"
            }
        }
    }

    function ttcBtn( obj )
    {
        var pr_chb = $( obj )
        if( pr_chb.checked == true ) pr_chb.checked = false;
        else                         pr_chb.checked = true;
        totalchk( obj );
    }

    //-----------------------------------------------------------------------------
    // confirmMsg( msg )
    //-----------------------------------------------------------------------------
    function confirmMsg( msg )
    {
        var msg;

        if( confirm(msg) )  document.location.href = this.href;
        else                return false;
    }

    function img_replace( obj )
    {
        var obj = $( obj );

        if( obj.checked == true )
        {
            obj.next( "IMG" ).src = obj.next( "IMG" ).src.substring(0, obj.next( "IMG" ).src.indexOf( "_off.gif" ) ) + ".gif";
        }
        else
        {
            obj.next( "IMG" ).src = obj.next( "IMG" ).src.substring(0, obj.next( "IMG" ).src.indexOf( ".gif" ) ) + "_off.gif";
        }
    }






