/* È­¸é¿¡¼­ ¿ª»óÃ³¸®½Ã TR °´Ã¼¿¡¼­ Over Event ¹ß»ý½Ã ÀÌ °ªÀ» ÂüÁ¶·Î »öÀ» º¯°æÇÑ´Ù */
var sRollOver   = "#dee0e0";
/* È­¸é¿¡¼­ ¿ª»óÃ³¸®½Ã TR °´Ã¼¿¡¼­ Out  Event ¹ß»ý½Ã ÀÌ °ªÀ» ÂüÁ¶·Î »öÀ» º¯°æÇÑ´Ù */
var sRollOut    = "white";

var sSysDate    = null;
var sImgGb      = 0;

 
if ( document.getElementById && ! document.all )
{
    var isNS = true;
    var isIE = false;
}
else
{
    var isIE = true;
    var isNS = false;
}

if( ! window.event && window.captureEvents )
{
    // set up event capturing for mouse events ( add or subtract as desired )
    window.captureEvents( Event.MOUSEOVER | Event.MOUSEOUT | Event.CLICK | Event.DBLCLICK );
    // set window event handlers ( add or subtract as desired )
    window.onmouseover = WM_getCursorHandler;
    window.onmouseout = WM_getCursorHandler;
    window.onclick = WM_getCursorHandler;
    window.ondblclick = WM_getCursorHandler;
    // create an object to store the event properties
    window.event = new Object;
}

function WM_getCursorHandler( e )
{
    // set event properties to global vars ( add or subtract as desired )
    window.event.clientX = e.pageX;
    window.event.clientY = e.pageY;
    window.event.x = e.layerX;
    window.event.y = e.layerY;
    window.event.screenX = e.screenX;
    window.event.screenY = e.screenY;
    // route the event back to the intended function
    if ( routeEvent( e ) == false )
    {
        return false;
    }
    else
    {
        return true;
    }
}

// Ä³¸¯ÅÍ Å¸ÀÔ °ËÁõ 'H' - ÇÑ±Û, 'E' - ¿µ¹®, 'N' - ¼ýÀÚ, 'Z' - ±âÅ¸
function getCharType( pValue )
{
    var bHan = false;
    var bAlp = false;
    var bNum = false;
    var bEtc = false;

    var retStr = "";

    if( isEmpty( pValue ) )
    {
        return "";
    }

    for( var idx = 0; idx < pValue.length; idx ++ )
    {
        if ( isAlpha( pValue[idx] ) )
        {
            bAlp = true;
        }
        else if ( isNum( pValue[idx] ) )
        {
            bNum = true;
        }
        else if ( isHangul( pValue[idx] ) )
        {
            bHan = true;
        }
        else
        {
            bEtc = true;
        }

        if ( bHan ) retStr = retStr + "H";
        if ( bAlp ) retStr = retStr + "E";
        if ( bNum ) retStr = retStr + "N";
        if ( bEtc ) retStr = retStr + "Z";
    }

    return retStr;
}

////////////////////////////////
// À©µµ¿ì »õÃ¢..
////////////////////////////////

// »õÃ¢ ¿©´Â ÇÔ¼ö
function uf_newWin( url, winName, sizeW, sizeH )
{
    var nLeft  = screen.width / 2 - sizeW / 2 ;
    var nTop  = screen.height / 2 - sizeH / 2 ;

    opt = ",toolbar=no,menubar=no,location=no,scrollbars=no,status=no";
    window.open( url, winName, "left=" + nLeft + ",top=" +  nTop + ",width=" + sizeW + ",height=" + sizeH  + opt );

}

function uf_newWin2( url, winName, sizeW, sizeH, scrollable )
{
    var nLeft  = screen.width / 2 - sizeW / 2 ;
    var nTop  = screen.height / 2 - sizeH / 2 ;

    var scl = "";

    if ( scrollable == 'T' )
    {
        scl = "yes";
    }
    else
    {
        scl = "no";
    }

    opt = ",toolbar=no,menubar=no,location=no,scrollbars="  + scl + ",status=no";
    window.open( url, winName, "left=" + nLeft + ",top=" +  nTop + ",width=" + sizeW + ",height=" + sizeH  + opt );

}

// »õÃ¢ »çÀÌÁî Á¤ÇÔ
function uf_reSize ( sizeW, sizeH )
{
    window.resizeTo( sizeW, sizeH );

}

// ¿É¼ÇÀÌ ÀÖ´Â°æ¿ì

function selDataChange( form )
{
    var DataIndex = form.url.selectedIndex;
    if ( form.url.options[DataIndex].value != null )
    {
        location = form.url.options[DataIndex].value;
    }
}

function selDataChange2( form )
{
    var DataIndex = form.url2.selectedIndex;
    if ( form.url2.options[DataIndex].value != null )
    {
        location = form.url2.options[DataIndex].value;
    }
}


////////////////////////////////
// Validation Ã¼Å© 
////////////////////////////////

/* *
* ÀÔ·Â°ªÀÌ NULLÀÎÁö Ã¼Å©
*/
function isNull( input )
{
    if ( input.value == null || input.value == "" )
    {
        return true;
    }
    return false;
}

/* *
* ÀÔ·Â°ª¿¡ ½ºÆäÀÌ½º ÀÌ¿ÜÀÇ ÀÇ¹ÌÀÖ´Â °ªÀÌ ÀÖ´ÂÁö Ã¼Å©
* ex ) if ( isEmpty( form.keyword ) ) {
*         alert( "°Ë»öÁ¶°ÇÀ» ÀÔ·ÂÇÏ¼¼¿ä." );
*     }
*/
function isEmpty( input )
{
    if ( input.value == null || input.value.replace( / /gi, "" ) == "" )
    {
        return true;
    }
    return false;
}

/* *
* ÀÔ·Â°ª¿¡ Æ¯Á¤ ¹®ÀÚ( chars )°¡ ÀÖ´ÂÁö Ã¼Å©
* Æ¯Á¤ ¹®ÀÚ¸¦ Çã¿ëÇÏÁö ¾ÊÀ¸·Á ÇÒ ¶§ »ç¿ë
* ex ) if ( containsChars( form.name, "!,*&^%$#@~;" ) ) {
*         alert( "ÀÌ¸§ ÇÊµå¿¡´Â Æ¯¼ö ¹®ÀÚ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù." );
*     }
*/
function containsChars( input, chars )
{
    for ( var inx = 0; inx < input.value.length; inx ++ )
    {
        if ( chars.indexOf( input.value.charAt( inx ) ) != - 1 )
        return true;
    }
    return false;
}

