/*
if (navigator.appName.toUpperCase == 'MICROSOFT INTERNET EXPLORER')
{
    function NOclickIE(e)
    {
        if (event.button == 2 || event.button == 3)
        {
        return false;
        }
    return true;
    }//function NOclickIE(e)

    document.onmousedown=NOclickIE;
    document.onmouseup=NOclickIE;
    window.onmousedown=NOclickIE;
    window.onmouseup=NOclickIE;
}//if (navigator.appName == 'Microsoft Internet Explorer')
else
{
    function NOclickNN(e)
    {
        if (document.layers||document.getElementById&&!document.all)
        {
            if (e.which==2||e.which==3)
            {
                return false;
            }
        }//if (document.layers||document.getElementById&&!document.all)
    }//function NOclickNN(e)
    if (document.layers)
    {
        document.captureEvents(Event.MOUSEDOWN);
        document.onmousedown=NOclickNN;
    }//if (document.layers)
    document.oncontextmenu=new Function("return false")
}//if (navigator.appName == 'Microsoft Internet Explorer')

*/

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 getFrameHTML(win, url)
{
  if(isIE()) pophtml = '<div><iframe src="' + url + '" width="100%" height="100%" frameborder="0"></iframe></div>';
  else {
    var margin = (isIE(1))?0:10;
    var popwidth = win.orgWindowWidth - margin;
    var popheight = win.orgWindowHeight - margin;
    pophtml = '<div><iframe src="' + url + '" width="' + popwidth + '" height="' + popheight + '" frameborder="0"></iframe></div>';
  }
  return pophtml;
}

function setModal(flag)
{
  if(window.navigator.userAgent.indexOf('MSIE')) {
    if(window.navigator.userAgent.indexOf('MSIE 8') == -1) return;
  }

  var obj=document.getElementById("oModalBG");

  if(!obj) {
    obj=document.createElement("DIV");
    obj.id = "oModalBG";

    with(obj.style) {
      display="none";
      position="absolute";
      left="0px";
      top="0px";
      zIndex="100";
      width="175px";
      height="168px";
      backgroundColor="#000000";
      if(isIE(1)) filter="alpha(opacity=70)";
      else opacity="0.7";
    }
    document.body.appendChild(obj);
    delete tmpHTML;
  }


  if(obj) {
    if(flag == true) {
      var winwidth = document.documentElement.clientWidth;
      var winheight = document.documentElement.clientHeight;
      if(winwidth == 0) winwidth = document.body.clientWidth;
      if(winheight == 0) winheight = document.body.clientHeight;

      var scrollHeight = document.documentElement.scrollHeight;
      if(scrollHeight == 0) scrollHeight = document.body.scrollHeight;

      var scrollWidth = document.documentElement.scrollWidth;
      if(scrollWidth == 0) scrollWidth = document.body.scrollWidth;

      obj.style.display = "";

      if(scrollHeight > winheight) {
        obj.style.height = scrollHeight + "px";
      }
      else {
        var scrollTop = document.documentElement.scrollTop;
        if(scrollTop == 0) scrollTop = document.body.scrollTop;

        obj.style.height = winheight + scrollTop + "px";
      }
      if(scrollWidth > winwidth) {
        obj.style.width = scrollWidth + "px";
      }
      else {
        var scrollLeft = document.documentElement.scrollLeft;
        if(scrollLeft == 0) scrollLeft = document.body.scrollLeft;
        obj.style.width = winwidth + scrollLeft + "px";
      }

      bodywidth = parseInt(obj.style.width, 10);
      bodyheight = parseInt(obj.style.height, 10);
    }
    else {
      obj.style.display = "none";
    }
  }
}


function getCenter(boxwidth, boxheight)
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  posLeft = myWidth/2 - parseInt(boxwidth, 10)/2;
  posTop = myHeight/2 - parseInt(boxheight, 10)/2;


  return {left:posLeft,top:posTop}

}

function copyData(src, des)
{
  if(src.value.trim() != "") des.value=src.value;
}

function URLEncode (clearString)
{
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}




function ZaddEvent(element, actualEventName, responder)
{

  if(actualEventName == "load") {
    if(window.addEventListener) // Firefox 1+, Opera 9, Safari 3+, etc.
    {
      window.addEventListener("load", responder, false);
    }
    else if(document.addEventListener) // Opera 7, Opera 8
    {
      document.addEventListener("load", responder, false);
    }
    else if("onload" in self) // MSIE 6, 7 and MSIE 8
    {
      self.onload = responder;
    };
  }
  else {

    if (element.addEventListener)
      element.addEventListener(actualEventName, responder, false);
    else
      element.attachEvent("on" + actualEventName, responder);

  }
  /*
  if (window.addEventListener)
    window.addEventListener(actualEventName, responder, false);
  else
    window.attachEvent("on" + actualEventName, responder);
  */
}

/* string prototype */

String.prototype.trim = function()
{
  return this.replace(/(^ *)|( *$)/g, "");
} // end of function

String.prototype.ltrim = function()
{
  return this.replace(/(^ *)/g, "");
} // end of function

String.prototype.rtrim = function()
{
  return this.replace(/( *$)/g, "");
} // end of function

String.prototype.lpad = function( maxLength, fillChar )
{

  var srcStr = this.substr( 0, maxLength );
  var cnt = 0;

  for( var inx = srcStr.length; inx < maxLength; inx++ ) {
    srcStr = fillChar.charAt(cnt) + srcStr;
    cnt++;
    cnt = ( cnt == fillChar.length ) ? 0 : cnt;
  }
  return srcStr;

} // end of function

String.prototype.rpad = function( maxLength, fillChar )
{

  var srcStr = this.substr( 0, maxLength );
  var cnt = 0;

  for( var inx = srcStr.length; inx < maxLength; inx++ ) {
    srcStr = srcStr + fillChar.charAt(cnt);
    cnt++;
    cnt = ( cnt == fillChar.length ) ? 0 : cnt;
  }

  return srcStr;

} // end of function

String.prototype.removeChr = function( findPattern )
{
  return (findPattern == null) ? this : eval( "this.replace(/(" + findPattern + ")/g, '' )" );
} // end of function

String.prototype.replaceChr = function( findPattern, replacePattern )
{
  return (findPattern == null) ? this : eval( "this.replace(/(" + findPattern + ")/g, '" + replacePattern + "' )" );
} // end of function

String.prototype.getByte = function( utf8Yn )
{
  var str = this.trim();

  var utf8Add = ( utf8Yn == true ) ? 2 : 1;
  var len = 0;

  for( var i = 0; i < str.length; i++, len++ ) {
    if( str.charCodeAt(i) < 0 || str.charCodeAt(i) > 127 ) len += utf8Add; // add Extra 2 when charSet is UTF-8
  }
  return len;
} // end of function

/**
* ¹®ÀÚ¿­À» Á¤¼ö·Î º¯È¯
* @return {Number}  Á¤¼ö
*/
String.prototype.getInt = function()
{
  if(!isNaN(this)) return parseInt(this);
  else return null;
} // end of function

/**
* ¹®ÀÚ¿­¿¡¼­ ¼ýÀÚ¸¸ °¡Á®¿À±â
* @return {String}  ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­
*/
String.prototype.getNum = function()
{
  return this.trim().replace(/[^0-9]/g, "");
} // end of function

/**
* ¹®ÀÚ¿­¿¡¼­ ¼ýÀÚ¸¸ °¡Á®¿À±â
* @return {String}  ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­
*/
String.prototype.getNotNum = function()
{
  return this.trim().replace(/[0-9]/g, "");
} // end of function

/**
* ¹®ÀÚ¿­¿¡¼­ ¿µ¹®ÀÚ¸¸ °¡Á®¿À±â
* @return {String}  ¿µ¹®ÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­
*/
String.prototype.getAlpha = function()
{
  return (this.trim().replace(/[^a-zA-Z]/g, ""));
} // end of function

/**
* ¹®ÀÚ¿­¿¡¼­ ¼ýÀÚ-¹®ÀÚ¸¸ °¡Á®¿À±â
* @return {String}  ¿µ¹®ÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­
*/
String.prototype.getAlphaNum = function()
{
  return (this.trim().replace(/[^0-9a-zA-Z]/g, ""));
} // end of function

/**
* ¼ýÀÚ¿¡ 3ÀÚ¸®¸¶´Ù ÄÞ¸¶¸¦ Âï¾î¼­ ¹ÝÈ¯
* @return {String}  3ÀÚ¸®¸¶´Ù ÄÞ¸¶°¡ ÂïÈù ¹®ÀÚ¿­
*/
String.prototype.getMoney = function()
{
  var num = this.trim();
  while((/(-?[0-9]+)([0-9]{3})/).test(num)) {
    num = num.replace((/(-?[0-9]+)([0-9]{3})/), "$1,$2");
  }
  return num;
} // end of function

/**
* Æ¯Á¤ ¹®ÀÚ¿­À» Æ÷ÇÔÇÏ°í ÀÖ´ÂÁö ¿©ºÎ¸¦ Ã¼Å©
* @param  {String}  pattern Ã¼Å©ÇÒ ¹®ÀÚ¿­
* @return {Boolean} Æ÷ÇÔ¿©ºÎ
*/
String.prototype.hasValue = function( pattern )
{
	return ( this.indexOf(pattern) >= 0 ) ? true : false;
} // end of function


