function Fcheck(form, fields) {
    var lah = new Fchecker(form);
    if (fields) lah.setCheckFields(fields);
    var wmf = lah.go();
    if (wmf == false) alert(lah.getErrorMessage());
    return wmf;
}

Fchecker = function(form) {
  this.FUNC_MAP = {
        email     : "this.func_email",
        hangul    : "this.func_hangul",
        engonly   : "this.func_engonly",
        number    : "this.func_number",
        residentno: "this.func_residentno",
        jumin     : "this.func_jumin",
        foreignerno:"this.func_foreignerno",
        bizno     : "this.func_bizno",
        phone     : "this.func_phone",
        homephone : "this.func_homephone",
        handphone : "this.func_handphone",
        userid    : "this.func_userid",
        passwd    : "this.func_passwd"
  }
  this.ERR_MSG = {
        system   : "Fchecker Error: ",
        required : "¹Ýµå½Ã ÀÔ·ÂÇÏ¿©¾ß ÇÕ´Ï´Ù.",
        requirenum:"ÀÌ Ç×¸ñµé Áß¿¡ {requirenum}°³ ÀÌ»óÀÇ Ç×¸ñÀÌ ÀÔ·ÂµÇ¾î¾ß ÇÕ´Ï´Ù.",
        notequal : "ÀÔ·ÂµÈ ³»¿ëÀÌ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.",
        invalid  : "ÀÔ·ÂµÈ ³»¿ëÀÌ Çü½Ä¿¡ ¾î±ß³³´Ï´Ù.",
        minbyte  : "ÀÔ·ÂµÈ ³»¿ëÀÇ ±æÀÌ°¡ {minbyte}Byte ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.",
        maxbyte  : "ÀÔ·ÂµÈ ³»¿ëÀÇ ±æÀÌ°¡ {maxbyte}Byte¸¦ ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.",
        mincheck : "{mincheck}°³ÀÇ Ç×¸ñÀÌ»óÀ¸·Î ¼±ÅÃÇÏ¼¼¿ä.",
        maxcheck : "{maxcheck}°³ÀÇ Ç×¸ñÀÌÇÏ·Î ¼±ÅÃÇÏ¼¼¿ä.",
        minselect: "{minselect}°³ÀÇ Ç×¸ñÀÌ»óÀ¸·Î ¼±ÅÃÇÏ¼¼¿ä.",
        maxselect: "{maxselect}°³ÀÇ Ç×¸ñÀÌÇÏ·Î ¼±ÅÃÇÏ¼¼¿ä.",
        imageonly: "ÀÌ¹ÌÁö ÆÄÀÏ¸¸ Ã·ºÎÇÒ ¼ö ÀÖ½À´Ï´Ù."
  }
  this.ERR_DO = {
        text   : "select focus",
        select : "focus",
        check  : "focus",
        radio  : "focus",
        file   : "focus",
        hidden : ""
  }
  this.ERR_SYS = '_SYSERR_';
  this.fields = form.elements;
  this.form = form;
  this.errMsg = "";
}

Fchecker.prototype.setForm = function(form) {
  this.form = form;
}

Fchecker.prototype.setFunc = function(map, func) {
  if (typeof(this.FUNC_MAP[map]) == "string") return;
  this.FUNC_MAP[map] = func;
}

Fchecker.prototype.setCheckFields = function(fields) {
  this.fields = [];
  if(typeof(fields) == 'string')
    this.fields = [this.form.elements[fields]];
  else
    for(var i=0, s=fields.length; i<s; i++)
      this.fields[this.fields.length] = this.form.elements[fields[i]];
}