/* *
* ÀÔ·Â°ªÀÌ Æ¯Á¤ ¹®ÀÚ( chars )¸¸À¸·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
* Æ¯Á¤ ¹®ÀÚ¸¸ Çã¿ëÇÏ·Á ÇÒ ¶§ »ç¿ë
* ex ) if ( ! containsCharsOnly( form.blood, "ABO" ) ) {
*         alert( "Ç÷¾×Çü ÇÊµå¿¡´Â A,B,O ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù." );
*     }
*/
function containsCharsOnly( input, chars )
{
    for ( var inx = 0; inx < input.value.length; inx ++ )
    {
        if ( chars.indexOf( input.value.charAt( inx ) ) == - 1 )
        return false;
    }
    return true;
}
function isStartWith( input, chars )
{
    for ( var inx = 0; inx < chars.length; inx ++ )
    {
        if ( chars.indexOf( input.value.charAt( 0 ) ) == - 1 )
        return false;
    }
    return true;
}
/* *
* ÀÔ·Â°ªÀÌ ¾ËÆÄºªÀÎÁö Ã¼Å©
* ¾Æ·¡ isAlphabet() ºÎÅÍ isNumComma()±îÁöÀÇ ¸Þ¼Òµå°¡
* ÀÚÁÖ ¾²ÀÌ´Â °æ¿ì¿¡´Â var chars º¯¼ö¸¦
* global º¯¼ö·Î ¼±¾ðÇÏ°í »ç¿ëÇÏµµ·Ï ÇÑ´Ù.
* ex ) var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
*     var lowercase = "abcdefghijklmnopqrstuvwxyz";
*     var number    = "0123456789";
*     function isAlphaNum( input ) {
*         var chars = uppercase + lowercase + number;
*         return containsCharsOnly( input, chars );
*     }
*/
function isAlphabet( input )
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª ´ë¹®ÀÚÀÎÁö Ã¼Å©
*/
function isUpperCase( input )
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª ¼Ò¹®ÀÚÀÎÁö Ã¼Å©
*/
function isLowerCase( input )
{
    var chars = "abcdefghijklmnopqrstuvwxyz ";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ª¿¡ ¼ýÀÚ¸¸ ÀÖ´ÂÁö Ã¼Å©
*/
function isNumber( input )
{
    var chars = "0123456789";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ªÀÌ ¾ËÆÄºª, ¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isAlphaNum( input )
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
    return containsCharsOnly( input, chars );
}

function isBigAlphaNum( input )
{
    var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
    return containsCharsOnly( input, chars );
}
/* *
* ÀÔ·Â°ªÀÌ ¼ýÀÚ, ´ë½Ã( - )·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isNumDash( input )
{
    var chars = "-0123456789";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ªÀÌ ¼ýÀÚ, ÄÞ¸¶( , )·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
*/
function isNumComma( input )
{
    var chars = ",0123456789";
    return containsCharsOnly( input, chars );
}

/* *
* ÀÔ·Â°ªÀÌ »ç¿ëÀÚ°¡ Á¤ÀÇÇÑ Æ÷¸Ë Çü½ÄÀÎÁö Ã¼Å©
* ÀÚ¼¼ÇÑ format Çü½ÄÀº ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ 'regular expression'À» ÂüÁ¶
*/
function isValidFormat( input, format )
{
    if ( input.value.search( format ) != - 1 )
    {
        return true; // ¿Ã¹Ù¸¥ Æ÷¸Ë Çü½Ä
    }
    return false;
}

/* *
* ÀÔ·Â°ªÀÌ ÀÌ¸ÞÀÏ Çü½ÄÀÎÁö Ã¼Å©
* ex ) if ( ! isValidEmail( form.email ) ) {
*         alert( "¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ ÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù." );
*     }
*/
function isValidEmail( input )
{
    //    var format = /^(\S+)@(\S+)\.([A-Za-z]+)$/;
    var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
    return isValidFormat( input, format );
}

/* *
* ÀÔ·Â°ªÀÌ ÀüÈ­¹øÈ£ Çü½Ä( ¼ýÀÚ - ¼ýÀÚ - ¼ýÀÚ )ÀÎÁö Ã¼Å©
*/
function isValidPhone( input )
{
    var format = /^(\d+)-(\d+)-(\d+)$/;
    return isValidFormat( input, format );
}

/* *
* ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ¸¦ ¸®ÅÏ
* ex ) if ( getByteLength( form.title ) > 100 ) {
*         alert( "Á¦¸ñÀº ÇÑ±Û 50ÀÚ(¿µ¹® 100ÀÚ) ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù." );
*     }
*/
function getByteLengthObject( input )
{
    var byteLength = 0;
    for ( var inx = 0; inx < input.value.length; inx ++ )
    {
        var oneChar = escape( input.value.charAt( inx ) );
        if ( oneChar.length == 1 )
        {
            byteLength ++ ;
        }
        else if ( oneChar.indexOf( "%u" ) != - 1 )
        {
            byteLength += 2;
        }
        else if ( oneChar.indexOf( "%" ) != - 1 )
        {
            byteLength += oneChar.length / 3;
        }
    }
    return byteLength;
}

/* *
* ÀÔ·Â°ª¿¡¼­ ÄÞ¸¶¸¦ ¾ø¾Ø´Ù.
*/
function removeComma( input )
{
    return input.value.replace( /,/gi, "" );
}

/* *
* À¯È¿ÇÑ( Á¸ÀçÇÏ´Â ) ¿ù( êÅ )ÀÎÁö Ã¼Å©
*/
function isValidMonth( mm )
{
    var m = parseInt( mm, 10 );
    return ( m >= 1 && m <= 12 );
}

/* *
* À¯È¿ÇÑ( Á¸ÀçÇÏ´Â ) ÀÏ( ìí )ÀÎÁö Ã¼Å©
*/
function isValidDay( yyyy, mm, dd )
{
    var m = parseInt( mm, 10 ) - 1;
    var d = parseInt( dd, 10 );

    var end = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
    if ( ( yyyy % 4 == 0 && yyyy % 100 != 0 ) || yyyy % 400 == 0 )
    {
        end[1] = 29;
    }

    return ( d >= 1 && d <= end[m] );
}

/* *
* À¯È¿ÇÑ( Á¸ÀçÇÏ´Â ) ½Ã( ãÁ )ÀÎÁö Ã¼Å©
*/
function isValidHour( hh )
{
    var h = parseInt( hh, 10 );
    return ( h >= 1 && h <= 24 );
}

/* *
* À¯È¿ÇÑ( Á¸ÀçÇÏ´Â ) ºÐ( ÝÂ )ÀÎÁö Ã¼Å©
*/
function isValidMin( mi )
{
    var m = parseInt( mi, 10 );
    return ( m >= 1 && m <= 60 );
}

/* *
* Time Çü½ÄÀÎÁö Ã¼Å©( ´À½¼ÇÑ Ã¼Å© )
*/
function isValidTimeFormat( time )
{
    return ( ! isNaN( time ) && time.length == 12 );
}

/* *
* À¯È¿ÇÏ´Â( Á¸ÀçÇÏ´Â ) Time ÀÎÁö Ã¼Å©
* ex ) var time = form.time.value; // '200102310000'
*     if ( ! isValidTime( time ) ) {
*         alert( "¿Ã¹Ù¸¥ ³¯Â¥°¡ ¾Æ´Õ´Ï´Ù." );
*     }
*/
function isValidTime( time )
{
    var year  = time.substring( 0, 4 );
    var month = time.substring( 4, 6 );
    var day   = time.substring( 6, 8 );
    var hour  = time.substring( 8, 10 );
    var min   = time.substring( 10, 12 );

    if ( parseInt( year, 10 ) >= 1900  && isValidMonth( month ) &&
    isValidDay( year, month, day ) && isValidHour( hour )   &&
    isValidMin( min ) )
    {
        return true;
    }
    return false;
}

/* *
* Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯
* parameter time : Time Çü½ÄÀÇ String
*/
function toTimeObject( time )
{
    // parseTime( time )
    var year  = time.substr( 0, 4 );
    var month = time.substr( 4, 2 ) - 1; // 1¿ù = 0, 12¿ù = 11
    var day   = time.substr( 6, 2 );
    var hour  = time.substr( 8, 2 );
    var min   = time.substr( 10, 2 );

    return new Date( year, month, day, hour, min );
}

/* *
* ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ½ºÆ®¸µÀ¸·Î º¯È¯
* parameter date : JavaScript Date Object
*/
function toTimeString( date )
{
    // formatTime( date )
    var year  = date.getFullYear();
    var month = date.getMonth() + 1; // 1¿ù = 0, 12¿ù = 11ÀÌ¹Ç·Î 1 ´õÇÔ
    var day   = date.getDate();
    var hour  = date.getHours();
    var min   = date.getMinutes();

    if ( ( "" + month ).length == 1 )
    {
        month = "0" + month;
    }
    if ( ( "" + day ).length   == 1 )
    {
        day   = "0" + day;
    }
    if ( ( "" + hour ).length  == 1 )
    {
        hour  = "0" + hour;
    }
    if ( ( "" + min ).length   == 1 )
    {
        min   = "0" + min;
    }

    return ( "" + year + month + day + hour + min )
}

/* *
* TimeÀÌ ÇöÀç½Ã°¢ ÀÌÈÄ( ¹Ì·¡ )ÀÎÁö Ã¼Å©
*/
function isFutureTime( time )
{
    return ( toTimeObject( time ) > new Date() );
}

/* *
* TimeÀÌ ÇöÀç½Ã°¢ ÀÌÀü( °ú°Å )ÀÎÁö Ã¼Å©
*/
function isPastTime( time )
{
    return ( toTimeObject( time ) < new Date() );
}

/* *
* ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ
* ex ) var time = form.time.value; // '20000101000'
*     alert( shiftTime( time, 0, 0, - 100, 0 ) );
*     = > 2000 / 01 / 01 00 : 00 À¸·ÎºÎÅÍ 100ÀÏ Àü Time
*/
function shiftTime( time, y, m, d, h )
{
    // moveTime( time, y, m, d, h )
    var date = toTimeObject( time );

    date.setFullYear( date.getFullYear() + y ); // y³âÀ» ´õÇÔ
    date.setMonth( date.getMonth() + m );       // m¿ùÀ» ´õÇÔ
    date.setDate( date.getDate() + d );         // dÀÏÀ» ´õÇÔ
    date.setHours( date.getHours() + h );       // h½Ã¸¦ ´õÇÔ

    return toTimeString( date );
}

/* *
* µÎ TimeÀÌ ¸î °³¿ù Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é( ¹Ì·¡¸é ) minus( - )
*/
function getMonthInterval( time1, time2 )
{
    // measureMonthInterval( time1, time2 )
    var date1 = toTimeObject( time1 );
    var date2 = toTimeObject( time2 );

    var years  = date2.getFullYear() - date1.getFullYear();
    var months = date2.getMonth() - date1.getMonth();
    var days   = date2.getDate() - date1.getDate();

    return ( years * 12 + months + ( days >= 0 ? 0 : - 1 ) );
}

/* *
* µÎ TimeÀÌ ¸çÄ¥ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é( ¹Ì·¡¸é ) minus( - )
*/
function getDayInterval( time1, time2 )
{
    var date1 = toTimeObject( time1 );
    var date2 = toTimeObject( time2 );
    var day   = 1000 * 3600 * 24; // 24½Ã°£

    return parseInt( ( date2 - date1 ) / day, 10 );
}

/* *
* µÎ TimeÀÌ ¸î ½Ã°£ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é( ¹Ì·¡¸é ) minus( - )
*/
function getHourInterval( time1, time2 )
{
    var date1 = toTimeObject( time1 );
    var date2 = toTimeObject( time2 );
    var hour  = 1000 * 3600; // 1½Ã°£

    return parseInt( ( date2 - date1 ) / hour, 10 );
}

/* *
* ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏ
*/
function getCurrentTime()
{
    return toTimeString( new Date() );
}

/* *
* ÇöÀç ½Ã°¢°ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ
*/
function getRelativeTime( y, m, d, h )
{

    return shiftTime( getCurrentTime(), y, m, d, h );
}

/* *
* ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getYear()
{

    return getCurrentTime().substr( 0, 4 );
}

/* *
* ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getMonth()
{

    return getCurrentTime().substr( 4, 2 );
}

/* *
* ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getDay()
{

    return getCurrentTime().substr( 6, 2 );
}

/* *
* ÇöÀç ãÁ¸¦ HHÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getHour()
{

    return getCurrentTime().substr( 8, 2 );
}

/* *
* ¿À´ÃÀÌ ¹«½¼ ¿äÀÏÀÌ¾ß ?
* ex ) alert( '¿À´ÃÀº ' + getDayOfWeek() + '¿äÀÏÀÔ´Ï´Ù.' );
*/
function getDayOfWeek()
{
    var now = new Date();

    var day = now.getDay(); // ÀÏ¿äÀÏ = 0, ¿ù¿äÀÏ = 1, ..., Åä¿äÀÏ = 6
    var week = new Array( 'ÀÏ', '¿ù', 'È­', '¼ö', '¸ñ', '±Ý', 'Åä' );

    return week[day];
}


/* *
* Æ¯Á¤³¯Â¥ÀÇ ¿äÀÏÀ» ±¸ÇÑ´Ù.
*/
function getDayOfWeek( time )
{
    var now = toTimeObject( time );

    var day = now.getDay(); // ÀÏ¿äÀÏ = 0, ¿ù¿äÀÏ = 1, ..., Åä¿äÀÏ = 6
    var week = new Array( 'ÀÏ', '¿ù', 'È­', '¼ö', '¸ñ', '±Ý', 'Åä' );

    return week[day];
}

/* *
*   ¹®ÀÚ¿­ÀÇ ¿À¸¥ÂÊ ³¡¿¡¼­ ºÎÅÍ ÁöÁ¤µÈ °³¼ö¸¸Å­ÀÇ ¹®ÀÚµéÀ» ¸®ÅÏÇÑ´Ù.
*/
function substrInverse( str, num )
{
    var len;

    len = str.length;

    return str.substr( len - num, num );
}

/* *
*  ¹®ÀÚ¿­·ÎÀÇ Æ¯Á¤À§Ä¡·ÎºÎÅÍ ÁöÁ¤µÈ °³¼öÀÇ ¹®ÀÚµéÀ» ¸®ÅÏÇÑ´Ù.
*/
function substrMid( str, idx, num )
{
    return str.substr( idx - 1, num );
}

function Half2Full( HalfVal )
{
    var arg;
    arg = myHalf2Full( HalfVal );
    return arg;
}

function myHalf2Full( HalfVal )
{
    var FullChar = [
    "¡¡", "£¡", "£¢", "££", "£¤", "£¥", "£¦", "£§", "£¨",    	// 33 ~
    "£©", "£ª", "£«", "£¬", "£­", "£®", "£¯", "£°", "£±", "£²",      // 41 ~
    "£³", "£´", "£µ", "£¶", "£·", "£¸", "£¹", "£º", "£»", "£¼",      // 51 ~
    "£½", "£¾", "£¿", "£À", "£Á", "£Â", "£Ã", "£Ä", "£Å", "£Æ",      // 61 ~
    "£Ç", "£È", "£É", "£Ê", "£Ë", "£Ì", "£Í", "£Î", "£Ï", "£Ð",      // 71 ~
    "£Ñ", "£Ò", "£Ó", "£Ô", "£Õ", "£Ö", "£×", "£Ø", "£Ù", "£Ú",      // 81 ~
    "£Û", "£Ü", "£Ý", "£Þ", "£ß", "£à", "£Á", "£Â", "£Ã", "£Ä",      // 91 ~
    "£Å", "£Æ", "£Ç", "£È", "£É", "£Ê", "£Ë", "£Ì", "£Í", "£Î",      // 101 ~
    "£Ï", "£Ð", "£Ñ", "£Ò", "£Ó", "£Ô", "£Õ", "£Ö", "£×", "£Ø",      // 111 ~
    "£Ù", "£Ú", "£û", "£ü", "£ý", "¢¦"                        	// 121 ~
    ];
    var stFinal = "";
    var ascii;
    for( i = 0; i < HalfVal.length; i ++ )
    {
        ascii = HalfVal.charCodeAt( i );
        if( ( 31 < ascii && ascii < 128 ) )
        {
            stFinal += FullChar[ascii - 32];
        }
        else
        {
            stFinal += HalfVal.charAt( i );
        }
    }
    return stFinal;
}



function chkJumin(objectName1, objectName2) {
	var resiFirst = eval('document.'+objectName1+'.value');
	var resiLast = eval('document.'+objectName2+'.value');

	var chk = 0;
	var nYear   = resiFirst.substring(0,2);
	var nMondth = resiFirst.substring(2,4);
	var nDay    = resiFirst.substring(4,6);
	var nSex    = resiLast.charAt(0);

	for (i=0; i<resiFirst.length; i++) {
        	if(Num.indexOf(resiFirst.substring(i,i+1))<0) {
			alert('ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕºÎºÐ¿¡ Àß¸øµÈ ¹®ÀÚ°¡ ÀÖ½À´Ï´Ù');
			eval('document.'+objectName1+'.focus();');
			eval('document.'+objectName1+'.select();');
			return false;
		}
	}
	for (i=0; i<resiLast.length; i++) {
        	if(Num.indexOf(resiLast.substring(i,i+1))<0) {
			alert('ÁÖ¹Îµî·Ï¹øÈ£ µÞºÎºÐ¿¡ Àß¸øµÈ ¹®ÀÚ°¡ ÀÖ½À´Ï´Ù');
			eval('document.'+objectName2+'.focus();');
			eval('document.'+objectName2+'.select();');
			return false;
		}
	}	
	
	if ( resiFirst.length!=6 ||  nMondth<1 || nMondth>12 || nDay<1 || nDay>31) {
		alert('ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕºÎºÐ¿¡ Àß¸øµÇ¾ú½À´Ï´Ù');
		eval('document.'+objectName1+'.focus();');
		eval('document.'+objectName1+'.select();');
		return false;
	}
	
	if ( resiLast.length!=7 || (nSex!=1 && nSex!=2 && nSex!=3 && nSex!=4) ) {
		alert('ÁÖ¹Îµî·Ï¹øÈ£ µÞºÎºÐ¿¡ Àß¸øµÇ¾ú½À´Ï´Ù');
			eval('document.'+objectName2+'.focus();');
			eval('document.'+objectName2+'.select();');
		return false;
	}
	
	var i;
	for (i=0; i<6; i++) {
		chk += ( (i+2) * parseInt( resiFirst.charAt(i) ));
	}
	
	for (i=6; i<12; i++) {
		chk += ( (i%8+2) * parseInt( resiLast.charAt(i-6) ));
	}
	
	chk = 11 - (chk%11);
	chk %= 10;
	
	if (chk != parseInt( resiLast.charAt(6))) {
		alert('À¯È¿ÇÏÁö¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù!!');
		eval('document.'+objectName1+'.focus();');		
		return false;
	}
	return true;
}


////////////////////////////////////////////////////////////////
// Cookie °ü·Ã 
////////////////////////////////////////////////////////////////
/* This function is used to set cookies */
function setCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

/* This function is used to get cookies */
function getCookie(name) {
	var prefix = name + "=" 
	var start = document.cookie.indexOf(prefix) 

	if (start==-1) {
		return null;
	}
	
	var end = document.cookie.indexOf(";", start+prefix.length) 
	if (end==-1) {
		end=document.cookie.length;
	}

	var value=document.cookie.substring(start+prefix.length, end) 
	return unescape(value);
}

/* This function is used to delete cookies */
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


////////////////////////////////////////////////////////////////
// µ¥ÀÌÅÍ Àü¼ÛÇüÅÂ °ü·Ã
////////////////////////////////////////////////////////////////

// get ¹æ½ÄÀÇ ÆÄ¶ó¹ÌÅÍ¸¦ ÇØ´çÆû¿¡ input hidden °´Ã¼·Î »ý¼ºÇÑ´Ù.
function get2post( frm, sSearch )
{
    if ( sSearch.length > 0 )
    {

        var asKeyValues = sSearch.split( '&' );
        var asKeyValue  = '';

        for ( var i = 0; i < asKeyValues.length; i ++ )
        {

            asKeyValue = asKeyValues[i].split( '=' );
            var e = document.createElement( "input" );
            e.setAttribute( "type", "hidden" );
            e.setAttribute( "name", asKeyValue[0] );
            e.setAttribute( "value", asKeyValue[1] );
            e.setAttribute( "_temp", "true" );

            // 			alert( "[" + e.name + "]:[" + e.value + "]" );

            frm.appendChild( e );
        }
    }
    // 	 alert( "form °´Ã¼ °¹¼ö" + frm.elements.length );
}

// get2post·Î »ý¼ºÇÑ ÀÓ½Ã °´Ã¼¸¦ ÆÄ±«ÇÑ´Ù.
function removeTempAttribute( frm )
{
    var idx = 0;
    while ( idx < frm.elements.length )
    {
        var obj = frm.elements[idx];

        if( obj.getAttribute( "_temp" ) != null && obj.getAttribute( "_temp" ) == "true" )
        {
            frm.removeChild( obj );
            continue;
        }
        idx ++ ;
    }
}



////////////////////////////////////////////////////////////////
// checkbox, select , radio °ü·Ã
////////////////////////////////////////////////////////////////
function setSelect( oSelect, value, text ) {	
    for( var i = 0; i < oSelect.options.length; i ++ )
    {
        if( oSelect.options[i].value == value )		oSelect.options[i].selected = true;
		if( oSelect.options[i].innerText == text )	oSelect.options[i].selected = true;
    }
}
function getSelectValue( oSelect ){
    var retValue = '';
    for( var j = 0; j < oSelect.length; j ++ )
    {
        if ( oSelect.options[j].selected ) {
            if ( retValue != '' ) retValue += ', ';
            retValue += oSelect.options[j].value;
        }
    }
    return retValue;
}
function getSelectText( oSelect ){
    var retValue = '';
    for( var j = 0; j < oSelect.length; j ++ )
    {
        if ( oSelect.options[j].selected && oSelect.options[j].value != '' )
        {
            if ( retValue != '' ) retValue += ', ';
            retValue += oSelect.options[j].innerText;
        }
    }
    return retValue;
}

// simple submit setcheckbox function by suineg    Àü¼ÛÀü checkbox ÀÔ·Â°ª ¼³Á¤.
/*
function setCheckbox( frm, true_str, false_str )
{
    if ( ( true_str != null ) && ( false_str != null ) )
    {
        frm.value = ( frm.checked ) ? true_str : false_str;
    }
    frm.value = ( frm.checked ) ? 'T' : 'F';
}
*/
function onsubmitCheckbox(oCheckbox) {
	if ( oCheckbox == null ) return;
    if ( oCheckbox.length > 1 ){
		for ( var inx = 0; inx < oCheckbox.length; inx ++ ) {
			if ( oCheckbox[inx].checked ) { 
				oCheckbox[inx].value='Y';
			} else {
				oCheckbox[inx].value='N';
				oCheckbox[inx].checked = true;
			}
		}
    }else{
		if ( oCheckbox.checked ) { 
			oCheckbox.value='Y';
		} else {
			oCheckbox.value='N';
			oCheckbox.checked = true;
		}
    }
}

function setCheckbox( oCheckbox, value, title) {// checkbox ¿¡   title ¿¡ ÇØ´çÇÏ´Â °ªÀ¸·Î ¼³Á¤.
    if ( oCheckbox.length > 1 ){
		for ( var inx = 0; inx < oCheckbox.length; inx ++ ) {
			if ( oCheckbox[inx].value == value ) oCheckbox[inx].checked = true;
			if ( oCheckbox[inx].title == title ) oCheckbox[inx].checked = true;
		}
    }else{
        if ( oCheckbox.value == value ) oCheckbox.checked = true;
        if ( oCheckbox.title == title ) oCheckbox.checked = true;
    }
}
function getCheckboxTitle( oCheckbox, delimeter ){
    if( delimeter == null ) delimeter = ', ';
    var retValue = '';
    if ( escape( oCheckbox.length ) == 'undefined' ){
        if ( oCheckbox.checked ) retValue = oCheckbox.value;
    }else{
        var retValue = '';
        for( var j = 0; j < oCheckbox.length; j ++ ){
            if ( oCheckbox[j].checked ){
                if ( retValue != '' ) retValue += delimeter;
                retValue += oCheckbox[j].title;
            }
        }
    }
    return retValue;
}
function getCheckboxValue( oCheckbox, nullValue ) {
    if( nullValue == null ) nullValue = ' ';
    var retValue = '';
    if ( escape( oCheckbox.length ) == 'undefined' ){
        if ( oCheckbox.checked ) retValue = oCheckbox.value;
    }else{
        var retValue = '';
        for( var j = 0; j < oCheckbox.length; j ++ ){
            if ( oCheckbox[j].checked ) {
                retValue += oCheckbox[j].value;
            } else {
                retValue += nullValue;
            }
        }
    }
    return retValue;
}

function getRadioValue( oRadio ){
	return getCheckboxValue( oRadio, '' );
}

function getFormType( oElement ){
tagName = oElement.tagName.toUpperCase();
if ( tagName == 'INPUT' ) tagName = oElement.type.toUpperCase();
return tagName;
}

function setInputValueText( oInputObj , value, text )
{
    var formType = getFormType( oInputObj );
    var retValue = '';
    switch ( formType )
    {
        case 'TEXT' 	 :
        case 'PASSWORD' :
        case 'HIDDEN' 	 :
        case 'TEXTAREA'	 :
				oInputObj.value = value;
        break;
        case 'RADIO' 	 :
				setCheckbox(oInputObj,value,text);
        break;
        case 'CHECKBOX' :
				setCheckbox(oInputObj,value,text);
        break;
        case 'SELECT' 	 :
				setSelect(oInputObj,value,text);
        break;
    }
}

function getFormElementValue( oObj )
{
    var formType = getFormType( oObj );
    var oInputObj = eval( eafinputform + '.' + oObj.name );
    var retValue = '';
    switch ( formType )
    {
        case 'TEXT' 	 :
        case 'PASSWORD' :
        case 'HIDDEN' 	 :
        case 'TEXTAREA'	 :
        retValue = oInputObj.value;
        break;
        case 'RADIO' 	 :
        retValue = getRadioValue( oInputObj );
        break;
        case 'CHECKBOX' :
        retValue = getCheckboxValue( oInputObj );
        break;
        case 'SELECT' 	 :
        retValue = getSelectInnerText( oInputObj );
        break;
    }
    return retValue;
}


function isExistsComboBoxValue( targt, optValue )
{
    last = targt.length;
    for( var i = 0; i < last; i ++ )
    {
        if( targt.options[i].value == optValue )
        {
            return true;
        }
    }
    return false;
}


// check ÇÑ °³¼ö¸¦ ¸®ÅÏÇÑ´Ù.
function getCheckedCount( aElem )
{
    var elem = document.all;
    var cnt = 0;
    for ( var i = 0; i < document.all.length; i ++ )
    {
        if ( ( elem[i].type == "checkbox" ) && ( elem[i].checked ) && ( elem[i].name == aElem ) )	cnt = cnt + 1;
    }
    return cnt;
}

// ÁöÁ¤ÇÑ ÀÌ¸§À» °¡Áø ¸ðµç checkbox¸¦ check ÇÑ´Ù.
function checkAll( aElem )
{

    var elem = document.all;
    var cnt = 0;

    for ( var i = 0; i < document.all.length; i ++ )
    {
        if ( ( elem[i].type == "checkbox" ) && ( elem[i].name == aElem ) )	elem[i].checked = true;
    }
}
// ÁöÁ¤ÇÑ ÀÌ¸§À» °¡Áø ¸ðµç checkboxÀÇ checked °ªÀ» ¹ÝÀü ÇÑ´Ù.
function invertCheck( aElem )
{

    var elem = document.all;
    var cnt = 0;

    for ( var i = 0; i < document.all.length; i ++ )
    {
        if ( ( elem[i].type == "checkbox" ) && ( elem[i].name == aElem ) )
        {
            if ( elem[i].checked )
            {
                elem[i].checked = false;
            }
            else
            {
                elem[i].checked = true;
            }
        }
    }
}

/* *
* ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÌ ÀÖ´ÂÁö Ã¼Å©
*/
function hasCheckedRadio( input )
{
    if ( input.length > 1 )
    {
        for ( var inx = 0; inx < input.length; inx ++ )
        {
            if ( input[inx].checked ) return true;
        }
    }
    else
    {
        if ( input.checked ) return true;
    }
    return false;
}

/* *
* ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÇ °ªÀ» ¸®ÅÏ
*/
function hasCheckedRadioValue( input )
{
    if ( input.length > 1 )
    {
        for ( var inx = 0; inx < input.length; inx ++ )
        {
            if ( input[inx].checked ) return input[inx].value;
        }
    }
    else
    {
        if ( input.checked ) return input.value;
    }
    return null;
}

/* *
* ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡ ÀÖ´ÂÁö Ã¼Å©
*/
function hasCheckedBox( input )
{
    return hasCheckedRadio( input );
}


/* *
* ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡  ¸î°³ÀÎÁö  ±× °³¼ö¸¦ ¹ÝÈ¯
*/
function hasMultiCheckedRadio( input )
{
    var kkkk = 0;
    if ( input.length > 1 )
    {
        for ( var inx = 0; inx < input.length; inx ++ )
        {
            if ( input[inx].checked )
            {
                kkkk ++ ;
            }
        }
    }
    else
    {
        if ( input.checked ) kkkk = 1;
    }
    return kkkk;
}




////////////////////////////////
// UTIL ÇÔ¼ö
////////////////////////////////

var isDivEvent = false;

function hideOneNav()
{
    if ( ! isDivEvent )
    {
        window.account.style.visibility = 'hidden';
    }
    else
    {
        isDivEvent = false;
    }
}


function showOneNav( obj )
{
    isDivEvent = true;
    window.account.style.left = getLeftPos( obj );
    window.account.style.top = getTopPos( obj ) + obj.offsetHeight - 8;
    window.account.style.visibility = 'visible';
    return false;
}

function getLeftPos( obj )
{
    var parentObj = null;
    var clientObj = obj;
    var left = obj.offsetLeft + document.body.clientLeft;

    while( ( parentObj = clientObj.offsetParent ) != null )
    {
        left = left + parentObj.offsetLeft;
        clientObj = parentObj;
    }

    return left;
}

function getTopPos( obj )
{
    var parentObj = null;
    var clientObj = obj;
    var top = obj.offsetTop + document.body.clientTop;

    while( ( parentObj = clientObj.offsetParent ) != null )
    {
        top = top + parentObj.offsetTop;
        clientObj = parentObj;
    }

    return top;
}

/* *
*  ¹®ÀÚ¿­¿¡ ÀÖ´Â Æ¯Á¤¹®ÀÚÆÐÅÏÀ» ´Ù¸¥ ¹®ÀÚÆÐÅÏÀ¸·Î ¹Ù²Ù´Â ÇÔ¼ö.
*/

function replace( targetStr, searchStr, replaceStr )
{
    var len, i, tmpstr;

    len = targetStr.length;
    tmpstr = "";

    for ( i = 0 ; i < len ; i ++ )
    {
        if ( targetStr.charAt( i ) != searchStr )
        {
            tmpstr = tmpstr + targetStr.charAt( i );
        }
        else
        {
            tmpstr = tmpstr + replaceStr;
        }
    }
    return tmpstr;
}

/* *
*  ¹®ÀÚ¿­¿¡¼­ ÁÂ¿ì °ø¹éÁ¦°Å
*/

function trim( str )
{
    return replace( str, " ", "" );
}

/* *
* 	ÄÞ¸¶¼³Á¤.
*/

function putComma( input )
{
    var num = input;

    if ( num < 0 )
    {
        num *= - 1;
        var minus = true;
    }
    else
    {
        var minus = false;
    }

    var dotPos = ( num + "" ).split( "." );
    var dotU = dotPos[0];
    var dotD = dotPos[1];
    var commaFlag = dotU.length % 3;

    if( commaFlag )
    {
        var out = dotU.substring( 0, commaFlag );
        if ( dotU.length > 3 ) out += ",";
    }
    else var out = "";

    for ( var i = commaFlag; i < dotU.length; i += 3 )
    {
        out += dotU.substring( i, i + 3 );
        if( i < dotU.length - 3 ) out += ",";
    }

    if( minus ) out = "-" + out;
    if( dotD ) return out + "." + dotD;
    else return out;
}


// ¿ùÀÇ ³¡ ÀÏÀÚ ¾ò±â
function getEndDate( datestr )
{

    // ³ÎÀÎÁö ?
    if( isEmpty( datestr ) )
    {
        return null;
    }

    // ¼ýÀÚÀÎÁö ?
    if( ! isNum( datestr ) )
    {
        return null;
    }

    // ±æÀÌ°¡ 8ÀÚ¸® ?
    if( datestr.length != 6 )
    {
        return null;
    }

    var yy = Number( datestr.substring( 0, 4 ) );
    var mm = Number( datestr.substring( 4, 6 ) );

    // À±³â °ËÁõ
    var boundDay = "";

    if( mm != 2 )
    {
        var mon = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
        boundDay = mon[mm - 1];
    }
    else
    {
        if ( yy % 4 == 0 && yy % 100 != 0 || yy % 400 == 0 )
        {
            boundDay = 29;
        }
        else
        {
            boundDay = 28;
        }
    }

    return boundDay;
}

// Left ºóÀÚ¸® ¸¸Å­ padStr À» ºÙÀÎ´Ù.
function lpad( src, len, padStr )
{
    var retStr = "";
    var padCnt = Number( len ) - String( src ).length;
    for( var i = 0; i < padCnt; i ++ ) retStr += String( padStr );
    return retStr + src;
}

// Right ºóÀÚ¸® ¸¸Å­ padStr À» ºÙÀÎ´Ù.
function rpad( src, len, padStr )
{
    var retStr = "";
    var padCnt = Number( len ) - String( src ).length;
    for( var i = 0; i < padCnt; i ++ ) retStr += String( padStr );
    return src + retStr;
}




// ´ë¹®ÀÚº¯È¯
function toUpperCase( str )
{

    if( isEmpty( str ) ) return str;
    return str.toUpperCase();
}


// ÀüÈ­¹øÈ£ ±¹¹ø°ËÁõ
function isValidDDDPhoneNum( dddphonenum )
{

    // ³ÎÀÎ°¡ ?
    if ( isEmpty( dddphonenum ) )
    {
        return null;
    }


    if ( dddphonenum != "02" && dddphonenum != "031" && dddphonenum != "032" && dddphonenum != "033" && dddphonenum != "041" &&
    dddphonenum != "042" && dddphonenum != "043" && dddphonenum != "051" && dddphonenum != "052" && dddphonenum != "053" &&
    dddphonenum != "054" && dddphonenum != "055" && dddphonenum != "061" && dddphonenum != "062" && dddphonenum != "063" &&
    dddphonenum != "064" && dddphonenum != "011" && dddphonenum != "016" && dddphonenum != "017" && dddphonenum != "018" && dddphonenum != "019" )
    {

        ERR_MSG = "Àß¸øµÈ ÀüÈ­¹øÈ£ ±¹¹øÀÔ´Ï´Ù.";
        return false;
    }

    return true;

}


// ÀüÈ­¹øÈ£ ±¹¹ø°ËÁõ
function isValidMobilePhoneNum( phonenum )
{

    // ³ÎÀÎ°¡ ?
    if ( isEmpty( phonenum ) )
    {
        return null;
    }


    if (  phonenum != "010" && phonenum != "011" && phonenum != "016" && phonenum != "017" && phonenum != "018" && phonenum != "019" )
    {

        ERR_MSG = "Àß¸øµÈ ÇÚµåÆù¹øÈ£ÀÔ´Ï´Ù.";
        return false;
    }

    return true;

}


// ¼ýÀÚ°ËÁõ
function isNum( str )
{

    if( isEmpty( str ) ) return false;

    for( var idx = 0; idx < str.length; idx ++ )
    {
        if( str.charAt( idx ) < '0' || str.charAt( idx ) > '9' )
        {
            return false;
        }
    }
    return true;
}


// ¿µ¹®ÀÚ°ËÁõ
function isAlpha( str )
{

    if( isEmpty( str ) ) return false;

    for( var idx = 0; idx < str.length; idx ++ )
    {
        if( ! ( ( str.charAt( idx ) >= 'a' && str <= 'z' ) || ( str.charAt( idx ) >= 'A' && str <= 'Z' ) ) )
        {
            return false;
        }
    }
    return true;
}


// ÇÑ±Û°ËÁõ
function isHangul( str )
{

    if( isEmpty( str ) ) return false;

    for( var idx = 0; idx < str.length; idx ++ )
    {
        var c = escape( str.charAt( idx ) );
        if ( c.indexOf( "%u" ) == - 1 )
        {
            return false;
        }
    }
    return true;
}


// ½ÇÁ¦±æÀÌ ¹ÝÈ¯( ÇÑ±Û 2byte °è»ê )
function getByteLength( s )
{

    var len = 0;
    if ( s == null ) return 0;
    for( var i = 0; i < s.length; i ++ )
    {
        var c = escape( s.charAt( i ) );
        if ( c.length == 1 ) len ++ ;
        else if ( c.indexOf( "%u" ) != - 1 ) len += 2;
        else if ( c.indexOf( "%" ) != - 1 ) len += c.length / 3;
    }
    return len;
}


// ºó°ªÀÎÁö ¸®ÅÏÇÑ´Ù.
function isEmpty( pValue )
{

    if( ( pValue == "" ) || ( pValue == null ) )
    {
        return true;
    }
    return false;
}




// °Ë»ö³¯Â¥ À¯È¿±â°£
function getBoundDate1( yy, mm, dd, stdDate )
{
    var today = new Date();
    today.setYear( stdDate.substring( 0, 4 ) );
    today.setMonth( stdDate.substring( 4, 6 ) - 1 );
    today.setDate( stdDate.substring( 6, 8 ) );
    today.setHours( today.getHours() );
    today.setMinutes( today.getMinutes() );
    today.setSeconds( today.getSeconds() );

    yy = Number( yy );
    mm = Number( mm );
    dd = Number( dd );

    var date = new Date();

    var DAY = 24 * 60 * 60 * 1000;

    if ( yy != 0 )
    {
        date.setTime( today.getTime() + DAY * 365 * yy );
    }

    if ( mm != 0 )
    {
        date.setTime( today.getTime() + DAY * 30 * mm );
    }

    if ( dd != 0 )
    {
        date.setTime( today.getTime() + DAY * dd );
    }

    return lpad( new String( date.getYear() ), 4, '0' ) + lpad( new String( date.getMonth() + 1 ), 2, '0' ) + lpad( new String( date.getDate() ), 2, '0' );
}



function getBoundDate( yy, mm, dd )
{
    yy = Number( yy );
    mm = Number( mm );
    dd = Number( dd );

    var date = new Date();

    var DAY = 24 * 60 * 60 * 1000;


    if ( yy != 0 )
    {
        date.setTime( datToday.getTime() + DAY * 365 * yy );
    }

    if ( mm != 0 )
    {
        date.setTime( datToday.getTime() + DAY * 30 * mm );
    }

    if ( dd != 0 )
    {
        date.setTime( datToday.getTime() + DAY * dd );
    }

    return lpad( new String( date.getYear() ), 4, '0' ) + lpad( new String( date.getMonth() + 1 ), 2, '0' ) + lpad( new String( date.getDate() ), 2, '0' );
}


// °Ë»ö³¯Â¥ Ã¼Å©
function isVaildTerm( obj, yy, mm, dd )
{
    var datestr = obj.value;


    // ³ÎÀÎÁö ?
    if( isEmpty( datestr ) )
    {
        return null;
    }

    // ³¯Â¥ Æ÷¸ËÁ¦°Å
    obj_removeformat( obj );

    // 8ÀÚ¸®ÀÎÁö ?
    if ( getByteLength( datestr ) != 8 )
    {
        alert( "³¯Â¥´Â '-'¸¦ Á¦¿ÜÇÑ 8ÀÚ¸® ¼ýÀÚ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À." );
        return false;

    }



    // yy, mm, dd, fromto°¡ ¾øÀ» °æ¿ì
    if ( yy == null ) yy = 0;
    if ( mm == null ) mm = 0;
    if ( dd == null ) dd = 0;

    // °Ë»ö³¯Â¥ À¯È¿±â°£ °¡Á®¿À±â
    var boundDate = getBoundDate( yy, mm, dd );

    if ( yy < 0  || mm < 0  || dd < 0 )
    {
        if ( boundDate > datestr )
        {
            alert( "À¯È¿ÇÏÁö ¾ÊÀº °Ë»ö³¯Â¥ÀÔ´Ï´Ù.\nÀ¯È¿ÇÑ ³¯Â¥´Â" + boundDate.substring( 0, 4 ) + "³â " + boundDate.substring( 4, 6 ) + "¿ù " + boundDate.substring( 6 ) + "ÀÏºÎÅÍ ÀÔ´Ï´Ù." );
            obj.select();
            return false;
        }
    }
    else
    {
        if ( boundDate < datestr )
        {
            alert( "À¯È¿ÇÏÁö ¾ÊÀº °Ë»ö³¯Â¥ÀÔ´Ï´Ù.\nÀ¯È¿ÇÑ ³¯Â¥´Â" + boundDate.substring( 0, 4 ) + "³â " + boundDate.substring( 4, 6 ) + "¿ù " + boundDate.substring( 6 ) + "ÀÏ±îÁö ÀÔ´Ï´Ù." );
            obj.select();
            return false;
        }
    }


    return true;

}

// ¿À´Ã³¯Â¥
function getToDay()
{

    var date = datToday;

    var year  = date.getFullYear();
    var month = date.getMonth() + 1; // 1¿ù = 0, 12¿ù = 11ÀÌ¹Ç·Î 1 ´õÇÔ
    var day   = date.getDate();

    if ( ( "" + month ).length == 1 )
    {
        month = "0" + month;
    }
    if ( ( "" + day ).length   == 1 )
    {
        day   = "0" + day;
    }

    return ( "" + year + month + day )

}


function getDateString( date )
{
    return ( date.getYear() < 10 ? '0' : '' ) + date.getYear() + "-" +
    ( date.getMonth() + 1 < 10 ? '0' : '' ) + ( date.getMonth() + 1 ) + "-" +
    ( date.getDate() < 10 ? '0' : '' ) + date.getDate();
}


/* ------------------------------------------------------------------
Function ID  : findObject
Description  : ÇØ´ç ÀÌ¸§À» °®´Â ¿ÀºêÅØÆ®°¡ ÀÖ´ÂÁö °Ë»öÇØÁØ´Ù
Argument     : n : Object Name
d : Document
Return Value : null Or Object
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function findObject( n, d )
{
    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 = findObject( n, d.layers[i].document ); return x;
}


/* ------------------------------------------------------------------
Function ID  : scrHoriz
Description  : ¸®½ºÆ®Ãâ·ÂºÎ¿¡¼­ »ç¿ëÇÏ¸ç ¸®½ºÆ®ÀÇ ½ºÅ©·Ñ ÀÌµ¿½Ã
Çì´õºÎ¿Í ÇÕ°èºÎÀÇ À§Ä¡µµ °°ÀÌ ½ºÅ©·Ñ ÇØÁØ´Ù.
Argument     : divHeaderObj : Object
divListObj   : Object
divSumObj    : Object
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function scrHoriz( divHeaderObj, divListObj, divSumObj )
{
    H = divListObj.scrollLeft;
    divHeaderObj.scrollLeft = H;
    if ( divSumObj != null ) divSumObj.scrollLeft = H;
}

/* ------------------------------------------------------------------
Function ID  : gettblObjHight
Description  : ¸®½ºÆ®Ãâ·ÂºÎ¿¡¼­ »ç¿ëÇÏ¸ç ÇØ´ç Ãâ·Â¸®½ºÆ®ÀÇ
ÀüÃ¼ ³ôÀÌ¸¦ ±¸ÇÏ±â À§ÇØ »ç¿ëÇÑ´Ù.
Argument     : tblObj       : Object
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   : ¸®½ºÆ®Å×ÀÌºíÀ» ¸î°Ç¾¿ ³ª´©¾î Ãâ·ÂÇÏ¹Ç·Î ¹è¿­·Î
ÀâÈú¼öµµ ÀÖ°í ÇÏ³ª·Î ½áÁú¼öµµ ÀÖÀ¸¹Ç·Î
ÇÏ´Ü¿¡¼­ ¹è¿­¿©ºÎ¸¦ È®ÀÎÇØ Ã³¸®ÇÑ´Ù.
-------------------------------------------------------------------- */
function gettblObjHight( tblObj )
{
    var nLoop   = 0;
    var nHeight = 0;
    for ( nLoop = 0; nLoop < tblObj.length ; nLoop ++ )
    {
        nHeight = nHeight + tblObj[nLoop].scrollHeight;
    }
    if ( nHeight == 0 ) nHeight = tblObj.scrollHeight;

    return nHeight;
}


/* ------------------------------------------------------------------
Function ID  : gettblObjWidth
Description  : ¸®½ºÆ®Ãâ·ÂºÎ¿¡¼­ »ç¿ëÇÏ¸ç ÇØ´ç Ãâ·Â¸®½ºÆ®ÀÇ
ÀüÃ¼ ³ÐÀÌ¸¦ ±¸ÇÏ±â À§ÇØ »ç¿ëÇÑ´Ù.
Argument     : tblObj       : Object
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   : Ãâ·Â¸®½ºÆ®ÀÇ ³ÐÀÌ¸¦ ¾Ë¾Æ¾ß ¼¼·Î½ºÅ©·ÑÀÇ À§Ä¡¸¦
°áÁ¤ÇÒ¼ö ÀÖ´Ù.
-------------------------------------------------------------------- */
function gettblObjWidth( tblObj )
{
    var nLoop   = 0;
    var nWidth  = 0;

    for ( nLoop = 0; nLoop < tblObj.length ; nLoop ++ )
    {
        nWidth = tblObj[nLoop].scrollWidth;
        break;
    }

    if ( nWidth == 0 ) nWidth = tblObj.scrollWidth;
    return nWidth;
}


/* ------------------------------------------------------------------
Function ID  : rsetScrollBar
Description  : µ¥ÀÌÅ¸¸¦ Ãâ·ÂÈÄ µ¥ÀÌÅ¸ °Ç¼ö¿¡ µû¶ó
divList ÀÇ »çÀÌÁî¸¦ Á¶ÀýÇØÁØ´Ù.
Argument     : divObj       : Object
tblListObj   : Object
nWidth       : Integer
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   : ¼¼·Î½ºÅ©·Ñ À§Ä¡ ÁöÁ¤°ú ÇÕ°èºÎ°¡ ÀÖ´Â °æ¿ì¿¡ ÇØ´ç
ÇÕ°èºÎ¸¦ Ãâ·Â¸®½ºÆ®¸¶Áö¸·¿¡ ºÙÀÌ±â À§ÇØ
¸®½ºÆ®Å×ÀÌºíÀÇ Á¤º¸¸¦ ÃëÇÕµÚ »çÀÌÁî¸¦ °áÁ¤ÇÑ´Ù.
-------------------------------------------------------------------- */
function rsetScrollBar( divObj, tblListObj, nWidth )
{
    if ( nWidth == null )
    {
        nWidth = 977;
    }

    if ( gettblObjWidth( tblListObj ) <= nWidth )
    {
        // °¡·Î ½ºÅ©·ÑÀÌ ¾ø´Â°æ¿ì
        if ( gettblObjHight( tblListObj ) > parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) )
        {
            divObj.style.width = ( nWidth + 16 ) + "px";
            divObj.style.height = ( parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) ) ;
        }
        else
        {
            divObj.style.width = ( nWidth ) + "px";
            divObj.style.height = gettblObjHight( tblListObj ) + 1;
        }
    }
    else
    {
        // °¡·Î ½ºÅ©·ÑÀÌ ÀÖ´Â°æ¿ì
        if ( gettblObjHight( tblListObj ) < parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) )
        {
            divObj.style.width = ( nWidth - 2 ) + "px";
            divObj.style.height = gettblObjHight( tblListObj ) + 18;
        }
        else
        {
            divObj.style.width = ( nWidth + 14 ) + "px";
        }
    }

    mngRollOver( tblListObj )
}

