var browser_type;

if(navigator.userAgent.indexOf('MSIE') == -1) browser_type = 'NS';
else browser_type = 'IE';

function MM_preloadImages() { //v3.0
  var d=document; if (d.images){ if (!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if (!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if (!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore,link_head){ //v3.0
  if (selObj.value == '') return;
  if (link_head == undefined) link_head = '';
  eval(targ+".location='"+link_head+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu_window(targ,selObj,restore){ //v3.0
  if (selObj.value == '') return;
  window.open(selObj.options[selObj.selectedIndex].value, 'window_quick', 'top=0,left=0,width=900,height=700,resizable=yes,scrollbars=yes,menubar=yes');
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu_radio(targ,selObj,restore){ //v3.0
  if (selObj.value == '') return;
  eval(targ+".location='"+selObj.value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_showHideBoards() { //v6.0
  var i,p,v,obj,args=MM_showHideBoards.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='block')?'block':(v=='none')?'none':v; }
    obj.display=v; }
}

function show_layer(lname, flag) {
  layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
  if (typeof(layer) == 'undefined' || lname == '') return;
  if (navigator.appName == 'Netscape') layer.visibility = (flag == 0) ? 'show' : 'hide';
  else layer.style.visibility = (flag == 0) ? 'visible' : 'hidden';
}

// ¸¶¿ì½ºÁÂÇ¥¸¦ ±¸ÇÏ´Â ÇÔ¼ö (layer , window)
function get_mouse_xy(mode) {
  xy = new Array();
  switch (mode) {
    case "layer" :
      xy[0] = (event.pageX) ? event.pageX : Math.max(document.body.scrollLeft, document.documentElement.scrollLeft)+event.clientX;
      xy[1] = (event.pageY) ? event.pageY : Math.max(document.body.scrollTop, document.documentElement.scrollTop)+event.clientY;
    break;
    case "window" :
      xy[0] = (event.pageX) ? event.pageX : event.screenX;
      xy[1] = (event.pageY) ? event.pageY : event.screenY;
    break;
    case "window2" :
      xy[0] = (event.screenX) ? event.screenX : Math.max(document.body.scrollLeft, document.documentElement.scrollLeft)+event.clientX;
      xy[1] = (event.screenY) ? event.screenY : Math.max(document.body.scrollTop, document.documentElement.scrollTop)+event.clientY;
    break;
  }
  return xy;
}

// screenX ´Â ¸ð´ÏÅÍÈ­¸é ¿ÞÂÊ»ó´Ü ±âÁØ ¸¶¿ì½º X ÁÂÇ¥, clientX(NS:pageX) ´Â ÇöÀç Ã¢ ±âÁØ ¿ÞÂÊ »ó´Ü ±âÁØ X ÁÂÇ¥°ª
function open_window_mouse(ref, x_control, y_control, width, height, name) {
  xy = get_mouse_xy('window');
  x_owm = xy[0];
  y_owm = xy[1];
  if (typeof(x_control) == "number") x_owm = x_owm + x_control;
  if (typeof(y_control) == "number") y_owm = y_owm + y_control;
  if (name == '') name = 'OWM';
  window.open(ref,name,'width=' + width + ',height=' + height + ',status=no,resizable=yes,scrollbars=yes,top=' + y_owm + ',left=' + x_owm + '').focus();
}

function open_window(ref, left, top, width, height, name) {
  if (name == '') name = 'OW';
  window.open(ref,name,'width=' + width + ',height=' + height + ',status=no,resizable=yes,scrollbars=yes,top=' + top + ',left=' + left + '').focus();
}

//name : °´Ã¼ÀÌ¸§, len: ÃÖ´ë±æÀÌ, gb: ÀÔ·Â¿©ºÎÃ¼Å©
function chkTxarea(obj, len, gb, obj_print_len_box) {
  j = k = 0;
  tempStr = tempStr2 = '';
  //obj.value = trim(obj.value);
  for(i = 0; i < obj.value.length; i++  ) {
    tempStr = obj.value.charCodeAt(i);
    tempStr2 = tempStr.toString();
    if (tempStr2.length >= 5) j++;    //ÇÑ±Û
    else k++;                       //¿µ¹®
  }
  ln = k+(j*2);
  if (gb == "D" && ln == 0) {
    alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
    obj.focus();
    obj.select();
    return false;
  }
  if (obj_print_len_box != '') obj_print_len_box.value = ln;
  if (ln > len) {
    alert(len+"Byte ÀÌ³»·Î ÀÔ·ÂÇÏ¼¼¿ä. (ÇöÀç "+ ln +" Byte)");
    obj.focus();
    return false;
  } else {
    if (obj_print_len_box != '') obj_print_len_box.value = ln;
    return true;
  }
}

function coloring_box(obj, color) {
  if (color == '') color = "#EDFBFF;";
  obj.style.background = color;
}

function focus_msg(obj, msg, color) {
  if (msg != '') alert(msg);
  if (color != '') coloring_box(obj, color);
  obj.focus();
}

// ÀÔ·Â»óÀÚ¿¡ ¼ýÀÚ¸¸ ÀÔ·ÂµÇµµ·Ï °É·¯ÁÖ´Â ÇÔ¼ö
function ck_number(obj, min, max) {
  if (obj.value == '') return;
  minus = '';
  x = no_comma(obj.value);                    // ÄÞ¸¶Á¦°Å
  if (x.charAt(0) == '-') {                       // À½¼öÀÎ °æ¿ì
    minus = '-';                                  // minus flag ¿¡ - ÁöÁ¤
    x = x.substring(1, x.length);               // ¾ç¼ö·Î º¯È¯
  }
  if (isNaN(x)) {                               // 1. ¼ýÀÚ°¡ ¾Æ´Ñ°æ¿ì ¸Þ½ÃÁö ÈÄ ¿øÀ§Ä¡
    alert("¼ýÀÚ¸¸ ÀÔ·Â ÇÏ¼¼¿ä.");
    obj.value = obj.defaultValue;
    obj.focus();
  } else {                                      // ¼ýÀÚÀÎ°æ¿ì
    if (typeof(min) != 'undefined') {           // 2. ÃÖ¼Ò ÀÔ·Â °ª Ã³¸® (ÃÖ¼Ò ÀÔ·Â°ª º¸´Ù ÀÛÀ¸¸é ¿øÀ§Ä¡)
      if (minus + x < min) {                    // À½¼ö¹Ý¿µ
        alert(min + " ÀÌ»óÀÇ ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼¼¿ä");
        obj.value = obj.defaultValue
        obj.focus();
        return;
      }
    }
    if (typeof(max) != 'undefined') {           // 3. ÃÖ´ë ÀÔ·Â °ª Ã³¸® (ÃÖ´ë ÀÔ·Â°ª º¸´Ù Å©¸é ¿øÀ§Ä¡)
      if (minus + x > max) {                    // À½¼ö¹Ý¿µ
        alert(max + " ÀÌÇÏÀÇ ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼¼¿ä");
        obj.value = obj.defaultValue
        obj.focus();
        return;
      }
    }
    obj.value = minus + number_format(x);   // ÄÞ¸¶ Âï¾î¼­ ¸®ÅÏ
  }
}

function ck_number_1(obj) {
  x = obj.value;
  if (isNaN(x)) {
    alert("¼ýÀÚ¸¸ ÀÔ·Â ÇÏ¼¼¿ä.");
    obj.value = obj.defaultValue;
    obj.focus();
  }
}

// , ¸¦ ¾ø¾Ø´Ù.
function no_comma(data) {
  tmp = '';
  comma = ',';
  for (NC_i=0; NC_i<data.length; NC_i++) {
    if (data.charAt(NC_i) != comma) tmp += data.charAt(NC_i);
  }
  return tmp;
}

function number_format(data) {
  data = new String(data);
  tmp = '';
  number = '';
  cutlen = 3;
  comma = ',';
  len = data.length;
  mod = (len % cutlen);
  k = cutlen - mod;
  for (NF_i=0; NF_i<data.length; NF_i++) {
    number = number + data.charAt(NF_i);
    if (NF_i < data.length - 1) {
      k++;
      if ((k % cutlen) == 0) {
        number = number + comma;
        k = 0;
      }
    }
  }
  return number;
}

function check_number(value, min, max) {
  reg_express = new RegExp('^[0-9]{' + min + ',' + max + '}$');
  if (!reg_express.test(value)) return false;
}

function check_digit(checkval) {
  val = new String(checkval);
  len = val.length;
  for (idx=0; idx<len; idx++) {
    if (val.charAt(idx) != '0' && val.charAt(idx) != '1' && val.charAt(idx) != '2' && val.charAt(idx) != '3' && val.charAt(idx) != '4' && val.charAt(idx) != '5' && val.charAt(idx) != '6' && val.charAt(idx) != '7' && val.charAt(idx) != '8' && val.charAt(idx) != '9' )  return false;
  }
  return true;
}

function social_no_chk(socialno) {
  if ( socialno.length != 13 ) return false;
  lastid  = parseFloat(socialno.substring(12,13));
  value0  = parseFloat(socialno.substring(0,1)) * 2;
  value1  = parseFloat(socialno.substring(1,2)) * 3;
  value2  = parseFloat(socialno.substring(2,3)) * 4;
  value3  = parseFloat(socialno.substring(3,4)) * 5;
  value4  = parseFloat(socialno.substring(4,5)) * 6;
  value5  = parseFloat(socialno.substring(5,6)) * 7;
  value6  = parseFloat(socialno.substring(6,7)) * 8;
  value7  = parseFloat(socialno.substring(7,8)) * 9;
  value8  = parseFloat(socialno.substring(8,9)) * 2;
  value9  = parseFloat(socialno.substring(9,10))  * 3;
  value10 = parseFloat(socialno.substring(10,11)) * 4;
  value11 = parseFloat(socialno.substring(11,12)) * 5;
  value12 = 0;
  value12 = value0+value1+value2+value3+value4+value5+value6+value7+value8+value9+value10+value11+value12;
  li_mod = value12 % 11;
  li_minus = 11 - li_mod;
  li_last = li_minus % 10;
  if (li_last != lastid) return false;
  return true;
}

function multi_select(form, new_name, name, divider) {
  multi_value = divider;
  T_name = eval("form." + name);
  T_new_name = eval("form." + new_name);
  select_flag = 0;
  for (var i=0; i<T_new_name.length; i++) {
    if (T_new_name.options[i].selected && T_new_name.options[i].value != '') {
      multi_value += T_new_name.options[i].value + divider;
      select_flag = 1;
    }
  }
  if (select_flag == 1) T_name.value = multi_value;
  else T_name.value = '';
}

function multi_check(form, new_name, name, divider) {
  multi_value = divider;
  frm_els = form.elements;
  cnt = frm_els.length ;
  nm_cnt = new_name.length;
  select_flag = 0;
  for (i=0; i<cnt; i++) {
    if ((frm_els[i].type == 'checkbox' || frm_els[i].type == 'radio') && frm_els[i].name.substring(0, nm_cnt) == new_name) {
      if (frm_els[i].disabled != true && frm_els[i].checked && frm_els[i].value != '') multi_value += frm_els[i].value + divider;
      else continue;
      select_flag = 1;
    }
  }
  T_name = eval("form." + name);
  if (select_flag == 1) T_name.value = multi_value;
  else T_name.value = '';
}

// ¶óµð¿À ¹öÆ° °ªÀ» µ¹·ÁÁÖ´Â ÇÔ¼ö (Ã¼Å©°¡ ¾ÈµÈ »óÅÂ¸é false ¸®ÅÏ)
function submit_radio_check(form, name) {
  frm_els = document.getElementsByName(name);
  cnt = frm_els.length ;
  for (i_radio_check=0; i_radio_check<cnt; i_radio_check++) {
    if (frm_els[i_radio_check].checked) return frm_els[i_radio_check].value;
  }
  return false;
}

// ¸ÖÆ¼ Ã¼Å©»óÀÚ¿¡¼­ 'ÀüÃ¼' Ç×¸ñÀ» Ã¼Å©ÇÏ¸é ³ª¸ÓÁö´Â ºñÈ°¼ºµÇµµ·Ï ÇÏ´Â ÇÔ¼ö
function chk_box_tog_all(form, chk_box_name, hdn_box_name, idx_all, divider) {
  FL_all_chk = true;                                                                  // ÀüÃ¼ÀÌ¿ÜÀÇ ³ª¸ÓÁö°¡ ¸ðµÎ Ã¼Å©µÇ¾ú´ÂÁö È®ÀÎ ÇÏ´Â ÇÃ·¡±×
  obj_checkbox = document.getElementsByName(chk_box_name);
  obj_hidden_box = document.getElementsByName(hdn_box_name);
  cnt_chk_box = obj_checkbox.length;
  if (obj_checkbox[idx_all].checked) {
    for (i=0; i<cnt_chk_box; i++) {
      if (i == idx_all) continue;
      obj_checkbox[i].disabled = true;
    }
  } else {
    for (i=0; i<cnt_chk_box; i++) {
      if (i == idx_all) continue;
      obj_checkbox[i].disabled = false;
      if (obj_checkbox[i].checked == true) FL_all_chk = false;                      // ÇÑ¹øÀÌ¶óµµ Ã¼Å©µÇ¾úÀ¸¸é ÇÃ·¡±×º¯¼ö °ª º¯°æ
    }
  }
  if (FL_all_chk == false) obj_checkbox[idx_all].disabled = true;                   // ÇÑ¹øÀÌ¶óµµ Ã¼Å©µÈ °æ¿ì 'ÀüÃ¼' Ç×¸ñ Ã¼Å©»óÀÚ´Â ºñÈ°¼º
  else obj_checkbox[idx_all].disabled = false;
  multi_check(form, chk_box_name, hdn_box_name, divider);                     // Ã¼Å©»óÀÚ ½ÇÁ¦(¸ðÀ½)°ª Àû¿ë
}

// Æû³»ºÎ °´Ã¼Áß Á¦¿ÜÇÑ °Íµé¸¸ »©°í ¸ðµÎ ºñÈ°¼º ½ÃÅ´ (GET ¹æ½ÄÀÇ °Ë»ö¿¡¼­ °Ë»ö¿¡ È°¿ëµÉ ÀÔ·Â»óÀÚ¸¸ À¯ÁöÇÒ¶§ È°¿ëµÊ)
function disabled_except_obj(form, except_head, excepts) {
  frm_els = form.elements;
  cnt = frm_els.length;
  cnt_except_head = except_head.length;
  for (i=0; i<cnt; i++) {
    flag = 'Y';
    for (j=0; j<excepts.length; j++) {                                          // Á¦¿Ü¸ñ·Ï Ã³¸®
      if (frm_els[i].name == excepts[j]) {
        flag = 'N';
        break;
      }
    }
    if (frm_els[i].name.substring(0, cnt_except_head) == except_head) {   // Á¦¿Ü Çì´õÃ³¸®
      flag = 'N';
      continue;
    }
    if (flag == 'Y') frm_els[i].disabled = true;
  }
}

// ´Ù¼öÀÇ Ã¼Å©»óÀÚ°¡ Ã¼Å©µÇ¾ú´ÂÁö ¿©ºÎ (°³¼ö¸®ÅÏ)
function submit_multi_checkbox(checkbox_name) {
  obj_checkbox = document.getElementsByName(checkbox_name);
  cnt = obj_checkbox.length;
  flag = 0;
  for (i=0; i<cnt; i++) {
    if (obj_checkbox[i].checked) flag++;
  }
  return flag;
}

function get_radio_value(obj) {
  if (typeof(obj) == 'undefined') return;
  cnt = obj.length;
  if (cnt > 1) {
    for (i=0; i<cnt; ++i) {
      if (obj[i].checked) return obj[i].value;
    }
  } else {
    if (obj.checked) return obj.value;
  }
}

function callColorPicker(tmpx, tmpy, d, e, str_btn, str_input) {
  xy = get_mouse_xy('window2');
  x = xy[0] + tmpx;
  y = xy[1] + tmpy;
  showColorPicker(x, y, d, str_btn, str_input);
  return;
}

function showColorPicker(x, y, d, str_btn, str_input) {
  var Selcol = showModalDialog('/include/js/palbas.nwz','','font-family:Verdana; font-size:12; dialogWidth:196px; dialogHeight:190px; dialogLeft:' + x + 'px; dialogTop:' + y + 'px; status:no; help:no; scroll:no');
  if (Selcol != '') {
    var valid_color = /[0-9a-fA-F]{6}/;
    if (! valid_color.test (Selcol)) return;
    if (d == 1) {
      //c1 = Selcol;
      btn = eval(str_btn);
      input_box = eval(str_input);
      btn.style.backgroundColor = Selcol;
      input_box.style.backgroundColor = Selcol;
      input_box.value = Selcol;
    }
  }
  return;
}

// ÁöÁ¤ÇÑ id °ªÀÌ ¼³Á¤µÈ ¿¤¸®¸ÕÆ®¸¦ º¸ÀÌ°Ô ¶Ç´Â º¸ÀÌÁö ¾Ê°Ô ÇÏ´Â ÇÔ¼ö
// È°¿ë : enable_child_id('FIRSTTABLE', document.getElementsByTagName('table'), '')
function enable_child_id(parent_id, layer_child, excepts, reverse, header) {

  if (typeof(excepts) == "undefined") excepts = '';                     // Á¦¿Ü¸ñ·ÏÀÌ ¾øÀ¸¸é ³Î.
  if (typeof(parent_id) != "undefined") enables = parent_id.split('_'); // ¼±ÅÃµÈ ÀÔ·Â»óÀÚÀÇ id °ªÀ¸·Î º¸¿©ÁÙ ·¹ÀÌ¾î µéÀ» ¹è¿­·Î ÀúÀå
  else enables = '';
  for (i=0; i<layer_child.length; i++) {                                    // ³Ñ¾î¿Â ·¹ÀÌ¾î °³¼ö¸¸Å­ ¹Ýº¹
    layer_child_id = layer_child[i].id
    if (layer_child_id == '') continue;                                   // ¾ÆÀÌµð°¡ ¾øÀ¸¸é °Ç³Ê¶Ü.
    if (typeof(header) != "undefined") {
      if (layer_child_id.substring(0, header.length) != header) continue;
    }

    T_flag_excepts = 'N';
    for (k=0; k<excepts.length; k++) {                                  // Á¦¿Ü¸ñ·Ï Ã³¸®
      if (layer_child_id == excepts[k]) {
        T_flag_excepts = 'Y';
        break;
      }
    }
    if (T_flag_excepts == 'Y') continue;
    T_flag = 'N';
    for(j=0; j<enables.length; j++) {                                   // º¸¿©ÁÙ id °ªµé¸¸Å­ ¹Ýº¹
      if (enables[j] == layer_child_id) {                               // ·¹ÀÌ¾î id ¿Í µ¿ÀÏ ÇÏ¸é Ãâ·Â ¾Æ´Ï¸é Ãâ·Â¾ÈÇÔ.
        T_flag = 'Y';
        break;
      }
    }
    if (reverse != 'Y') {
      if (T_flag == 'Y') layer_child[i].style.display = 'block';
      else layer_child[i].style.display = 'none';
    } else{
      if (T_flag == 'Y') layer_child[i].style.display = 'none';
      else layer_child[i].style.display = 'block';
    }
  }
}

function disable_child_radio(parent_id, obj_child) {
  enables = parent_id.split('_');
  for (i=0; i<obj_child.length; i++) {    // ÇÏÀ§ ¶óµð¿À °³¼ö¸¸Å­ ¹Ýº¹
    T_flag = 'N';
    for(j=0; j<enables.length; j++) { // ¼±ÅÃ(»óÀ§)µÈ ÀÔ·Â»óÀÚÀÇ ¾ÆÀÌµð¸¦ _ ·Î ºÐ¸®(¾ÆÀÌµð °ª¿¡ È°¼ºÈ­ ½ÃÅ³ ÇÏÀ§ ¶óµð¿ÀÀÇ °ªÀÌ _ ±¸ºÐÀÚ·Î ¼³Á¤µÇ¾î ÀÖ¾î¾ßÇÔ)
      if (enables[j] == obj_child[i].value) {
        T_flag = 'Y';
        break;
      }
    }
    if (T_flag == 'Y') obj_child[i].disabled = false;
    else  obj_child[i].disabled = true;
  }
}

function deletePrevCate(form, obj) {  // »óÀ§ Ä«Å×°í¸®°¡ º¯°æµÉ¶§ ÇÏÀ§ Ä«Å×°í¸® ¸®½ºÆ®¸¦ »èÁ¦ÇÏ´Â ÇÔ¼ö
  var optionCount = eval('document.createInsiteForm.categoryList_' + depth + '.length');  // Á¦°ÅÇØ¾ßÇÒ selectÀÇ option ÅÂ±×ÀÇ ¼ö¸¦ ¾ò¾î¿Â´Ù.
  for (var i=0; i<optionCount; i++) {
    eval('document.createInsiteForm.categoryList_' + depth + '.remove(0)'); // ¸ðµç option ÅÂ±×¸¦ Á¦°ÅÇÑ´Ù.
  }
}

function select_category_1(form, obj_name, obj_parent, form_name, category_2_title) {   // »óÀ§ Ä«Å×°í¸® ¸®½ºÆ®ÀÇ Ç×¸ñÀ» ¼±ÅÃÇÒ¶§ ÇÏÀ§ Ä«Å×°í¸® Ç×¸ñÀ» º¸¿©ÁÖ´Â ÇÔ¼ö
  obj = eval('form.' + obj_name);
  optionCount = obj.length;                                                                   // Á¦°ÅÇØ¾ßÇÒ selectÀÇ option ÅÂ±×ÀÇ ¼ö¸¦ ¾ò¾î¿Â´Ù.
  for (i=0; i<optionCount; i++) obj.remove(0);                                                // ¸ðµç option ÅÂ±×¸¦ Á¦°ÅÇÑ´Ù.
  newOption = document.createElement('OPTION');                                         // Ãâ·ÂÇÒ option ¿ä¼Ò¸¦ ¸¸µç´Ù.
  newOption.text = category_2_title;                                                          // text ±¸¼º
  newOption.value = '';                                                                       // value ±¸¼º
  obj.add(newOption);                                                                       // ÇöÀç ¼±ÅÃµÈ Ä«Å×°í¸® ¸®½ºÆ®ÀÇ ´ÙÀ½ ¸®½ºÆ®¿¡ ¸¸µé¾îÁø option ¿ä¼Ò¸¦ Ãß°¡ÇÑ´Ù.
  if (obj_parent.value == '') return false;
  temp1 = obj_parent.selectedIndex;
  temp2 = obj_parent.options[temp1].value;
  SELECTOPTION = eval('option_name_' + form_name + '_' + temp2);
  SELECTVALUE = eval('option_value_' + form_name + '_' + temp2);
  for (var k=0; k<SELECTVALUE.length; k++) {                                                // »õ·Î ³ªÅ¸³¯ ÇÏÀ§ Ä«Å×°í¸® ¸ñ·Ï¼ö¸¸Å­ ¹Ýº¹
    newOption = document.createElement('OPTION');                                       // Ãâ·ÂÇÒ option ¿ä¼Ò¸¦ ¸¸µç´Ù.
    newOption.text = SELECTOPTION[k];                                                     // text ±¸¼º
    newOption.value = SELECTVALUE[k];                                                     // value ±¸¼º
    obj.add(newOption);                                                                     // ÇöÀç ¼±ÅÃµÈ Ä«Å×°í¸® ¸®½ºÆ®ÀÇ ´ÙÀ½ ¸®½ºÆ®¿¡ ¸¸µé¾îÁø option ¿ä¼Ò¸¦ Ãß°¡ÇÑ´Ù.
  }
}

/* ¼±ÅÃ»óÀÚÀÇ ¿ä¼Ò¸¦ Ãß°¡ÇÔ (¿¬°ü¹è¿­ÀÌ¿ë)
option_array = {
'a' : 'A',
'b' : 'B',
'c' : 'C',
'd' : 'D'
}
¶Ç´Â
option_array = new Array();
option_array[a] = 'A';
option_array[b] = 'B';
*/
function select_box_add_option(obj, option_array) {
  for (key in option_array) {
    value = option_array[key];
    newOption = document.createElement('OPTION');                                       // Ãâ·ÂÇÒ option ¿ä¼Ò¸¦ ¸¸µç´Ù.
    newOption.text = value;                                                     // text ±¸¼º
    newOption.value = key;                                                      // value ±¸¼º
    obj.add(newOption);                                                                     // ÇöÀç ¼±ÅÃµÈ Ä«Å×°í¸® ¸®½ºÆ®ÀÇ ´ÙÀ½ ¸®½ºÆ®¿¡ ¸¸µé¾îÁø option ¿ä¼Ò¸¦ Ãß°¡ÇÑ´Ù.
  }
}

// ¼±ÅÃ»óÀÚÀÇ ¿ä¼Ò¸¦ »èÁ¦ÇÔ
function select_box_delete_option(obj) {
  var cnt = obj.length;                             // Á¦°ÅÇØ¾ßÇÒ selectÀÇ option ÅÂ±×ÀÇ ¼ö¸¦ ¾ò¾î¿Â´Ù.
  for (var i=0; i<cnt; i++) obj.remove(0);          // ¸ðµç option ÅÂ±×¸¦ Á¦°ÅÇÑ´Ù.
}

// php implode ÇÔ¼ö
function implode(glue, pieces) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Waldo Malqui Silva
    // *     example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: 'Kevin van Zonneveld'
    return ((pieces instanceof Array) ? pieces.join ( glue ) : pieces);
}

/*
bias_name : span ÅÂ±×ÀÇ id
node_array : ¿¬°ü¹è¿­
*/
function set_radio_nodes(form, name, bias_name, node_array, property, node_swap) {
  var objs = eval('form.' + name);
  bias_obj = document.getElementById(bias_name);
  for (i=0,cnt=objs.length; i<cnt; i++) {                                                       // ±âÁ¸ ³ëµå ¸ðµÎ »èÁ¦
    obj = objs[0];
    new_id = name + '_' + i;
    label_obj = document.getElementById('label_' + new_id);
    obj.removeNode();
    label_obj.innerHTML = '';
    label_obj.removeNode();
  }
  var i= 0;
  for (key in node_array) {                                                                 // »õ ³ëµå »ðÀÔ
    if (node_swap != 'Y') {
      radio_value = key;
      radio_label = node_array[key];
    } else {
      radio_value = node_array[key];
      radio_label = key;
    }
    new_id = name + '_' + i;
    new_node = document.createElement("<input type='radio' name='" + name + "' value='" + radio_value + "' id='" + new_id + "' " + property + ">");
    new_label = document.createElement("<label for='" + new_id + "' id='label_" + new_id + "'></label>");
    bias_obj.appendChild(new_node);
    bias_obj.appendChild(new_label);
    new_label.innerHTML = radio_label;
    //node_array[value] = '';
    i++;
  }
}

// ¸¶¿ì½º Å¬¸¯½Ã ·¹ÀÌ¾î ¸Þ´º ÆîÃÄÁö°Ô ÇÏ´Â ÇÔ¼ö (¾Æ·¡2°³)
var select_obj;
function open_mouse_layer(name, status, left_move, top_move) {
  var obj = document.all[name];
  if (status == 'visible') {
    if (select_obj) {
      select_obj.style.visibility = 'hidden';
      select_obj = null;
    }
    select_obj = obj;
    xy = get_mouse_xy('layer');
    obj.style.left = xy[0] + left_move;
    obj.style.top = xy[1] + top_move;
  } else {
    select_obj = null;
  }
  obj.style.visibility = status;
}

function get_layer_tag(name, layer_contents, width, height, drag) {
  var drag_ppt;
  if (drag_ppt == '') {
    drag_ppt = " align='center' valign='middle'";
  } else {
    if (drag == 'Y') drag_ppt = " onmousedown=drag_layer(0,event,'" + name + "'); onmouseup=stop_layer()";
    else drag_ppt = drag;
  }
  layer_header = "<div id='" + name + "' style='width:" + width + ";height:" + height + ";visibility:hidden; position:absolute; left:0; top:0; z-index:1'" + drag_ppt + ">";
  layer_footer = "</div>";
  document.writeln(layer_header+layer_contents+layer_footer);
}

// ÁöÁ¤µÈ ¿ÀºêÁ§Æ®ÀÇ left positon À» ¾òÀ½
function find_pos_x(obj){
  curleft = 0;
  if (obj.offsetParent) {
    while (obj.offsetParent) {
      curleft += obj.offsetLeft;
      obj = obj.offsetParent;
    }
  } else if (obj.x) {
    curleft += obj.x;
  }
  return curleft;
}

// ÁöÁ¤µÈ ¿ÀºêÁ§Æ®ÀÇ top positon À» ¾òÀ½
function find_pos_y(obj) {
  curtop = 0;
  if (obj.offsetParent){
    while(obj.offsetParent){
      curtop += obj.offsetTop;
      obj = obj.offsetParent;
    }
  } else if (obj.y) {
    curtop += obj.y;
  }
  return curtop;
}

// ¿òÁ÷ÀÌ´Â ·¹ÀÌ¾î Ã³¸®
var moving_layer_zindex = 20;
function drag_layer(drag_type, evt, divName) {
  if (divName) {
    obj_moving_layer = document.getElementById(divName);
    if (obj_moving_layer.style.position != 'absolute'){
      obj_moving_layer.style.left = find_pos_x(obj_moving_layer);
      obj_moving_layer.style.top = find_pos_y(obj_moving_layer);
      obj_moving_layer.style.position = 'absolute';
    }
    obj_moving_layer.style.zIndex = ++moving_layer_zindex;
  } else {
    return;
  }
  moving_start = 1;
  moving_start_x = (browser_type == 'NS') ? evt.pageX : event.clientX;
  moving_start_y = (browser_type == 'NS') ? evt.pageY : event.clientY;

  if (drag_type < 1) {                                                                    // µå·¡±×
    temp1 = parseInt(obj_moving_layer.style.left);
    temp2 = parseInt(obj_moving_layer.style.top);
    document.onmousemove = moving_layer;
  } else{                                                                                 // Ã¢ Å©±âÁ¶Àý
    iwindoWidth = parseInt(TntiwindowTable.width); // °¡·Î
    iwindoHeight = parseInt(TntiwindowTable.height); // ¼¼·Î
    document.onmousemove = resizing_layer;
  }
}
function moving_layer() {
  if (moving_start == 1){
    if (browser_type == 'NS') {
      obj_moving_layer.style.left = temp1+evt.pageX-moving_start_x;
      obj_moving_layer.style.top = temp2+evt.pageY-moving_start_y;
    } else {
      obj_moving_layer.style.left = temp1+event.clientX-moving_start_x;
      obj_moving_layer.style.top = temp2+event.clientY-moving_start_y;
    }
    return false;
  }
}
function stop_layer() {
  moving_start = 0;
}

/*
*±â´É:Æ¯Á¤ ¹®ÀÚ º¯È¯
*@param text:¿øº» ¹®ÀÚ
*@param oldstr:Ã£´Â¹®ÀÚ
*@param newstr:´ëÃ¼ÇÏ´Â ¹®ÀÚ
*@return º¯È¯µÈ ¹®ÀÚ¿­
*/
function str_replace(text, oldstr, newstr) {
  cnt = text.length;
  retValue = "";
  for(i=0; i < cnt; i++){
    if (text.charAt(i) == oldstr) retValue += newstr;
    else retValue += text.charAt(i);
  }
  return retValue;
}

function image_preview(form, obj_file, obj_name_img, width, height) {
  obj_image = eval("form." + obj_name_img);
  obj_image.src = obj_file.value;
  if (width != '') obj_image.width = width;
  if (height != '') obj_image.height = height;
}

// Æ¯Á¤ ÀÔ·Â»óÀÚ¸¦ Ã¼Å©»óÅÂ¿¡ µû¶ó È°¼º ¶Ç´Â ¾²±â°¡´É À¸·Î º¯°æÇÏ´Â ÇÔ¼ö
// header_cnt Ã¼Å©»óÀÚ name ¾Õ¿¡ ¾²ÀÌ´Â Çì´õ ±ÛÀÚ¼ö, Çì´õ ÀÌÈÄÀÇ name °ªÀº ´ë»ó ÀÔ·Â»óÀÚ¸í°ú µ¿ÀÏÇØ¾ßÇÔ.
function chk_box_enable(form, obj, header_cnt, mode) {
  obj_name = obj.name;
  obj_name_cnt = obj_name.length;
  obj_target_name = obj_name.substring(header_cnt, obj_name_cnt);
  obj_target = eval('form.' + obj_target_name);
  if (obj.checked == true) {    // Ã¼Å©µÈ°æ¿ì
    if (mode == 'D') {          // ºñÈ°¼º ¸ðµå
      obj_target.disabled = false;
      obj_target.style.background = 'ffffff';
    } else {                    // ÀÐ±âÀü¿ë ¸ðµå
      obj_target.readOnly = false;
      //obj_target.style.background = 'ffffff';
    }
  } else {
    if (mode == 'D') {          // ºñÈ°¼º ¸ðµå
      obj_target.disabled = true;
      obj_target.style.background = 'fafafa';
    } else {                    // ÀÐ±âÀü¿ë ¸ðµå
      obj_target.readOnly = true;
      //obj_target.style.background = 'fefefe';
    }
  }
}

// ³¯Â¥ ¹üÀ§ Çü½ÄÀÌ ¸Â´ÂÁö È®ÀÎ
function verify_date_term(form, str) {
  if (str == '') return true;
  reg_express = new RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})~([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$');
  if (!reg_express.test(str)) {
    alert('±â°£ ÁöÁ¤ Çü½ÄÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.');
    form.reset();
    return false;
  } else {
    return true;
  }
}

////////////////////////////////////////////////////
// ÀÔ·ÂÇÊµå¿¡ °ø¹éÀÌ ÀÖ´ÂÁö Ã¼Å©
var errmsg = '';
var errfld = '';
var submit_is_ing = 'N';

// ÇÊµå °Ë»ç
function check_field(fld, msg, color_ok, color_error, msg_method) {
  if (color_ok == '') color_ok = "#FFFFFF";
  if (color_error == '') color_error = "#CCFF99";
  if ((fld.value = trim(fld.value)) == '') return error_field(fld, msg, color_error, msg_method);
  else fld.style.background = color_ok;
  return;
}

// ÇÊµå ¿À·ù Ç¥½Ã
function error_field(fld, msg, color, msg_method) {
  if (color == '') color = "#CCFF99";
  if (errfld == '') errfld = fld;
  fld.style.background = color;
  if (msg != '') {
    if (msg_method == 'P') {
      alert(msg);
      if (errfld.type == 'text' || errfld.type == 'textarea' || errfld.type == 'select' || errfld.type == 'password') errfld.focus();
      errfld = '';
      return false;
    } else {
      errmsg += msg + "\n";
    }
  }
}

// ÀüÈ­¹øÈ£, ÈÞ´ëÆù°ú °°ÀÌ ¿©·¯ ÇÊµå°ªÀ» ±³Â÷ °Ë»çÇÒ ¶§ »ç¿ë
//objs = new Array();
//objs[0] = [form.od_b_tel_1, form.od_b_tel_2, form.od_b_tel_3];
//objs[1] = [form.od_b_hp_1, form.od_b_hp_2, form.od_b_hp_3];
//check_field_array(objs, '¹ÞÀ¸½Ã´Â ºÐÀÇ ÀüÈ­ ¶Ç´Â ÈÞ´ëÆù ¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.', '', '');
function check_field_array(objs, msg, color_ok, color_error, msg_method) {
  if (color_ok == '') color_ok = "#FFFFFF";
  if (color_error == '') color_error = "#CCFF99";
  flag_i = false;
  for (i=0; i<objs.length; i++) {
    flag_j = false;
    for (j=0; j<objs[i].length; j++) {
      if (typeof(objs[i][j]) == 'undefined') continue;
      if (objs[i][j].disabled == false && objs[i][j].value == '') {               // 2Â÷ ¿ÀºêÁ§Æ®¿¡ °ø¹é°ªÀÌ ÀÖ´Â »óÅÂ(¿¡·¯)
        flag_j = true;
        break;
      }
    }
    if (flag_j == false) flag_i = true;                                           // °ø¹é°ªÀÌ ¾ø´Â°æ¿ì (Åë°ú)
  }
  if (flag_i == false) {                                                          // 2Â÷ ¿ÀºêÁ§Æ® ±×·ì ¸ðµÎ°¡ ¹®Á¦°¡ ÀÖ´Â °æ¿ì
    for (i=0; i<objs.length; i++) {
      flag_j = false;
      for (j=0; j<objs[i].length; j++) {
        if (typeof(objs[i][j]) == 'undefined') continue;
        if (errfld == '') errfld = objs[i][j];                                        // Æ÷Ä¿½ºµÉ ÇÊµå
        objs[i][j].style.background = color_error;
      }
    }
    if (error_field(errfld, msg, color_error, msg_method) == false) return false;
    /*//if (msg != '') errmsg += msg + "\n";
    if (msg != '') {
      alert(msg);
      if (errfld.type == 'text' || errfld.type == 'textarea' || errfld.type == 'select' || errfld.type == 'password') errfld.focus();
      errfld = '';
      return false;
    }*/
  } else {
    for (i=0; i<objs.length; i++) {
      flag_j = false;
      for (j=0; j<objs[i].length; j++) {
        if (typeof(objs[i][j]) == 'undefined') continue;
        objs[i][j].style.background = color_ok;
      }
    }
  }
}

// ¸ðµç Å¸ÀÔÀÇ °´Ã¼¸¦ ´ë»óÀ¸·Î, °ªÀÌ ÀÔ·ÂµÇ°Å³ª ¼±ÅÃµÇ¾ú´ÂÁö È®ÀÎ ÇÏ´Â ÇÔ¼ö
// ÀÔ·ÂÀÌ ¾ÈµÇ¾úÀ¸¸é ¹è°æ»öÀ» º¯°æÇÔ
// È÷µç ÀÔ·Â»óÀÚ´Â ¿¬°áµÇ´Â ¼±ÅÃ»óÀÚµéÀÌ ÀÖ´ÂÁö È®ÀÎ
function chk_obj_input(form_name, obj_name, chg_color, res_color, obj_err_msg) {
  is_empty = F_skip = 'N';
  form = eval('document.' + form_name);
  obj = eval('form.' + obj_name);
  obj_DSF = eval('form.' + obj_name + '_DSF');
  if (!obj) {                                                         // ³¯Â¥ ¼±ÅÃ»óÀÚÀÎÁö ÆÄ¾Ç¿ë
    if (obj_DSF) {
      DSF_year = eval('form.' + obj_name + '_year');
      DSF_month = eval('form.' + obj_name + '_month');
      DSF_day = eval('form.' + obj_name + '_day');
      DSF_hour = eval('form.' + obj_name + '_hour');
      DSF_minute = eval('form.' + obj_name + '_minute');
      DSF_second = eval('form.' + obj_name + '_second');
      if (DSF_year) {
        if (!obj) obj = DSF_year;
        if (DSF_year.value == '') {
          if (chg_color != '') DSF_year.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_year.style.background = res_color;
        }
      }
      if (DSF_month) {
        if (!obj) obj = DSF_month;
        if (DSF_month.value == '') {
          if (chg_color != '') DSF_month.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_month.style.background = res_color;
        }
      }
      if (DSF_day) {
        if (!obj) obj = DSF_day;
        if (DSF_day.value == '') {
          if (chg_color != '') DSF_day.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_day.style.background = res_color;
        }
      }
      if (DSF_hour) {
        if (!obj) obj = DSF_hour;
        if (DSF_hour.value == '') {
          if (chg_color != '') DSF_hour.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_hour.style.background = res_color;
        }
      }
      if (DSF_minute) {
        if (!obj) obj = DSF_minute;
        if (DSF_minute.value == '') {
          if (chg_color != '') DSF_minute.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_minute.style.background = res_color;
        }
      }
      if (DSF_second) {
        if (!obj) obj = DSF_second;
        if (DSF_second.value == '') {
          if (chg_color != '') DSF_second.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_second.style.background = res_color;
        }
      }
    }
    obj_SCH = eval('form.' + 'SCH_' + obj_name);
    if (obj_SCH) obj = obj_SCH;
  } else {
    if (obj_DSF) {
      DSF_hour = eval('form.' + obj_name + '_hour');
      DSF_minute = eval('form.' + obj_name + '_minute');
      DSF_second = eval('form.' + obj_name + '_second');
      if (DSF_hour) {
        if (!obj) obj = DSF_hour;
        if (DSF_hour.value == '') {
          if (chg_color != '') DSF_hour.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_hour.style.background = res_color;
        }
      }
      if (DSF_minute) {
        if (!obj) obj = DSF_minute;
        if (DSF_minute.value == '') {
          if (chg_color != '') DSF_minute.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_minute.style.background = res_color;
        }
      }
      if (DSF_second) {
        if (!obj) obj = DSF_second;
        if (DSF_second.value == '') {
          if (chg_color != '') DSF_second.style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') DSF_second.style.background = res_color;
        }
      }
    }
  }
  if (!obj) {
    alert('Á¸ÀçÇÏÁö ¾Ê´Â ÀÔ·Â»óÀÚ¸¦ ÇÊ¼ö ÀÔ·ÂÇ×¸ñÀ¸·Î ¼±ÅÃÇÏ¼Ì½À´Ï´Ù.\r\n\r\nÇÊµå¸í : ' + obj_name + ' ¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä');
    return false;
  }
  if (chg_color == '') chg_color = "#CCFF99";
  if (res_color == '') res_color = "#FFFFFF";
  switch (obj.type) {
    case 'text' :
    case 'password' :
    case 'file' :
      if (obj.value == '') {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case 'textarea' :
      if (obj.value == '') {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case 'select-one' :
      if (obj.value == '') {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case 'select-multiple' :                                                              // ¸ÖÆ¼ÄÞº¸
      if (obj.value == '') {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case 'radio' :
      if (obj.checked == false) {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case 'checkbox' :
      if (obj.checked == false) {
        if (chg_color != '') obj.style.background = chg_color;
        is_empty = 'Y';
      } else {
        if (res_color != '') obj.style.background = res_color;
      }
    break;
    case undefined :                                                                    // ¸ÖÆ¼¶óµð¿À
      if (obj.length != undefined) {
        if (submit_radio_check(form, obj_name, 'radio') === false) {
          if (chg_color != '') for (i=0; i<obj.length ; i++) obj[i].style.background = chg_color;
          is_empty = 'Y';
        } else {
          if (res_color != '') for (i=0; i<obj.length ; i++) obj[i].style.background = res_color;
        }
      }
    break;
    case 'hidden' :
      HM = eval('form.' + obj_name + '_multi');
      if (HM != undefined) {                                                            // ¸ÖÆ¼ÄÞº¸ ¿¬°á
        if (obj.value == '') {
          if (chg_color != '') HM.style.background = chg_color;
          is_empty = 'Y';
        }
      } else {
        HM_name = obj_name + '_multi[]';
        obj_checkbox = document.getElementsByName(HM_name);
        if (obj_checkbox.length > 0) {                                                  // ¸ÖÆ¼Ã¼Å© ¿¬°á
          if (obj.value == '') {
            if (chg_color != '') for (i=0; i<obj_checkbox.length ; i++) obj_checkbox[i].style.background = chg_color;
            is_empty = 'Y';
          } else {
            if (res_color != '') for (i=0; i<obj_checkbox.length ; i++) obj_checkbox[i].style.background = res_color;
          }
        }
      }
    break;
    default :                                                                           // È®ÀÎ ¾ÈµÇ´Â °´Ã¼ÀÎ°æ¿ì
    break;
  }
  if (is_empty == 'Y') {                                                                  // ºó°ªÀÌ¸é
    if (errfld == '') errfld = obj;                                                         // Ã¹¹øÂ° °´Ã¼¸¸ ÀúÀå
    if (obj_err_msg != '') {                                                              // ÁöÁ¤µÈ ¿¡·¯ ¸Þ½ÃÁö°¡ ÀÖÀ¸¸é ¹Ù·Î ÁßÁö
      alert(obj_err_msg);
      if ((errfld.type == 'text' || errfld.type == 'textarea' || errfld.type == 'select' || errfld.type == 'password') && (errfld.style.display != 'none')) errfld.focus();
      errfld = '';
      return false;
    }
  }
}

function trim(s) {
  var t = '';
  var from_pos = to_pos = 0;
  for (i=0; i<s.length; i++) {
    if (s.charAt(i) == ' ') {
      continue;
    } else  {
      from_pos = i;
      break;
    }
  }
  for (i=s.length; i>=0; i--) {
    if (s.charAt(i-1) == ' ') {
      continue;
    } else {
      to_pos = i;
      break;
    }
  }
  t = s.substring(from_pos, to_pos);
  return t;
}

// E-Mail °Ë»ç
function email_check(email) {
    if (email.value.search(/(\S+)@(\S+)\.(\S+)/) == -1) return false;
    else return true;
}

function jumin_number_check(T_jumin_number) {
  var chk =0
  var yy = T_jumin_number.substring(0, 2)
  var mm = T_jumin_number.substring(2, 4)
  var dd = T_jumin_number.substring(4, 6)
  var sex = T_jumin_number.substring(7, 8)
  if ((T_jumin_number.length != 14) || (yy < 25 || mm < 1 || mm > 12 || dd < 1) || (sex != 1 && sex !=2 )) {
    return false;
  }
  // ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
  T_jumin_number_one = T_jumin_number.substring(0, 6);
  T_jumin_number_two = T_jumin_number.substring(7, 14);
  for (var i = 0; i <=5 ; i++){
    chk = chk + ((i%8+2) * parseInt(T_jumin_number_one.substring(i,i+1)))
  }
  for (var i = 6; i <=11 ; i++){
    chk = chk + ((i%8+2) * parseInt(T_jumin_number_two.substring(i-6,i-5)))
  }
  chk = 11 - (chk %11)
  chk = chk % 10
  if (chk != T_jumin_number_two.substring(6,7)) {
    return false;
  }
  return true;
}

// ÁÖ¹Îµî·Ï¹øÈ£ °Ë»ç
function jumin_check(j1, j2) {
  if (j1.value.length<6 || j2.value.length<7) return false;
  var sum_1 = 0;
  var sum_2 = 0;
  var at=0;
  var juminno= j1.value + j2.value;
  sum_1 = (juminno.charAt(0)*2)+
            (juminno.charAt(1)*3)+
            (juminno.charAt(2)*4)+
            (juminno.charAt(3)*5)+
            (juminno.charAt(4)*6)+
            (juminno.charAt(5)*7)+
            (juminno.charAt(6)*8)+
            (juminno.charAt(7)*9)+
            (juminno.charAt(8)*2)+
            (juminno.charAt(9)*3)+
            (juminno.charAt(10)*4)+
            (juminno.charAt(11)*5);
  sum_2=sum_1%11;
  if (sum_2 == 0) {
    at = 10;
  } else {
    if (sum_2 == 1) at = 11;
    else at = sum_2;
  }
  att = 11 - at;
  if (juminno.charAt(12) != att) return false;
  return true
}

// ÄíÅ° ÀÔ·Â
function set_cookie(name, value, expirehours) {
  var today = new Date();
  today.setTime(today.getTime() + (60*60*1000*expirehours));
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}

// ÄíÅ° ¾òÀ½
function get_cookie(name) {
  var find_sw = false;
  var start, end;
  var i = 0;
  for (i=0; i<= document.cookie.length; i++) {
    start = i;
    end = start + name.length;
    if (document.cookie.substring(start, end) == name) {
      find_sw = true
      break
    }
  }
  if (find_sw == true) {
  start = end + 1;
  end = document.cookie.indexOf(";", start);
  if (end < start) end = document.cookie.length;
    return document.cookie.substring(start, end);
  }
  return '';
}

// ÄíÅ° Áö¿ò
function delete_cookie(name) {
  var today = new Date();
  today.setTime(today.getTime() - 1);
  var value = get_cookie(name);
  if (value != '') document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
}

// °°Àº ·¹ÄÚµå¿¡ ÀÖ´Â ÀÔ·Â°ªÀ» º¯°æ ¶Ç´Â Ã¼Å© ÇÏ´Â ÇÔ¼ö
function chg_same_idx_obj(obj_source_name, obj_target_name, idx, mode) {
  obj_source = document.getElementsByName(obj_source_name);
  obj_target = document.getElementsByName(obj_target_name);
  switch (mode) {
    case 'V' :
      obj_target[idx].value = obj_source[idx].value;
    break;
    case 'C' :
      obj_target[idx].checked = true;
    break;
  }
}

// ¼±ÅÃ(Ã¼Å©)µÈ ·¹ÄÚµå ÀÌ¿ÜÀÇ ·¹ÄÚµåÀÇ ÀÔ·Â»óÀÚ¸¦ ºñÈ°¼ºÈ­ ½ÃÅ°´Â ÇÔ¼ö
function disable_other_idx_obj(checkbox_name, target_boxs, target_boxs_readonly) {
  obj_checkbox = document.getElementsByName(checkbox_name);
  cnt = obj_checkbox.length;
  cnt_target_boxs = target_boxs.length;
  for (i=0; i<cnt_target_boxs; i++) {
    obj_taret_box = document.getElementsByName(target_boxs[i]);
    cnt_obj_target_box = obj_taret_box.length;
    for (j=0; j<cnt_obj_target_box; j++) {
      obj_taret_box[j].disabled = false;
      if (obj_checkbox[j].checked == true) continue;
      obj_taret_box[j].disabled = true;
    }
  }
  if (typeof(target_boxs_readonly) != 'undefined') {
    cnt_target_boxs = target_boxs_readonly.length;
    for (i=0; i<cnt_target_boxs; i++) {
      obj_taret_box = document.getElementsByName(target_boxs_readonly[i]);
      cnt_obj_target_box = obj_taret_box.length;
      for (j=0; j<cnt_obj_target_box; j++) {
        obj_taret_box[j].readOnly = false;
        if (obj_checkbox[j].checked == true) continue;
        obj_taret_box[j].readOnly = true;
      }
    }
  }
}

// ¼±ÅÃ(Ã¼Å©)µÈ ·¹ÄÚµå ÀÌ¿ÜÀÇ ·¹ÄÚµåÀÇ ÀÔ·Â»óÀÚ¸¦ ºñÈ°¼ºÈ­ ½ÃÅ°´Â ÇÔ¼ö (1¿­¸¸ ÁöÁ¤ÇØ¼­ ºÎÇÏ¸¦ ÁÙÀÎ ÇÔ¼ö)
function disable_other_idx_obj_1(checkbox_name, idx, target_boxs, target_boxs_readonly) {
  obj_checkbox = document.getElementsByName(checkbox_name);
  cnt = obj_checkbox.length;
  cnt_target_boxs = target_boxs.length;
  for (i=0; i<cnt_target_boxs; i++) {
    obj_taret_box = document.getElementsByName(target_boxs[i]);
    if (obj_checkbox[idx].checked == true) obj_taret_box[idx].disabled = false;
    else obj_taret_box[idx].disabled = true;
  }
  if (typeof(target_boxs_readonly) != 'undefined') {
    cnt_target_boxs = target_boxs_readonly.length;
    for (i=0; i<cnt_target_boxs; i++) {
      obj_taret_box = document.getElementsByName(target_boxs_readonly[i]);
      if (obj_checkbox[idx].checked == true) obj_taret_box[idx].readOnly = false;
      else obj_taret_box[idx].readOnly = true;
    }
  }
}

// ¸ñ·ÏµîÀÇ ´ÙÁß Ã¼Å©»óÀÚ¸¦ ÀÏ°ý¼±ÅÃ, ¹ÝÀü, ¼±ÅÃÃë¼Ò ÇÏ´Â ÇÔ¼ö
function chg_checkbox_state(checkbox_name, mode) {
  obj_checkbox = document.getElementsByName(checkbox_name);
  cnt = obj_checkbox.length;
  for (i=0; i<cnt; i++) {
    switch (mode) {
      case 'C' :
        obj_checkbox[i].checked = true;
      break;
      case 'N' :
        obj_checkbox[i].checked = false;
      break;
      case 'R' :
        if (obj_checkbox[i].checked == false) obj_checkbox[i].checked = true;
        else obj_checkbox[i].checked = false;
      break;
    }
  }
}

// Ã¼Å©µÇÁö ¾ÊÀ¸¸é ºñÈ°¼º°ú µ¿ÀÏÇÑ ¼Ó¼ºÀ» Áö´Ñ Ã¼Å©»óÀÚ¸¦ º¸¿ÏÇÏ´Â ÇÔ¼ö
// <input type='hidden' name='it_sell_enabled[]' value='$value[it_sell_enabled]'> Ã³·³ ½ÇÁ¦ ÀÔ·Â»óÀÚ´Â hidden À¸·Î Ã³¸® ÇÔ
function chk_sell_enabled(obj, obj_target_name, index, chk_value, unchk_value) {
  obj_target = document.getElementsByName(obj_target_name);
  if (typeof(chk_value) == 'undefined') chk_value = 'Y';
  if (typeof(unchk_value) == 'undefined') unchk_value = '';
  if (obj.checked == true) obj_target[index].value = chk_value;
  else obj_target[index].value = unchk_value;
}

// °ßÀû°è»ê ÇÁ·Î±×·¥
function get_estimate_price(form, nm_item, nm_item_stan, nm_price, nm_ea, nm_subsum, nm_total_sum, extra_title) {
  if (typeof(form) == 'undefined') return;
  total_sum = exist_alpa = 0;
  item_array = document.getElementsByName(nm_item);
  item_stan_array = document.getElementsByName(nm_item_stan);
  price_array = document.getElementsByName(nm_price);
  ea_array = document.getElementsByName(nm_ea);
  subsum_array = document.getElementsByName(nm_subsum);
  cnt_price_array = price_array.length;
  cnt_ea_array = ea_array.length;
  cnt_subsum_array = subsum_array.length;
  obj_total_sum = eval('form.' + nm_total_sum);
  if (cnt_price_array != cnt_ea_array || cnt_price_array != cnt_subsum_array) {
    alert('°¡°Ý, ¼ö·®, ¼Ò°è Ç×¸ñÀÇ °³¼ö°¡ ¼­·Î ´Ù¸¨´Ï´Ù.');
    return;
  } else {
    total_item = cnt_price_array;
  }
  for (i=0; i<total_item; i++) {
    obj_item = item_array[i];
    obj_item_stan = item_stan_array[i];
    obj_price = price_array[i];
    obj_ea = ea_array[i];
    obj_subsum = subsum_array[i];
    split_ea = obj_ea.value.split(':');                                     // ¼ö·®°ª¿¡ ¿¡ '°¡°Ý:¼ö·®' Çü½ÄÀ¸·Î ÀúÀåµÈ ³»¿ëÀ» ºÐ¸®
    if (split_ea.length == 2) {
      if (isNaN(split_ea[0])) price_value = split_ea[0];                    // isNaN : ½ÇÁ¦ type ÀÌ ¹®ÀÚ ¶óµµ ¼ýÀÚ(0Æ÷ÇÔ)·Î¸¸ ÀÌ·ç¾îÁ® ÀÖÀ¸¸é ¼ýÀÚÀÓÀ» ¾Ë¸®´Â false ¸¦ ¸®ÅÏ ÇÔ
      else price_value = parseFloat(no_comma(split_ea[0]));
      if (isNaN(split_ea[1])) ea_value = split_ea[1];
      else ea_value = parseFloat(no_comma(split_ea[1]));
    } else {
      obj_price_value = no_comma(obj_price.value);
      obj_ea_value = no_comma(obj_ea.value);
      if (isNaN(obj_price_value) || obj_price_value == '') {
        if (obj_price.value != '') price_value = obj_price.value;
        else price_value = obj_ea.value;
      } else {
        price_value = parseFloat(obj_price_value);
      }
      if (isNaN(obj_ea_value) || obj_ea_value == '') {
        if (ea_value.value != '') ea_value = obj_ea.value;
        else ea_value = obj_price.value;
      } else {
        ea_value = parseFloat(obj_ea_value);
      }
    }

    if (typeof(price_value) != 'number') {                                  // typeof == 'number' : ¹®ÀÚ¿­°ú ¼ýÀÚ¸¦ ¾ö°ÝÈ÷ ±¸ºÐÇÔ
      obj_subsum.value = price_value;                                   // ¼Ò°è¿¡ °³º°°ßÀû µîÀÇ ¹®±¸ ³ëÃâ
      if (ea_value != '') exist_alpa++;
    } else if (typeof(ea_value) != 'number') {
      obj_subsum.value = ea_value;
      exist_alpa++;
    } else {                                                                // °¡°Ý, °³¼ö ¸ðµÎ ¼ýÀÚÀÎ °æ¿ì¸¸ ¼Ò°è¿¡ °è»ê
      sub_sum = price_value * ea_value
      obj_subsum.value = number_format(sub_sum);
      total_sum = total_sum + sub_sum;
    }
    if (!isNaN(obj_price.value)) obj_price.value = number_format(obj_price.value);
  }
  obj_total_sum.value = number_format(total_sum) + '¿ø';
  if (exist_alpa > 0 && extra_title != '') obj_total_sum.value = obj_total_sum.value + ' / ' + exist_alpa + '°Ç Àº ' + extra_title;
}

function confirm_url(msg, url) {
   if (confirm(msg)) document.location.href = url;
}

// ¿ø´ÜÀ§Ã³¸®(R:¹Ý¿Ã¸², C:¿Ã¸², F:¹ö¸²)
function chg_1won(amount, mode) {
  if (mode == '') mode = 'R';
  remove_amount = amount / 10;
  if (mode == 'F') remove_amount = Math.floor(remove_amount);
  else if (mode == 'R') remove_amount = Math.round(remove_amount);
  else if (mode == 'C') remove_amount = Math.ceil(remove_amount);
  remove_amount = remove_amount * 10;
  return remove_amount;
}

// ³¯Â¥ ¼±ÅÃ»óÀÚ ¼±ÅÃ½Ã ÁöÁ¤µÈ ³¯Â¥ ÀÌ³»ÀÎÁö È®ÀÎ
// form : Æû°´Ã¼, box_name : ¹Ú½ºÀÌ¸§, Á¦ÇÑ³¯Â¥/ÃÖ¼Ò (¿À´Ã ±âÁØ +/- ÃÊ´ÜÀ§), Á¦ÇÑ³¯Â¥/ÃÖ´ë (¿À´Ã ±âÁØ +/- ÃÊ´ÜÀ§)
// onchange="chk_date_limit(this.form, 'close_date', 604800, 0)"
// ÃÖ¼Ò, ÃÖ´ëÀÏÀ» Àû¿ëÇÏÁö ¾ÊÀ¸·Á¸é '' À¸·Î ÀÔ·ÂÇØ¾ß ÇÔ (0 Àº ÇöÀç ³¯Â¥ °ªÀ¸·Î ÆÇ´ÜÇÔ)
function chk_date_limit(form, box_name, before_second, after_second, msg_before, msg_after) {
  date_now = new Date();                                    // ÇöÀç½Ã°£
  date_objs = {'year' : 0, 'month' : 0, 'day' : 0, 'hour' : 0, 'minute' : 0, 'second' : 0}
  TS_now = Math.round(date_now.getTime() / 1000);       // Å¸ÀÓ½ºÅÆÇÁ
  T_flag = T_flag_1 = 'T';                                      // ³¯Â¥ ¼±ÅÃÀÌ ¿Ï·áµÇ¾ú´ÂÁö È®ÀÎ ÇÏ´Â ÇÃ·¡±×
  for (key in date_objs) {                                      // ³â, ¿ù, ÀÏ, ½Ã, ºÐ, ÃÊ ..
    obj = eval('form.' + box_name + '_' + key);               // ÀÔ·Â»óÀÚ Á¸Àç ¿©ºÎ ÆÄ¾Ç
    if (typeof(obj) != 'undefined') {
      if (obj.value == '') {                                      // Á¸ÀçÇÏ´Â ÀÔ·Â»óÀÚÀÇ °ªÀÌ ¼±ÅÃµÇÁö ¾ÊÀº °æ¿ì
        T_flag = 'F';                                           // ¹«½Ã
        break;
      }
      date_objs[key] = parseInt(obj.value);                 // ¼±ÅÃµÈ °ª ÆÄ¾Ç
    }
  }

  if (T_flag == 'T') {                                            // ¸ðµç ³¯Â¥ ¼±ÅÃÀÌ ¿Ï·áµÈ°æ¿ì
    date_select = new Date(date_objs['year'], date_objs['month']-1, date_objs['day'], date_objs['hour'], date_objs['minute'], date_objs['second']); // ¼±ÅÃÇÑ ³¯Â¥ °´Ã¼»ý¼º(¿ùÀÇ ÀÎµ¦½º´Â 0 ºÎÅÍ ½ÃÀÛ)
    TS_select = date_select.getTime() / 1000;               // ¼±ÅÃ ³¯Â¥ Å¸ÀÓ½ºÅÆÇÁ
    if (before_second !== '') {                                   // ÃÖ¼Ò ³¯Â¥ Á¦ÇÑÀÌ ÀÖ´Â °æ¿ì
      TS_compare = TS_now+before_second;                // ÃÖ¼Ò ³¯Â¥ Å¸ÀÓ½ºÅÆÇÁ
      if (TS_select < TS_compare) {
        date_compare = new Date(TS_compare * 1000);     // ÃÖ¼Ò ³¯Â¥ °´Ã¼
        if (typeof(msg_before) == 'undefined' || msg_before == '') msg = date_compare.toLocaleString() + ' ÀÌÈÄ ºÎÅÍ ¼±ÅÃ °¡´ÉÇÕ´Ï´Ù.\n\nÁö±Ý ¼±ÅÃÇÏ½Å ³¯Â¥´Â ' + date_select.toLocaleString() + 'ÀÔ´Ï´Ù.';
        else msg = msg_before;
        alert(msg);
        T_flag_1 = 'F';
      }
    }
    if (after_second !== '') {                                    // ÃÖ´ë ³¯Â¥ Á¦ÇÑÀÌ ÀÖ´Â °æ¿ì
      TS_compare = TS_now+after_second;                 // ÃÖ´ë ³¯Â¥ Å¸ÀÓ½ºÅÆÇÁ
      if (TS_select > TS_compare) {
        date_compare = new Date(TS_compare * 1000);     // ÃÖ´ë ³¯Â¥ °´Ã¼
        if (typeof(msg_after) == 'undefined' || msg_after == '') msg = date_compare.toLocaleString() + ' ÀÌÀü ±îÁö¸¸ ¼±ÅÃ °¡´ÉÇÕ´Ï´Ù.\n\nÁö±Ý ¼±ÅÃÇÏ½Å ³¯Â¥´Â ' + date_select.toLocaleString() + 'ÀÔ´Ï´Ù.';
        else msg = msg_after;
        alert(msg);
        T_flag_1 = 'F';
      }
    }
    if (T_flag_1 == 'F') {
      for (key in date_objs) {
        obj = eval('form.' + box_name + '_' + key);
        if (typeof(obj) != 'undefined') obj.value = '';
      }
    }
  }
}

// text, textarea »óÀÚÀÇ Ä¿¼­À§Ä¡ ÆÄ¾Ç
function save_cursor_postion(obj_text_box) {
  if (obj_text_box.createTextRange) obj_text_box.currentPos = document.selection.createRange().duplicate();
}

// Ä¿¼­ À§Ä¡¿¡ ÅØ½ºÆ®¸¦ ÀÔ·Â
function text_box_insert_text(obj_text_box, text) {
  if (obj_text_box.createTextRange && obj_text_box.currentPos) {
    var currentPos = obj_text_box.currentPos;
    currentPos.text = currentPos.text.charAt(currentPos.text.length - 1) == ' ' ? text + ' ' : text;
  }
}

// Å°º¸µå ÀÔ·Â½Ã ÇÑ±ÛÀÎÁö È®ÀÎ ÇÏ´Â ÇÔ¼ö
// onKeyPress="is_hangul('ÇÑ±Û¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.')" Çü½ÄÀ¸·Î È°¿ë
function is_hangul(msg) {
  if (event.keyCode < 12592 || event.keyCode > 12687) {
    if (msg != '') alert(msg);
    event.returnValue = false
  }
}

// ÀÌ¸ÞÀÏ Á¦°ø¾÷Ã¼ º¯°æ
function chg_email_vendor(form, obj, email_2_box) {
  email_2_box.value = obj.value;
  EVB = document.getElementById(email_2_box.name);
  if (obj.value == '') {
    email_2_box.readOnly = false;
    EVB.style.display = 'block';
  } else {
    email_2_box.readOnly = true;
    //EVB.style.display = 'none';
  }
}

function set_box_value(obj, str) {
  obj.value =  str;
}

        var  favoriteurl="http://www.kbpf.org/"
        var  favoritetitle="´ëÇÑºÒ±³ÁøÈï¿ø"
        function  favoritesite(){
        if  (document.all)
        window.external.AddFavorite(favoriteurl,favoritetitle)}
// º¸°ü¿ë
/*
function save_current_pos(objTextArea) {
  if (objTextArea.createTextRange) objTextArea.currentPos = document.selection.createRange().duplicate();
}
function input_special_char(text) {
  if (objTextArea.createTextRange && objTextArea.currentPos) {
    var currentPos = objTextArea.currentPos;
    currentPos.text = currentPos.text.charAt(currentPos.text.length - 1) == ' ' ? text + ' ' : text;
  }
}

if (objForm.bc[objForm.bc.selectedIndex].text == 'Åõ¸í') objForm.is_transparency.value = 'Y';
*/