Fchecker.prototype.setUnCheckFields = function(fields) {
  this.fields = [];
  var _isUnCheckEl;

  if(typeof(fields) == 'string')
    fields = [fields];
    for (var i=0, s=this.form.elements.length; i<s; i++) {
      _isUnCheckEl = false;
      for (var j=0, t=fields.length; j<t; j++) {
        if (this.form.elements[i] == this.form.elements[fields[j]]) {
          _isUnCheckEl = true;
          break;
        }
      }
      if (!_isUnCheckEl) this.fields[this.fields.length] = this.form.elements[i];
    }
  }

  Fchecker.prototype.setParam = function(el, name, value) {
    el.setAttribute(name, value);
  }

  Fchecker.prototype.delParam = function(el, name) {
    el.removeAttribute(name);
  }

  Fchecker.prototype.go = function() {
    for (var i=0,s=this.fields.length; i<s; i++) {
      var el = this.fields[i];
      if (!this.isValidElement(el)) continue;

      var elType = this.getType(el);
      var trim = el.getAttribute("TRIM");
      var required = el.getAttribute("REQUIRED");
      var requirenum = el.getAttribute("REQUIRENUM");
      var minbyte = parseInt(el.getAttribute("MINBYTE"),10);
      var maxbyte = parseInt(el.getAttribute("MAXBYTE"),10);
      var mincheck = parseInt(el.getAttribute("MINCHECK"),10);
      var maxcheck = parseInt(el.getAttribute("MAXCHECK"),10);
      var minselect = parseInt(el.getAttribute("MINSELECT"),10);
      var maxselect = parseInt(el.getAttribute("MAXSELECT"),10);
      var option = el.getAttribute("OPTION");
      var match = el.getAttribute("MATCH");
      var span = el.getAttribute("SPAN");
      var glue = el.getAttribute("GLUE");
      var pattern = el.getAttribute("PATTERN");
      var imageonly = el.getAttribute("IMAGEONLY");

      if (trim != null && (elType == "text" || elType == "hidden")) {
        switch (trim) {
        case "trim":
          el.value = el.value.replace(/^\s+/, "").replace(/\s+$/, "");
          break;
        case "compress":
          el.value = el.value.replace(/\s+/, "");
          break;
        case "ltrim":
          el.value = el.value.replace(/^\s+/, "");
          break;
        case "rtrim":
          el.value = el.value.replace(/\s+$/, "");
          break;
        }
      }

      var elEmpty = this.isEmpty(el, elType);

      if (required != null) {
        if (required == "required") {
          if (elEmpty) return this.raiseError(el, "required");
        } else {
          requirenum = parseInt(requirenum, 10);
          var _num = 0;
          var _name = [];
          if (requirenum > 0) {
            for (var j=0; j<this.form.elements.length; j++) {
              var _el = this.form.elements[j];
              if (required == _el.getAttribute("REQUIRED")) {
                if(!this.isEmpty(_el, this.getType(_el))) _num++;
                _name[_name.length] = this.getName(_el);
              }
            }
            if(_num < requirenum)
            return this.raiseError(el, "requirenum", _name.join(", "));
          }
        }
      }
      if ((minbyte > 0 || maxbyte > 0) && (elType == "text" || elType == "hidden")) {
        var _tmp = el.value;
        var _len = el.value.length;
        for (j=0; j<_tmp.length; j++) {
          if (_tmp.charCodeAt(j) > 128) _len++;
        }
        if (minbyte > 0 && _len < minbyte) return this.raiseError(el, "minbyte");
        if (maxbyte > 0 && _len > maxbyte) return this.raiseError(el, "maxbyte");
      }
      if (match != null && elType != "file") {
        if (typeof this.form.elements[match] == "undefined")
          return this.raiseError(this.ERR_SYS, "Element '"+ match +"' is not found.");
        else if (el.value != this.form.elements[match].value)
          return this.raiseError(el, "notequal");
      }
      if (option != null && !elEmpty && elType != "file") {
            var _options = option.split(" ");
            for (var j in _options) {
                var _func = eval(this.FUNC_MAP[_options[j]]);
                if (span != null) {
                    var _value = [];
                    for (var k=0; k<parseInt(span,10); k++) {
                        try {
                            _value[k] = this.fields[i+k].value;
                        } catch (e) {
                            return this.raiseError(this.ERR_SYS,  (i+k) +"th Element is not found.");
                        }
                    }
                    try {
                        var _result = _func(el, _value.join(glue == null ? "" : glue));
                    } catch (e) {
                        return this.raiseError(this.ERR_SYS,  "function map '"+ _options[j] +"' is not exist.");
                    }
                    if (_result !== true) return this.raiseError(el, _result);
                } else {
                    try {
                        var _result = _func(el);
                    } catch (e) {
                        return this.raiseError(this.ERR_SYS,  "function map '"+ _options[j] +"' is not exist.");
                    }
                    if (_result !== true) return this.raiseError(el, _result);
                }
            }
        }
        if (pattern != null && !elEmpty && elType != "file") {
            try {
                pattern = new RegExp(pattern);
            } catch (e) {
                return this.raiseError(this.ERR_SYS, "Invalid Regular Expression '"+ pattern +"'");
            }
            if (!pattern.test(el.value)) return this.raiseError(el, "invalid");
        }
        if ((mincheck > 0 || maxcheck > 0) && elType == "check") {
            var _checks = this.form.elements[el.name];
            var _num = 0;
            if (typeof _checks.length != "undefined") {
                for (var j=0; j<_checks.length; j++) {
                    if (_checks[j].checked) _num++;
                }
            } else {
                if (_checks.checked) _num++;
            }
            if (mincheck > 0 && _num < mincheck) return this.raiseError(el, "mincheck");
            if (maxcheck > 0 && _num > maxcheck) return this.raiseError(el, "maxcheck");
        }
        if ((minselect > 0 || maxselect > 0) && elType == "multiselect") {
            var _num = 0;
            for (var j=0; j<el.options.length; j++) {
                if (el.options[j].selected) _num++;
            }
            if (minselect > 0 && _num < minselect) return this.raiseError(el, "minselect");
            if (maxselect > 0 && _num > maxselect) return this.raiseError(el, "maxselect");
        }
        if (imageonly != null && elType == "file") {
            var fn = el.value;
            if (fn != "") {
                var dotIndex = fn.lastIndexOf(".");
                var ext = fn.substring(dotIndex+1).toLowerCase();
                if(ext != "jpg" && ext != "jpeg" && ext != "gif" && ext != "png")
                    return this.raiseError(el, "imageonly");
            }
        }
    }
    return true;
}

Fchecker.prototype.isValidElement = function(el) {
    return el.name && el.tagName.match(/^input|select|textarea$/i) && !el.disabled;
}

Fchecker.prototype.isEmpty = function(el, type) {
    switch (type) {
    case "file": case "text": case "hidden":
        if (el.value == null || el.value == "") return true;
        break;
    case "select": case "multiselect":
        if (el.selectedIndex == -1 || el[el.selectedIndex].value == null ||
                el[el.selectedIndex].value == "")
            return true;
        break;
    case "check": case "radio":
        var elCheck = this.form.elements[el.name];
        var elChecked = false;
        if (typeof elCheck.length != "undefined") {
            for (var j=0; j<elCheck.length; j++) {
                if (elCheck[j].checked == true) elChecked = true;
            }
        } else {
            if (elCheck.checked == true) elChecked = true;
        }
        if (elChecked == false) return true;
        break;
    }
    return false;
}

Fchecker.prototype.getType = function(el) {
    switch (el.tagName.toLowerCase()) {
    case "select":
        return el.multiple == true ? "multiselect" : "select";
    case "textarea": return "text";
    case "input":
        switch (el.type.toLowerCase()) {
        case "radio": return "radio";
        case "checkbox": return "check";
        case "file": return "file";
        case "text": case "password": return "text";
        case "hidden": return "hidden";
        }
        break;
    }
}

