  var IE = false ;

  if (/MSIE/.test(navigator.userAgent))
  {
	IE = true;
  }
    
  // ÀûÇÕÇÑ »ç¿ëÀÚIDÀÎÁö Ã¼Å©
  function isValidMemberId(memberid)
  {
      var result = true;
      var re = /^[a-z0-9_]+$/g;
      
      if(memberid=="") result = false;
      
      if(memberid.length > 20) result = false;
      
      if(!memberid.match(re)) result = false;
      
      return result;      
  }
  
  // ÇÑ±ÛÆ÷ÇÔ¿©ºÎ ¹ÝÈ¯ 
  function existKor(strValue){
    for(i=0;i<strValue.length;i++) {
        var code=strValue.charCodeAt(i);
        if (code > 128) {
            return true;
        }
    }    
    return false;
  }

  // ¹®ÀÚ¿­¿¡¼­ ÇÑ±Û Á¦°Å
  function delKor(strValue){
    var tmp = "";

    for(var i=0;i<strValue.length;i++) {
      var code=strValue.charCodeAt(i);

      if (code > 128) {
        if(!tmp){
          tmp = strValue;
        }
        
        tmp = tmp.replace(strValue.substring(i, i + 1), "");
      }
    }

    return trim(tmp);
  }

  // ¼ýÀÚ Ã¼Å©
  function isNumber(value) 
  {
    if (value.match(/^[0-9]*$/g))
      return true;
    else
      return false;
  }

  // ¹®ÀÚ¿­ trim
  String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
  }

  // checkbox ÀüÃ¼ ¼±ÅÃ
  function checkAll( checkObject )
  {
    if(checkObject.length)
    {
      for( var i=0; i<checkObject.length ; i++)
      {
        if(!checkObject[i].disabled)
        {
          checkObject[i].checked = true;
        }
      }
    }
    else
    {
      if(!checkObject.disabled)
      {
        checkObject.checked = true;
      }
    }
  }

  // checkbox ÀüÃ¼ ¼±ÅÃ ÇØÁ¦
  function uncheckAll( checkObject )
  {
    if(checkObject.length)
    {
      for( var i=0; i<checkObject.length ; i++)
      {          
        if(!checkObject[i].disabled)
        {
          checkObject[i].checked = false;
        }
      }
    }
    else
    {
      if(!checkObject.disabled)
      {
        checkObject.checked = false;
      }
    }
  }

  // checkbox Ã¼Å©µÈ °³¼ö ¹ÝÈ¯
  function getCheckCount( checkObject )
  {
    var cnt = 0;
    if(checkObject.length)
    {
      for( var i=0; i<checkObject.length ; i++)
      {
        if(checkObject[i].checked)
        {
          cnt++;
        }
      }
    }
    else
    {
      if(checkObject.checked)
      {
        cnt++
      }
    }
    return cnt;
  }
  
  // selectbox ÀüÃ¼ ¼±ÅÃ
  function selectAll( checkObject )
  {
    var items = checkObject.options;
    for( var i=0; i<items.length ; i++)
    {
      items[i].selected = true;
    }
  }

  // selectbox ÀüÃ¼ ¼±ÅÃ ÇØÁ¦
  function unselectAll( checkObject )
  {
    var items = checkObject.options;
    for( var i=0; i<items.length ; i++)
    {
      items[i].selected = false;
    }    
  }
  
  // select1 ¿¡¼­ ¼±ÅÃµÈ optionµéÀ» select2·Î ¿Å±è
  function moveSelect( select1, select2 )
  {
      var items = select1.options;
      for( var i=0; i<items.length; i++)
      {
          if( items[i].selected )
          {
              var opt = document.createElement("OPTION");
              if(IE)
              {
                select2.insertBefore(opt);
              }
              else
              {
                select2.appendChild(opt,null);
              }
              opt.value = items[i].value;              
              opt.innerHTML = items[i].innerHTML;
              select1.removeChild(items[i]);
              i--;
          }
      }
  }
  
  // ÆË¾÷Ã¢ ¶ç¿ì±â
  function open_window(url, name, width, height, feature)
  {
    var oWnd;

    if (IE && width < window.screen.width && height < window.screen.height) 
    {
        var windowX = Math.ceil( (window.screen.width  - width) / 2 );
        var windowY = Math.ceil( (window.screen.height - height) / 2 );

        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY + ",resizable=yes");
    }
    else 
    {
        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height + ",resizable=yes");
    }

    return oWnd;
  }

  // ÆË¾÷Ã¢ ¸®»çÀÌÁî
  function resizepopup(wid,minH) 	
  {
    if (IE) {
      var winW = wid, winH = 200;
      winW = wid;
      winH = document.body.scrollHeight;
      
      if(winH > 750)
      {
        winH = 750;
      }
      if(winH < minH)
      {
        winH = minH
      }

      var deltaW = 0;
      var deltaH = 0;
      if(document.body.clientHeight)
      {
        deltaW = winW - document.body.clientWidth;
        deltaH = winH - document.body.clientHeight;
      }else
      {
        deltaW = winW - window.innerWidth;
        deltaH = winH - window.innerHeight;
      }
      if(deltaH>=4) deltaH = deltaH-4;

      var windowX = Math.ceil( (window.screen.width  - winW) / 2 );
      var windowY = Math.ceil( (window.screen.height - winH) / 2 );

      window.moveTo(windowX, windowY);
      
      window.resizeBy(deltaW, deltaH);

    } else {
      var width_adjustment = 6;
      var height_adjustment = 32;
      
      var oW = window.document.body;
      var oW = oW.clip ? oW.clip.width : oW.offsetWidth;

      var oH = window.document.body;
      var oH = oH.clip ? oH.clip.height : oH.offsetHeight;
      
      var myW = 0, myH = 0, d = window.document.documentElement, b = window.document.body;

      if( window.innerWidth ) { 
        myW = window.innerWidth; myH = window.innerHeight; 
      }
      else if( b && b.clientWidth ) {
        myW = b.clientWidth; myH = b.clientHeight; 
      } 
      else if( d && d.clientWidth ) { 
        myW = d.clientWidth; myH = d.clientHeight; 
      } 

      //alert(oH+","+myH);

      if( window.opera && !document.childNodes ) { myW += 16; }
      var winW = parseInt(wid) + width_adjustment;
      var winH = oH+50 ;//+ ( (oH + 200 ) - myH ) + height_adjustment;
      
      if(winH > 750)
      {
        winH = 750;
      }
      if(winH<minH) winH = minH

      var windowX = Math.ceil( (window.screen.width  - wid) / 2 );
      var windowY = Math.ceil( (window.screen.height - winH) / 2 );

      window.moveTo(windowX, windowY);
      
      window.resizeTo( winW, winH );      
    }
  }
  