function rsetScrollBarEdt( divObj, tblListObj, nWidth )
{
      if (nWidth == null)
      {
         nWidth = 977;
      }

      if (gettblObjWidth(tblListObj) <= nWidth) {
         //°¡·Î ½ºÅ©·ÑÀÌ ¾ø´Â°æ¿ì

          if (gettblObjHight(tblListObj) >= parseInt(divObj.style.height.substring(0,divObj.style.height.indexOf("p")))) {
              divObj.style.width = "995px";
//              divObj.style.height = (parseInt(divObj.style.height.substring(0,divObj.style.height.indexOf("p")))) ;
         } else {
            divObj.style.width = (nWidth) + "px";
//            divObj.style.height = gettblObjHight(tblListObj) + 1;
         }
      } else {
         //°¡·Î ½ºÅ©·ÑÀÌ ÀÖ´Â°æ¿ì
         if (gettblObjHight(tblListObj) < parseInt(divObj.style.height.substring(0,divObj.style.height.indexOf("p")))) {
            divObj.style.width = (nWidth - 2) + "px";
//            divObj.style.height = gettblObjHight(tblListObj) + 18;
         } else{
            divObj.style.width = (nWidth + 14) + "px";
         }
      }
      if ( tblListObj.rows.length > 1 )
         window.status = (tblListObj.rows.length - 1) + " °ÇÀÌ Ãâ·ÂµÇ¾ú½À´Ï´Ù";
      else
         window.status = "";


}