Fchecker.prototype.raiseError = function(el, type, elName) {
    if (el == this.ERR_SYS) {
        this.errMsg = this.ERR_MSG["system"] + type;
        return false;
    }
    var pattern = /\{([a-zA-Z0-9_]+)\}/i;
    var msg = this.ERR_MSG[type] ? this.ERR_MSG[type] : type;
    var elType = this.getType(el);
    var elName = elName ? elName : this.getName(el);
    var errDo = el.getAttribute("ERRDO") ? el.getAttribute("ERRDO") : this.ERR_DO[elType];
    var _errDos = errDo ? errDo.split(" ") : [];

    if (el.getAttribute("ERRMSG") != null) msg = el.getAttribute("ERRMSG");
    if (pattern.test(msg) == true) {
        while (pattern.exec(msg)) msg = msg.replace(pattern, el.getAttribute(RegExp.$1));
    }
    for (var i in _errDos) {
        switch (_errDos[i]) {
        case "delete": el.value = ""; break;
        case "select": el.select(); break;
        case "focus":  el.focus(); break;
        }
    }
    this.errMsg = "\'"+ elName +"\'\n\n   - "+ msg +"\n";
    return false;
}

Fchecker.prototype.getErrorMessage = function() {
    return this.errMsg;
}

Fchecker.prototype.getName = function(el) {
    return el.getAttribute("HNAME") == null || el.getAttribute("HNAME") == ""
        ? el.name : el.getAttribute("HNAME");
}
/**
* validate functions
*/
Fchecker.prototype.func_email = function(el,value) {
    var value = value ? value : el.value;
    var pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
    return pattern.test(value) ? true : "invalid";
}

Fchecker.prototype.func_hangul = function(el) {
    var pattern = /[°¡-Èþ]/;
    return pattern.test(el.value) ? true : "¹Ýµå½Ã ÇÑ±ÛÀ» Æ÷ÇÔÇØ¾ß ÇÕ´Ï´Ù";
}

Fchecker.prototype.func_engonly = function(el) {
    var pattern = /^[a-zA-Z]+$/;
    return pattern.test(el.value) ? true : "invalid";
}

Fchecker.prototype.func_number = function(el) {
    var pattern = /^[0-9]+$/;
    return pattern.test(el.value) ? true : "¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù";
}

Fchecker.prototype.func_residentno = function(el,value) {
    var pattern = /^(\d{6})-?(\d{5}(\d{1})\d{1})$/;
    var num = value ? value : el.value;
    if (!pattern.test(num)) return "invalid";
    num = RegExp.$1 + RegExp.$2;
    if (RegExp.$3 == 7 || RegExp.$3 == 8 || RegExp.$4 == 9)
        if ((num[7]*10 + num[8]) %2) return "invalid";

    var sum = 0;
    var last = num.charCodeAt(12) - 0x30;
    var bases = "234567892345";
    for (var i=0; i<12; i++) {
        if (isNaN(num.substring(i,i+1))) return "invalid";
        sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
    }
    var mod = sum % 11;
    if(RegExp.$3 == 7 || RegExp.$3 == 8 || RegExp.$4 == 9)
        return (11 - mod + 2) % 10 == last ? true : "invalid";
    else
        return (11 - mod) % 10 == last ? true : "invalid";
}

Fchecker.prototype.func_jumin = function(el,value) {
    var pattern = /^([0-9]{6})-?([0-9]{7})$/;
    var num = value ? value : el.value;
    if (!pattern.test(num)) return "invalid";
    num = RegExp.$1 + RegExp.$2;
    var sum = 0;
    var last = num.charCodeAt(12) - 0x30;
    var bases = "234567892345";
    for (var i=0; i<12; i++) {
        if (isNaN(num.substring(i,i+1))) return "invalid";
        sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
    }
    var mod = sum % 11;
    return (11 - mod) % 10 == last ? true : "invalid";
}
Fchecker.prototype.func_foreignerno = function(el,value) {
    var pattern = /^(\d{6})-?(\d{5}[7-9]\d{1})$/;
    var num = value ? value : el.value;
    if (!pattern.test(num)) return "invalid";
    num = RegExp.$1 + RegExp.$2;
    if ((num[7]*10 + num[8]) %2) return "invalid";

    var sum = 0;
    var last = num.charCodeAt(12) - 0x30;
    var bases = "234567892345";
    for (var i=0; i<12; i++) {
        if (isNaN(num.substring(i,i+1))) return "invalid";
        sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
    }
    var mod = sum % 11;
    return (11 - mod + 2) % 10 == last ? true : "invalid";
}

Fchecker.prototype.func_bizno = function(el,value) {
    var pattern = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/;
    var num = value ? value : el.value;
    if (!pattern.test(num)) return "invalid";
    num = RegExp.$1 + RegExp.$2 + RegExp.$3;
    var cVal = 0;
    for (var i=0; i<8; i++) {
        var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7);
        cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10;
    }
    var li_temp = parseFloat(num.substring(i,i+1)) * 5 + "0";
    cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
    return parseInt(num.substring(9,10)) == 10-(cVal % 10)%10 ? true : "invalid";
}