/** 
  Function Equivalent to java.net.URLEncoder.encode(String, "UTF-8")
  Copyright (C) 2002, Cresc Corp.
  Version: 1.0
*/
function encodeURL(str){
    var s0, i, s, u;
    s0 = "";                // encoded str
    for (i = 0; i < str.length; i++){   // scan the source
        s = str.charAt(i);
        u = str.charCodeAt(i);          // get unicode of the char
        if (s == " "){s0 += "+";}       // SP should be converted to "+"
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                s0 = s0 + s;            // don't escape
            }
            else {                  // escape
                if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     // quaternary byte format (extended)
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        // triple byte format
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                      // double byte format
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }
    return s0;
} 

/*  Function Equivalent to java.net.URLDecoder.decode(String, "UTF-8")
    Copyright (C) 2002, Cresc Corp.
    Version: 1.0
*/
function decodeURL(str){
    var s0, i, j, s, ss, u, n, f;
    s0 = "";                // decoded str
    for (i = 0; i < str.length; i++){   //scan the source str
        s = str.charAt(i);
        if (s == "+"){s0 += " ";}       // "+" should be changed to SP
        else {
            if (s != "%"){s0 += s;}     // add an unescaped char
            else{               // escape sequence decoding
                u = 0;          // unicode of the character
                f = 1;          // escape flag, zero means end of this sequence
                while (true) {
                    ss = "";        // local str to parse as int
                        for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
                            sss = str.charAt(++i);
                            if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
                                ss += sss;      // if hex, add the hex character
                            } else {--i; break;}    // not a hex char., exit the loop
                        }
                    n = parseInt(ss, 16);           // parse the hex str as byte
                    if (n <= 0x7f){u = n; f = 1;}   // single byte format
                    if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
                    if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
                    if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
                    if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
                    if (f <= 1){break;}         // end of the utf byte sequence
                    if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
                    else {break;}                   // abnormal, format error
                }
            s0 += String.fromCharCode(u);           // add the escaped character
            }
        }
    }
    return s0;
}

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}
function encode64Han(str) {
  return encode64(escape(str))
}
function decode64Han(str) {
  return unescape(decode64(str))
}