/* ------------------------------------------------------------------
Function ID  : mngRollOver
Description  : css¿¡ µû¶ó rollover ¸¦ Ã³¸®ÇØÁØ´Ù
Argument     : tblListObj   : Object
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   : Ãâ·Â¸®½ºÆ® Å×ÀÌºíÀÇ css ¸íÀ» ÀÌ¿ëÇØ ÇØ´ç Å×ÀÌºíÀÇ ÇÑ Record °¡ ¸î°³ÀÇ Row·Î ±¸ºÐµÇ´ÂÁö ±¸º°ÇÏ°í
±× Á¤º¸¸¦ ÀÌ¿ëÇØ ±âÁ¸Á¤ÀÇµÈ function ÀÇ Æ÷ÀÎÅÍ( ? )¸¦ ¸¸µé¾î °¢°¢ÀÇ Å×ÀÌºí¿¡ ±¸¼ºµÈ
TR °´Ã¼¿¡ onmouseout, onmouseover ¿¡ Á¤ÀÇÇÑ function Æ÷ÀÎÅÍ¸¦ ¿¬°á½ÃÄÑµÐ´Ù
-------------------------------------------------------------------- */
function mngRollOver( tblListObj )
{
    var nLoop     = 0;
    var nTblLoop  = 0;
    var oFuncOver = null;
    var oFuncOut  = null;
    var oObj      = null;

    if ( tblListObj.length != null )
    {
        oObj = tblListObj[0];
    }
    else
    {
        oObj = tblListObj;
    }

    if ( oObj.className == null )  return;

    var nGubun = 1;

    if ( oObj.className == 'csTbList' )
    {
        oFuncOver = trRollOver;
        oFuncOut  = trRollOut;
        nGubun    = 1;
    }
    else if ( oObj.className == 'cs2TbList' )
    {
        oFuncOver = trRollOver2;
        oFuncOut  = trRollOut2;
        nGubun    = 2;
    }
    else if ( oObj.className == 'cs3TbList' )
    {
        oFuncOver = trRollOver3;
        oFuncOut  = trRollOut3;
        nGubun    = 3;
    }
    else
    {
        return;
    }

    var nRowCount = 0;

    if ( tblListObj.length != null )
    {
        for ( nTblLoop = 0; nTblLoop < tblListObj.length ; nTblLoop ++ )
        {
            nRowCount = tblListObj[nTblLoop].rows.length + nRowCount;
            for ( nLoop = 0; nLoop < tblListObj[nTblLoop].rows.length; nLoop ++ )
            {
                tblListObj[nTblLoop].rows[nLoop].onmouseover = oFuncOver;
                tblListObj[nTblLoop].rows[nLoop].onmouseout  = oFuncOut;
            }
        }
    }
    else
    {
        nRowCount = tblListObj.rows.length;
        for ( nLoop = 0; nLoop < tblListObj.rows.length; nLoop ++ )
        {
            tblListObj.rows[nLoop].onmouseover = oFuncOver;
            tblListObj.rows[nLoop].onmouseout  = oFuncOut;
        }
    }

    nRowCount = parseInt( nRowCount / nGubun );

    window.status = nRowCount + " °ÇÀÌ Ãâ·ÂµÇ¾ú½À´Ï´Ù";
}