Fchecker.prototype.func_phone = function(el,value) {
    var pattern = /^(0[2-8][0-5]?|01[01346-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
    var pattern15xx = /^(1544|1566|1577|1588|1644|1688)-?([0-9]{4})$/;
    var num = value ? value : el.value;
    return pattern.exec(num) || pattern15xx.exec(num) ? true : "invalid";
}

Fchecker.prototype.func_homephone = function(el,value) {
    var pattern = /^(0[2-8][0-5]?)-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
    var pattern15xx = /^(1544|1566|1577|1588|1644|1688)-?([0-9]{4})$/;
    var num = value ? value : el.value;
    return pattern.exec(num) || pattern15xx.exec(num) ? true : "invalid";
}

Fchecker.prototype.func_handphone = function(el,value) {
    var pattern = /^(01[01346-9])-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
    var num = value ? value : el.value;
    return pattern.exec(num) ? true : "invalid";
}

Fchecker.prototype.func_userid = function(el,value) {
    var pattern = /^[a-zA-Z0-9]{4,20}$/;
    return pattern.test(el.value) ? true : "4ÀÚÀÌ»ó 20ÀÚ ÀÌÇÏ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.\n   - ¿µ¹®, ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù";
}

Fchecker.prototype.func_passwd = function(el,value) {
    var pattern = /^[a-zA-Z0-9]{4,20}$/;
    return pattern.test(el.value) ? true : "4ÀÚÀÌ»ó 20ÀÚ ÀÌÇÏ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.\n   - ¿µ¹®, ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù";
}

/**
* direct_javascript function
*/

// È­¸éÁß¾Ó¿¡¼­ Ã¢¿­±â
function nwindow(page,name,w,h,scroll,resize){
var win= null;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/3;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable='+resize+',';
      settings +='status=no';
  win=window.open(page,name,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
//¼ö·® ´õÇÏ±â
function num_plus(num){
	gnum = parseInt(num.value);
	num.value = gnum + 1;
	return;
}
//¼ö·® »©±â
function num_minus(num){
	gnum = parseInt(num.value);
	if( gnum > 0 ){
		num.value = gnum - 1;
	}
	return;
}
/**
 *  text ±âº»°ª
 * <input type="text" name="txtname"  value="default_value" onFocus="txt_default_value('focus', this, 'default_value');" onBlur="txt_default_value('blur', this, 'default_value');">
 */
function txt_default_value(mode, txtObj, default_val)
{
    if (mode == "focus" && txtObj.value == default_val) {
        txtObj.value = '';
    } else if (mode == "blur" && !txtObj.value) {
        txtObj.value = default_val;
    }
}

/**
 *  ¼ýÀÚ¸¸ ÀÔ·Â¹Þ´Â´Ù.
 *
 *  »ç¿ë¹ý : onKeyDown='onlyNumber()'
 *  ¼³ ¸í :  ÇÑ±ÛÀÔ·Â¾ÈµÊ. ¿£ÅÍ¿Í ¹é½ºÆäÀÌ½º,ÅÇÅ°,½ºÆäÀÌ½ºÅ°
 *           delete,insert,home/end/¹æÇâÅ°°ª,±×·¹ÀÌÅ°¼ýÀÚ°ª,Å°º¸µåÀ§¼ýÀÚ°ª¸¸ ÀÔ·Â°¡´ÉÇÏ´Ù.
 */

function onlyNumber() {
  if((event.keyCode<48) || (event.keyCode>57)){
    event.returnValue=false;
  }
}
function onlyEngnum() {
 if(only_key() != 2) {
  event.returnValue = false;
 }
}

/**
 *  ÇÑ±Û¸¸ ÀÔ·Â¹Þ´Â´Ù.
 *
 *  »ç¿ë¹ý : onKeyDown='onlyHangle()'
 */
function onlyHangle()
{
    var ek = event.keyCode
    if( ek != 13 && ek != 9 && ek != 8 && ek != 32 && ek != 46 && ek != 45 && ((ek < 48) ||(ek > 57)) )
     event.returnValue=false;
}

/**
 *  ¼ýÀÚ¿¡¼­ 3ÀÚ¸®¸¶´Ù ÄÄ¸¶ ºÙÀÌ±â
 *
 *  »ç¿ë¹ý : onKeyUp="numberformat(this)"
 *  ¼³ ¸í :  'onlyNumber()' °ú °°ÀÌ »ç¿ëÇÑ´Ù.
 */
function numberformat(obj)
{
    var num         = "";
    var only_num     = String(obj.value);
    only_num        = only_num.replace(/,|\s+/g, "");

    var len         = only_num.length;
    var pos         = len % 3;

    if (len < 3) {
        obj.value = only_num;
    } else {
        if (pos > 0) {
            num = only_num.substring(0,pos) + ",";
            len -= pos;
        }
        while (len > 3) {
            num += only_num.substring(pos, pos+3) + ",";
            len -= 3;
            pos += 3;
        }
        num += only_num.substring(pos, pos+3);
        obj.value = num;
    }
}

// ÀÚ¸®¼ö³Ñ±â¸é ´ÙÀ½
function move_field(argform,nextfield,chars,currfield) {
  var f = eval('document.'+ argform);
  var x= eval('document.' + argform + '.' +  currfield + '.' + 'value.length;');
  if (x == chars) {
    eval('document.' + argform + '.' + nextfield + '.focus();');
  }
}

/**
 *  ±Ý¾×ÀÔ·Â(3ÀÚ¸®¸¶´Ù ÄÄ¸¶ ºÙÀÌ±â), ÀÔ·ÂµÈ ±Ý¾× ÇÑ±Û·Î Ç¥½Ã
 *
 *  »ç¿ë¹ý : onKeyUp="numberformat(this)"
 *  <input type="text" name="A_EMONEY" size=18 maxLength=15 style="text-align:right"
 *	onkeypress="NUM_HAN(this.value,3,document.form.EMONEY_HAN)"
 *  onkeyup="this.value=numchk(this.value);
 *  NUM_HAN(this.value,3,document.form.EMONEY_HAN)"> ¿ø
 *  <input type="text" name="EMONEY_HAN" readonly style="border:0;" size="50">
 */


//±Ý¾×¿¡ , Âï±â
function numchk(num){
    num=new String(num);
    num=num.replace(/,/gi,"");
    return numchk1(num);
}

function numchk1(num){
    var sign="";
    if(isNaN(num)) {
        alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
        return 0;
    }
    if(num==0) {
        return num;
    }

    if(num<0){
        num=num*(-1);
        sign="-";
    }
    else{
        num=num*1;
    }
    num = new String(num)
    var temp="";
    var pos=3;
    num_len=num.length;
    while (num_len>0){
        num_len=num_len-pos;
        if(num_len<0) {
            pos=num_len+pos;
            num_len=0;
        }
        temp=","+num.substr(num_len,pos)+temp;
    }
    return sign+temp.substr(1);
}

// ±Ý¾× ¼ýÀÚ¸¦ ÇÑ±Û·Î
function num_han(num)
{
    if ( num == "1" )       return "ÀÏ";
    else if ( num == "2" )  return "ÀÌ";
    else if ( num == "3" )  return "»ï";
    else if ( num == "4" )  return "»ç";
    else if ( num == "5" )  return "¿À";
    else if ( num == "6" )  return "À°";
    else if ( num == "7" )  return "Ä¥";
    else if ( num == "8" )  return "ÆÈ";
    else if ( num == "9" )  return "±¸";
    else if ( num == "½Ê" ) return "½Ê";
    else if ( num == "¹é" ) return "¹é";
    else if ( num == "Ãµ" ) return "Ãµ";
    else if ( num == "¸¸" ) return "¸¸ ";
    else if ( num == "¾ï" ) return "¾ï ";
    else if ( num == "Á¶" ) return "Á¶ ";
    else if ( num == "0" )  return "";
}

function NUM_HAN(num,mode,return_input)
{
    if ( num == "" || num == "0" ) {
        if ( mode == "3" ) {
            return_input.value = "";
        }
        return;
    }

    num=new String(num);
    num=num.replace(/,/gi,"");

    var len  = num.length;
    var temp1 = "";
    var temp2 = "";

    if ( len/4 > 3 && len/4 <= 4 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "Á¶"
			+ ciphers_han(num.substring(4,8)) + "¾ï"
			+ ciphers_han(num.substring(8,12)) + "¸¸"
			+ ciphers_han(num.substring(12,16));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "Á¶"
			+ ciphers_han(num.substring(len%4,len%4+4)) + "¾ï"
			+ ciphers_han(num.substring(len%4+4,len%4+8)) + "¸¸"
			+ ciphers_han(num.substring(len%4+8,len%4+12));
        }
    }
    else if ( len/4 > 2 && len/4 <= 3 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "¾ï"
			+ ciphers_han(num.substring(4,8)) + "¸¸"
			+ ciphers_han(num.substring(8,12));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "¾ï"
			+ ciphers_han(num.substring(len%4,len%4+4)) + "¸¸"
			+ ciphers_han(num.substring(len%4+4,len%4+8));
        }
    }
    else if ( len/4 > 1 && len/4 <= 2 ) {
        if ( len%4 == 0 ) {
            temp1 = ciphers_han(num.substring(0,4)) + "¸¸"
			+ ciphers_han(num.substring(4,len));
        }
        else {
            temp1 = ciphers_han(num.substring(0,len%4)) + "¸¸"
			+ ciphers_han(num.substring(len%4,len));
        }
    }
    else if ( len/4 <= 1 ) {
        temp1 = ciphers_han(num.substring(0,len));
    }

    for (var i=0; i<temp1.length; i++) {
        temp2 = temp2 + num_han(temp1.substring(i, i+1));
    }

    temp3=new String(temp2);
    temp3=temp3.replace(/¾ï ¸¸/gi,"¾ï ");
    temp3=temp3.replace(/Á¶ ¾ï/gi,"Á¶ ");

    if ( mode == 1 ) {
        alert(temp3 + " ¿ø");
    } else if ( mode == 2 ) {
        return temp3;
    } else if ( mode == 3 ) {
        return_input.value = "( " + temp3 + " ¿ø )";
    }
}

function ciphers_han(num)
{
    var len  = num.length;
    var temp = "";

    if ( len == 1 ) {
        temp = num;
    }
    else if ( len == 2 ) {
        temp = num.substring(0,1) + "½Ê"
		+ num.substring(1,2);
    }
    else if ( len == 3 ) {
        temp = num.substring(0,1) + "¹é"
		+ num.substring(1,2) + "½Ê"
		+ num.substring(2,3);
    }
    else if ( len == 4 ) {
        temp = num.substring(0,1) + "Ãµ"
		+ num.substring(1,2) + "¹é"
		+ num.substring(2,3) + "½Ê"
		+ num.substring(3,4);
    }

    num=new String(temp);
    num=num.replace(/0½Ê/gi,"");
    num=num.replace(/0¹é/gi,"");
    num=num.replace(/0Ãµ/gi,"");
    return num;
}
// ÅØ½ºÆ®¹Ú½º¿¡ value °ª³Ö±â
function Change (target,type)
{
       if ( target.value == target.defaultValue && type==0)
        {
           target.style.backgroundImage='';
           target.value = '';
        }
       if ( !target.value && type==1) target.value = target.defaultValue;
}

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" : "");
}
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
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";
    }
}
//  ÇÁ¸°Æ® °ü·Ã ÇÔ¼ö
function printDiv () {
if (document.all && window.print) {
window.onbeforeprint = beforeDivs;
window.onafterprint = afterDivs;
window.print();
}
}
function beforeDivs () {
if (document.all) {
objContents.style.display = 'none';
objSelection.innerHTML = document.all['d1'].innerHTML;
}
}
function afterDivs () {
if (document.all) {
objContents.style.display = 'block';
objSelection.innerHTML = "";
}
}