String.prototype.isNull = function( pattern )
{
  //if( this == undefined || this == null || (typeof this == 'string' && this == '') ) return true;
  if( this == undefined || this == null || this == '' ) return true;
  return false;
} // end of function

String.prototype.isAlphaNum = function()
{
  var str = this.trim();

  //mask°¡ µÇ¾î ÀÖÀ» °æ¿ì¿¡ ´ëÇØ Ã³¸®ÇØ¾ß ÇÑ´Ù.
  //Áö±ÝÀº °í·ÁÄ¡ÇÑ°í ÀÏ´Ü ÄÚµù
  //var param = ( typeof inputStr == 'object' ) ? this.getUnmaskStr( inputStr ) : inputStr;
  if( str.isNull() ) return true;
  return (/^[0-9a-zA-Z]+$/).test(str);
} // end of function

String.prototype.isNumber = function()
{
  var str = this.trim();

  str = str.replaceAll(",", "");
  str = str.replaceAll("-", "");
  str = str.replaceAll("+", "");

  if( str.isNull() ) return true;

  return (/^[0-9]+$/).test(str);
} // end of function

String.prototype.isEmail = function()
{
  var str = this.trim();
  var filter=/^.+@.+\..{2,3}$/
  if (filter.test(str)) return true;
  else return false;
}