/* ------------------------------------------------------------------
Function ID  : trRollOver
Description  : ·¹ÄÚµå°¡ ÇÑ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseover ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOver()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOver;
    }
}

/* ------------------------------------------------------------------
Function ID  : trRollOut
Description  : ·¹ÄÚµå°¡ ÇÑ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseout ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOut()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  return false;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOut;
    }
}

/* ------------------------------------------------------------------
Function ID  : trRollOver2
Description  : ·¹ÄÚµå°¡ µÎ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseover ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOver2()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOver;

        if ( ( oObj.rowIndex % 2 ) == 0 )
        {
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOver;
        }
        else
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOver;
        }
    }
}

/* ------------------------------------------------------------------
Function ID  : trRollOut2
Description  : ·¹ÄÚµå°¡ µÎ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseout ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOut2()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  return false;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOut;

        if ( ( oObj.rowIndex % 2 ) == 0 )
        {
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOut;
        }
        else
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOut;
        }
    }
}

/* ------------------------------------------------------------------
Function ID  : trRollOver3
Description  : ·¹ÄÚµå°¡ ¼¼ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseover ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOver3()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOver;

        if ( ( oObj.rowIndex % 3 ) == 0 )
        {
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOver;
            oObj.parentElement.rows[oObj.rowIndex + 2].style.backgroundColor = sRollOver;
        }
        else if ( ( oObj.rowIndex % 3 ) == 1 )
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOver;
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOver;
        }
        else
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOver;
            oObj.parentElement.rows[oObj.rowIndex - 2].style.backgroundColor = sRollOver;
        }
    }
}

/* ------------------------------------------------------------------
Function ID  : trRollOut3
Description  : ·¹ÄÚµå°¡ ¼¼ ·Î¿ì·Î ±¸¼ºµÈ °æ¿ìÀÇ tr°´Ã¼ÀÇ onmouseout ¿¡ ÀÚµ¿¿¬°áµÇ´Â function
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function trRollOut3()
{
    var oObj = event.srcElement.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  oObj = oObj.parentElement;
    if ( oObj.tagName.toLowerCase() != "tr" )  return false;

    if ( oObj.TOT_VALUE == null )
    {
        oObj.style.backgroundColor = sRollOut;

        if ( ( oObj.rowIndex % 3 ) == 0 )
        {
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOut;
            oObj.parentElement.rows[oObj.rowIndex + 2].style.backgroundColor = sRollOut;
        }
        else if ( ( oObj.rowIndex % 3 ) == 1 )
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOut;
            oObj.parentElement.rows[oObj.rowIndex + 1].style.backgroundColor = sRollOut;
        }
        else
        {
            oObj.parentElement.rows[oObj.rowIndex - 1].style.backgroundColor = sRollOut;
            oObj.parentElement.rows[oObj.rowIndex - 2].style.backgroundColor = sRollOut;
        }
    }
}

/* ------------------------------------------------------------------
Function ID  : rsetScrollBarPop
Description  : ÆË¾÷¿¡¼­ »ç¿ëÇÏ¸ç µ¥ÀÌÅ¸¸¦ Ãâ·ÂÈÄ µ¥ÀÌÅ¸ °Ç¼ö¿¡ µû¶ó divList ÀÇ »çÀÌÁî¸¦ Á¶ÀýÇØÁØ´Ù.
Argument     : non
Return Value : non
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   :
-------------------------------------------------------------------- */
function rsetScrollBarPop( divObj, tblListObj, nWidth )
{
    if ( nWidth == null )
    {
        nWidth = 404;
    }

    if ( gettblObjWidth( tblListObj ) <= nWidth )
    {
        // °¡·Î ½ºÅ©·ÑÀÌ ¾ø´Â°æ¿ì
        if ( gettblObjHight( tblListObj ) > parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) )
        {
            divObj.style.height = parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) + 1;
        }
        else
        {
            divObj.style.width = ( nWidth ) + "px";
            divObj.style.height = gettblObjHight( tblListObj ) + 2;
        }
    }
    else
    {
        // °¡·Î ½ºÅ©·ÑÀÌ ÀÖ´Â°æ¿ì
        if ( gettblObjHight( tblListObj ) < parseInt( divObj.style.height.substring( 0, divObj.style.height.indexOf( "p" ) ) ) )
        {
            divObj.style.width = ( nWidth - 2 ) + "px";
            divObj.style.height = gettblObjHight( tblListObj ) + 18;
        }
        else
        {
            divObj.style.width = ( nWidth + 18 ) + "px";
        }
    }
}