/////////////////////////////////////////////////////////////////////¿ÀÆÀÀå ÇÔ¼ö
//°ü¸®ÀÚ ¿ìÆí¹øÈ£
function S_Zip(){
  nwindow('/common/zip.php?form=write&zip1=s_zip1&zip2=s_zip2&address=s_addr1', 'zipcode', '510' , '360' ,'yes','yes');
}
function E_Zip(){
  nwindow('/common/zip.php?form=write&zip1=e_zip1&zip2=e_zip2&address=e_addr1', 'zipcode', '510' , '360' ,'yes','yes');
}
//ÀÎµ¦½º ¿ìÆí¹øÈ£
function S_Zip1(){
  nwindow('/common/index_zip.php?form=m_order&zip1=s_zip1&zip2=s_zip2&address=s_addr1', 'zipcode', '510' , '360' ,'yes','yes');
}
function E_Zip1(){
  nwindow('/common/index_zip.php?form=m_order&zip1=e_zip1&zip2=e_zip2&address=e_addr1', 'zipcode', '510' , '360' ,'yes','yes');
}

//Á÷¿øµî·Ï ÇÊµå ¾ÆÀÌµð Ã¼Å©
function Id_CheckIt(){
  nwindow('/adm/staff/ad_staff_check.php?form=write&id=staff_id', '', '510' , '360' ,'yes','yes');
}
/*
function Id_CheckIt(){
  var f=document.write;
  if( (f.staff_id.value.length<4) || (f.staff_id.value.search(/([^A-Za-z0-9]+)/)!=-1) ) {
    alert("¾ÆÀÌµð´Â 4ÀÚ ÀÌ»ó ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î¸¸ ÀÔ·Â ÇÒ ¼ö ÀÖ½À´Ï´Ù.");
    f.staff_id.focus();
  }else{
    nwindow('/adm/staff/ad_staff_check.php?form=write&id=staff_id', '', '510' , '360' ,'yes','yes');
  }
}*/