var zFormUtil = new function() {

  this.formcheck = function(form)
  {

    var el = null;

    //return false when form is invalid object
    if(form == undefined || typeof form != 'object') {
      zMsgUtil.alert("ÀÔ·ÂÆûÀÌ °³Ã¼°¡ ¾Æ´Õ´Ï´Ù.");
      return false;
    }
    if(form.tagName != "FORM") {
      zMsgUtil.alert("ÀÔ·ÂÆûÀÌ °³Ã¼°¡ ¾Æ´Õ´Ï´Ù.");
      return false;
    }


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

      //el = form.elements.item( i );
      el = form.elements[i];

      if(!this.checkRequired(el) ||
         !this.checkEmail(el) ||
         !this.checkNumber(el) ||
         !this.checkAlphabet(el) ||
         !this.checkAlphaNumeric(el) ||
         !this.checkMaxbyte(el) ||
         !this.checkMinbyte(el) ||
         !this.checkFixbyte(el)
        ) {
        return false;
      }

    }
    return true;

  } // end of function

  /*
    obj : input type object

    check the value of obj is not empty.
  */
  this.checkRequired = function(obj)
  {
    var hasvalue = false;

    if(obj.getAttributeNode("required")) {
      switch(obj.tagName) {
        case "TEXTAREA" :
        case "INPUT"    : hasvalue = (obj.value.trim())?true:false; break;
        case "SELECT"   : hasvalue = (obj.selectedIndex >= 0 && obj.options[obj.selectedIndex].value)?true:false; break;
      }

      if(!hasvalue) {
        zMsgUtil.alert("* Ç¥½ÃµÈ Ç×¸ñÀº ÇÊ¼öÇ×¸ñÀÔ´Ï´Ù.");
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

  /*
    obj : input type object

    check the value of obj is an email or not.
  */
  this.checkEmail = function(obj)
  {
    if(obj.getAttributeNode("email")) {
      if(obj.value.isEmail() == false) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀº Email ÁÖ¼ÒÇü½Ä¿¡ ¸Â°Ô ÀÔ·ÁÇÏ¼¼¿ä.");
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function



  /*
    obj : input type object

    check the value of obj is a number or not.
  */
  this.checkNumber = function(obj)
  {
    if(obj.getAttributeNode("number")) {
      if(obj.value.isNumber() == false) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀº ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

  /*
    obj : input type object

    check the value of obj is an alphanumeric string.
  */
  this.checkAlphabet = function(obj)
  {
    if(obj.getAttributeNode("alphabet")) {
      if(obj.value.isAlphaNum() == false) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀº ¿µ¹®ÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

  /*
    obj : input type object

    check the value of obj is an alphanumeric string.
  */
  this.checkAlphaNumeric = function(obj)
  {
    if(obj.getAttributeNode("alphanum")) {
      if(obj.value.isAlphaNum() == false) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀº ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

  /*
    obj : input type object

    check the length of value of obj is larger than maxbyte.
  */
  this.checkMinbyte = function(obj)
  {
    if(obj.getAttributeNode("minbyte")) {
      if(obj.value.getByte() < obj.getAttribute("minbyte")) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀ» [#]¹ÙÀÌÆ® ÀÌ»óÀ¸·Î ÀÔ·ÂÇÏ¼¼¿ä.", obj.getAttribute("minbyte"));
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

  /*
    obj : input type object

    check the length of value of obj is larger than maxbyte.
  */
  this.checkMaxbyte = function(obj)
  {
    if(obj.getAttributeNode("maxbyte")) {
      if(obj.value.getByte() > obj.getAttribute("maxbyte")) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀ» [#]¹ÙÀÌÆ® ÀÌÇÏ·Î ÀÔ·ÂÇÏ¼¼¿ä.", obj.getAttribute("maxbyte"));
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function



  /*
    obj : input type object

    check the length of value of obj is fixbyte.
  */
  this.checkFixbyte = function(obj)
  {
    if(obj.getAttributeNode("fixbyte")) {
      if(obj.value.getByte() != obj.getAttribute("fixbyte")) {
        zMsgUtil.alert("ÇØ´ç Ç×¸ñÀ» [#]¹ÙÀÌÆ®·Î ÀÔ·ÂÇÏ¼¼¿ä.", obj.getAttribute("fixbyte"));
        obj.focus();
        return false;
      }
      else return true;
    }
    else return true;
  } // end of function

} //end of class




/*
  message code ¸¦ ¹ÙÅÁÀ¸·Î ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÑ´Ù.
*/
var zMsgUtil = new function() {

  /*
  °æ°íÃ¢¿¡ ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÑ´Ù.
  */
  this.alert = function( msg )
  {
    alert( this.getMsg(arguments) );
  } // end of function


  /*
    message code¿¡ µî·ÏµÈ ¸Þ½ÃÁö¸¦ ¸®ÅÏÇÑ´Ù.
  */
  this.getMsg = function( inputMsg )
  {
    if( typeof arguments[ 0 ] == "object" ) arguments = arguments[ 0 ];
    var argLen = arguments.length;

    if( argLen == 0 ) return '';

    var msg = arguments[0];

    if(this.message) {
      msg = this.message[ arguments[0] ] ? this.message[ arguments[0] ] : arguments[0];
    }

    if( argLen == 1 ) return msg.removeChr( '#' );

    // bind @ to Input String (array)
    var idx = 0;

    for( var i = 1; i < argLen; i++ ) {
        idx = msg.indexOf( "#", idx );
        msg = msg.substr( 0, idx ) + String( arguments[i] ) + msg.substring( idx + 1 );
        idx = idx + String( arguments[i] ).length;
    }

    return msg;

  } // end of function

} // end of class



































/******************* old common function *****************************/

function submenuOver(no, curno)
{
  if(no == curno) return;
  document.getElementById("submenu" + no).className = "submenuOver";
}

function submenuOut(no, curno)
{
  if(no == curno) return;
  document.getElementById("submenu" + no).className = "submenuOut";
}


function isIE(flag)
{
  if (window.navigator.userAgent.indexOf('MSIE') != -1) {
    if (window.navigator.userAgent.indexOf('MSIE 8') != -1 && flag != 1) {
      return false; //8.0Àº IE°¡ ¾Æ´Ñ°ÍÀ¸·Î °£ÁÖ(ÇÁ·Î±×·¥ ³Ê¹« ¸¹À» °÷À» ¼ÕºÁ¾ß ÇÑ´Ù.)
    }
    else {
      return true;
    }
  } else {
    return false;
  }
}

function setDataOver(tr)
{
  for(var i=0; i < tr.cells.length; i++) {
    tr.cells[i].style.backgroundColor='#f5f5f5';
  }
}

function setDataOut(tr)
{
  for(var i=0; i < tr.cells.length; i++) {
    tr.cells[i].style.backgroundColor='';
  }
}


var isPopMenuShow = false;

function Line()
{
  this.Left = new Point();
  this.Right = new Point();
}

function Point()
{
  this.x=0;
  this.y=0;
}

var mouseXY = new Point();


function Square()
{
  this.top=0;
  this.left=0;
  this.right=0;
  this.bottom=0;
}

function windowInfo()
{
  this.top=0;
  this.left=0;
  this.width=0;
  this.height=0;
}

function getMousePos(evt)
{
  var e = evt || window.event;

  if(navigator.appName == "Netscape"){
    mouseXY.x = e.pageX;
    mouseXY.y = e.pageY;
  }
  else {
    mouseXY.x = e.x;
    mouseXY.y = e.y;
  }
  alert(mouseXY.x);
}

function copyAreaData(ischecked, goodstype, des)
{
  if(ischecked == true)
  {
    var src1 = document.getElementById(goodstype + "_takearea11");
    var src2 = document.getElementById(goodstype + "_takearea21");
    var src3 = document.getElementById(goodstype + "_takearea31");
    if(src1.selectedIndex > 0 && src2.selectedIndex > 0 && src3.selectedIndex > 0)
    {
      var des1 = document.getElementById(goodstype + "_takearea1" + des);
      var des2 = document.getElementById(goodstype + "_takearea2" + des);
      var des3 = document.getElementById(goodstype + "_takearea3" + des);

      des1.selectedIndex = src1.selectedIndex;
      changeCategory2(des2, des3, des1.selectedIndex, null, null);
      des2.selectedIndex = src2.selectedIndex;
      changeCategory3(des3, des1.selectedIndex, des2.selectedIndex, null, null);
      des3.selectedIndex = src3.selectedIndex;
    }
    else {
      alert("Á¢¼öÁö¿ª 1,2,3ÀÌ ¸ðµÎ ¼±ÅÃµÇ¾î ÀÖ¾î¾ß ÇÕ´Ï´Ù.");
    }
  }
}

function copyData(src, des)
{
  if(src.value.trim() != "")
  {
    des.value=src.value;
  }
}

function copyData2(ischecked, src1, des1, src2, des2)
{
  if(ischecked == true && src1.value.trim() != "")
  {
    des1.value=src1.value;
  }
  if(ischecked == true && src2.value.trim() != "")
  {
    des2.value=src2.value;
  }
}

function getLength(str)
{
  return(str.length+(escape(str)+"%u").match(/%u/g).length-1);
}


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

//usage : variable.replaceAll
String.prototype.replaceAll = function(str1, str2)
{
 var temp_str = "";

 if (this.trim() != "" && str1 != str2)
 {
  temp_str = this.trim();

  while (temp_str.indexOf(str1) > -1)
  {
   temp_str = temp_str.replace(str1, str2);
  }
 }

 return temp_str;
}

function onlyNumber(evt)
{
  var IE = isIE(1);
  var evt = IE?window.event : evt;
  var ikeycode = IE?evt.keyCode:evt.keyCode;
  var icharcode = IE?evt.keyCode:evt.charCode;

  //FF°¡ control key¿Í char key ¸¦ ±¸ºÐÇÏ³×..¤Ð.¤Ð
  if(ikeycode == 0 && icharcode > 0) ikeycode = icharcode;

  if ( ikeycode != 9 &&  ikeycode != 37 && ikeycode != 39 && ikeycode != 46 && ikeycode != 8 && (ikeycode < 48 || 57 < ikeycode) ) {
    if(IE) evt.returnValue=false;
    else evt.preventDefault();
    return;
  }
}

function onlyAlphaNumeric(evt)
{
  var IE = isIE(1);
  var evt = IE?window.event : evt;
  var ikeycode = IE?evt.keyCode:evt.keyCode;
  var icharcode = IE?evt.keyCode:evt.charCode;

  if(ikeycode == 0 && icharcode > 0) ikeycode = icharcode;

  if ( !(icharcode >= 48 && 57 >= icharcode) &&
    !(icharcode >= 65 && 90 >= icharcode) &&
    !(icharcode >= 97 && 122 >= icharcode)) {
    if(IE) evt.returnValue=false;
    else evt.preventDefault();
    return;
  }
}



function onlyFloat(evt)
{
  var IE = isIE(1);
  var evt = IE?window.event : evt;
  var ikeycode = IE?evt.keyCode:evt.keyCode;
  var icharcode = IE?evt.keyCode:evt.charCode;

  if ( ikeycode != 46 && (ikeycode < 48 || 57 < ikeycode )) {
    if(IE) evt.returnValue=false;
    else evt.preventDefault();
    return;
  }
}




function noPaste(evt)
{
  var IE = isIE(1);
  var evt = IE?window.event : evt;

  if(IE) evt.returnValue=false;
  else evt.preventDefault();

}


function GetStrByte(val)
{
  val = parseInt(val, 10);
  if(val == "NaN") return "0 B";
  if(val < 1024) return val + " B";
  else if(val >= 1024 && val < 1024 * 1024) return parseInt(val/1024, 10) + "." + parseInt((val%1024)/100, 10) + " KB";
  else if(val >= 1024 * 1024 && val < 1024 * 1024 * 1024) return parseInt(val/1024/1024, 10) + "." + parseInt((val%1024)/100, 10) + " MB";
  else return parseInt(val/1024/1024/1024, 10) + "." + parseInt((val%1024)/100, 10) + " GB";
}


/* check mail format */
function CheckEmail(str)
{
  str = str.trim();
  var filter=/^.+@.+\..{2,3}$/
  if (filter.test(str)) return true;
  else return false;
}

/* µÎ°³ÀÇ ¹®ÀÚ¿­ »çÀÌÀÇ ¹®ÀåÀ» °ËÃâÇØ ³»´Â ÇÔ¼ö */
function str_extract_java(value, start, end)
{
    var tmp;
  var stStr = eval("/"+start+"/");
  var endStr = eval("/["+end+" ]+/g");

  if ((value.search(stStr)) == -1)
    return value;

  tmp = value.split(start);
  tmp = tmp[1];
  tmp = tmp.replace(endStr, "");

  return tmp;
}

function setJustCookie( name, value )
{
  document.cookie = name + "=" + value + "; path=/;"
}

function setCookie( name, value, expiredays )
{
  var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie( name )
{
  var nameOfCookie = name + "=";
  var x = 0;
  while ( x <= document.cookie.length )
  {
    var y = (x+nameOfCookie.length);
    if ( document.cookie.substring( x, y ) == nameOfCookie ) {
      if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
        endOfCookie = document.cookie.length;
      return unescape( document.cookie.substring( y, endOfCookie ) );
    }
    x = document.cookie.indexOf( " ", x ) + 1;
    if ( x == 0 )
      break;
  }
  return "";
}





function GetCookie(sName)
{
  var aCookie = document.cookie.split(';');
  for (var i=0; i < aCookie.length; i++)
  {
    var aCrumb = aCookie[i].split('=');
    if (sName == trim(aCrumb[0])) {
      return unescape(aCrumb[1]);
    }
  }

  return null;
}


function IsNumber(t)
{
  var i,j;
  var Digit = '1234567890'
  astr = Digit;

    //0ÀÏ¶§.. false°¡ ¸®ÅÏµÇ¼­..

  if(t == "0") return(true);

  if(t.length == 0) return(false);
  if (astr.length > 1) {
    for(i=0;i<t.length;i++) {
      if(astr.indexOf(t.substring(i,i+1)) < 0)  {
        j=1;
        return(false);
      }
    }
  }
  return(t);
}


function IsContinueNo(t)
{
  var i;
  var cont_flag=false;
  var next='';

  for(i=0; i<t.length-1; i++) {
    next = parseInt(t.substring(i, i+1), 10) + 1;
    if(t.substring(i+1, i+2) == next) cont_flag = true;
    else return(false);
  }
  return(cont_flag);
}

function WhiteChk(strValue) {
  var flag=true;
  if (strValue!="") {
    for (var i=0; i < strValue.length; i++) {
      if (strValue.charAt(i) == " ") {
        flag=false;
        break;
      }
    }
  }
  return flag;
}


function HaveSpecialChars(t)
{
  var i,j;

  for(i=0;i<t.length;i++) {
    ch = t.substring(i, i+1);
    if((ch >= ' ' && ch <= '/') || (ch >= ':' && ch <= '@') || (ch >= '[' && ch <= '`') || (ch >= '{' && ch <= '~')) return(true);
  }
  return(false);
}


function IsAlphaNumeric(t)
{
  var i,j;

  for(i=0;i<t.length;i++) {
    ch = t.substring(i, i+1);
    if((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) j=0;
    else return(false);
  }
  return(true);
}



function IsHangul(str)
{

  for (i = 0; i < str.length; i++) {
    ch = str.substring(i, i+1);
    if (ch < ' ' || ch > '~') return(true);
  }
  return(false);
}

function SetNextFocus(thisobj, nextobj, len)
{
  if(thisobj.value.length == len) nextobj.focus();
}

// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function CheckJoomin(ssn)
{

  var key = "234567892345";
  var total = 0;

  ssn = ssn.replaceAll("-", "");
  if(ssn.length == 0) return false;

  for(var i=0; i<12; i++)
  {
    total = total + ssn.charAt(i)*key.charAt(i);
  }
  total = 11 - (total % 11);

  switch(total)
  {
    case 11:
      total=1;
      break;
    case 10:
      total=0;
      break;
    default:
      total=total;
      break;
  }

  if(ssn.charAt(12) != total)
  {
    return false;
  }
  return true;
}


// »ç¾÷ÀÚµî·Ï¹øÈ£ Ã¼Å©
function CheckBizNo(vencode)
{
/*
  if (vencode.length == 10)
    return true;
  else
    return false;
*/
  vencode = vencode.trim();
  vencode = vencode.replaceAll("-", "");
  if (vencode.length != 10) return false;
  if(vencode == "") return false;
  //¾Æ·¡ÀÇ ·ÎÁ÷¿¡¼­ 888-88-88888ÀÌ¸é ¹«Á¶°Ç Åë°úµÇ¹Ç·Î, 888-88-88888 ÀÌ¸é ¿À·ùÃ³¸®
  if(vencode == "8888888888") return false;

  var sum = 0;
  var getlist =new Array(10);
  var chkvalue =new Array("1","3","7","1","3","7","1","3","5");

  for(var i=0; i<10; i++) { getlist[i] = vencode.substring(i, i+1); }

  for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }

  sum = sum + parseInt((getlist[8]*5)/10, 10);
  sidliy = sum % 10;
  sidchk = 0;

  if(sidliy != 0) { sidchk = 10 - sidliy; }
  else { sidchk = 0; }
  if(sidchk != getlist[9]) { return false; }
  return true;
}


function hexa(numb){
    var k=0;
    var kk=0;
    var str = "";

    k = numb;
    while(1) {
      kk = k % 16;
      k = Math.floor(k/16);
      str = convert(kk) + str;
      if (k == 0) break;
    }

    //str = convert(kk) + str;
    return(str);
}

function convert(nr)
{
  var chr;
  if (nr==10){chr="A"}
  else if (nr==11){chr="B"}
  else if (nr==12){chr="C"}
  else if (nr==13){chr="D"}
  else if (nr==14){chr="E"}
  else if (nr==15){chr="F"}
  else {chr=nr;}
  return(chr);
}
function imgStrSize(val)
{
  // Ã·ºÎÆÄÀÏ´ç 10M·Î Á¦ÇÑ


  //ÀÌ¹ÌÁö Å©±â °è»ê
  if(val > 1024 && val < 1048576)
  {
    strFileSize = Math.round(eval(val)/1000)+"KB";
  }
  else if(val<1024)
  {
    strFileSize = eval(val)+"B";
  }
  else
  {
    intMB = (eval(val)/1000)/1000 ;
    intMB = Math.round(intMB*100)/100

    strFileSize = intMB+"MB";
  }

  return strFileSize;
}

function imgReSize(imgWidth, imgHeight, maxWidth, imgObj)
{
  if(imgWidth > maxWidth) {
    heightValue = parseInt((maxWidth * imgHeight)/imgWidth, 10);
    widthValue = maxWidth;
  }
  else {
    heightValue = imgHeight;
    widthValue = imgWidth;
  }
  imgObj.style.width = widthValue;
  imgObj.style.height = heightValue;
}



function imgReSizeFixed(imgWidth,imgHeight,maxWidth,maxHeight, imgObj)
{
  if (imgWidth >  maxWidth)
  {
    widthValue = maxWidth;
  }
  else
  {
    widthValue = imgWidth;
  }

  WidthRate = (widthValue / imgWidth) ;

  if (imgHeight > maxHeight)
  {
    heightValue = maxHeight ;
  }
  else
  {
    heightValue = imgHeight ;
  }

  HeightRate = (heightValue / imgHeight) ;

  if (maxWidth == 0)
  {
    WidthRate = 100;
  }

  if (maxHeight == 0)
  {
    HeightRate = 100;
  }

  if (HeightRate < WidthRate)
  {
    widthValue =  imgWidth * HeightRate ;
    heightValue = imgHeight * HeightRate ;
  }
  else
  {
    widthValue  =  imgWidth * WidthRate;
    heightValue = imgHeight * WidthRate;
  }
  imgObj.style.width = widthValue;
  imgObj.style.height = heightValue;
}


function getmulticontent(source, maxlength, separate_str)
{

    var content_size = getLength(source);
    var multicontent = "";

    if(maxlength >= content_size) {
      return source;
    }


    var oldpos = 0;
    var j=0;
    var i=0;

    while(i < content_size) {
      if(source.charCodeAt(i) < 256) {
        j++;
      }
      else {
        j += 2;
      }
      i++;

      if(j >= maxlength) {
        if(j > maxlength) i--;
        scontent = source.substring(oldpos, i);
        if(scontent.length) multicontent += scontent + separate_str;
        oldpos = i;
        j=0;
      }
    }

    multicontent = multicontent.substring(0, multicontent.length - separate_str.length);
    return multicontent;
}

function removeItems(obj, remainsize)
{
  if(typeof(remainsize) == "undefined") remainsize = 0;

  for(var k=obj.length ; k >= remainsize; k--) {
   obj.remove(k);
  }
}

function MoveItems(sourceObj, targetObj, iscopy, dupcheck, removeitemonduple)
{
  var newOpt;
  var isduple = false;
  var dupleindex = new Array();

  var selindex = sourceObj.selectedIndex;

  for(var k=0; k < targetObj.options.length; k++) targetObj.options[k].selected = false;

  var cnt = sourceObj.options.length;
  for(var k=0; k < cnt; k++) {
    dupleindex[k] = 0;

    if(sourceObj.options[k].value != "" && sourceObj.options[k].selected) {
      var srcval = sourceObj.options[k].value;

      /* Áßº¹Ã¼Å© ½ÃÀÛ */
      isduple = false;
      if(dupcheck == true) {
        for(var j=0; j < targetObj.options.length; j++) {
          if(targetObj.options[j].value == srcval) {
            isduple = true;
            dupleindex[k] = 1;
          }
        }
      }
      if(isduple == true) continue;
      /* Áßº¹Ã¼Å© ³¡ */

      var fnm = sourceObj.options[k].text;
      var newOpt2 = new Option(fnm, srcval);
      var selcnt = targetObj.options.length;

      targetObj.options[selcnt]=newOpt2;
      targetObj.options[selcnt].selected = true;
    }
  }


  if(iscopy == false) {
    for(var k=cnt-1 ; k >= 0; k--) {
      if(sourceObj.options[k].value != "" && sourceObj.options[k].selected && (dupleindex[k] == 0 || (dupleindex[k] == 1 && removeitemonduple == true))) {
        sourceObj.remove(k);
      }
    }
  }
  if(selindex ==  sourceObj.options.length) selindex =  sourceObj.options.length -1;
  if(selindex != -1) sourceObj.options[selindex].selected = true;
}

function moveItemUp(obj)
{
  var selIndex = obj.selectedIndex;
  var sText;
  var sValue;
  if(selIndex != 0 && selIndex != -1) {
    var cnt = obj.options.length;
    var isfirst = false;
    for(var k=0; k < cnt; k++) {
      if(obj.options[k].selected && isfirst == false) isfirst = true;
      else obj.options[k].selected = false;
    }
    sValue  = obj.options[selIndex-1].value;
    sText  = obj.options[selIndex-1].text;
    obj.options[selIndex-1].value = obj.options[selIndex].value;
    obj.options[selIndex-1].text = obj.options[selIndex].text;
    obj.options[selIndex].value = sValue;
    obj.options[selIndex].text = sText;
    obj.options[selIndex].selected = false;
    obj.options[selIndex-1].selected = true;
  }
}

function moveItemDown(obj)
{
  var opLength = obj.options.length;
  var selIndex = obj.selectedIndex;
  var sText;
  var sValue;
  if( selIndex != (opLength - 1) && selIndex != -1 ) {
    var cnt = obj.options.length;
    var isfirst = false;
    for(var k=0; k < cnt; k++) {
      if(obj.options[k].selected && isfirst == false) isfirst = true;
      else obj.options[k].selected = false;
    }
    sValue  = obj.options[selIndex+1].value;
    sText  = obj.options[selIndex+1].text;
    obj.options[selIndex+1].value = obj.options[selIndex].value;
    obj.options[selIndex+1].text = obj.options[selIndex].text;
    obj.options[selIndex].value = sValue;
    obj.options[selIndex].text = sText;
    obj.options[selIndex].selected = false;
    obj.options[selIndex+1].selected = true;
  }
}

function SetNumberFormat(obj, evt)
{
  var str = obj.value;
  obj.value = GetNumberFormat(str.replaceAll(",", ""));
}

function GetNumberFormat(str)
{
  str = String(str);

  var str2 = "";
  var j = 0;

  var minus = str.substring(0, 1);

  if(minus == "-" && minus == str) return str;

  if(minus == "-") {
    str = str.substring(1, str.length);
  }
  for(i=str.length; i > 0 ;i--) {
    ch = str.substring(i, i-1);
    str2 = ch + str2;

    j++;
    if(j%3 == 0) str2 = "," + str2;
  }
  if(j%3 == 0) str2 = str2.substring(1, str2.length);

  if(minus == "-") str2 = minus + str2;
  return str2;
}


function SetDateFormat(obj, evt)
{
  var IE = isIE(1);
  var evt = IE?window.event : evt;
  var ikeycode = IE?evt.keyCode:evt.keyCode;
  var icharcode = IE?evt.keyCode:evt.charCode;

  //FF°¡ control key¿Í char key ¸¦ ±¸ºÐÇÏ³×..¤Ð.¤Ð
  if(ikeycode == 0 && icharcode > 0) ikeycode = icharcode;

  var str = obj.value;
  obj.value = GetDateFormat(str.replaceAll("-", ""), str, ikeycode);
}

function GetDateFormat(str, orgstr, ikeycode)
{
  var str2 = "";
  var j = 0;
  var len = str.length;


  if(ikeycode == 8) {
    if(orgstr.length == 5) return str.substring(0, 4);
    if(orgstr.length == 4) return str.substring(0, 3);
  }
  if(len >= 4) {
    str2 = str.substring(0, 4);
    if(len >= 6) {
      var month = str.substring(4, 6);
      if(len == 6 && (parseInt(month, 10) < 1 || parseInt(month, 10) > 12)) {
        str2 += "-" + str.substring(4, 5);
        return(str2);
      }
      str2 += "-" + month;
      var day = str.substring(6);
      if(len == 8) {
        if(parseInt(day, 10) < 1 || parseInt(day, 10) > 31) {
          str2 += "-" + str.substring(6, 7);
          return(str2);
        }
        str2 += "-" + day;
      }
      else if(len == 7) {
        if(parseInt(day, 10) < 1 || parseInt(day, 10) > 31) {
          str2 += "-" + day;
          return(str2);
        }
        str2 += "-" + day;
      }
    }
    else str2 += "-" + str.substring(4);
    return str2;
  }
  else return str;
}



function SetBiznoFormat(obj)
{
  var str = obj.value;
  obj.value = GetBiznoFormat(str.replaceAll("-", ""), str);
}

function GetBiznoFormat(str, orgstr)
{

  var len = str.length;

  if(len <= 3) return str;
  else if(len <= 5) return str.substr(0, 3) + "-" + str.substr(3, 2);
  else if(len <= 10) return str.substr(0, 3) + "-" + str.substr(3, 2) + "-" + str.substr(5, 5);
}


function SetPostcodeFormat(obj)
{
  var str = obj.value;
  obj.value = GetPostcodeFormat(str.replaceAll("-", ""), str);
}

function GetPostcodeFormat(str, orgstr)
{

  var len = str.length;

  if(len < 3) return str;
  else return str.substr(0, 3) + "-" + str.substr(3, 3);
}


function getAreaLength(str)
{


  if(str.substring(0, 2) == "02") return {arealen:2,maxlen:10};
  else if(str.substring(0, 2) == "15") return {arealen:4,maxlen:8};
  else {
    var areacode = str.substring(0, 3);
    if(areacode == "050" || areacode == "013" || areacode == "050") return {arealen:4,maxlen:12};
    else return {arealen:3,maxlen:11};
  }
}


function SetStudNoFormat(obj)
{
  var str = obj.value;
  obj.value = GetStudNoFormat(str.replaceAll("-", ""), str);
}



function GetStudNoFormat(str, orgstr)
{
  var str2 = "";
  var j = 0;
  var len = str.length;

  if(len < 2) return str;

  var retstr = "";

  if(str.substr(0, 2) == '20') {
    if(len > 4) {
      if(len < 10) retstr = str.substr(0, 4) + '-' + str.substr(4, len-4);
      else retstr = str.substr(0, 4) + '-' + str.substr(4, 5);
    }
    else return str;
  }
  else {
    if(len > 5) {
      if(len < 9) retstr = str.substr(0, 5) + '-' + str.substr(5, len-5);
      else {
        retstr = str.substr(0, 5) + '-' + str.substr(5, 3);
      }
    }
    else return str;
  }

  return retstr;

}

function SetTelFormat(obj)
{
  var str = obj.value;
  obj.value = GetTelFormat(str.replaceAll("-", ""), str);
}



function GetTelFormat(str, orgstr)
{
  var str2 = "";
  var j = 0;
  var len = str.length;

  if(len < 2) return str;

  var noinfo = getAreaLength(str);

  if(len > noinfo.maxlen) str = str.substr(0, noinfo.maxlen);
  retstr = str.substr(0, noinfo.arealen);

  var telno = str.substr(noinfo.arealen);
  var tellen = telno.length;

  if(tellen == 0) return retstr;

  if(tellen < 8) {
    if(tellen <= 3) {
      retstr = retstr + "-" + telno.substr(0, len);
    }
    else {
      if(noinfo.maxlen == 8) {
        retstr = retstr + "-" + telno.substr(0, 4);
      }
      else {
        retstr = retstr + "-" + telno.substr(0, 3) + "-" + telno.substr(3);
      }
    }
  }
  else  {
    retstr = retstr + "-" + telno.substr(0, 4) + "-" + telno.substr(4, 4);
  }
  return retstr;

}

function SetSSNFormat(obj)
{
  var str = obj.value;
  obj.value = GetSSNFormat(str.replaceAll("-", ""), str);
}

function GetSSNFormat(str, orgstr)
{

  var len = str.length;

  if(len < 7) return str;
  else return str.substr(0, 6) + "-" + str.substr(6, 7);
}

function SetCardFormat(obj)
{
  var str = obj.value;
  obj.value = GetCardFormat(str.replaceAll("-", ""), str);
}

function GetCardFormat(str, orgstr)
{

  var len = str.length;

  if(len < 4) return str;
  else if(len <= 8) return str.substr(0, 4) + "-" + str.substr(4, 4);
  else if(len <= 12) return str.substr(0, 4) + "-" + str.substr(4, 4) + "-" + str.substr(8, 4);
  else if(len <= 16) return str.substr(0, 4) + "-" + str.substr(4, 4) + "-" + str.substr(8, 4) + "-" + str.substr(12, 4);
}


function SetNextFocus(thisobj, nextobj, len)
{
  if(thisobj.value.length == len) nextobj.focus();
}


function setClass(obj, stylename)
{
    obj.className = stylename;
}

function getObject(oname)
{
  return document.getElementById(oname);
}

function srhObject(obj, srhid)
{
  if(obj.id == srhid) return obj;
  else if(obj == document.body) return document.body;

  srhObject(obj.parentNode, srhid);
}

function getXY(Obj)
{
/*
  var sumTop = 0;
  var sumLeft = 0;
  for (;Obj!=document.body;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.parentNode) alert(Obj.tagName + ": " + sumLeft + "," + sumTop);
*/
  for (var sumTop=0,sumLeft=0;Obj!=document.body;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent) {
    if(Obj.tagName == "HTML") break;
  }
  return {left:sumLeft,top:sumTop}
}

function showFlash(url,w,h,id,bg,vars,win){
  // ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
  var flashStr=
  "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
  "<param name='allowScriptAccess' value='always' />"+
  "<param name='movie' value='"+url+"' />"+
  "<param name='FlashVars' value='"+vars+"' />"+
  "<param name='wmode' value='"+win+"' />"+
  "<param name='menu' value='false' />"+
  "<param name='quality' value='high' />"+
  "<param name='bgcolor' value='"+bg+"' />"+
  "<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
  "</object>";
  // ÇÃ·¡½Ã ÄÚµå Ãâ·Â
  document.write(flashStr);
}

function ShowFlash3(divid, swfpath, fwidth, fheight, extraParam)
{
  //var strFlash = '<object type="application/x-shockwave-flash" data="' + swfpath + '" width="' + fwidth + '" height="' + fheight + '">';
  var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + fwidth + '" height="' + fheight + '">';
  strFlash += '<param name="allowScriptAccess" value="always"/>';
  strFlash += '<param name="quality" value="high"/>';
  strFlash += '<param name="movie" value="' + swfpath + '"/>';
  strFlash += '<param name="wmode" value="opaque">';
  strFlash += '<param name="wmode" value="transparent">';
  strFlash += '<param name="allowFullScreen" value="false"/>';
  if(extraParam) strFlash += extraParam;
  strFlash += '<\/object>';

  divid.innerHTML = strFlash ;
}


function ShowFlash2(divid, swfpath, fwidth, fheight, extraParam)
{
  var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + fwidth + '" height="' + fheight + '">';
  strFlash += '<param name="movie" value="' + swfpath + '">';
  strFlash += '<param name="quality" value="high">';
  strFlash += '<param name=wmode value=transparent>';
  strFlash += '<param name=wmode value=opaque>';
  if(extraParam) strFlash += extraParam;
  strFlash += '<embed src="' + swfpath + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + fwidth + '" height="' + fheight + '"></embed>';
  strFlash += '</object>';

  divid.innerHTML = strFlash ;
}



function IsValidDate(datestr)
{

  var MonthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

  datestr = datestr.trim();

  if (datestr.indexOf("-")!=-1){
    var sdate = datestr.split("-")
  }
  else {
    var sdate = datestr.split("/")
  }


  if(sdate[0].length == 4) {
    //2006-08-22
    if(sdate[1].length != 2 || sdate[2].length != 2) return false;

    var tmpmonth = parseInt(sdate[1] - 1, 10);
    datestr = MonthName[tmpmonth] + " " + parseInt(sdate[2], 10) + ", " + parseInt(sdate[0], 10);
  }
  else {
    //08-22-2006
    if(sdate[0].length != 2 || sdate[1].length != 2) return false;

    var tmpmonth = parseInt(sdate[0] - 1, 10);
    datestr = MonthName[tmpmonth] + " " + parseInt(sdate[1], 10) + ", " + parseInt(sdate[2], 10);
  }

  var chkDate=new Date(Date.parse(datestr));

  var cmpDate="";
  if(isIE(1)) cmpDate = chkDate.getYear()+"-"+ parseInt(chkDate.getMonth()+1, 10)+"-"+(chkDate.getDate());
  else cmpDate = parseInt(1900 + chkDate.getYear())+"-"+ parseInt(chkDate.getMonth()+1, 10)+"-"+(chkDate.getDate());
  var datestr2=(Math.abs(sdate[0]))+"-"+(Math.abs(sdate[1]))+"-"+(Math.abs(sdate[2]))


  if(datestr2 != cmpDate){
    return false;
  }
  else {
    if(cmpDate == "NaN/NaN/NaN"){
      return false;
    }
    else {
      return true;
    }
  }

}

function FillChr(str, fillch, len)
{
  var str2 = String(str);
  var intlen = str2.length;
  if( intlen >= len ) return str;

  for(var i=0; i < len - intlen; i++) {
    str2 = fillch + str2;
  }
  return str2;
}

function GetValidDateFormat(datestr)
{
  if(datestr == "") return datestr;

  if (datestr.indexOf("-")!=-1){
    var sdate = datestr.split("-")
  }
  else {
    var sdate = datestr.split("/")
  }

  if(sdate[0].length == 4) {
    datestr = sdate[0] + "-" + FillChr(parseInt(sdate[1], 10), "0", 2) + "-" + FillChr(parseInt(sdate[2], 10), "0", 2);
  }
  else {
    datestr = sdate[2] + "-" + FillChr(parseInt(sdate[0], 10), "0", 2) + "-" + FillChr(parseInt(sdate[1], 10), "0", 2);
  }
  return datestr;
}


function iframe_reset()
{
  dataobj=document.all? document.all.pagecontent : document.getElementById("pagecontent");
  dataobj0=document.all? parent.document.all.clubmain : parent.document.getElementById("clubmain");


  if(dataobj == null || dataobj0 == null ) return;

  dataobj.style.top=0;
  dataobj.style.left=0;

  pagelength=dataobj.offsetHeight;
  if(pagelength < 650) pagelength = 650;
  dataobj0.height = pagelength+20;
}

function setComboBox(obj, val)
{
  for(var i = 0; i < obj.options.length; i++) {
    if(obj.options[i].value == val) {
      obj.selectedIndex = i;
      break;
    }
  }
}

/* radio °´Ã¼Áß ¼±ÅÃµÈ °´Ã¼ÀÇ index¸¦ return */
function getRadioIdx(obj)
{
  if( obj == undefined )
  {
    return -1;
  }

  //radio Ç×¸ñÀÌ ÇÏ³ª ÀÎ°Ü¿ì,
  if(obj.length == undefined)
  {
    if(obj.checked == true) return 1; //ÇÏ³ª°¡ ¼±ÅÃµÇ¾úÀ¸¸é..
    else return -1; //¼±ÅÃµÇÁö ¾Ê¾ÒÀ¸¸é..
  }

  for(var i=0; i < obj.length; i++)
  {
    if( obj[i].checked == true )
    {
      return i;
    }
  }

  return -1;
}

/* radio °´Ã¼Áß ¼±ÅÃµÈ °´Ã¼ÀÇ value¸¦ return */
function getRadioValue(obj)
{
  if( obj == undefined )
  {
    alert('°´Ã¼°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.');
    return '';
  }

  //radio Ç×¸ñÀÌ ÇÏ³ª ÀÎ°Ü¿ì,
  if(obj.length == undefined)
  {
    if(obj.checked == true) return obj.value; //ÇÏ³ª°¡ ¼±ÅÃµÇ¾úÀ¸¸é..
    else return ''; //¼±ÅÃµÇÁö ¾Ê¾ÒÀ¸¸é..
  }

  for(var i=0; i < obj.length; i++)
  {
    if( obj[i].checked == true )
    {
      return obj[i].value;
    }
  }

  return '';
}

function getCheckedCounter(obj)
{
  if( obj == undefined ) return 0;

  var chkcnt = 0;

  for(var i=0; i < obj.length; i++) {
    if(obj[i].checked) chkcnt++;
  }
  return chkcnt;
}

function CheckFileType(str, exts)
{
  str = str.trim();
  if(str == "") return false;
  str = str.toLowerCase();
  var extpos = str.lastIndexOf(".");
  var ext = str.substring(extpos+1);
  arrExts = exts.split(",");
  for(var i=0; i < arrExts.length; i++) {
    if(ext == arrExts[i].trim()) return true;
  }
  return false;

}


function innerText(htmlStr)
{
  var strRegExp = /<\/?[^>]+>/gi;
  return htmlStr.replace(strRegExp, "");
}

/*¶ó¿îµåÅ×ÀÌºí*/
function roundTableNew(objID)
{
   var obj = document.getElementById(objID);
   var Parent, objTmp, Table, TBody, TR, TD;
   var bdcolor, bgcolor, Space, conttype;
   var trIDX, tdIDX, MAX;
   var styleWidth, styleHeight;

   if(!obj) return;
   var innerHeight = obj.clientHeight;
   var innerWidth = obj.clientWidth;


   // get parent node
   Parent = obj.parentNode;
   objTmp = document.createElement('SPAN');
   Parent.insertBefore(objTmp, obj);
   Parent.removeChild(obj);

   // get attribute
   bdcolor = obj.getAttribute('rborder');
   bgcolor = obj.getAttribute('rbgcolor');
   conttype = obj.getAttribute('conttype');
   radius = parseInt(obj.getAttribute('radius'), 10);
   if (radius == null || radius < 1) radius = 1;
   else if (radius > 6) radius = 6;

   MAX = radius * 2 + 1;


   Table = document.createElement('TABLE');
   TBody = document.createElement('TBODY');

   Table.cellSpacing = 0;
   Table.cellPadding = 0;

   if(conttype == "full") {

     for (trIDX=0; trIDX < MAX/2; trIDX++) {
        TR = document.createElement('TR');
        Space = Math.abs(trIDX - parseInt(radius), 10);
        for (tdIDX=0; tdIDX < MAX; tdIDX++) {
           TD = document.createElement('TD');

           styleWidth = '1px';
           styleHeight = '1px';
           if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
           else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
           else if (radius > 2) {
              if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
              if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
           }


           if (styleWidth != null) TD.style.width = styleWidth;
           if (styleHeight != null) TD.style.height = styleHeight;

           if(trIDX == 0 && (Space == tdIDX || Space == MAX - tdIDX - 1)) TD.style.width = innerWidth - MAX - 1;
           if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
           else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;

           if (Space == 0 && tdIDX == radius) {

           }
           TR.appendChild(TD);
        }
        TBody.appendChild(TR);
     }

     TR = document.createElement('TR');

     TD = document.createElement('TD');
     TD.style.backgroundColor = bdcolor;
     TR.appendChild(TD);

     TD = document.createElement('TD');
     TD.colSpan = MAX - 2;
     obj.style.height = innerHeight - MAX;
     obj.style.width = innerWidth - 2;
     TD.appendChild(obj);
     TR.appendChild(TD);

     TD = document.createElement('TD');
     TD.style.backgroundColor = bdcolor;
     TR.appendChild(TD);

     TBody.appendChild(TR);


     for (; trIDX < MAX; trIDX++) {
        TR = document.createElement('TR');
        Space = Math.abs(trIDX - parseInt(radius), 10);
        for (tdIDX=0; tdIDX < MAX; tdIDX++) {
           TD = document.createElement('TD');

           styleWidth = '1px';
           styleHeight = '1px';
           if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
           else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
           else if (radius > 2) {
              if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
              if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
           }


           if (styleWidth != null) TD.style.width = styleWidth;
           if (styleHeight != null) TD.style.height = styleHeight;

           if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
           else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;

           if (Space == 0 && tdIDX == radius) {
             obj.style.height = innerHeight - MAX - 1;
             obj.style.width = innerWidth - MAX - 1;
             TD.appendChild(obj);
           }
           TR.appendChild(TD);
        }
        TBody.appendChild(TR);
     }
   }
   else {
     for (trIDX=0; trIDX < MAX; trIDX++) {
        TR = document.createElement('TR');
        Space = Math.abs(trIDX - parseInt(radius), 10);
        for (tdIDX=0; tdIDX < MAX; tdIDX++) {
           TD = document.createElement('TD');

           styleWidth = '1px'; styleHeight = '1px';
           if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
           else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
           else if (radius > 2) {
              if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
              if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
           }


           if (styleWidth != null) TD.style.width = styleWidth;
           if (styleHeight != null) TD.style.height = styleHeight;

           if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
           else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;

           if (Space == 0 && tdIDX == radius) {
             obj.style.height = innerHeight - MAX - 1;
             obj.style.width = innerWidth - MAX - 1;
             TD.appendChild(obj);
           }
           TR.appendChild(TD);
        }
        TBody.appendChild(TR);
     }
   }

   Table.appendChild(TBody);

   // insert table and remove original table
   Parent.insertBefore(Table, objTmp);
}

/*¶ó¿îµåÅ×ÀÌºí*/
function roundTable(objID)
{
   var obj = document.getElementById(objID);
   var Parent, objTmp, Table, TBody, TR, TD;
   var bdcolor, bgcolor, Space;
   var trIDX, tdIDX, MAX;
   var styleWidth, styleHeight;

   // get parent node
   Parent = obj.parentNode;
   objTmp = document.createElement('SPAN');
   Parent.insertBefore(objTmp, obj);
   Parent.removeChild(obj);

   // get attribute
   bdcolor = obj.getAttribute('rborder');
   bgcolor = obj.getAttribute('rbgcolor');
   radius = parseInt(obj.getAttribute('radius'), 10);
   if (radius == null || radius < 1) radius = 1;
   else if (radius > 6) radius = 6;

   MAX = radius * 2 + 1;

   /*
          create table {{
   */
   Table = document.createElement('TABLE');
   TBody = document.createElement('TBODY');

   Table.cellSpacing = 0;
   Table.cellPadding = 0;

   for (trIDX=0; trIDX < MAX; trIDX++) {
      TR = document.createElement('TR');
      Space = Math.abs(trIDX - parseInt(radius), 10);
      for (tdIDX=0; tdIDX < MAX; tdIDX++) {
         TD = document.createElement('TD');

         styleWidth = '1px'; styleHeight = '1px';
         if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
         else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
         else if (radius > 2) {
            if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
            if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
         }

         if (styleWidth != null) TD.style.width = styleWidth;
         if (styleHeight != null) TD.style.height = styleHeight;

         if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
         else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;

         if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
         TR.appendChild(TD);
      }
      TBody.appendChild(TR);
   }

   /*
          }}
   */

   Table.appendChild(TBody);

   // insert table and remove original table
   Parent.insertBefore(Table, objTmp);
}




function PlayWAV( divobj, strurl )
{
  var strhtml = "";
  strhtml += "<object id='oMediaPlayer1' width=\"100%\" height=45 classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"\n";
  strhtml += "codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'\n";
  strhtml += "standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>\n";
  strhtml += "<param name=\"Filename\" value=\"" + strurl + "\">\n";
  strhtml += "<param name=\"ShowAudioControls\" value=\"true\">\n";
  strhtml += "<param name=\"ShowPositionControls\" value=\"true\">\n";
  strhtml += "<param name=\"ShowStatusBar\" value=\"false\">\n";
  strhtml += "<param name=\"ShowTracker\" value=\"true\">\n";
  strhtml += "<param name=\"ShowControls\" value=\"true\">\n";
  strhtml += "<param name=\"loop\" value=\"1\">\n";
  strhtml += "<param name=\"AudioStream\" value=\"-1\">\n";
  strhtml += "<param name=\"AutoStart\" value=\"true\">\n";
  strhtml += "<param name=\"AnimationAtStart\" value=\"true\">\n";
  strhtml += "<param name=\"AllowScan\" value=\"true\">\n";
  strhtml += "<param name=\"AllowChangeDisplaySize\" value=\"true\">\n";
  strhtml += "<param name=\"AutoRewind\" value=\"false\">\n";
  strhtml += "<param name=\"Balance\" value=\"0\">\n";
  strhtml += "<param name=\"BufferingTime\" value=\"4\">\n";
  strhtml += "<param name=\"ClickToPlay\" value=\"true\">\n";
  strhtml += "<param name=\"CursorType\" value=\"0\">\n";
  strhtml += "<param name=\"CurrentPosition\" value=\"-1\">\n";
  strhtml += "<param name=\"CurrentMarker\" value=\"0\">\n";
  strhtml += "<param name=\"DisplayBackColor\" value=\"0\">\n";
  strhtml += "<param name=\"DisplayForeColor\" value=\"16777215\">\n";
  strhtml += "<param name=\"DisplayMode\" value=\"0\">\n";
  strhtml += "<param name=\"DisplaySize\" value=\"true\">\n";
  strhtml += "<param name=\"Enabled\" value=\"true\">\n";
  strhtml += "<param name=\"EnableContextMenu\" value=\"false\">\n";
  strhtml += "<param name=\"EnablePositionControls\" value=\"true\">\n";
  strhtml += "<param name=\"EnableFullScreenControls\" value=\"false\">\n";
  strhtml += "<param name=\"EnableTracker\" value=\"true\">\n";
  strhtml += "<param name=\"InvokeURLs\" value=\"true\">\n";
  strhtml += "<param name=\"Language\" value=\"-1\">\n";
  strhtml += "<param name=\"Mute\" value=\"false\">\n";
  strhtml += "<param name=\"PlayCount\" value=\"0\">\n";
  strhtml += "<param name=\"PreviewMode\" value=\"false\">\n";
  strhtml += "<param name=\"Rate\" value=\"1\">\n";
  strhtml += "<param name=\"SelectionStart\" value=\"-1\">\n";
  strhtml += "<param name=\"SelectionEnd\" value=\"-1\">\n";
  strhtml += "<param name=\"SendOpenStateChangeEvents\" value=\"true\">\n";
  strhtml += "<param name=\"SendWarningEvents\" value=\"true\">\n";
  strhtml += "<param name=\"SendErrorEvents\" value=\"true\">\n";
  strhtml += "<param name=\"SendKeyboardEvents\" value=\"false\">\n";
  strhtml += "<param name=\"SendMouseClickEvents\" value=\"true\">\n";
  strhtml += "<param name=\"SendMouseMoveEvents\" value=\"false\">\n";
  strhtml += "<param name=\"SendPlayStateChangeEvents\" value=\"true\">\n";
  strhtml += "<param name=\"ShowCaptioning\" value=\"false\">\n";
  strhtml += "<param name=\"ShowDisplay\" value=\"false\">\n";
  strhtml += "<param name=\"ShowGotoBar\" value=\"false\">\n";
  strhtml += "<param name=\"TransparentAtStart\" value=\"false\">\n";
  strhtml += "<param name=\"VideoBorderWidth\" value=\"0\">\n";
  strhtml += "<param name=\"VideoBorderColor\" value=\"0\">\n";
  strhtml += "<param name=\"VideoBorder3D\" value=\"false\">\n";
  strhtml += "<param name=\"WindowlessVideo\" value=\"false\">\n";
  strhtml += "</OBJECT>\n";

  divobj.innerHTML = strhtml;

}


function isValidRGB(color)
{
  if(IsAlphaNumeric(color) == false) return false;
  for(i=0;i<color.length;i++) {
    ch = color.substring(i, i+1);
    if(ch > 'F') return false;
  }
  return true;
}


function removeRow(oTable, curTr)
{
  for(var i=0; i <= oTable.rows.length; i++) {
    if(oTable.rows[i] == curTr) {
      oTable.rows[i].removeNode(true);
      break;
    }
  }
}

function getCurTrNo(oTable, curTr)
{
  for(var i=0; i <= oTable.rows.length; i++) {
    if(oTable.rows[i] == curTr) {
      return i;
      break;
    }
  }
  return -1;
}

function getCurTr()
{
  if (!e) var e=window.event;
  var S=e.srcElement;
  var curTr=S.parentElement.parentElement;
  return curTr;
}


function addZero(str)
{
  return ((str < 10) ? "0" : "") + str;
}

function getdateformat(year,month,day)
{
  month++;
  var format = "%Y-%m-%d";

  var Y = year;
  var y = year.toString().substr(2,2);
  var m = addZero(month);
  var d = addZero(day);

  format = format.replace(/%Y/g, Y);
  format = format.replace(/%y/g, y);
  format = format.replace(/%m/g, m);
  format = format.replace(/%d/g, d);

  return format;
}

function oneday(startobj, endobj, flag)
{
  var date = new Date;
  var Y = date.getFullYear();
  var m = date.getMonth();
  var d = date.getDate();


  endobj.value = getdateformat(Y, m, d);
  startobj.value = endobj.value;
}

function oneweek(startobj, endobj, flag)
{
  var date = new Date;
  var Y = date.getFullYear();
  var m = date.getMonth();
  var d = date.getDate();

  if(flag == true) {
    endobj.value = getdateformat(Y, m, d);
    startobj.value = relativeDate(endobj.value, -6);
  }
  else {
    startobj.value = getdateformat(Y, m, d);
    endobj.value = relativeDate(startobj.value, 6);
  }
}

function onemonth(startobj, endobj, flag)
{
  var date = new Date;
  var Y = date.getFullYear();
  var m = date.getMonth();
  var d = date.getDate();

  if(flag == true) {
    endobj.value = getdateformat(Y, m, d);
    startobj.value = relativeMonth(endobj.value, -1);
  }
  else {
    startobj.value = getdateformat(Y, m, d);
    endobj.value = relativeMonth(startobj.value, 1);
  }
}

function threemonth(startobj, endobj, flag)
{
  var date = new Date;
  var Y = date.getFullYear();
  var m = date.getMonth();
  var d = date.getDate();

  if(flag == true) {
    endobj.value = getdateformat(Y, m, d);
    startobj.value = relativeMonth(endobj.value, -3);
  }
  else {
    startobj.value = getdateformat(Y, m, d);
    endobj.value = relativeMonth(startobj.value, 3);
  }
}

function alldays(startobj, endobj, chkobj)
{
  if(chkobj) chkobj.value = "Y";
  endobj.value = "";
  startobj.value = "";
}

function fromfirstday(startobj, endobj)
{
  var date = new Date;
  var Y = date.getFullYear();
  var m = date.getMonth();
  var d = date.getDate();


  endobj.value = getdateformat(Y, m, d);
  startobj.value = getdateformat(Y, m, 1);
}



/**
* Function      : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ ³âµµ¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param        : bastDt   - ±âÁØÀÏ
*               : n          - »ó´ëÀû ³âµµ¼ö
* @return       : String     - °è»êµÈ ÀÏÀÚ
*/
function relativeYear(bastDt, n)
{
    return relativeMonth(bastDt, n*12);
}

/**
* Function      : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ °³¿ù¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param        : bastDt   - ±âÁØÀÏ
*               : n          - »ó´ëÀû °³¿ù¼ö
* @return       : String     - °è»êµÈ ÀÏÀÚ
*/


function relativeMonth(bastDt, n)
{
  var oldDate, newLastDate;
  var oDestDate = null;

  //±âÁØÀÏ Å¸ÀÔÀÌ Date °´Ã¼
  if (typeof bastDt == "object") { oDestDate = bastDt; }
  //±âÁØÀÏ Å¸ÀÔÀÌ String °´Ã¼
  else { oDestDate = castDateType( bastDt ); }

  // ÇöÀç ÀÏÀÚ¸¦ ¹é¾÷ÇØ µÎ°í 1ÀÏ·Î ¼¼ÆÃÇÑ ÈÄ »ó´ëÀûÀÎ °³¿ù °è»êÈÄ ´Ù½Ã ÇöÀçÀÏÀÚ¸¦ º¹¿øÇÑ´Ù.
  // ÀÌÀ¯) ±¸ÇÏ´Â »ó´ëÀÏÀÚÀÇ ³â¿ùÀÇ ¸¶Á÷¸· ÀÏÀÚ°¡ ÇöÀçÀÇ ÀÏÀÚº¸´Ù ÀûÀ» °æ¿ì
  //       »ó´ëÀÏÀÚÀÇ ¸¶Áö¸·ÀÏÀÚ·Î ¼¼ÆÃÇØ¾ß ÇÔ
  //       ¿¹> 20050731 ÀÇ ÇÑ´ÞÀüÀ» ÀÏÀÚ´Â 20050631(X) °¡ ¾Æ´Ï°í 20050630 ÀÌ´Ù.
  oldDate = oDestDate.getDate();
  oDestDate.setDate(1);

  //»ó´ëÀûÀÎ °³¿ù °è»ê
  oDestDate.setMonth( oDestDate.getMonth() + n );

  //»ó´ëÀûÀÎ ³â¿ùÀÇ ¸¶Áö¸· ÀÏÀÚ¿Í ÀÌÀü ³â¿ù ÀÏÀÚ¸¦ ºñ±³ÇÑ ÈÄ Å¸´çÇÑ ÀÏÀÚ¸¦ ¼¼ÆÃ
  //¿¹> 20050731 ÀÇ ÇÑ´ÞÀüÀ» ÀÏÀÚ´Â 20050631(X) °¡ ¾Æ´Ï°í 20050630 ÀÌ´Ù.
  var nTmp = oDestDate.getYear().toString();

  if ( nTmp.length == 2 ) { nTmp = "19" + nTmp; }
  else if( nTmp.length == 3) { nTmp = parseInt(nTmp, 10) + 1900;}

  newLastDate = getDaysInMonth( eval(nTmp), oDestDate.getMonth()+1 );
  if(oDestDate.getMonth()+1 == 2) { //2¿ù´Þ¿¡ ´ëÇØ¼­..
    if(oldDate > getDaysInMonth(eval(nTmp), oDestDate.getMonth()+1)) {
      oDestDate.setDate(newLastDate);
    }
    else {
      oDestDate.setDate(oldDate - 1);
    }
  }
  else {
    if ( oldDate > newLastDate ) { oDestDate.setDate(newLastDate); }
    else oDestDate.setDate(oldDate - 1);
  }

  if ( bastDt.length == 6 ) { return castStrType( oDestDate, "yyyyMM" ); }
  else { return castStrType( oDestDate ); }
}

/**
* Function      : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ ÀÏÀÚ¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param        : bastDt   - ±âÁØÀÏ
*               : n          - »ó´ëÀû ÀÏÀÚ¼ö
* @return       : String     - °è»êµÈ ÀÏÀÚ
*/
function relativeDate(bastDt, n)
{
  var oDestDate = null;

  //±âÁØÀÏ Å¸ÀÔÀÌ Date °´Ã¼
  if (typeof bastDt == "object") { oDestDate = bastDt; }
  //±âÁØÀÏ Å¸ÀÔÀÌ String °´Ã¼
  else { oDestDate = castDateType( bastDt ); }

  oDestDate.setDate(oDestDate.getDate() + n);

  return castStrType( oDestDate );
}

/**
* Function      : String Çü½ÄÀ» Date Çü½ÄÀ¸·Î º¯È¯
* @param        : strDate   - String Çü½ÄÀÇ ³¯Â¥.
* @return       : Date      - º¯È¯µÈ Date Çü½ÄÀÇ °´Ã¼
*/
function castDateType( strDate )
{
/*
  if ( !isValidDate( strDate ) )
  {
      dialogError("À¯È¿ÇÑ ÀÏÀÚ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.(¿¹:20058010)");
      return null;
  }
*/
  var dtRtn = null;

  if ( strDate.length == 6 ) { strDate += "01"; }

  //Æ÷¸ËÀ» °¡Áø ÇüÅÂ·Î Àü´ÞµÇ¾úÀ» °æ¿ì. (¿¹ 2005.01.01)
  if ( strDate.length == 10 )
  {
      var aDate = strDate.split( strDate.substring(4, 5) );
      dtRtn = new Date(aDate[0], eval(aDate[1])-1, aDate[2]);
  }
  //Æ÷¸ËÀÌ ¾ø´Â ÇüÅÂ·Î Àü´ÞµÇ¾úÀ» °æ¿ì. (¿¹ 20050101)
  else if (strDate.length == 8 )
  {
      var year = eval(strDate.substring(0, 4));
      var month = eval(strDate.substring(4, 6));
      var date = eval(strDate.substring(6, 8));

      dtRtn = new Date(year, month-1, date);
  }
  else
  {
      throw "ºÎÀûÇÕÇÑ ³¯Â¥ Çü½ÄÀÔ´Ï´Ù.(" + strDate + ")";
  }

  return dtRtn;
}

/**
* Function      : Date Çü½ÄÀ» String Çü½ÄÀ¸·Î º¯È¯
* @param        : dtDate    - Date Çü½ÄÀÇ ³¯Â¥.
*               : delm      - ³¯Â¥ÀÇ Æ÷¸Ë ±¸ºÐÀÚ (¿¹ '.' -> 2005.08.01 )
* @return       : String    - º¯È¯µÈ String Çü½ÄÀÇ °´Ã¼
*/
function castStrType( dtDate, format )
{
  var re = "";
  var delm = "-";

  if ( format == null )  { format = "yyyyMMdd"; }

  for (var i=0; i<format.length; i++)
  {
    var vChr = format.charAt(i);
    if ( vChr != 'y' && vChr != 'M' && vChr != 'd')
    {
      delm = vChr;
      break;
    }
  }

  if      ( delm == "/"     ) { re = eval("/\\" + delm + "/g"); }
  else if ( delm.length != 0) { re = eval("/" + delm + "/g"); }

  format = format.replace(re, "");

  var year = dtDate.getYear().toString();
  if(year.length == 2) year = "19" + dtDate.getYear();
  else if(year.length == 3) year = 1900 + dtDate.getYear();
  var month = dtDate.getMonth()+1;
  var date = dtDate.getDate();

  if (month < 10) { month = "0" + month; }
  if (date < 10) { date = "0" + date; }

  if      ( format == "yyyy"     ) { return year; }
  else if ( format == "yyyyMM"   ) { return year + delm + month; }
  else if ( format == "yyyyMMdd" ) { return year + delm + month + delm + date; }
  else if ( format == "yyyy-MM-dd" ) { return year + delm + month + delm + date; }
}



/**
* Function      : ÇØ´ç¿ùÀÌ ¸îÀÏ±îÁö ÀÖ´ÂÁö °è»êÇÑ´Ù.
*               : 13¿ù 15ÀÏ Ãß°¡.
* @param        : year      - ³âµµ
*               : month     - ¿ù
* @return       : days      - ÀÏ¼ö
*/
function getDaysInMonth(year,month)
{
  var days;
  if (month==1 || month==3 || month==5 || month==7 || month==8 ||
      month==10 || month==12)  days=31;
  else if (month==4 || month==6 || month==9 || month==11) days=30;
  else if (month==2)
  {
    if (leapYear (year)==1)  days=29;
    else days=28;
  }
  else if (month==13) days=15;

  return (days);
}


/**
* Function      : ÇØ´ç³âÀÌ À±³âÀÎÁö °Ë»çÇÑ´Ù.
* @param        : year      - ³âµµ
*               : month     - ¿ù
* @return       : À±³âÀÌ¸é 1, ¾Æ´Ï¸é 0
*/
function leapYear (Year)
{
  if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0))
    return (1);
  else
    return (0);
}


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_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_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 removeAllList(obj)
{
  var listcnt = obj.options.length;
  for(var k=listcnt-1 ; k >= 0; k--) {
    obj.remove(k);
  }
}

function addListItem(obj, val, txt)
{
  var newOpt = new Option(txt, val);
  var selcnt = obj.options.length;

  obj.options[selcnt]=newOpt;
}

