if (typeof(COMMON_JS) == 'undefined') {
  var COMMON_JS = true;
  var is_ie = navigator.userAgent.toLowerCase().indexOf("msie") != -1;

 
  function check_field(fld, msg) {
    if ((fld.value = trim(fld.value)) == "") {
      alert(msg);
      fld.focus();
      return false;
    }
  }

 
  function trim(s) {
    return s.replace(/^\s+|\s+$/g,'');
  }

 
 
  function number_format(s) {
    s = s.toString();
    return s.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,');
  }

 
  function no_comma(s) {
    var tmp = '';
    var comma = ',';
    var i;

    for (i=0; i<s.length; i++) {
      if (s.charAt(i) != comma)
        tmp += s.charAt(i);
    }
    return tmp;
  }

 
  function check_byte(content, target) {
    var i = 0;
    var cnt = 0;
    var ch = '';
    var cont = document.getElementById(content).value;

    for (i=0; i<cont.length; i++) {
      ch = cont.charAt(i);
      if (escape(ch).length > 4) {
        cnt += 2;
      } else {
        cnt += 1;
      }
    }

   
    document.getElementById(target).innerHTML = cnt;

    return cnt;
  }

 
  function autoSelect(selName, selValue) {
    if(selName && selValue) {
      var selobj = document.getElementById(selName);
      if(selobj) selobj.value = selValue;
      if(selValue=='') selobj.options[0].selected = true;
    }
  }

 
  function popup_window(url, winname, option) {
    window.open(url, winname, option);
  }

 
  function del(href) {
    if (confirm("ÇÑ¹ø »èÁ¦ÇÑ ÀÚ·á´Â º¹±¸ÇÒ ¹æ¹ýÀÌ ¾ø½À´Ï´Ù.\n\nÁ¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) 
      document.location.href = href;
  }

 
  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 = getCookie(name);
    if (value != "")
      document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
  }

 
 
  function image_window(img,title) {
    if (!img.width) {
      var imgObj = new Image();
      imgObj.src = img;

     
      if (imgObj.width == 0 || imgObj.height == 0) {
        if (title) var func_str="image_window('"+img+"','"+title+"')";
        else var func_str="image_window('"+img+"')";
        setTimeout(func_str, 50);
        return;
      }

      var img = imgObj.src;
      var w = imgObj.width;
      var h = imgObj.height;
    }
    else {
      var w = img.width;
      var h = img.height;
      var img = img.src;
    }

   
    winl = (screen.width-w)/2;
    wint = (screen.height-h)/3;

    if (w >= screen.width) {
      winl = 0;
      h = (parseInt)(w * (h / w));
    }

    if (h >= screen.height) {
      wint = 0;
      w = (parseInt)(h * (w / h));
    }

    var js_url = "<script language='JavaScript'> \n";
        js_url += "<!-- \n";
        js_url += "var is_ie=document.all; \n";
        js_url += "var isdrag=false; \n";
        js_url += "var x,y; \n";
        js_url += "var dobj; \n";
        js_url += "function movemouse(e) \n";
        js_url += "{ \n";
        js_url += "  if (isdrag) \n";
        js_url += "  { \n";
        js_url += "    dobj.style.left = is_ie ? tx + event.clientX - x : tx + e.clientX - x; \n";
        js_url += "    dobj.style.top  = is_ie ? ty + event.clientY - y : ty + e.clientY - y; \n";
        js_url += "    return false; \n";
        js_url += "  } \n";
        js_url += "} \n";
        js_url += "function selectmouse(e) \n";
        js_url += "{ \n";
        js_url += "  var fobj       = is_ie ? event.srcElement : e.target; \n";
        js_url += "  var topelement = is_ie ? 'BODY' : 'HTML'; \n";
        js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragme') \n";
        js_url += "  { \n";
        js_url += "    fobj = is_ie ? fobj.parentElement : fobj.parentNode; \n";
        js_url += "  } \n";
        js_url += "  if (fobj.className=='dragme') \n";
        js_url += "  { \n";
        js_url += "    isdrag = true; \n";
        js_url += "    dobj = fobj; \n";
        js_url += "    tx = parseInt(dobj.style.left+0); \n";
        js_url += "    ty = parseInt(dobj.style.top+0); \n";
        js_url += "    x = is_ie ? event.clientX : e.clientX; \n";
        js_url += "    y = is_ie ? event.clientY : e.clientY; \n";
        js_url += "    document.onmousemove=movemouse; \n";
        js_url += "    return false; \n";
        js_url += "  } \n";
        js_url += "} \n";
        js_url += "document.onmousedown=selectmouse; \n";
        js_url += "document.onmouseup=new Function('isdrag=false'); \n";
        js_url += "//--> \n";
        js_url += "</"+"script> \n";

    var settings  ='width='+w+',';
        settings +='height='+h+',';
        settings +='top='+wint+',';
        settings +='left='+winl+',';
        settings +='scrollbars=no,';
        settings +='resizable=no,';
        settings +='status=no';

    win=window.open("","image_window",settings);
    win.document.open();
    win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset=euc-kr'>\n");
    var size = "ÀÌ¹ÌÁö »çÀÌÁî : "+w+" x "+h;
    if (!title) title = "¿øº» ÀÌ¹ÌÁö º¸±â";
    win.document.write ("<title>"+title+"</title> \n");
    if (w >= screen.width || h >= screen.height) {
      win.document.write (js_url);
      var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n ÀÌ¹ÌÁö »çÀÌÁî°¡ È­¸éº¸´Ù Å®´Ï´Ù. \n ¿ÞÂÊ ¹öÆ°À» Å¬¸¯ÇÑ ÈÄ ¸¶¿ì½º¸¦ ¿òÁ÷¿©¼­ º¸¼¼¿ä. \n\n ÀÌ¹ÌÁö¸¦ ´õºí Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù. '"; 
    } else
      var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù. '";

    win.document.write ("<style>.dragme{position:relative;}</style>\n");
    win.document.write ("</head> \n\n");
    win.document.write ("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#dddddd' style='margin:0'> \n");
    win.document.write ("<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td align='center'><img src='"+img+"' width='"+w+"' height='"+h+"' border='0' class='dragme' "+click+"></td></tr></table> \n");
    win.document.write ("</body></html>");
    win.document.close();

    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  }

 
  function win_open(url, name, option) {
    var popup = window.open(url, name, option);
    popup.focus();
  }

 
  function get_left_pos(obj) {
    var parentObj = null;
    var clientObj = obj;
   
    var left = obj.offsetLeft;

    while((parentObj=clientObj.offsetParent) != null) {
      left = left + parentObj.offsetLeft;
      clientObj = parentObj;
    }

    return left;
  }

 
  function get_top_pos(obj) {
    var parentObj = null;
    var clientObj = obj;
   
    var top = obj.offsetTop;

    while((parentObj=clientObj.offsetParent) != null) {
      top = top + parentObj.offsetTop;
      clientObj = parentObj;
    }

    return top;
  }
}


function mflash(s,d,w,h,t) {
  return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+" /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>";
}

function documentwrite(src) {
  document.write(src);
}

function setcode(target, code) {
  target.innerHTML = code;
}