//ÀÎµ¦½º onmoseover(ÀÌ¹ÌÁöº¯°æ)
function premier(n) {
	for(var i = 1; i <= 2; i++) {
		obj = document.getElementById('premier'+i);
		img = document.getElementById('premier_button'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.height = 23;
			img.src = "/img/bu_0"+i+".gif";
		} else {
			obj.style.display = "none";
			img.height = 23;
			img.src = "/img/bu_r_0"+i+".gif";
		}
	}
}
function apremier(n) {
	for(var i = 1; i <= 2; i++) {
		obj = document.getElementById('apremier'+i);
		img = document.getElementById('apremier_button'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.height = 25;
			img.src = "/img/ku_0"+i+".gif";
		} else {
			obj.style.display = "none";
			img.height = 25;
			img.src = "/img/ku_r_0"+i+".gif";
		}
	}
}

//ÅØ½ºÆ®¹Ú½º¿¡ value °ª³Ö±â
//function Change (target,type){
  //if ( target.value == target.defaultValue && type==0) target.value = '';
  //if ( !target.value && type==1) target.value = target.defaultValue;
//}

//°ßÀûÁ¦ÃâÆäÀÌÁö-ÃÑÃ»±¸±Ý¾×
/*
function cost_sum(form){
  var total_won1;
  var outstanding1;

  //ÀÌ»çºñ¿ë
  move_won = parseInt(form.move_won.value);
  //¿É¼Çºñ¿ë
  option_won = parseInt(form.option_won.value);
  //º¸°üºñ¿ë
  custody_won = parseInt(form.custody_won.value);
  //ÃÑºñ¿ë
  total_won = parseInt(form.total_won.value);
	//ÀÔ±Ý¾×
	agree_won = parseInt(form.agree_won.value);
	//¹Ì¼ö±Ý
	outstanding = parseInt(form.outstanding.value);
	//Á¶°Ç ¹× °è»ê
	if((form.move_won.value == "0") || (form.move_won.value == '')) { form.move_won.value=0;};
	if((form.option_won.value == "0") || (form.option_won.value == '')) { form.option_won.value=0;};
	if((form.custody_won.value == "0") || (form.custody_won.value == '')) { form.custody_won.value=0;};
	if((form.agree_won.value == "0") || (form.agree_won.value == '')) { form.agree_won.value=0;};
	total_won1 = eval(move_won + option_won + custody_won);
	outstanding1 = eval(total_won1 - agree_won);
  form.total_won.value = total_won1;
  form.outstanding.value = outstanding1;
  return total_won.value;
}*/

//°è¾àÁ¦ÃâÆäÀÌÁö-TON
/*
function ton_sum(form){
  //Â÷·®¼ö
  ton5 = parseInt(form.a_ton5.value);
  ton2 = parseFloat(form.a_ton2.value);
  ton1 = parseInt(form.a_ton1.value);
	//ÃÑÂ÷·®Åæ¼ö(ton)
	ton_total = parseFloat(form.a_ton_total.value);

	//Á¶°Ç ¹× °è»ê
	if((form.a_ton5.value == NaN) || (form.a_ton5.value == '')) { form.a_ton5.value=0;};
	if((form.a_ton2.value == NaN) || (form.a_ton2.value == '')) { form.a_ton2.value=0;};
	if((form.a_ton1.value == NaN) || (form.a_ton1.value == '')) { form.a_ton1.value=0;};

	ton_5 = ton5 * 5;
	ton_2 = ton2 * 2.5;
	ton_1 = ton1 * 1;
	ton_total = eval(ton_5 + ton_2 + ton_1);

	form.a_ton_total.value = ton_total;
	return form.a_ton_total.value;
}
*/
//°è¾àÁ¦ÃâÆäÀÌÁö-ÃÑ¿É¼Ç±Ý¾×
/*function agree_sum(form){
  var option_won1;
	var total_won1;
	var outstanding1;

  //¿É¼Çºñ¿ë
  opt1_won = parseInt(form.a_opt1_won.value);
  opt2_won = parseInt(form.a_opt2_won.value);
  opt3_won = parseInt(form.a_opt3_won.value);
  opt4_won = parseInt(form.a_opt4_won.value);
  opt5_won = parseInt(form.a_opt5_won.value);
  opt6_won = parseInt(form.a_opt6_won.value);
  opt7_won = parseInt(form.a_opt7_won.value);
  opt8_won = parseInt(form.a_opt8_won.value);
  opt9_won = parseInt(form.a_opt9_won.value);
  opt10_won = parseInt(form.a_opt10_won.value);

  //ÀÌ»çºñ¿ë
  move_won = parseInt(form.a_move_won.value);
	//ÃÑ¿É¼Çºñ¿ë
	option_won = parseInt(form.a_option_won.value);
	//º¸°üºñ¿ë
	custody_won = parseInt(form.a_custody_won.value);
	//ÃÑºñ¿ë
	total_won = parseInt(form.a_total_won.value);
	//°è¾à±Ý
	agree_won = parseInt(form.a_agree_won.value);
	//¹Ì¼ö±Ý
	outstanding = parseInt(form.a_outstanding.value);

	//Á¶°Ç ¹× °è»ê
	if((form.a_opt1_won.value == "0") || (form.a_opt1_won.value == "")) { form.a_opt1_won.value=0;};
	if((form.a_opt2_won.value == "0") || (form.a_opt2_won.value == "")) { form.a_opt2_won.value=0;};
	if((form.a_opt3_won.value == "0") || (form.a_opt3_won.value == "")) { form.a_opt3_won.value=0;};
	if((form.a_opt4_won.value == "0") || (form.a_opt4_won.value == "")) { form.a_opt4_won.value=0;};
	if((form.a_opt5_won.value == "0") || (form.a_opt5_won.value == "")) { form.a_opt5_won.value=0;};
	if((form.a_opt6_won.value == "0") || (form.a_opt6_won.value == "")) { form.a_opt6_won.value=0;};
	if((form.a_opt7_won.value == "0") || (form.a_opt7_won.value == "")) { form.a_opt7_won.value=0;};
	if((form.a_opt8_won.value == "0") || (form.a_opt8_won.value == "")) { form.a_opt8_won.value=0;};
	if((form.a_opt9_won.value == "0") || (form.a_opt9_won.value == "")) { form.a_opt9_won.value=0;};
	if((form.a_opt10_won.value == "0") || (form.a_opt10_won.value == "")) { form.a_opt10_won.value=0;};
	if((form.a_move_won.value == "0") || (form.a_move_won.value == "")) { form.a_move_won.value=0;};
	if((form.a_option_won.value =="0") || (form.a_option_won.value == "")) { form.a_option_won.value=0;};
	if((form.a_custody_won.value == "0") || (form.a_custody_won.value == "")) { form.a_custody_won.value=0;};
	if((form.a_total_won.value == "0") || (form.a_total_won.value == "")) { form.a_total_won.value=0;};
	if((form.a_agree_won.value == "0") || (form.a_agree_won.value == "")) { form.a_agree_won.value=0;};

	option_won1 = eval(opt1_won + opt2_won + opt3_won + opt4_won + opt5_won + opt6_won + opt7_won + opt8_won + opt9_won + opt10_won);
	total_won1 = eval(move_won + option_won1 + custody_won);
  outstanding1 = eval(total_won1 - agree_won);

	form.a_option_won.value = option_won1;
	form.a_total_won.value = total_won1;
  form.a_outstanding.value = outstanding1;
	return form.a_outstanding.value;
}*/