/* ------------------------------------------------------------------
Function ID  : clearData
Description  : ¾ÆÀÌÇÁ·¹ÀÓÀÇ µ¥ÀÌÅ¸ Ãâ·ÂºÎºÐÀ» disable ½ÃÅ²´Ù
Argument     :
Return Value :
ÀÛ  ¼º  ÀÚ   : EZFARM
ÀÛ¼º  ÀÏÀÚ   : 2003 - 04 - 17
ÀÛ¼º  ³»¿ë   : µû¶ó¼­ °Ë»öÁ¶°ÇÀÇ ¸ðµç ¿ÀºêÁ§Æ®ÀÇ onchange ÀÌº¥Æ®¿¡ ÀÌ functionÀ» ¿¬°á½ÃÄÑ¾ß ÇÑ´Ù.
-------------------------------------------------------------------- */
function clearData()
{
    var objTblMenu;

    window.status = "";

    var objTblMenu = findObject( 'divList' );
    var objkey     = findObject( 's_key' );

    objkey.value   = "KEY_OFF";

    if ( objTblMenu == null )
    {
        if ( dataWindow.divList ) dataWindow.divList.style.display = "none";
    }
    else
    {
        divList.style.display = "none";
    }

    objTblMenu = null;
    var objTblMenu = findObject( 'divSum' );
    if ( objTblMenu == null )
    {
        objTblMenu = findObject( 'dataWindow' );
        if ( objTblMenu != null )
        {
            if ( dataWindow.divSum ) dataWindow.divSum.style.display = "none";
        }
    }
    else
    {
        divSum.style.display = "none";
    }
}