//ÀÌ¹ÌÁö »õÃ¢¶ç¿ì±â ½ÃÀÛ
function showPicture(src) {
  var imgObj = new Image();
  imgObj.src = src;
  var wopt = "scrollbars=no,status=no,resizable=yes";
  wopt += ",width=" + imgObj.width;
  wopt += ",height=" + imgObj.height;
  var wbody = "<head><title>ÀÌ¹ÌÁöºä</title>";
  wbody += "<script language='javascript'>";
  wbody += "function finalResize(){";
  wbody += "  var oBody=document.body;";
  wbody += "  var oImg=document.images[0];";
  wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
  wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
  wbody += "  window.resizeBy(xdiff,ydiff);";
  wbody += "}";
  wbody += "</"+"script>";
  wbody += "</head>";
  wbody += "<body onLoad='finalResize()' style='margin:0'>";
  wbody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
  wbody += "</body>";
  winResult = window.open("about:blank","",wopt);
  winResult.document.open("text/html", "replace");
  winResult.document.write(wbody);
  winResult.document.close();
  return;
}
//ÀÌ¹ÌÁö Å©±â¸¦ maxwÅ©±â¸¸Å­ Á¶ÀýÇØ¼­ »Ñ·ÁÁÖ´Â ½ºÅ©¸³ ½ÃÀÛ
//º»¹® ³»¿ë ¾Æ¹«°÷¿¡³ª id ¸¦ ºÎ¿©ÇØÁÖ¸é, ÇØ´ç Å×ÀÌºíÀÇ ÇÏÀ§³ëµå¿¡ ´ëÇÑ
//ÀÌ¹ÌÁö ÆÄÀÏµé¸¸ Ã£¾Æ, ¸®»çÀÌÂ¡À» ÇÕ´Ï´Ù.
function searchAll_IMG( obj ) {
	var maxw = 600;	//ÃÖ°í Çã¿ëÄ¡ °¡·ÎÅ©±â
	if( obj.nodeName == 'IMG' ) {
		if( obj.width > maxw ) obj.width = maxw;
	}
	if( obj.childNodes ) {	//ÇÏÀ§Å×ÀÌºí ¼øÂ÷°Ë»ö ..
		var dest = obj.childNodes;
		for( var i = 0; i < dest.length; i ++ ) {
			searchAll_IMG( dest[i] );
		}
	}
}
function startResize( id ) {
	var obj = document.getElementById( id );
	searchAll_IMG( obj );
}

//¹«ºù¹Ú½º5 Å¬¶óÀÌ¾ðÆ® ÆäÀÌÁö ÇØ´çµÈ´Ù.
function searchAll_IMG2( obj2 ) {
	var maxw = 647;	//ÃÖ°í Çã¿ëÄ¡ °¡·ÎÅ©±â
	if( obj2.nodeName == 'IMG' ) {
		if( obj2.width > maxw ) obj2.width = maxw;
	}
	if( obj2.childNodes ) {	//ÇÏÀ§Å×ÀÌºí ¼øÂ÷°Ë»ö ..
		var dest = obj2.childNodes;
		for( var i = 0; i < dest.length; i ++ ) {
			searchAll_IMG2( dest[i] );
		}
	}
}
function startResize2( id ) {
	var obj2 = document.getElementById( id );
	searchAll_IMG2( obj2 );
}


//ÀÌ¹ÌÁö ½½¶óÀÌµå Çü½ÄÀ¸·Î º¸¿©ÁÖ±â
var _dropinslideshowcount=0

function dropinslideshow(imgarray, w, h, delay){
    this.id="_dropslide"+(++_dropinslideshowcount) //Generate unique ID for this slideshow instance (automated)
    this.createcontainer(parseInt(w), parseInt(h))
    this.delay=delay
    this.imgarray=imgarray
    var preloadimages=[]
    for (var i=0; i<imgarray.length; i++){
        preloadimages[i]=new Image()
        preloadimages[i].src=imgarray[i][0]
    }
    this.animatestartpos=parseInt(h)*(-1) //Starting "top" position of an image before it drops in
    this.slidedegree=10 //Slide degree (> is faster)
    this.slidedelay=30 //Delay between slide animation (< is faster)
    this.activecanvasindex=0 //Current "active" canvas- Two canvas DIVs in total
    this.curimageindex=0
    this.zindex=100
    this.isMouseover=0
    this.init()
}