function selLoad()
{
    if( parent.window.dataWindow )
    {
        //         parent.parent.frames[0].window.mnuBigChk( parent.form1.pro_big.value )
        parent.divLoading.style.display = "none";
        window.status = " ";
    }
    else
    {
        //         parent.frames[0].window.mnuBigChk( form1.pro_big.value )
        if ( divLoading != null )
        divLoading.style.display = "";
        if ( parent.divLoading != null )
        parent.divLoading.style.display = "";
        if ( parent.parent.divLoading != null )
        parent.parent.divLoading.style.display = "";

        clearData();
        window.status = "°Ë»öÃ³¸®°¡ ÁøÇàÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·ÁÁÖ½Ê½Ã¿ä";
    }
}

function callCalendar( oObj )
{
    //if ( imgUseChk () == false ) return false;
    showCalendar( form1, oObj, document.body, event.x, event.y );
}


function imgUseChk ()
{
    if ( sImgGb > 0 )
    {
        if ( nEdtGb == 0 )
        {
            alert( "ÇöÀç ÀÌ¹ÌÁö¸¦ »ç¿ë ÇÒ ¼ö ¾ø½À´Ï´Ù.\n ÀÔ·Â / ¼öÁ¤ ÀÛ¾÷½Ã¿¡ »ç¿ë °¡´É ÇÕ´Ï´Ù." );
            return false;
        }
    }
    return true;
}

function replaceAll( argOriginalStr, argFindStr, argReplaceStr )
{
    var pos         = 0;
    var preStr      = "";
    var postStr     = "";
    var nFindStrLen = argFindStr.length ;

    pos = argOriginalStr.indexOf( argFindStr );

    while ( pos != - 1 )
    {
        preStr         = argOriginalStr.substr( 0, pos );
        postStr        = argOriginalStr.substr( pos + nFindStrLen, argOriginalStr.length );
        argOriginalStr = preStr + argReplaceStr + postStr;
        pos = argOriginalStr.indexOf( argFindStr );
    }
    return argOriginalStr;
}


/* Function for showing and hiding elements that use 'display:none' to hide */
function toggleDisplay(targetId)
{
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.display == "none"){
    		target.style.display = "";
    	} else {
    		target.style.display = "none";
    	}
    }
}

// toggle visibility 
function toggleVisibility(targetId) {
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.visibility == "hidden"){
    		target.style.visibility = "visible";
    	} else {
    		target.style.visibility = "hidden";
    	}
    }
}

// toggle visibility 
function toggleOpacity(targetId) {
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.filter == ""){
    		target.style.filter = "alpha(opacity=100,style=3,finishopacity=30)";
    		target.style.cursor = "";
    	} else {
    		target.style.filter = "";
    		target.style.cursor = "hand";
    	}
    }
}

function setOpacity(targetId) {
    if (document.getElementById) {
        target = parent.document.getElementById(targetId);
		target.style.filter = "alpha(opacity=100,style=3,finishopacity=30)";
		target.style.cursor = "";
    }
}

function unsetOpacity(targetId) {
    if (document.getElementById) {
        target = parent.document.getElementById(targetId);
		target.style.filter = "";
		target.style.cursor = "hand";
    }
}

function setButtonImageOpacity(nEdtGb) {
	if (bDEBUG) alert('setButtonImageOpacity start');

	if ( nEdtGb == 1 ) {			//ÀÔ·Â
		setOpacity('but_modi');
		setOpacity('but_del');
		setOpacity('but_save');
	} else if ( nEdtGb == 2 ) {		//¼öÁ¤
		setOpacity('but_input');
		setOpacity('but_del');
		setOpacity('but_save');
	} else if ( nEdtGb == 5 ) {		//È®ÀÎ
		unsetOpacity('but_input');
		unsetOpacity('but_modi');
		unsetOpacity('but_del');
		unsetOpacity('but_save');
	} else if ( nEdtGb == 0 ) {		//Ãë¼Ò 
		unsetOpacity('but_input');
		unsetOpacity('but_modi');
		unsetOpacity('but_del');
		unsetOpacity('but_save');
	} 
	if (bDEBUG) alert('setButtonImageOpacity end');

}

String.prototype.trim = function() {
  return this.replace(/(^\s*)|(\s*$)/gi, "");
}

String.prototype.popupView = function() {
    var img_view = this;
    var x = x + 20 ;
    var y = y + 30 ;
    htmlz = "<html><head><title>ÀÌ¹ÌÁöÅ©°Ôº¸±â</title><style>body{margin:0;cursor:pointer;}</style></head><body scroll=auto onload='width1=document.getElementById(\"Timage\").width;if(width1>1024)width1=1024;height1=document.getElementById(\"Timage\").height;if(height1>768)height1=768;top.window.resizeTo(width1+30,height1+54);' onclick='top.window.close();'><img src='"+img_view+"' title='Å¬¸¯ÇÏ½Ã¸é ´ÝÈü´Ï´Ù.' name='Timage' id='Timage'></body></html>";
    imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1");
    imagez.document.open();
    imagez.document.write(htmlz);
    imagez.document.close();
}

String.prototype.strip = function() {
	var str = this;
	var p1 = str.indexOf('<');
	if (p1 == -1) return str;
	else {
		var p2 = str.indexOf('>', p1);
		if (p2 == -1) return str;
		return (str.substr(0, p1) + str.substr(p2+1)).strip();
	}
}


var popupMessageWindow;
function popupMessage(txt) {
	if(popupMessageWindow != null) popupMessageWindow.close();
	
	var height = screen.height; 
	var width = screen.width; 
	var leftpos = width / 2 - 150; 
	var toppos = height / 2 - 100; 
	var windowprops="menu=no,location=no,resiable=1,toolbar=no,status=no,scrollbars=no,left="+leftpos+",top="+toppos+",width=300,height=170";

	popupMessageWindow = window.open("about:blank", "message", windowprops);
	if (popupMessageWindow != null) {
		var Doc = "";
		Doc+="<title>Á¤º¸</title>";
		Doc+="<link href='./css/style.css' rel=stylesheet>";
		Doc+="<style>P {white-space:pre;margin-top:3px;margin-bottom:3px;margin-left:3;margin-right:3;word-break:break-all;}</style>";
		Doc+="<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onBlur=self.focus() bgcolor=#F5F5F5>";
		Doc+="<table border=0 cellspacing=0 cellpadding=0 width=100% height=100%>";
		Doc+="<tr><td width=1% height=30><img src=./img/common/board/title_icon.gif width=23 height=30></td><td background='./img/common/board/title_bg.gif' width=99%><b>Hi!</b></td></tr>";
		Doc+="<tr><td colspan=2 align=center style=font-size:10pt><img src=./img/common/board/infor.gif align=absmiddle><b> "+txt+"</b></td></tr>";
		Doc+="<tr><td colspan=2 align=center><img src=./img/common/board/btn_close.gif align=absmiddle style=cursor:pointer onclick=window.close()></td></tr></table>";
		Doc+="</body>";
    	
		popupMessageWindow.document.open();
		popupMessageWindow.document.write(Doc);
		popupMessageWindow.document.close();
		popupMessageWindow.focus();
	} else {
		txt = txt.replace('<BR>', '\n');
		alert(txt.strip());	
	}
}