dropinslideshow.prototype.createcontainer=function(w, h){
document.write('<div id="'+this.id+'" style="position:relative; width:'+w+'px; height:'+h+'px; overflow:hidden">')
    document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:0;"></div>')
    document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:-'+h+'px;"></div>')
    document.write('</div>')
    this.slideshowref=document.getElementById(this.id)
    this.canvases=[]
    this.canvases[0]=this.slideshowref.childNodes[0]
    this.canvases[1]=this.slideshowref.childNodes[1]
}

dropinslideshow.prototype.populatecanvas=function(canvas, imageindex){
    var imageHTML='<img src="'+this.imgarray[imageindex][0]+'" style="border: 0" />'
    if (this.imgarray[imageindex][1]!="")
        imageHTML='<a href="'+this.imgarray[imageindex][1]+'" target="'+this.imgarray[imageindex][2]+'">'+imageHTML+'</a>'
    canvas.innerHTML=imageHTML
}


dropinslideshow.prototype.animateslide=function(){
    if (this.curimagepos<0){ //if image hasn't fully dropped in yet
        this.curimagepos=this.curimagepos+this.slidedegree
        this.activecanvas.style.top=this.curimagepos+"px"
    }
    else{
        clearInterval(this.animatetimer)
        this.activecanvas.style.top=0
        this.setupnextslide()
        var slideshow=this
        setTimeout(function(){slideshow.rotateslide()}, this.delay)
    }
}


dropinslideshow.prototype.setupnextslide=function(){
    this.activecanvasindex=(this.activecanvasindex==0)? 1 : 0
    this.activecanvas=this.canvases[this.activecanvasindex]
    this.activecanvas.style.top=this.animatestartpos+"px"
    this.curimagepos=this.animatestartpos
    this.activecanvas.style.zIndex=(++this.zindex)
    this.curimageindex=(this.curimageindex<this.imgarray.length-1)? this.curimageindex+1 : 0
    this.populatecanvas(this.activecanvas, this.curimageindex)
}

dropinslideshow.prototype.rotateslide=function(){
    var slideshow=this
    if (this.isMouseover)
        setTimeout(function(){slideshow.rotateslide()}, 50)
    else
        this.animatetimer=setInterval(function(){slideshow.animateslide()}, this.slidedelay)
}

dropinslideshow.prototype.init=function(){
    var slideshow=this
    this.populatecanvas(this.canvases[this.activecanvasindex], 0)
    this.setupnextslide()
    this.slideshowref.onmouseover=function(){slideshow.isMouseover=1}
    this.slideshowref.onmouseout=function(){slideshow.isMouseover=0}
    setTimeout(function(){slideshow.rotateslide()}, this.delay)
}

//´ÙÁß¼¿·ºÆ®
/*var cnt = new Array();
cnt[0] = new Array('¼­ºñ½ºÁ¾·ù');
cnt[1] = new Array('°¡¿ÁÇüÅÂ','¾ÆÆÄÆ®','ºô¶ó','¿ÀÇÇ½ºÅÚ','´Üµ¶ÁÖÅÃ','´Ù¼¼´ë','¿ø·ë');
cnt[2] = new Array('±â¾÷ÇüÅÂ','ºôµù','»ó°¡','°øÀå','¿ÀÇÇ½ºÅÚ','±âÅ¸');
cnt[3] = new Array('°¡¿ÁÇüÅÂ','¾ÆÆÄÆ®','ºô¶ó','¿ÀÇÇ½ºÅÚ','´Üµ¶ÁÖÅÃ','´Ù¼¼´ë','¿ø·ë');
cnt[4] = new Array('°¡¿ÁÇüÅÂ','¾ÆÆÄÆ®','ºô¶ó','¿ÀÇÇ½ºÅÚ','´Üµ¶ÁÖÅÃ','´Ù¼¼´ë','¿ø·ë');
function change(ku) {
  //Ãâ¹ßÁö
  sel=document.write.s_house
  //¿É¼Ç¸Þ´º»èÁ¦
  for (i=sel.length-1; i>=0; i--){
    sel.options[i] = null
  }
  //¿É¼Ç¹Ú½ºÃß°¡
  for (i=0; i < cnt[ku].length;i++){
    sel.options[i] = new Option(cnt[ku][i],i);
  }
  //µµÂøÁö
  sel1=document.write.e_house
  //¿É¼Ç¸Þ´º»èÁ¦
  for (i=sel1.length-1; i>=0; i--){
    sel1.options[i] = null
  }
  //¿É¼Ç¹Ú½ºÃß°¡
  for (i=0; i < cnt[ku].length;i++){
    sel1.options[i] = new Option(cnt[ku][i],i);
  }
}*/

//¶óµð¿À,Ã¼Å©¹Ú½º ÀÚµ¿Ã¼Å©ÇÏ±â
function mSelect(input_name,input_value) {
  if(!(fn = document.getElementById(input_name))) {
    name = document.getElementsByName(input_name);
    fn = name[0];
  }
  if(fn!=null && input_value != '') {
    if(fn.type=='radio') {
      count = count = document.getElementsByName(input_name).length;
      for(i=0;i<count;i++) {
        if(document.getElementsByName(input_name)[i].value==input_value) {
          document.getElementsByName(input_name)[i].checked=true;
        }
      }
    } else {
      switch (fn.type) {
      case 'checkbox' :
        if(fn.value==input_value) {
          fn.checked = true;
        }
        break;
      case 'select-one' :
        fn.value = input_value;
        if(fn.value=='') {
          fn.options[0].selected = true;
        }
        break;
      case 'text' :
      case 'textarea' :
        fn.value = input_value;
        break;
      default :
      }
    }
  }
}

