

/**
 * @type : intro
 * @desc : pass_common.js´Â ÇÁ·ÎÁ§Æ® °øÅë
 *
 * ÇÔ¼ö Naming RuleÀº ´ÙÀ½°ú °°´Ù.
 * <pre>
 *     - cf  : common function
 * </pre>
 * @version : 1.0
 * @change  :
 * <pre>
 *     <font color="blue">V1.0</font>
 *     - ÃÖÃÊ¹öÀü.
 * </pre>
 */
/***********************************************************************************************************
 *                                             ³»ºÎ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

var    _intValue = '0123456789';
var    _upperValue = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var    _lowerValue = 'abcdefghijklmnopqrstuvwxyz';
var    _etcValue   = '|\'\"<>\\';
var    _etcValueWFW   = '&|\'\"<>\\';//º¹Áö¿©¼º Æ¯¼ö¹®ÀÚ (2004-09-09 Ãß°¡)
var    dayOfMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var		isModelPopupShow = false;
var   isIOError = false;


/***********************************************************************************************************
 *                                             coMap Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/
function coMap() {
  // fields

  this.names = new Array();
  this.values = new Array();
  this.count = 0;

  // methods
  this.getValue          = coMap_getValue;
  this.put               = coMap_put;
  this.getNameAt         = coMap_getNameAt;
  this.getValueAt        = coMap_getValueAt;
  this.size              = coMap_size;
  this.getMaxNameLength  = coMap_getMaxNameLength;
  this.remove			 = coMap_remove;
  this.removeAt			 = coMap_removeAt;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : name¿¡ ¸Â´Â ÆÄ¶ó¹ÌÅÍ°ªÀ» ¸®ÅÏÇÑ´Ù.
 * @sig    : name
 * @param  : name required mapÀÇ nameÀ¸·Î »ç¿ëÇÒ °ª
 * @return : ÆÄ¶ó¹ÌÅÍ°ª
 */
function coMap_getValue(name) {
  for (var i = 0; i < this.count; i++) {
    if (this.names[i] == name) {
      return this.values[i];
    }
  }

  return null;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : »õ·Î¿î mapÀ» Ãß°¡ÇÑ´Ù. °°Àº name°¡ Á¸ÀçÇÒ °æ¿ì overwriteÇÑ´Ù.
 * @sig    : name, value
 * @param  : name  required mapÀÇ name·Î »ç¿ëÇÒ °ª
 * @param  : value required mapÀÇ value·Î »ç¿ëÇÒ °ª
 * @return : ÆÄ¶ó¹ÌÅÍ°ª
 */
function coMap_put(name, value) {
  for (var i = 0; i < this.count; i++) {
    if (this.names[i] == name) {
      this.values[i] = value;
      return;
    }
  }

  this.names[this.count] = name;
  this.values[this.count++] = value;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : ÁöÁ¤µÈ index¿¡ ÀÖ´Â mapÀÇ nameÀ» ¾Ë·ÁÁØ´Ù.
 * @sig    : index
 * @param  : index - mapÀÇ index
 * @return : name
 */
function coMap_getNameAt(index) {
  return this.names[index];
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : ÁöÁ¤µÈ index¿¡ ÀÖ´Â mapÀÇ value¸¦ ¾Ë·ÁÁØ´Ù.
 * @sig    : index
 * @param  : index required mapÀÇ index
 * @return : value
 */
function coMap_getValueAt(index) {
  return this.values[index];
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : mapÀÇ name-value ½ÖÀÇ °¹¼ö¸¦ ¾Ë·ÁÁØ´Ù.
 * @return : name-value ½ÖÀÇ °¹¼ö
 */
function coMap_size() {
  return this.count;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : map ³»ÀÇ name °ªµéÀ» StringÀ¸·Î È¯»êÇÏ¿© ÃÖ´ë±æÀÌ¸¦ ¾Ë·ÁÁØ´Ù.
 * @return : max name length
 */
function coMap_getMaxNameLength() {
  var maxLength = 0;

  for (var i = 0; i < this.count; i++) {
    if (String(this.names[i]).length > maxLength) {
      maxLength = String(this.names[i]).length;
    }
  }

  return maxLength;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : map ³»ÀÇ name °ª¿¡ ÇØ´çµÇ´Â µ¥ÀÌÅÍ¸¦ Áö¿î´Ù.
 * @return : result value (true/false)
 */
function coMap_remove(name) {
  var check = false;

  for (var i = 0; i < this.count; i++) {
    if (String(this.names[i]) == name) {
      this.names[i] = null;
	  this.values[i] = null;
	  check = true;
	  this.count--;
	  break;
    }
  }

  return check;
}

/**
 * @type   : method
 * @access : public
 * @object : coMap
 * @desc   : map ³»ÀÇ idx °ª¿¡ ÇØ´çµÇ´Â µ¥ÀÌÅÍ¸¦ Áö¿î´Ù.
 * @return : result value (true/false)
 */
function coMap_removeAt(idx) {
  var check = false;

  for(var i = idx;i < this.count; i++) {
	if(i == idx) {
	  this.names[idx] = null;
	  this.values[idx] = null;
	} else {
	  this.names[i-1] = this.names[i];
	  this.values[i-1] = this.values[i];
	}
  }
  this.count--;

  /*if(this.count > idx)
  {
	  this.names[idx] = null;
	  this.values[idx] = null;
	  this.count--;
	  check = true;
  }*/

  return check;
}

/***********************************************************************************************************
 *                                             µðÀÚÀÎ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

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];}
}

/***********************************************************************************************************
 *                                             ³¯Â¥ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**
 * ³»    ¿ë: ÇöÀç ½Ã°£À» ¹®ÀÚ¿­ 14ÀÚ¸®·Î ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetThisTime(); 20050825101010 -> 2005³â 08¿ù 25ÀÏ 10½Ã 10ºÐ 10ÃÊ
 */
function cfGetThisTime()
{
	return new Date().format("YYYYMMDDHHmmss");
}

/**
 * ³»    ¿ë: ÇöÀç ½Ã°£À» ¹®ÀÚ¿­·Î ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: ¼ýÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ÆÄ¶ó¹ÌÅÍ·Î ÀûÀº ¼ýÀÚ¸¸Å­¸¸ ¸®ÅÏÇÑ´Ù.
 * ¿¹    Á¦: cfGetDate(8); --> 20050810 (³â¿ùÀÏ ±îÁö¸¸ ¸®ÅÏ)
 */
function cfGetDate(len)
{
	return cfGetThisTime().substr(0, len);
}

/**
 * ³»    ¿ë: ³¯Â¥¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsDate(2005, 05, 06);
 */
function cfIsDate(y,m,d)
{
	var yy,mm,dd;
	if (!cfIsNumber(y) || !cfIsNumber(m) || !cfIsNumber(d)) return false;

	yy = Number(y, 10);
	mm = Number(m, 10);
	dd = Number(d, 10);

	if (yy < 1000 ) return false;

	if (mm < 1 || mm > 12) return false;
	if (dd < 1) return false;
	if (mm == 1 || mm == 3 || mm == 5 || mm == 7 || mm == 8 || mm==10 || mm==12)
	{
		if (dd > 31) return false;
	}
	else if (mm==2)
	{
		if (cfIsYunNyun(yy))
		{
			if (dd > 29) return false;
		}
		else {
			if (dd > 28) return false;
		}

	}
	else if (dd > 30) return false;
	return true;
}

/**
 * ³»    ¿ë: ³¯Â¥¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsDateString('20050506');
 */
function cfIsDateString(str)
{
	var y,m,d;
	var yy,mm,dd;

	if(cfIsNull(str)) return false;

	if(cfIsNumber(str) == false || str.length < 8) return false;

	y = eval(str.substring(0, 4));
	m = eval(str.substring(4, 6));
	d = eval(str.substring(6, 8));

	if (!cfIsNumber(y) || !cfIsNumber(m) || !cfIsNumber(d)) return false;
	yy = Number(y, 10);
	mm = Number(m, 10);
	dd = Number(d, 10);

	if (yy < 1000 ) return false;

	if (mm < 1 || mm > 12) return false;
	if (dd < 1) return false;
	if (mm == 1 || mm == 3 || mm == 5 || mm == 7 || mm == 8 || mm==10 || mm==12)
	{
		if (dd > 31) return false;
	}
	else if (mm==2)
	{
		if (cfIsYunNyun(yy))
		{
			if (dd > 29) return false;
		}
		else {
			if (dd > 28) return false;
		}

	}
	else if (dd > 30) return false;
	return true;
}

/**
 * ³»    ¿ë: ½Ã°£¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsTimeString('152000');
 */
function cfIsTimeString(str)
{
	var h,m,s;
	var hh,mm,ss;

	if(cfIsNull(str)) return false;

	if(cfIsNumber(str) == false || str.length < 6) return false;

	h = eval(str.substring(0, 2));
	m = eval(str.substring(2, 4));
	s = eval(str.substring(4, 6));

	if (!cfIsNumber(h) || !cfIsNumber(m) || !cfIsNumber(s)) return false;

	hh = Number(h, 10);
	mm = Number(m, 10);
	ss = Number(s, 10);

	if(hh == 24 && mm == 00 && ss == 00) return true;

	if (hh > 23 ) return false;
	if (mm > 59 ) return false;
	if (ss > 59 ) return false;

	return true;
}

/**
 * ³»    ¿ë: ³¯Â¥½Ã°£¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfDateTimeValid(objId);
 */
function cfIsDateTimeValid(obj, msg){
	var str = obj.text.replace(/ /gi,"");
	var smsg = msg;

	// ÃÊ¸¦ Á¦¿ÜÇÑ ½Ã°£ Á¤º¸°¡ ¿ÔÀ»¶§..
	if(str.length == 12) str += "00";

	if(cfIsNull(smsg)) smsg = "½ÃÀÛ½Ã°£";
	smsg = smsg + "ÀÌ Àß¸ø ÀÔ·Â µÇ¾ú½À´Ï´Ù."

	if(cfIsNull(str)) return true; //
	if(cfIsNumber(str) == false || str.length < 14)
	{
		alert(smsg);
		obj.SelectAll = true;
		obj.Focus();
		return false;
	}

	var rsDate = cfIsDateString(str.substring(0,8));
	var rsTime = cfIsTimeString(str.substring(8,14))

	if(!rsDate)
	{
		alert(smsg);
		obj.SelectAll = true;
		obj.Focus();
		return false;
	}

	if(!rsTime)
	{
		alert(smsg);
		obj.SelectAll = true;
		obj.Focus();
		return false;
	}

	return true;
}

/**
 * ³»    ¿ë: ³¯Â¥ ¼ø¼­ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfCheckDateOrder('20050101','20051231');
 */
function cfCheckDateOrder(strDate1, strDate2)
{
	var sdt = Number(parseFloat(strDate1, 10), 10);
	var edt = parseFloat(parseFloat(strDate2, 10), 10);

	if (sdt > edt)
	{
		return false;
	}
	else
  {
	  return true;
  }
}

/**
 * ³»    ¿ë: OnBlur·Î ÇØ´ç ³¯Â¥ÀÇ from, to ³¯Â¥ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: onblur='cfCheckFromToDate(obj)';
 */
function cfCheckFromToDate(obj)
{
	if(obj.Text)
	{
		var id = obj.id;
		if(id.length > 2 && id.substring(0, 2) == 'to')
		{
			var fromObj = document.all['from' + id.substring(2)];
			if(fromObj && !cfCheckDateOrder(fromObj.Text, obj.Text))
			{
				alert('Á¾·áÀÏÀÌ ½ÃÀÛÀÏº¸´Ù ÀÛ½À´Ï´Ù.');
				obj.Text = fromObj.Text;
				fromObj.Focus();
				fromObj.SelectAll = true;
				return;
			}
		}else if(id.length > 4 && id.substring(0, 4) == 'from')
		{
			var toObj = document.all['to' + id.substring(4)];
			if(toObj && !cfCheckDateOrder(obj.Text, toObj.Text))
			{
				alert('½ÃÀÛÀÏÀÌ Á¾·áÀÏº¸´Ù Å®´Ï´Ù.');
				obj.Text = toObj.Text;
				obj.Focus();
				obj.SelectAll = true;
				return;
			}
		}
	}else
	{
		var id = obj.id;
		if(id.length > 2 && id.substring(0, 2) == 'to')
		{
			var fromObj = document.all['from' + id.substring(2)];

			if(fromObj && !cfCheckDateOrder(cfRemoveEtcChar(fromObj.value,'-'), cfRemoveEtcChar(obj.value,'-')))
			{
				alert('Á¾·áÀÏÀÌ ½ÃÀÛÀÏº¸´Ù ÀÛ½À´Ï´Ù.');
				obj.value = fromObj.value;
				fromObj.focus();
				return;
			}
		}else if(id.length > 4 && id.substring(0, 4) == 'from')
		{
			var toObj = document.all['to' + id.substring(4)];
			if(toObj && !cfCheckDateOrder(cfRemoveEtcChar(obj.value,'-'), cfRemoveEtcChar(toObj.value,'-')))
			{
				alert('½ÃÀÛÀÏÀÌ Á¾·áÀÏº¸´Ù Å®´Ï´Ù.');
				obj.value = toObj.value;
				obj.focus();
				return;
			}
		}
	}
}

/**
 * ³»    ¿ë: Á¶È¸½Ã ÇØ´ç ³¯Â¥ÀÇ from, to ³¯Â¥ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfCheckFromToDateSearch(obj)';
 */
function cfCheckFromToDateSearch(obj)
{
	if(obj.Text)
	{
		var id = obj.id;
		if(id.length > 2 && id.substring(0, 2) == 'to')
		{
			var fromObj = document.all['from' + id.substring(2)];
			if(fromObj && !cfCheckDateOrder(fromObj.Text, obj.Text))
			{
				alert('Á¾·áÀÏÀÌ ½ÃÀÛÀÏº¸´Ù ÀÛ½À´Ï´Ù.');
				obj.Text = fromObj.Text;
				fromObj.Focus();
				fromObj.SelectAll = true;
				return false;
			}
		}else if(id.length > 4 && id.substring(0, 4) == 'from')
		{
			var toObj = document.all['to' + id.substring(4)];
			if(toObj && !cfCheckDateOrder(obj.Text, toObj.Text))
			{
				alert('½ÃÀÛÀÏÀÌ Á¾·áÀÏº¸´Ù Å®´Ï´Ù.');
				obj.Text = toObj.Text;
				obj.Focus();
				obj.SelectAll = true;
				return false;
			}
		}
	}else
	{
		var id = obj.id;
		if(id.length > 2 && id.substring(0, 2) == 'to')
		{
			var fromObj = document.all['from' + id.substring(2)];

			if(fromObj && !cfCheckDateOrder(cfRemoveEtcChar(fromObj.value,'-'), cfRemoveEtcChar(obj.value,'-')))
			{
				alert('Á¾·áÀÏÀÌ ½ÃÀÛÀÏº¸´Ù ÀÛ½À´Ï´Ù.');
				obj.value = fromObj.value;
				fromObj.focus();
				return false;
			}
		}else if(id.length > 4 && id.substring(0, 4) == 'from')
		{
			var toObj = document.all['to' + id.substring(4)];
			if(toObj && !cfCheckDateOrder(cfRemoveEtcChar(obj.value,'-'), cfRemoveEtcChar(toObj.value,'-')))
			{
				alert('½ÃÀÛÀÏÀÌ Á¾·áÀÏº¸´Ù Å®´Ï´Ù.');
				obj.value = toObj.value;
				obj.focus();
				return false;
			}
		}
	}
}

/**
 * ³»    ¿ë: ³â¿ù¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsYearMM('200505');
 */
function cfIsYearMM(str)
{
	var y,m;
	var yy,mm;

	if(cfIsNull(str)) return false;

	if(cfIsNumber(str) == false || str.length < 6) return false;

	y = eval(str.substring(0, 4));
	m = eval(str.substring(4, 6));

	if (!cfIsNumber(y) || !cfIsNumber(m)) return false;
	yy = Number(y, 10);
	mm = Number(m, 10);

	if (yy < 1000 ) return false;

	if (mm < 1 || mm > 12) return false;

	return true;
}

/**
 * ³»    ¿ë: À±³â¿©ºÎ¸¦ Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsYunNyun(2005);
 */
function cfIsYunNyun(y)
{
	if ( (y % 4) == 0 )
	{
		if ((y % 100) != 0) return true;
		if ((y % 400) == 0) return true;
	}
	return false;
}

/**
 * ³»    ¿ë: YYYYMMDD Çü½ÄÀÇ StringÀ» Date Object·Î º¯È¯
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: Date
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetDateObject("20031223");
 * ÁÖÀÇ»çÇ×: ³âµµ´Â 4ÀÚ¸®·Î Ç¥½Ã, ÇÑÀÚ¸® ´ÞÀÇ °æ¿ì ¾Õ¿¡ 0À» ºÙÀÌÁö ¸»°Í
 */
function cfGetDateObject(dateStr) {
  var dateObj = new Date();

  dateObj.setFullYear( Number(dateStr.substr(0,4),10),
                     Number(dateStr.substr(4,2),10)-1,
                     Number(dateStr.substr(6,2),10) );
  return dateObj;
}

/**
 * ³»    ¿ë: YYYYMMDDHHMMSS Çü½ÄÀÇ StringÀ» Date Object·Î º¯È¯
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: Date
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetDateObject("20031223102011");
 * ÁÖÀÇ»çÇ×: ³âµµ´Â 4ÀÚ¸®·Î Ç¥½Ã, ÇÑÀÚ¸® ´ÞÀÇ °æ¿ì ¾Õ¿¡ 0À» ºÙÀÌÁö ¸»°Í
 */
function cfGetDateObject_1(dateStr) {
  var dateObj = new Date(Number(dateStr.substring(0,4),10),
	  Number(dateStr.substring(4,6),10) - 1,
	  Number(dateStr.substring(6,8),10) ,
	  Number(dateStr.substring(8,10),10),
	  Number(dateStr.substring(10,12),10),
	  Number(dateStr.substring(12,14),10));
  return dateObj;
}

 /**
 * ³»    ¿ë: Date Object¸¦ YYYYMMDD Çü½ÄÀÇ StringÀ¸·Î º¯È¯ÇÏ¿© ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: Date
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetDateString(dateObj);
 */
function cfGetDateString(dateObj) {
  var year, mon, day;

  year = dateObj.getFullYear().toString();
  mon = (dateObj.getMonth() + 1).toString();
  day = dateObj.getDate().toString();

  if (mon.length == 1) mon = '0'+mon;
  if (day.length == 1) day = '0'+day;

  return year+mon+day;
}

/**
 * ³»    ¿ë: ¿À´Ã ³¯Â¥¿¡¼­ moveDay ³¯Â¥¸¸Å­ ÀÌµ¿ÇÑ ³¯Â¥¸¦ ¸®ÅÏÇÑ´Ù. À½¼ö´Â ÀÌÀü ¾ç¼ö´Â ÀÌÈÄ
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfMoveDay("20031225", 5);
 */
function cfMoveDay(date, days) {
  if ( days == '0') return date;
//  date = cfStringDateToNum(date);
    if (date == "") return "";
    var dateObj = cfGetDateObject(date);

  dateObj.setDate(dateObj.getDate()+ Number(days,10));

  return cfGetDateString(dateObj);
}

/**
 * ³»    ¿ë: µÎ ³¯Â¥ °£ÀÇ Â÷ÀÌ¸¦ ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: µÚÀÇ ³¯Â¥¿¡¼­ ¾ÕÀÇ ³¯Â¥¸¦ »«´Ù.
 * ¿¹    Á¦: cfGetDaysGap("2003-12-25", "2005-10-10");
 */
function cfGetDaysGap(dateStr1, dateStr2) {

	var date1 = cfGetDateObject(cfReplace(dateStr1,"-",""));
	var date2 = cfGetDateObject(cfReplace(dateStr2,"-",""));

	return (date2 - date1) / (1000*60*60*24);
}

/**
 * ³»    ¿ë: ¹®ÀÚ º¯È¯
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×:
 * ¿¹    Á¦: cfReplace("2003-12-25", "-", "");
 */
function cfReplace(str, original, replacement)
{
	var result;
	result = "";
	while(str.indexOf(original) != -1) {
		if (str.indexOf(original) > 0)
		result = result + str.substring(0, str.indexOf(original)) + replacement;
	else
		result = result + replacement;
		str = str.substring(str.indexOf(original) + original.length, str.length);
	}
	return result + str;
}

/**
 * ³»    ¿ë: µÎ ³¯Â¥ °£ÀÇ Â÷ÀÌ¸¦ ¿ù´ÜÀ§·Î ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: µÚÀÇ ³¯Â¥¿¡¼­ ¾ÕÀÇ ³¯Â¥¸¦ »«´Ù.
 * ¿¹    Á¦: cfGetMonthsGap("2005-10", "2006-03");
 */
function cfGetMonthsGap(dateStr1, dateStr2) {
  var y1 = Number(dateStr1.substring(0,4)); // 2005
  var m1 = Number(dateStr1.substring(5,7)); // 10
  var y2 = Number(dateStr2.substring(0,4)); // 2006
  var m2 = Number(dateStr2.substring(5,7)); // 03

  var yGap1 = y2 - y1;  // 2006 - 2005 = 1
  var mGap1 = (m2 + (12 * yGap1)) - m1; // (3 + (12 * 1)) - 10 + 1 = 6

  return mGap1;
}

/**
 * ³»    ¿ë: ¿À´Ã ³¯Â¥¿¡¼­ moveDay ³¯Â¥¸¸Å­ ÀÌµ¿ÇÑ ³¯Â¥¸¦ ¸®ÅÏÇÑ´Ù. À½¼ö´Â ÀÌÀü ¾ç¼ö´Â ÀÌÈÄ
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfMoveMinutes("20031225101010", 5);
 */
function cfMoveMinutes(date, min) {
	if ( min == '0') return date;
    if (date == "") return "";

    var dateObj = cfGetDateObject_1(date);

	var aa  = dateObj.getMinutes() + Number(min,10);;
	dateObj.setMinutes(aa);

	var year, mon, day, h, m, s;

	year	= dateObj.getFullYear().toString();
	mon		= (dateObj.getMonth() + 1).toString();
	day		= dateObj.getDate().toString();
	h		= dateObj.getHours().toString();
	m		= dateObj.getMinutes().toString();
	s		= dateObj.getSeconds().toString();

	if (mon.length == 1) mon = '0'+mon;
	if (day.length == 1) day = '0'+day;
	if (h.length == 1) h = '0'+h;
	if (m.length == 1) m = '0'+m;
	if (s.length == 1) s = '0'+s;

	return year+mon+day+h+m+s;
}

/**
 * ³»    ¿ë: ÇØ´ç³â¿ùÀÇ ¸¶Áö¸· ³¯Â¥¸¦ ¾ò´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¼ýÀÚ
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfLastDay(2005, 5);
 * ÁÖÀÇ»çÇ×: ³âµµ´Â 4ÀÚ¸®·Î Ç¥½Ã, ÇÑÀÚ¸® ´ÞÀÇ °æ¿ì ¾Õ¿¡ 0À» ºÙÀÌÁö ¸»°Í
 */
function cfLastDay(calyear,calmonth)
{

    if (((calyear %4 == 0) && (calyear % 100 != 0))||(calyear % 400 == 0))
        dayOfMonth[1] = 29;
    else
        dayOfMonth[1] = 28;
    var nDays = dayOfMonth[calmonth-1];
    return nDays;
}

/**
 * ³»    ¿ë: ³¯Â¥ null & µÎ ³¯Â¥ °£ÀÇ Â÷ÀÌ Ã¼Å©
 *			 from~to ÇüÅÂÀÇ ³¯Â¥¸¸ ÇØ´ç
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ, ¹®ÀÚ, ¼ýÀÚ
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: µÚÀÇ ³¯Â¥¿¡¼­ ¾ÕÀÇ ³¯Â¥¸¦ »«´Ù.
 * ¿¹    Á¦: cfDateValidChk(fromMbrStorCmplDt, toMbrStorCmplDt, 'ÀÔ°íÀÏÀÚ','30')
 */
function cfDateValidChk(fromDt, toDt, msg, gap)
{
	if(cfAllTrim(fromDt.value) == '')
	{
		alert(msg+'¸¦ Àû¾î ÁÖ½Ê½Ã¿ä.');
		fromDt.focus();
		return false;
	}

	if(cfAllTrim(toDt.value) == '')
	{
		alert(msg+'¸¦ Àû¾î ÁÖ½Ê½Ã¿ä.');
		toDt.focus();
		return false;
	}

	if(cfIsNull(gap)) gap = '30'; // default 30ÀÏ

	if(!cfGetDateGapCheck(fromDt, toDt, gap))
	{
		alert(msg+'ÀÇ ¹üÀ§¸¦ '+gap+'ÀÏ ÀÌ³»·Î ÇÏ½Ê½Ã¿ä.');
		fromDt.focus();
		return false;
	}

	return true;
}

/**
 * ³»    ¿ë: µÎ ³¯Â¥ °£ÀÇ Â÷ÀÌ¸¦ ±¸ÇÑ ÈÄ ÁöÁ¤µÈ ³¯ ¼ö º¸´Ù Å«Áö ÀÛÀºÁö Ã¼Å©
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ, ¼ýÀÚ
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: µÚÀÇ ³¯Â¥¿¡¼­ ¾ÕÀÇ ³¯Â¥¸¦ »«´Ù.
 * ¿¹    Á¦: cfGetDateGapCheck(fromDate, toDate, '50);
 */
function cfGetDateGapCheck(fromDt, toDt, gap)
{
	if(cfIsNull(gap)) gap = '30'; // default 30ÀÏ

	var result = cfGetDaysGap(fromDt.value, toDt.value);

	if(eval(result) > eval(gap))
	{
		return false;
	}

	return true;
}

/***********************************************************************************************************
 *                                             À¯È¿¼º Ã¼Å© Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**
 * ³»    ¿ë: ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ¼ýÀÚÀÎÁö¸¦ °Ë»çÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: strTarget   - ÆÇ´ÜÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­ °´Ã¼
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsNumber('123');  cfIsNumber('-111,123', '-,');
 */
function cfIsNumber(strTarget, s1)
{
	for(iIndex = 0; iIndex < strTarget.length; iIndex++)
	{
		if(strTarget.charAt(iIndex) < '0' || strTarget.charAt(iIndex) > '9') {
			if(typeof(s1) != 'undefined')
			{
				var check = false;
				for(j = 0; j < s1.length; j++)
				{
					if(check == false && s1.charAt(j) == strTarget.charAt(iIndex))
						check = true;
				}

				if(check == false)
				{
					return false;
				}
			}else
			{
				return false;
			}
		}
	}

	return true;
}

/**
 * ³»    ¿ë: ½Ç¼ö,Á¤¼ö,±Ý¾× À¯È¿¼º Ã¼Å© ¹× Çã¿ëÇÏÁö ¾Ê´Â ¹®ÀÚ´Â °æ°í ¾øÀÌ ÀÚµ¿ »èÁ¦
 * ÆÄ¶ó¹ÌÅÍ: obj(ÀÔ·Â ÄÁÆ®·Ñ¸í), cmd(¼ýÀÚ À¯Çü)
 * ¸® ÅÏ °ª: ¾øÀ½
 * ¿¹    Á¦: <input name="num1" type="text"  onkeyup= "cfIsNumberOnly(this, 'money')"  ...>
 */
function cfIsNumberOnly(obj, cmd) {
    var instr = obj.value;
    var cstr = "";
    var tempstr = "";

    if(cmd == "real") {
        cstr = "0123456789.-";          //½Ç¼ö
    } else if(cmd == "real2") {
        cstr = "0123456789.";          //¾çÀÇ½Ç¼ö
    } else if(cmd=="int"){
        cstr="0123456789-";             //Á¤¼ö
    } else if(cmd=="money"){
        cstr="0123456789,";            //±Ý¾×
    } else if(cmd == "real3"){
        cstr = "0123456789.-,";          //½Ç¼ö : , Æ÷ÇÔ
	}else if(cmd=='numeric'){
        cstr = "0123456789";          //¼ýÀÚ
	}

	//°Å²Ù·Î µ¹·Á¾ß ÇÔ
    if(instr.length) {
		var len = instr.length;
        for(var i=len-1; i>=0; i--) {
            if(cstr.lastIndexOf(instr.charAt(i)) == -1) {
				instr = instr.substring(0, i)+ instr.substring(i+1);
                obj.value = instr;
            }
        }
    }
}

/**
 * ³»    ¿ë: ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ÇÑ±ÛÀÎÁö¸¦ °Ë»çÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: s   - ÆÇ´ÜÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­ °´Ã¼
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsKor('ÇÑ±Û');
 */
function cfIsKor(s)
{
	s = s.trim().toUpperCase();
	for (var i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if (!('A' <= c && c >= 'Z'))
			if (!('0' <= c && c <= '9'))
				if (!((c == ':') || (c == ';') || (c == ',') || (c == 32) || (c == '-') || (c == '.') || (c == '_')
						|| (c == '/') || (c == ')') || (c == '(')))
					return false;
	}
	return true;
}

/**
 * ³»    ¿ë: ÁÖ¾îÁø °ªÀÌ ³ÎÀÎÁö Ã¼Å©ÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: obj   - ÆÇ´ÜÇÏ°íÀÚ ÇÏ´Â °´Ã¼
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsKor('ÇÑ±Û');
 */
function cfIsNull(obj)
{
	if(typeof(obj) == 'undefined' || obj == null || obj == '')
	{
		return true;
	}else
	{
		return false;
	}
}

/**
 * ³»    ¿ë: value°ªÀÌ str¹®ÀÚ¿­¿¡ ¸ðµÎ Æ÷ÇÔµÇ´ÂÁö Ã¼Å©ÇÏ´Â ÇÔ¼ö.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsIncludeString('ABC', 'AAA') ;
 */
function cfIsIncludeString(str, value)
{
    var i, j;
	var check = true;

	for(i = 0; i < value.length ; i++)
	{
		var c = String(value.charAt(i));
		if(check == true && str.indexOf(c) < 0)
		{
			return false;
		}
	}
    return true;
}


/**
 * ³»    ¿ë: ¿µ¹® ´ë¹®ÀÚÀÎÁö¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsUpperString('AA') ;
 */
function cfIsUpperString(value) {
	return cfIsIncludeString(_upperValue, value);
}

/**
 * ³»    ¿ë: ¿µ¹® ¼Ò¹®ÀÚÀÎÁö¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsUpperString('AA') ;
 */
function cfIsLowerString(value) {
	return cfIsIncludeString(_lowerValue, value);
}

/**
 * ³»    ¿ë: type¿¡ ÇØ´çµÇ´Â Çü½ÄÀÌ ¸Â´ÂÁö Ã¼Å©ÇÏ´Â ÇÔ¼ö.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsTypeString('kor', value);
 */
function cfIsTypeString(typeName, value) {
	if(value == null) return false;

	if(typeName == 'upper')
	{
		return cfIsIncludeString(_upperValue, value);
	}else if(typeName == 'lower')
	{
		return cfIsIncludeString(_lowerValue, value);
	}else if(typeName == 'etc')
	{
		return cfIsIncludeString(_etcValue, value);
	}else if(typeName == 'etcWFW')
	{
		return cfIsIncludeString(_etcValueWFW, value);
	}else if(typeName == 'kor')
	{
		return cfIsKor(value);
	}else if(typeName == 'eng')
	{
		return cfIsIncludeString(_lowerValue + _upperValue, value);
	}else if(typeName == 'num')
	{
		return cfIsNumber(value);
	}else if(typeName == 'money')
	{
		return cfIsNumber(value, '-,');
	}else if(typeName == 'date')
	{
		if(value.length == 8)
			return cfIsDate(value.substring(0, 4), value.substring(4, 6), value.substring(6, 8));
		else
			return false;
	}else if(typeName == 'numEng')
	{
		return cfIsIncludeString(_intValue + _lowerValue + _upperValue, value);
	}else
	{
		alert('typeName¿¡ ÇØ´çµÇ´Â Á¾·ù°¡ ¾ø½À´Ï´Ù. ' + typeName);
		return false;
	}
}

/**
 * ³»    ¿ë: ÁÖ¹Îµî·Ï¹øÈ£°¡ À¯È¿ÇÑÁö °Ë»çÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: front ÁÖ¹Îµî·Ï¹øÈ£ ¾Õ 6ÀÚ¸®
 *				back ÁÖ¹Îµî·Ï¹øÈ£ µÚ 7ÀÚ¸®
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: isSSN('111111', '11111118');
 */
function isSSN(front, back) {
	var birthday = front;
	var num = back;

	if(birthday.length != 6) {
		return false;
	}
	if(num.length != 7) {
		return false;
	}
	var hap = 0;
	for(var i=0; i < 6; i++) {
		var temp = birthday.charAt(i) * (i+2);
		hap += temp;
	}

	var n1 = num.charAt(0);
	var n2 = num.charAt(1);
	var n3 = num.charAt(2);
	var n4 = num.charAt(3);
	var n5 = num.charAt(4);
	var n6 = num.charAt(5);
	var n7 = num.charAt(6);

	hap += n1*8+n2*9+n3*2+n4*3+n5*4+n6*5;
	hap %= 11;
	hap = 11 - hap;
	hap %= 10;
	if(hap != n7)
		return false;
	return true;
}

/**
 * ³»    ¿ë: ÀüÈ­¹øÈ£°¡ À¯È¿ÇÑÁö °Ë»çÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: telno ÀüÈ­¹øÈ£
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfIsValidTelNo("011-333-5555");
 */
function cfIsValidTelNo(phonNo)
{
	var telno = new Array("", "", "");

	if(phonNo == "") return;
	if(phonNo == "--") phonNo = "";

	telno = phonNo.split("-");

	if(telno.length != 3)
	{
		alert("ÀüÈ­¹øÈ£ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù.");
		return false;
	}
	else
	{
		if( telno[0].length > 3)
		{
			alert("Áö¿ª¹øÈ£´Â 3ÀÚ¸® ÀÌÇÏ·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
			return false;
		}

		if(telno[1].length < 3)
		{
			alert("±¹¹øÀº 3ÀÚ¸® ÀÌ»óÀ¸·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
			return false;
		}

		if(telno[2].length < 4)
		{
			alert("¹øÈ£´Â 4ÀÚ¸®·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
			return false;
		}

		return;
	}
}

/**
 * ³»    ¿ë: »ç¾÷ÀÚµî·Ï¹øÈ£°¡ À¯È¿ÇÑÁö °Ë»çÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: »ç¾÷ÀÚµî·Ï¹øÈ£
 * ¸® ÅÏ °ª: boolean
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: isCSN('2141244444');
 */
function isCSN(vencod)
{
  var nVencod = cfCharTrim(vencod)
	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] = nVencod.substring(i, i+1); }
	for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
	sum = sum + Number((getlist[8]*5)/10);
	sidliy = sum % 10;
	sidchk = 0;
	if(sidliy != 0) { sidchk = 10 - sidliy; }
	else { sidchk = 0; }
	if(sidchk != getlist[9]) { return false; }
	return true;
}

/**
 * ³»    ¿ë: °øÅëÆË¾÷ÀÇ Á¤»ó°ª Ã¼Å© ¿©ºÎ È®ÀÎ
 * ÆÄ¶ó¹ÌÅÍ: obj   - Ã¼Å©ÇÏ´Â °´Ã¼
 * ¸® ÅÏ °ª: ¾øÀ½
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfCheckSearchData(obj)
 */
function cfCheckSearchData(obj)
{
	if(isModelPopupShow == true) return;
  if(obj.value != '')
  {
    var isSearch = false;
    if(obj.orgValue)
    {
      if(obj.Text)
      {
        if(obj.Text != '' && obj.Text != obj.orgValue)
        {
          isSearch = true;
        }
      }else
      {
        if(obj.value != obj.orgValue)
        {
          isSearch = true;
        }
      }
    }else
    {
      isSearch = true;
    }

    if(isSearch == true)
    {
      if(typeof(callback_search_popup) != 'undefined')
      {
        callback_search_popup(obj);
      }
    }
  }
}

/***********************************************************************************************************
 *                                             ¹®ÀÚ¿­ Á¶ÀÛ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**
 * ³»    ¿ë: ¹®ÀÚ¿­ ÁÂÃø°ø¹éÁ¦°Å
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfLTrim(str) ;
 */
function cfLTrim(str)
{
    while(str.substring(0,1) == ' ')
        str = str.substring(1, str.length);
    return str;
}

/**
 * ³»    ¿ë: ¹®ÀÚ¿­ Áß°£°ø¹éÁ¦°Å
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfMTrim(str) ;
 */
function cfMTrim(str)
{
    for ( i=0; i < str.length;)
        if (str.substring(i,i+1) == ' ' )
                str = str.substring(0,i) + str.substring(i+1,str.length);
        else
                i++;
        return str;
}

/**
 * ³»    ¿ë: ¹®ÀÚ¿­ ¿ìÃø°ø¹éÁ¦°Å
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfRTrim(str) ;
 */
function cfRTrim(str)
{
    while(str.substring(str.length-1,str.length) == ' ')
        str = str.substring(0, str.length-1);
    return str;
}

/**
 * ³»    ¿ë: °ø¹é¹®ÀÚ¸¦ Á¦¿ÜÇÑ ¹®ÀÚ¿­À» ¸®ÅÏÇÏ´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfAllTrim(str) ;
 */
function cfAllTrim( arg_str )
{
	var rtn_str = "";
	var i=0;
	while( arg_str.charAt(i) != "" ) {
		if( arg_str.charAt(i)!=' ') {
			rtn_str += arg_str.charAt(i);
		}
		i++;
	}
	return rtn_str;
}

/**
 * ³»    ¿ë: ¾ÕµÚ °ø¹é¹®ÀÚ¸¦ Á¦¿ÜÇÑ ¹®ÀÚ¿­À» ¸®ÅÏÇÏ´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfTrim(str) ;
 */
function cfTrim(pm_sStr){
   return pm_sStr.replace(/^\s+|\s+$/g, '');
}

/**
 * ³»    ¿ë: ¼ýÀÚ¿Í ¹®ÀÚ¿­ÀÌ È¥ÇÕµÇ¾î ÀÖ´Â °Í¿¡¼­ ¼ýÀÚ¸¸ ¸®ÅÏ
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfCharTrim('1134sd3dkk8') ;
 */
function cfCharTrim(str) {
	var strNew = "";
    var chkstr = "0123456789";
    for (var i = 0; i < str.length; i++) {
        if (chkstr.indexOf(str.substring(i, i + 1)) >= 0) {
            strNew += str.substring(i, i + 1);
        }
    }
    return strNew;
}

/**
 * ³»    ¿ë: Æ¯¼ö¹®ÀÚ¸¦ Á¦°ÅÇÏ´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfRemoveEtcChar('50%', '-%*') ;
 */
function cfRemoveEtcChar(str, sep)
{

	if(str.length == 0) return '';

	var str = str;
	var str_len = str.length;
	var sep_len = sep.length;

	if(sep_len == 0) return '';

	for(var i=str_len-1; i >= 0 ; i--){//°Å²Ù·Î ·çÇÎ
		for(var j=0; j<sep_len; j++){
			if(str.charAt(i) == sep.charAt(j)){
				str = str.substring(0, i) + str.substring(i+1);
			}
		}

	}

	return str;
}

/**
 * ³»    ¿ë: iTotalSizeÀÇ ±æÀÌ¸¸Å­ strTextÀÇ ¾Õ¿¡ cSpace¹®ÀÚ¿­À» ºÙÀÎ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: strText - ¹®ÀÚ¿­
 *			cSpace - ºÙÀÏ ¹®ÀÚ
 *			iTotalSize - ÃÖ´ë ±æÀÌ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfFixTextSize('aaa', '0', 10); -> '0000000aaa'
 */
function cfFixTextSize(strText, cSpace, iTotalSize)
{
	var s = '';
	var st = String(strText);
	if(cfIsNull(st)) return '';

	for(var i = st.length ; i < iTotalSize; )
	{
		st = cSpace + st;

		i = i + cSpace.length;
	}

	s = String(st);

	return s;
}


/**
 * ³»    ¿ë:
 * ÆÄ¶ó¹ÌÅÍ: strText - ÀüÈ­¹øÈ£ ¹®ÀÚ¿­
 * ¸® ÅÏ °ª: Array 3
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetTelNoArray('02-111-2344'); -> [0]:02,[1]:111,[2]:2344
 */
function cfGetTelNoArray(strText)
{
	var telNos = new Array('', '', '');
	if(cfIsNull(strText)) return telNos;

	telNos = strText.split('-');

	if(telNos.length == 3)
	{
	}else if(telNos.length == 2)
	{
		telNos[2] = telNos[1];
		telNos[1] = telNos[0];
		telNos[0] = '';
	}else if(telNos.length == 1)
	{
		telNos[2] = telNos[1];
		telNos[1] = '';
		telNos[0] = '';
	}else
	{
		telNos[2] = strText;
		telNos[1] = '';
		telNos[0] = '';
	}

	return telNos;
}

/**
 * ³»    ¿ë: Á¤±Ô½Ä¿¡ ÇØ´çµÇ´Â ¹®ÀÚ¿­À» ¹è¿­·Î ¸®ÅÏ (splitÀº Ã£Àº ³»¿ëÀ» ±âÁØÀ¸·Î ºÐÇÒµÇ¼­ ¸®ÅÏÇÏÁö¸¸ ÀÌ ¸Þ¼Òµå´Â Ã£Àº ³»¿ëÀ» ¹è¿­·Î ¸®ÅÏ)
 * ÆÄ¶ó¹ÌÅÍ: pattern -> Á¤±Ô½Ä, text -> ¹®ÀÚ¿­
 * ¸® ÅÏ °ª: Array
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfRegExpSplit(pattern, text)
  var ret = cfRegExpSplit(/[=][a-zA-Z*]*[,|)]/, 'SERVLET(O:dsPartIngoLgc=dsPartIngoLgc,I:dsPartIngoLgc=dsPartIngoLgc)');

  for(var i = 0 ; i < ret.length ; i++)
  {
    alert(ret[i]);
  }
 */
function cfRegExpSplit(pattern, text)
{
  var ret = new Array();

  var rxSplit = new RegExp(pattern);
  var pos = text.search(rxSplit);
  var idx = 0;
  while(pos > 0)
  {
    var value = text.match(rxSplit);

    ret[idx] = value;
    text = text.substring(pos + value.length);
    idx++;
    pos = text.search(rxSplit);
  }

  return ret;
}


/***********************************************************************************************************
 *                                             ¼ýÀÚ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**
 * ³»    ¿ë: ¼ýÀÚÀÇ ¼Ò¼ý ÀÚ¸®¸¦ ¹Ý¿Ã¸²ÇØÁÖ´Â ±â´É
 * ÆÄ¶ó¹ÌÅÍ: num   - ¼ýÀÚ
 *          point  - ¹Ý¿Ã¸²ÇÒ ¼Ò¼ö ÀÚ¸®¼öÀÇ À§Ä¡
 * ¸® ÅÏ °ª: ¼ýÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfRound(100.106, 1);
 */
function cfRound(num, point){

	var retNum = "";

	if (point == 1) {
		retNum = Math.round(num);
	} else {
		var sNum = String(num);
		var index = sNum.indexOf(".");
		var num1 = sNum.split(".")[0];
		var num2 = sNum.split(".")[1];

		if (index < 0) {
			retNum = sNum;
		} else {
			if(point > num2.length){
				retNum = num;
			} else {
				var tmpNum = String(Math.round(num1 + num2.substring(0,point-1) + "." + num2.substring(point-1)));
				var result = tmpNum / 10;

				retNum = result;
			}
		}
	}

	retNum = setNumberComma(retNum);

	return retNum;
}

/**
 *  @Description	: ¼ýÀÚ ¼¼ÀÚ¸®¸¶µð ÄÞ¸¶Âï´Â ÇÔ¼ö(Á¤¼öÇü, ¼Ò¼öÁ¡ ±¸ºÐ)
 *  @Input			: num - ¼ýÀÚ
 *  @Output			: º¯È¯ ¼ýÀÚ
 */
function setNumberComma (num)
{
	var convNum = num;

	if (num != "")
	{
		var sNum = String(num);

		var index = sNum.indexOf(".");

		if(index > 0) {
			var num1 = sNum.split(".")[0];
			var num2 = sNum.split(".")[1];
			convNum = setNumberCommaInt(num1) + "." + num2;
		} else {
			var num1 = sNum.split(".")[0];
			convNum = setNumberCommaInt(num1);
		}
	}
	return convNum;
}
/**
 *  @Description	: ¼ýÀÚ ¼¼ÀÚ¸®¸¶µð ÄÞ¸¶Âï´Â ÇÔ¼ö(Á¤¼öÇü)
 *  @Input			: num - ¼ýÀÚ
 *  @Output			: º¯È¯ ¼ýÀÚ
 */
function setNumberCommaInt(iNum) {
	if (iNum != "")
	{
		iNum = new Number(iNum);
		iNum = (new Number(iNum)).toString()

		if (iNum.length < 4)
		{
			return iNum;
		}

		l=iNum.length-3;

		while(l > 0)
		{
			iNum = iNum.substr(0,l)+","+iNum.substr(l);
			l-=3;
		}
	}
	return iNum;
}

/***********************************************************************************************************
 *                                             À©µµ¿ì ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**
 * ³»    ¿ë: ÆË¾÷À©µµ¿ì¸¦ È­¸é Áß¾Ó¿¡ ¶ç¿ì´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfPopup('/popup.jsp', 500, 300) ;
 */
function cfPopup(url, popupwidth, popupheight)
{
	Top = (window.screen.height - popupheight) / 3;
	Left = (window.screen.width - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;

	Future = "directories=no,status=no,menubar=no,	scrollbars=no,resizable=no,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
//	PopUpWindow = window.open(url, "PopUpWindow", Future)'
	PopUpWindow = window.open(url, "", Future);
	PopUpWindow.focus();
}

/**
 * ³»    ¿ë: ¸ð´Þ ÆË¾÷À©µµ¿ì¸¦ È­¸é Áß¾Ó¿¡ ¶ç¿ì´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ(¸ÊÇüÅÂ)
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfModalPopup('/popup.jsp', 500, 300, yes) ;
 */
function cfModalPopup(surl, popupwidth, popupheight, scroll ){
	Top = (window.screen.height - popupheight) / 3;
	Left = (window.screen.width - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;

	if(typeof(scroll) == 'undefined') scroll = 'no';

	future = 'center:yes; help:no; status:no; scroll:' + scroll + '; resizable:no; width:' + popupwidth + 'px;height:'+ popupheight+'px;dialogWidth:' + popupwidth + 'px;dialogHeight:'+ popupheight+'px; dialogTop:'+Top+'; dialogLeft:'+Left+';' ;

	showModalDialog(surl, 'ModalWin', future);
}

/**
 * ³»    ¿ë: ¸ð´Þ ÆË¾÷À©µµ¿ì¸¦ È­¸é Áß¾Ó¿¡ ¶ç¿ì´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ(¸ÊÇüÅÂ)
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfModalPopup('/popup.jsp', 500, 300, yes) ;
 */
function cfModalPopupMap(surl, popupwidth, popupheight, scroll ){
	Top = (window.screen.height - popupheight) / 3;
	Left = (window.screen.width - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;

	if(typeof(scroll) == 'undefined') scroll = 'no';

	future = 'center:yes; help:no; status:no; scroll:' + scroll + '; resizable:no; width:' + popupwidth + 'px;height:'+ popupheight+'px;dialogWidth:' + popupwidth + 'px;dialogHeight:'+ popupheight+'px; dialogTop:'+Top+'; dialogLeft:'+Left+';' ;

	var returnValue = showModalDialog(surl, 'ModalWin', future);

	var retArray = new coMap();

	for(var i = 0 ; returnValue && i < returnValue.length ; i++)
	{
		var cols = returnValue[i].split('=');
		retArray.put(cols[0], cols[1]);
	}

	return retArray;
}

/**
 * ³»    ¿ë: ¸ð´Þ ÆË¾÷À©µµ¿ì¸¦ È­¸é Áß¾Ó¿¡ ¶ç¿ì´Â ÇÔ¼ö
 *			 ¸®ÅÏ½Ã º¹¼ö rowÀÇ µ¥ÀÌÅÍ¸¦ ¸®ÅÏÇÒ ¼ö ÀÖÀ½.
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfModalPopup2('/popup.jsp', 500, 300, yes) ;
 */
function cfModalPopupMultiMap(surl, popupwidth, popupheight, scroll ){
	Top = (window.screen.height - popupheight) / 3;
	Left = (window.screen.width - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;

	if(typeof(scroll) == 'undefined') scroll = 'no';

	future = 'center:yes; help:no; status:no; scroll:' + scroll + '; resizable:no; width:' + popupwidth + 'px;height:'+ popupheight+'px;dialogWidth:' + popupwidth + 'px;dialogHeight:'+ popupheight+'px; dialogTop:'+Top+'; dialogLeft:'+Left+';' ;

	var returnValue = showModalDialog(surl, 'ModalWin', future);

	var rows = new Array();

	for(var j = 0; returnValue && j < returnValue.length; j++)
	{
		var retArray = new coMap();
		var row = returnValue[j];
		for(var i = 0 ; row && i < row.length ; i++)
		{
			var cols = row[i].split('=');
			retArray.put(cols[0], cols[1]);
		}

		rows[j] = retArray;
	}

	return rows;
}

/**
 * ³»    ¿ë: °øÅë °Ë»ö Ã¢À» ¸ð´Þ ÆË¾÷À©µµ¿ì¸¦ È­¸é Áß¾Ó¿¡ ¶ç¿ì´Â ÇÔ¼ö
 * ÆÄ¶ó¹ÌÅÍ: type : °Ë»öÃ¢ Á¾·ù (zipcode:¿ìÆí¹øÈ£ °Ë»ö, cse : ¿£Áö´Ï¾î °Ë»ö)
 *			  params : query¸¦ À§ÇÑ ÆÄ¶ó¹ÌÅÍ
 *			  isShowPopup : ÆË¾÷À» ¹«Á¶°Ç ¶ç¿ï °ÍÀÎÁö °áÁ¤
 * ¸® ÅÏ °ª: coMap (°¢ ¸ÞÀÎ Å×ÀÌºíÀÇ ÄÃ·³ °ªÀ» ³×ÀÌ¹Ö ·ê¿¡ ¸ÂÃç¼­ Å°·Î µÇ¾î ÀÖÀ½.
 * ¿¹) BA_ZIP_CODE(¿ìÆí¹øÈ£ Å×ÀÌºí) GU_CITY_COUN (±¸½Ã±º) coMap¿¡ getValue('guCityCoun') ¸Þ¼Òµå¸¦ È£ÃâÇÏ¸é °á°ú°ª ¸®ÅÏ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦:
 *	var returnValue = cfSearchPopup('zipcode', 'dong=%' + document.all.dong.value + '%');
 *
 *	if( ! cfIsNull(returnValue) && returnValue.size() > 0)
 *	{
 *		alert(returnValue.getValue('postNo'));
 *	}
 */
function cfSearchPopup(type, params, isShowPopup)
{
	var control;
	var url;
	var width = 400;
	var height = 400;
	var optionParam;
	var retValue;

	if(cfIsNull(isShowPopup)) isShowPopup = false;

	if(type == 'zipcode')
	{
		// ÁÖ¼Ò °Ë»ö
		// params¿¡´Â dong : µ¿ ÀÌ µé¾î°¥ ¼ö ÀÖ´Ù.
		classMethod = 'camas.common.svc.control.SeacControl.selectSeacZimnList';
		url = '/common/popup/SeacZimnP.jsp?';
		width = 382;
		height = 415;
		if(cfIsParam(params, 'dong') == false)
		isShowPopup = true;
	}

	var retValue = new coMap();

	if(isShowPopup == true)
	{
		isModelPopupShow = true;
		retValue = cfModalPopup(url + params, width, height);
		isModelPopupShow = false;
	}else
	{
		cafTempDataSet.DataID = '/Common.Seac.gau?mode=dataCount&classMethod=' + classMethod + '&' + params;
		cafTempDataSet.SyncLoad = true;
		cfReset(cafTempDataSet);

		if(cafTempDataSet.CountRow == 1)
		{
			for(var i = 1; i <= cafTempDataSet.CountColumn ; i++)
			{
				var key = cafTempDataSet.ColumnID(i);
				var value = cafTempDataSet.NameValue(1, key);
				retValue.put(key, value);
			}
		}else
		{
			isModelPopupShow = true;
			retValue = cfModalPopup(url + params, width, height);
			isModelPopupShow = false;
		}
	}

	return retValue;
}

/***********************************************************************************************************
 *												ÄíÅ° Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/
/**
 * ³»    ¿ë: ÄíÅ°¿¡ µî·ÏµÈ µ¥ÀÌÅÍ¸¦ Ã£´Â Å°
 * ÆÄ¶ó¹ÌÅÍ: name   - ÄíÅ°¿¡¼­ Ã£´Â Å°
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetCookie ('key');
 */
function cfGetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getcookValue (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

/**
 * ³»    ¿ë: ÄíÅ°¿¡ µ¥ÀÌÅÍ¸¦ µî·Ï
 * ÆÄ¶ó¹ÌÅÍ: name   - ÄíÅ°¿¡¼­ Ã£´Â Å°
 *			value	- ÄíÅ°¿¡ µî·ÏµÈ °ª
 * ¸® ÅÏ °ª: ¾øÀ½
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfSetCookie ('key', 'value');
 */
function cfSetCookie (name, value, expDate) {
	var argv = cfSetCookie .arguments;
	var argc = cfSetCookie .arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

/**
 * ³»    ¿ë: ÄíÅ°¿¡ µî·ÏµÈ µ¥ÀÌÅÍ¸¦ Ã£´Â Å° (³â ´ÜÀ§ ¹öÀü)
 * ÆÄ¶ó¹ÌÅÍ: name   - ÄíÅ°¿¡¼­ Ã£´Â Å°
 * ¸® ÅÏ °ª: ¹®ÀÚ
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetCookie ('key');
 */
function cfGetCookie365(name){
	var client_name = name + "=";
	var set = document.cookie;

	if (set.length > 0) {
		begin = set.indexOf(client_name);
		if (begin != -1) {
			begin += client_name.length;
			end = set.indexOf(";", begin);
			if (end == -1) end = set.length;
			return unescape(set.substring(begin, end));
		}
	}
	return null;
}

/**
 * ³»    ¿ë: ÄíÅ°¿¡ µ¥ÀÌÅÍ¸¦ µî·Ï (³â ´ÜÀ§ ¹öÀü)
 * ÆÄ¶ó¹ÌÅÍ: name   - ÄíÅ°¿¡¼­ Ã£´Â Å°
 *			value	- ÄíÅ°¿¡ µî·ÏµÈ °ª
 * ¸® ÅÏ °ª: ¾øÀ½
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfSetCookie ('key', 'value');
 */
function cfSetCookie365(name, value) {
	var now = new Date();
	var then = new Date(now.getTime() + 31536000000);//ÄíÅ° À¯Áö±â°£À» 365 ÀÏ·Î ÇÕ´Ï´Ù.
	document.cookie = name + "=" + escape(value) + "; expires=" + then.toGMTString() + "; path=/";
}

/**
 * ³»    ¿ë: ÄíÅ°¿¡ µî·ÏµÈ Á¤º¸ »èÁ¦
 * ÆÄ¶ó¹ÌÅÍ: name   - ÄíÅ°¿¡¼­ »èÁ¦ÇÏ°íÀÚ ÇÏ´Â Å°
 * ¸® ÅÏ °ª: ¾øÀ½
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfSetCookie ('key', 'value');
 */
function cfDeleteCookie(name) {
	var exp = new Date();
	FixCookieDate (exp);
	exp.setTime (exp.getTime() - 1);
	var cval = cfGetCokie (name);
	if (cval != null)
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}




/***********************************************************************************************************
 *                                             ±âÅ¸ Ã³¸® ºÎºÐ ½ÃÀÛ
 ***********************************************************************************************************/

/**************************************************************
*  ¼³ ¸í :
*  »ç¿ë¿¹:
*         onKeyPress ÀÌº¥Æ®¿¡ »ç¿ë.
*         onKeyPress ÀÌº¥Æ®½Ã a: 97   z: 122
*         onKeyUp     ÀÌº¥Æ®½Ã a: 65   z:  90
*         onKeyDown  ÀÌº¥Æ®½Ã a: 65   z:  90
***************************************************************/
function toUpperCase(fld)
{
   if((event.keyCode >= 97) && (event.keyCode <= 122))
   {
      if(fld.value.length < fld.getAttribute("maxlength"))

      {
         fld.value += String.fromCharCode(event.keyCode).toUpperCase();
      }
      event.returnValue = false;
   }
}

/**
 * ¹®ÀÚ¿­¿¡ ´ëÇÑ Ã³¸®¸¦ ´ã´çÇÏ´Â ÀÚ¹Ù½ºÅ©¸³Æ® °´Ã¼ <BR>
 *
 * @version	1.0, 2003-12-16
 * @author	donghochoi
 *@constructor
 */
function StringUtil() {
	this.getStrByteSize 	= getStrByteSize_StringUtil;
	this.isNum 				= isNum_StringUtil;
	this.brToReturn 		= brToReturn_StringUtil;
	this.returnToBr 		= returnToBr_StringUtil;
	this.trim 				= trim_StringUtil;
	this.cutString 			= cutString_StringUtil;
	this.isNonSpecial		= isNonSpecial_StringUtil;
	this.replace			= replace_StringUtil;
	this.safeEscape			= safeEscape_StringUtil;
	this.get2Token			= get2Token_StringUtil;
}

/**
 * str Áß Æ¯Á¤ ¹®ÀÚ¿­À» ´ëÃ¼ ¹®ÀÚ¿­·Î ¹Ù²Ù¾î¼­ ¹ÝÈ¯ÇÑ´Ù. <br>
 *
 * @param	str 		¹®ÀÚ¿­
 * @param	original	¹Ù²Ü¹®ÀÚ¿­
 * @param	original	¹Ù²ð¹®ÀÚ¿­
 * @return	´ëÃ¼µÈ ¹®ÀÚ¿­
 */
function replace_StringUtil(str, original, replacement) {
	var result;
	result = "";
	while(str.indexOf(original) != -1) {
		if (str.indexOf(original) > 0)
		result = result + str.substring(0, str.indexOf(original)) + replacement;
	else
		result = result + replacement;
		str = str.substring(str.indexOf(original) + original.length, str.length);
	}
	return result + str;
}

function get2Split_StringUtil(str, deli)
{
	var idx = str.split(deli);
	return idx;
}

function get2Token_StringUtil(str, deli) {
	var result = new Array('','');

	var idx = str.indexOf(deli);
	if(idx != -1) {
		result[0] = str.substring(0, idx);
		result[1] = str.substring(idx + 1, str.length);
	}
	return result;
}

/**
 * ÀÔ·ÂµÈ ¹®ÀÚ¿­ÀÌ ¸î Byte ÀÎÁö¸¦ ±¸ÇÏ´Â Function.<br>
 * html ¹®¼­¿¡¼­ ¹®ÀÚ ±æÀÌ¸¦ °Ë»çÇÏ´Â ºÎºÐ¿¡ ÁÖÀÇÇØ¾ß ÇÒ Á¡ÀÌ ÀÖ½À´Ï´Ù.<br>
 * µ¥ÀÌÅ¸ º£ÀÌ½º¿¡ ¹®ÀÚ¿­ ±æÀÌ¸¦ ÃÖ´ë 10À¸·Î ÇÏ°í
 * À¥¿¡¼­ ±æÀÌ°¡ 10ÀÌ ³ÑÀ» °æ¿ì ¿¡·¯ ¸Þ½ÃÁö¸¦ º¸¿©ÁÖµµ·Ï
 * (ÀúÀåÇÏ±âÀü¿¡ ´Ù½Ã °Ë»ç¸¦ ÇÏ°ÚÁö¸¸) ÇØÁÖ´Â °æ¿ì Á¦´ë·Î Ã¼Å©¸¦ ¸øÇÏ´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù.<br>
 * ÇÑ±ÛÀÇ °æ¿ì javascript¿¡¼­(Java ¿¡¼­µµ ¸¶Âù°¡Áö)
 * ±æÀÌ¸¦ 1·Î »ý°¢À» ÇÏ±â ¶§¹®¿¡ °Ë»ç°¡ Á¦´ë·Î µÇÁö ¾Ê½À´Ï´Ù.<br>
 * ±× ÀÌÀ¯´Â ÇÑ±ÛÀÇ °æ¿ì 2 ByteÀÎ 16-bit Unicode·Î ÀÌ·ç¾î Á³±â ¶§¹®ÀÌ´Ù.
 *
 * @param	Byte ¼ö¸¦ ±¸ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­
 * @return	ÀÔ·ÂµÈ ¹®ÀÚ¿­ÀÇ Byte ¼ö
 */
function getStrByteSize_StringUtil(pm_sStr) {
	var slength = 0;
	var tlength = 0;

	if(name != null)
		tlength = pm_sStr.length;

	slength = tlength;

	var i = 0;

	for(i; i < tlength; i++) {
		if(pm_sStr.charCodeAt(i) > 256) {
			slength ++;
		}
	}
	return slength;
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚÀÎÁö¸¦ È®ÀÎÇÑ´Ù. <BR>
 *@param	name	È®ÀÎÇÏ·Á´Â ¹®ÀÚ¿­
 *@return  ÀÔ·Â°ªÀÌ ÀüºÎ ¼ýÀÚÀÏ °æ¿ì true return, ¼ýÀÚ°¡ ¾Æ´Ñ °ªÀÌ Æ÷ÇÔµÇ¾úÀ» °æ¿ì false return
 */
function isNum_StringUtil(name) {
    var ch = "\0";
	var flag = true;

    for (var i = 0, ch = name.charAt(i);
        (i < name.length) && (flag); ch = name.charAt(++i)) {
        if ((ch >= '0') && (ch <= '9'))
        	;
        else if( (i == 0)&&(ch == '-'))
        	;
        else
            flag = false;
    }
    return flag;
}

/**
 * ÀÔ·ÂµÈ ¹®ÀÚ¿­¿¡ ÀÖ´Â <BR> ¹®ÀÚ¸¦ '\n' ¹®ÀÚ·Î ±³Ã¼ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *
 * @param	pm_sStr	º¯È¯ ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­
 * @return	<BR> ¹®ÀÌ '\n'À¸·Î ±³Ã¼µÈ ¹®ÀÚ¿­
 */
function brToReturn_StringUtil(pm_sStr) {
	var lm_sRegExp = /<BR>/gi;
	var lm_sRetStr = pm_sStr.replace(lm_sRegExp,'\n');
	return lm_sRetStr;
}

/**
 * ÀÔ·ÂµÈ ¹®ÀÚ¿­¿¡ ÀÖ´Â '\n' ¹®ÀÚ¸¦ <BR> ¹®ÀÚ·Î ±³Ã¼ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *
 * @param	pm_sStr	º¯È¯ ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­
 * @return	<BR> ¹®ÀÌ '\n'À¸·Î ±³Ã¼µÈ ¹®ÀÚ¿­
 */
function returnToBr_StringUtil(pm_sStr) {
	var lm_sRegExp = /\n/gi;
	var lm_sRetStr = pm_sStr.replace(lm_sRegExp,'<BR>');
	return lm_sRetStr;
}

/**
 * ¹®ÀÚ¿­ÀÇ ¾ÕµÚ¿¡ ÀÖ´Â °ø¹éÀ» Á¦°ÅÇÏ´Â Function.<br>
 * JavaÀÇ String °´Ã¼¿¡ ÀÖ´Â trim() ¸Þ½îµå
 *
 * @param	pm_sStr	¾ÕµÚÀÇ °ø¹éÀ» Á¦°ÅÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­
 * @return	¾ÕµÚÀÇ °ø¹éÀÌ Á¦°ÅµÈ ¹®ÀÚ¿­
 */
function trim_StringUtil(pm_sStr){
   return pm_sStr.replace(/^\s+|\s+$/g, '');
}

/**
 * ÀÏÁ¤ Byte ÀÌ»óÀÇ ¹®ÀÚ¿­ ÀÌÈÄ¸¦ Àß¶ó³»°í append¸¦ Ãß°¡ÇÑ´Ù.
 *
 * @param   String  ¼öÁ¤À» ¿øÇÏ´Â ¹®ÀÚ¿­
 * @param   int     Byte ±æÀÌ<br>
 *					»ý·«½Ã default °ªÀº 20
 * @param   String  µÞ ºÎºÐÀÇ ¹®ÀÚ¿­À» Àß¶ó³»°í Ãß°¡ÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­<br>
 *					»ý·«½Ã default °ªÀº "..."<br>
 *                  ¿¹) Á¦¸ñÀÌ ³Ê¹« ±æ¶§ µÞ ºÎºÐÀÌ Áö±Ý Ã³·³ Àß¸®°Ô...
 * @return	String  ÀÔ·ÂµÈ Byte ÀÌ»óÀÏ °æ¿ì µÞ ºÎºÐÀÌ append·Î ´ëÄ¡µÈ ¹®ÀÚ¿­
 */
function cutString_StringUtil(pm_sStr, pm_iSize, pm_sAppend) {
	var lm_sRetStr = "";
	var lm_iStrSize = 0;
	var lm_iSize = 20;
	var lm_sAppend = "...";

	if(pm_iSize != null) {
		lm_iSize = pm_iSize;
	}

	if(pm_sAppend != null) {
		lm_sAppend = pm_sAppend;
	}

    // Byte ±æÀÌ¸¦ ¸ÕÀú °Ë»çÇÏ¿© ÀÔ·ÂµÈ ±æÀÌº¸´Ù ±ä °æ¿ì¸¸ Ã³¸®
    if(this.getStrByteSize(pm_sStr) > lm_iSize) {
    	var i = 0;
		for(i = 0; i < pm_sStr.length; i++) {
			if(pm_sStr.charCodeAt(i) > 256) {
				lm_iStrSize += 2;
			} else {
				lm_iStrSize++;
			}

            if(lm_iStrSize > lm_iSize) {
                break;
            } else {
                lm_sRetStr += pm_sStr.charAt(i);
            }
        }
        // append¸¦ µÞ ºÎºÐ¿¡ Ãß°¡
        lm_sRetStr += lm_sAppend;

        return lm_sRetStr;
    }

	return pm_sStr;
}

/**
 * ¹®ÀÚ¿­ Áß¿¡ Æ¯¼ö¹®ÀÚ°¡ Æ÷ÇÔµÇ¾ú´ÂÁö¸¦ ÆÄ¾ÇÇÑ´Ù.
 *@param	name 	¹®ÀÚ¿­
 *@return	ÀÔ·Â°ª¿¡ Æ¯¼ö ¹®ÀÚ°¡ ÇÏ³ªµµ Æ÷ÇÔµÇÁö ¾Ê¾ÒÀ» °æ¿ì true return
 */
function isNonSpecial_StringUtil(name) {

    var ch = "\0";

    for (var i = 0, ch = name.charAt(i);
        i <name.length; ch = name.charAt(++i)) {
        if ( ch == ' ' || ch == '~' || ch == '`' || ch == '\\'||
             ch == '-' || ch == '_' || ch == '|' || ch == '+' ||
             ch == '=' || ch == ',' || ch == '.' || ch == '/' ||
             ch == '<' || ch == '>' || ch == '?' || ch == '!' ||
             ch == '@' || ch == '#' || ch == '$' || ch == '%' ||
             ch == '^' || ch == '&' || ch == '*' || ch == '(' ||
             ch == ')' || ch == '\"' || ch == '[' || ch == ']' ||
             ch == ':' || ch == ';' || ch == '\'' || ch == '{' ||
             ch == '}' ) {
            return false;
        }
    }
    return true;
}

/**
 * À¯´ÏÄÚµå ¹®ÀÚ¿­À» Á¦¿ÜÇÑ °ø¹é, '=', '?' ¿¡ ´ëÇØ¼­ escape Ã³¸®¸¦ ÇÑ´Ù.
 * JavaÀÇ String °´Ã¼¿¡ ÀÖ´Â trim() ¸Þ½îµå
 *
 * @param	pm_sStr	¾ÕµÚÀÇ °ø¹éÀ» Á¦°ÅÇÏ°íÀÚ ÇÏ´Â ¹®ÀÚ¿­
 * @return	¾ÕµÚÀÇ °ø¹éÀÌ Á¦°ÅµÈ ¹®ÀÚ¿­
 */
function safeEscape_StringUtil(pm_sStr){
	var lm_sReturn = "";
	for(var i=0; i < pm_sStr.length; i++) {
		var lm_sChar = pm_sStr.charAt(i);
		if(lm_sChar == " ") {
			lm_sReturn += "%20";
		} else if(lm_sChar == "=") {
			lm_sReturn += "%3D";
		} else if(lm_sChar == "?") {
			lm_sReturn += "%3F";
		} else {
			lm_sReturn += lm_sChar;
		}//if
	}//for
	return lm_sReturn;
}


/***********************************************************************************************************
 *                                             select Box
 ***********************************************************************************************************/

/**
 *  @Description	: select box setting
 *  @Input			: objId
 *  @Input			: url
 *  @Input			: param
 *  @Output			: ¾øÀ½
 *  @example		: cfCreateSelectBox(roadSelectBox, "/statistics_new/searchMap/roadNameListItem.jsp", "?dongCode=" + dBox.options[dBox.selectedIndex].value)
 */
function cfCreateSelectBox(obj, url, param)
{
	cfDeleteSelectBox(obj);

	if(cfIsNull(param)) param = "";

	var lm_sURL = url + param;
	var loadRequest = sendHttpRequest("GET", lm_sURL);
	var lm_oXML = parse(cfTrim(loadRequest.responseText));
	var nodes = lm_oXML.getElementsByTagName('firstCode');

  	for (var i = 0; i < nodes.length;i++)
  	{
   		obj.options[i] = new Option(nodes[i].getAttribute('text'));
   		obj.options[i].value = nodes[i].getAttribute("value");
  	}
}

/**
 *  @Description	: ±¸´ÜÀ§ ¸®½ºÆ®¹Ú½º »ý¼º
 *  @Input			: sidoObj - ½Ãµµ
 *  @Input			: guObj - ½Ã±º±¸
 *  @Input			: dongObj - À¾¸éµ¿
 *  @Input			: gbn - 1:ÀÏ¹Ý
 *							2:¹ýÁ¤µ¿
 *							3:µµ½ÃÈ­
 *  @Output			: ¾øÀ½
 *  @example		: onchange="cfGetGuList(siDoSelectBox, guSelectBox, dongSelectBox, '1')"
 */
function cfGetGuList(sidoObj, guObj, dongObj, gbn)
{
	if(sidoObj.value == "")
	{
		if(!cfIsNull(guObj)) cfDeleteSelectBox(guObj);
		if(!cfIsNull(dongObj)) cfDeleteSelectBox(dongObj);
		return;
	}

	if(!cfIsNull(dongObj)) cfDeleteSelectBox(dongObj);	// ±âÁ¸  µ¿ ¸®½ºÆ® »èÁ¦

	var url = "";
	if(gbn == "1") url = "/statistics_new/searchMap/guListItem.jsp?sidoCode="+sidoObj.value;
	else if(gbn == "2") url = "/statistics_new/searchMap/lawGuList.jsp?sidoCode=" + sidoObj.options[sidoObj.selectedIndex].value;
	else if(gbn == "3") url = "/statistics_new/searchMap/cityGuListItem.jsp?siName="+sidoObj.options[sidoObj.selectedIndex].value;
	cfCreateSelectBox(guObj, url, "");
}

/**
 *  @Description	: µ¿´ÜÀ§ ¸®½ºÆ®¹Ú½º »ý¼º
 *  @Input			: sidoObj 	- ½Ãµµ
 *  @Input			: guObj 	- ½Ã±º±¸
 *  @Input			: dongObj 	- À¾¸éµ¿
 *  @Input			: gbn - 1:ÀÏ¹Ý
 *							2:¹ýÁ¤µ¿
 *							3:µµ½ÃÈ­
 *  @Output			: ¾øÀ½
 *  @example		: onchange="cfGetDongList(siDoSelectBox, guSelectBox, dongSelectBox, '1')"
 */
function cfGetDongList(sidoObj, guObj, dongObj, gbn)
{
	if(guObj.value == "")
	{
		if(!cfIsNull(dongObj)) cfDeleteSelectBox(dongObj);
		return;
	}

	if(sidoObj.value == "" || guObj.value == "") return;

	var url = "";
	if(gbn == "1") url = "/statistics_new/searchMap/dongListItem.jsp?guCode="+guObj.value;
	else if(gbn == "2") url = "/statistics_new/searchMap/lawDongList.jsp?guCode=" + guObj.options[guObj.selectedIndex].value;
	else if(gbn == "3") url = "/statistics_new/searchMap/cityDongListItem.jsp?siName=" + sidoObj.options[sidoObj.selectedIndex].value + "&guName=" + guObj.options[guObj.selectedIndex].value;

	cfCreateSelectBox(dongObj, url, "");
}

/**
 *  @Description	: select box ÃÊ±âÈ­
 *  @Input			: obj - select box ID
 *  @Output			: ¾øÀ½
 */
function cfDeleteSelectBox(obj)
{
	for (j = 1; j < obj.options.length; j++)
	{
		obj.options[j] = null;
	}

	obj.options.length = 1;
}

/**
 *  @Description	: xml¿ë ÅÂ±×·Î º¯È¯ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *  @Input			: element - ÅÂ±×
 *  @Input			: content - ³»¿ë
 *  @Output			: xml·Î º¯È¯È­¿© ¹ÝÈ¯
 *  @example		: getXmlTag('p_Item','ÃÑÀÎ±¸') - <p_Item>ÃÑÀÎ±¸</p_Item>
 */
function getXmlTag(element, content) {
	var xmlTag = "";
	xmlTag += "<" + element + ">";
	xmlTag += content;
	xmlTag += "</" + element + ">";
	return xmlTag;
}

/**
 *  @Description	: xml¿ë ÅÂ±×·Î º¯È¯ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *  @Input			: element - ÅÂ±×
 *  @Input			: content - ³»¿ë
 *	@Input			: id = id
 *  @Output			: xml·Î º¯È¯È­¿© ¹ÝÈ¯
 *  @example		: getIdXmlTag('p_Item','ÃÑÀÎ±¸','data_year') - <p_Item id='data_year'>ÃÑÀÎ±¸</p_Item>
 */
function getIdXmlTag(element, content, id) {
	var xmlTag = "";
	xmlTag += "<" + element + " id='" + id + "'>";
	xmlTag += content;
	xmlTag += "</" + element + ">";
	return xmlTag;
}


/**
 *  @Description	: xml¿ë CDATA ÅÂ±×·Î º¯È¯ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *  @Input			: element - ÅÂ±×
 *  @Input			: content - ³»¿ë
 *  @Output			: xml·Î º¯È¯È­¿© ¹ÝÈ¯
 *  @example		: getXmlCDATATag('p_Item','ÃÑÀÎ±¸') - <p_Item><![CDATA[ÃÑÀÎ±¸]]></p_Item>
 */
function getXmlCDATATag(element, content) {
	var xmlTag = "";
	xmlTag += "<" + element + ">";
	xmlTag += "<![CDATA[" + content + "]]>";
	xmlTag += "</" + element + ">";
	return xmlTag;
}

/**
 *  @Description	: ´ÜÀÏ xml¿ë ÅÂ±×·Î º¯È¯ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *  @Input			: element - ÅÂ±×
 *  @Input			: id - ³»¿ë
 *  @Output			: xml·Î º¯È¯È­¿© ¹ÝÈ¯
 *  @example		: getSingleIdXmlTag('p_Item','data_year') - <p_Item id='data_year' />
 */
function getSingleIdXmlTag(element, id) {
	var xmlTag = "";
	xmlTag += "<" + element + " id='" + id + "' />";
	return xmlTag;
}

/**
 *  @Description	: ´ÜÀÏ xml¿ë ÅÂ±×·Î º¯È¯ÇÏ¿© ¹ÝÈ¯ÇÑ´Ù.
 *  @Input			: element - ÅÂ±×
 *  @Input			: id - ³»¿ë
 *  @Input			: name - ³»¿ë
 *  @Output			: xml·Î º¯È¯È­¿© ¹ÝÈ¯
 *  @example		: getSingleIdXmlTag('p_Item','data_year','³âµµ') - <p_Item id='data_year' name='³âµµ' />
 */
function getSingleNameXmlTag(element, id, name) {
	var xmlTag = "";
	xmlTag += "<" + element + " id='" + id + "' name='" + name + "' />";
	return xmlTag;
}


//2001-01-01 Çü½ÄÀ¸·Î ¸®ÅÏÇÏ´Â ÇÔ¼ö
function dateFormat(strDate) {

	var date = "";

	if(strDate.indexOf("-") > -1) return strDate;

	if(strDate != "") {
		var year  = "";
		var month = "";
		var day   = "";
		if(strDate.length == 6){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			date = year+"-"+month
		}else if(strDate.length == 8){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			day = strDate.substring(6, 8);
			date = year+"-"+month+"-"+day
		}
	}

	return date;
}

function dateFormatDot(strDate) {

	var date = "";

	if(strDate.indexOf(".") > -1) return strDate;

	if(strDate != "") {
		var year  = "";
		var month = "";
		var day   = "";
		if(strDate.length == 6){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			date = year+"."+month
		}else if(strDate.length == 8){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			day = strDate.substring(6, 8);
			date = year+"."+month+"."+day
		}
	}

	return date;
}

function dateFormatDesc(strDate) {

	var date = "";

	if(strDate.indexOf(".") > -1) return strDate;

	if(strDate != "") {
		var year  = "";
		var month = "";
		var day   = "";
		if(strDate.length == 6){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			date = year+"³â"+month+"¿ù"
		}else if(strDate.length == 8){
			year = strDate.substring(0, 4);
			month = strDate.substring(4, 6);
			day = strDate.substring(6, 8);
			date = year+"³â"+month+"¿ù"+day+"ÀÏ"
		}
	}

	return date;
}

/**
 * ³»    ¿ë: ÇöÀç ½Ã°£À» ¹®ÀÚ¿­ 8ÀÚ¸®·Î ¸®ÅÏÇÑ´Ù.
 * ÆÄ¶ó¹ÌÅÍ: ¾øÀ½
 * ¸® ÅÏ °ª: ¹®ÀÚ¿­
 * Âü°í»çÇ×: ¾øÀ½
 * ¿¹    Á¦: cfGetToday(); 20050825 -> 2005³â 08¿ù 25ÀÏ
 */
function cfGetToday()
{
	today = new Date();
	strDate = "";
	strDate += today.getYear();
	var nowMonth = today.getMonth()+1;
	if(nowMonth < 10){
		strDate += "0"+nowMonth;
	}else{
		strDate += nowMonth;
	}
	if(today.getDate() < 10){
		strDate += "0"+today.getDate();
	}else{
		strDate += today.getDate();
	}

	return strDate;
}

/**
 * ³»    ¿ë: iframe ¾ÈÀÇ field °ªÀ» °¡Á®¿Â´Ù.
 * ÆÄ¶ó¹ÌÅÍ: p_frame - ÇÁ·¹ÀÓ ³×ÀÓ
 * ÆÄ¶ó¹ÌÅÍ: p_fieldname - ÇÊµå ³×ÀÓ
 * ¸® ÅÏ °ª: field °ª
 */
function getValueFromIFrame(p_frame, p_fieldname) {
	var frame = document.getElementById(p_frame);
	return (frame.contentDocument.forms[0].elements[p_fieldname].value);
}


/**
 *  @Description    : µ¿ÀûÀÎ iframe »ý¼ºÇÔ¼ö
 *  @Page           : index.jsp (´Ù¸¥ ÆäÀÌÁö¿¡¼­µµ »ç¿ë °¡´ÉÇÔ)
 *  @Author         : ¼ÕÇü¼ö
 *  @Input          : targetName    : iframeÀ» »ý¼ºÇÒ parent(ÁÖ·Î div) Id
 *  @Input          : frameId       : »ý¼ºÇÒ iframeÀÇ id¸¦ ÁöÁ¤ÇÔ 
 *                                    ÀÌ¸§¿¡ 'div_'°¡ ÀÖÀ» °æ¿ì frameId´Â  divÀÇ id°¡ µÇ¸ç iframeÀÇ id´Â 'div_'¸¦ Á¦¿ÜÇÑ ¹®ÀÚ¿­À» °¡Áö°Ô µÈ´Ù.
 *                                    kind ÀÇ °ªÀÌ 'ifr'ÀÏ °æ¿ì¿¡´Â 'div_'ÀÇ ¿©ºÎ¿Í »ó°ü¾øÀÌ iframeId´Â iframeÀÇ id°¡ µÈ´Ù.
 *  @Input          : uri           : iframe¿¡¼­ ¿­¾îÁÙ ÆäÀÌÁöÀÇ uri
 *  @Input          : sizeXY        : ÇÁ·¹ÀÓÀÇ »çÀÌÁî("width,height") (¿¹ : "100,150")
 *  @Input          : positionXY    : ÇÁ·¹ÀÓÀÇ À§Ä¡("left or right,top or bottom")   (¿¹ : "150,35" ¶Ç´Â "R30,B20")
 *  								  
 *  @Input          : kind          : iframeÀ» ½Î´Â div¸¦ »ý¼ºÇÒÁö ¿©ºÎ¸¦ °áÁ¤, ÁöÁ¤ÇÏÁö ¾ÊÀ» °æ¿ì div±îÁö »ý¼ºÇÏ¸ç
 *                                    'ifr' °ªÀ» º¸³¾ °æ¿ì div¸¦ Á¦¿ÜÇÑ iframe¸¸ »ý¼ºÇÑ´Ù.
 *  @Input			: method		: ÇÁ·¹ÀÓÀÇ »ý¼º ¹æ¹ýÀ» ÁöÁ¤ÇÑ´Ù.
 *  								  'replace'°ªÀ» ÁöÁ¤ÇÒ °æ¿ì¿¡´Â ÀÌ¹Ì Á¸ÀçÇÏ´Â ÇÁ·¹ÀÓ(div°¡ µÇ°Å³ª)À» ´ëÃ¼ÇÏ´Â ¹æ¹ýÀ¸·Î »ý¼ºÇÑ´Ù.
 *  								  ÀÌ¿ÜÀÇ °æ¿ì¿¡´Â ÇÁ·¹ÀÓÀ» Á÷Á¢ »ý¼ºÇÑ´Ù.
 *  @Output         : ÇØ´ç ÇÁ·¹ÀÓÀÇ »ý¼º
 *  
 *  @Notation1		: ¸¸µé¾îÁø ÇÁ·¹ÀÓ¿¡ Á¢±ÙÇÏ±â À§ÇØ¼­´Â »óÀ§ ÇÁ·¹ÀÓ¿¡¼­ ¸ÕÀú ÇÔ¼ö¸¦ ¸¸µé¾î¾ß ÇÑ´Ù
 *  				  ¿¹¸¦ µé¾î 'ifr' id¸¦ °¡Áø ÇÁ·¹ÀÓ ¾ÈÀÇ a.jsp°¡ test() ÇÔ¼ö¸¦ °¡Áö°í ÀÖÀ»¶§
 *  				  ÀÌ¸¦ È£ÃâÇÏ±â À§ÇØ¼­ document.getElementById('ifr').contentWindow.test() ¸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸³ª
 *  				  »óÀ§ ÇÁ·¹ÀÓÀÌ ¾Æ´Ñ 'ifr2' ÇÁ·¹ÀÓ¿¡¼­ È£ÃâÇÒ °æ¿ì
 *    				  parent.getElementById("ifr").contentWindow.test()´Â »ç¿ëÀÌ ºÒ°¡´ÉÇÏ´Ù.
 *    				  ¿øÀÎÀ» Ã£Áö ¸øÇÏ¿´Áö¸¸ ÇÁ·¹ÀÓÀ» ÇÏ³ª °Ç³Ê Á¢±ÙÇÏ°Ô µÉ °æ¿ì ¾Ë¼ö¾ø´Â ¿¡·¯°¡ ¹ß»ýÇÏ¹Ç·Î
 *					  ÀÌ °æ¿ì parent¿¡ ÇÔ¼ö¸¦ ÇÏ³ª Ãß°¡ÇÏ¿© ÀÌ ÇÔ¼ö°¡ parentÀÇ ÇÔ¼ö¸¦ È£ÃâÇÏµµ·Ï ÇÑ´Ù.
 *					  ¿¹¸¦ µé¾î À§¿Í °°Àº °æ¿ì parent ÇÁ·¹ÀÓ¿¡ ´ÙÀ½°ú °°Àº ÇÔ¼ö¸¦ Ãß°¡ÇÏ°í
 *					  ifr2¿¡¼­´Â parent.test()¸¦ È£ÃâÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
 *  				  function test(){document.getElementById("ifr").contentWindow.test();}
 *  
 *  @Notation2		: ÇÁ·¹ÀÓ ³»ºÎÀÇ º¯¼ö Á¢±Ù½Ã À§ÀÇ ¹æ¹ýÀ» »ç¿ëÇÏ´õ¶óµµ contentWindow¸¦ °¡Áö°í´Â Á¢±ÙÀÌ ºÒ°¡´ÉÇÏ´Ù
 *  				  ÀÌ¶§¿¡´Â contentDocument¸¦ »ç¿ëÇÏ´Â °Íµµ ¹æ¹ýÀÌÁö¸¸
 *  				  getter, setter °³³äÀ» »ç¿ëÇÏ¿© ÇÔ¼ö¸¦ ¸¸µé°í È£ÃâÇÏ´Â ¹æ¹ýÀÌ ´õ È¿À²ÀûÀÏ °ÍÀÌ´Ù.
 *  				  º¯¼ö¸¦ Á÷Á¢ °Çµå¸®¸é¾ß ´õ ÁÁ°ÚÁö¸¸.. º¸¾È¿¡ À§¹èµÇ´ÂÁö.. Á¢±ÙÀÌ Àß ¾ÈµÈ´Ù´õ¶ó..
 *  				  popupKDetail("div_mapLineBufferId","lineBufferId", "/statistics_new/common/mapLineBuffer.jsp", "238,71", "1000,500", 'ifr');
 */
function popupKDetail(targetName, frameId, uri,sizeXY,positionXY, kind, method)
{
	var sizeX = sizeXY.split(",")[0];
	var sizeY = sizeXY.split(",")[1];

	var positionX = positionXY.split(",")[0];
	var positionY = positionXY.split(",")[1];

    var htmlSrc = null;
    if(navigator.appName == "Netscape")
    {
        htmlSrc = document.createElement("iframe");
    }
    else
    {
        htmlSrc = document.createElement("<iframe frameborder=0></iframe>");
    }
    
    if (frameId.substring(0,4) == 'div_'){
        htmlSrc.id = frameId.substring(4);
        htmlSrc.name = frameId.substring(4);
    }
    htmlSrc.width = sizeX;
    htmlSrc.height = sizeY;
    htmlSrc.scrolling = "no";
    htmlSrc.frameborder = "0";
    htmlSrc.marginwidth = "0";
    htmlSrc.marginheight = "0";
    htmlSrc.src = uri;

    if(kind == 'ifr'){
        htmlSrc.id = frameId;
        htmlSrc.name = frameId;
        if(method=='replace'){
        	document.getElementById(targetName).replaceChild(htmlSrc, document.getElementById(htmlSrc.id));
        } else {
        	document.getElementById(targetName).appendChild(htmlSrc);
        }
    } else {
        var vHtm = document.createElement("div");
        vHtm.id = frameId;
        vHtm.style.position = "absolute";
        if(positionX.substring(0,1)=="R"){
        	vHtm.style.right = positionX.substring(1);
        } else {
        	vHtm.style.left = positionX;
        }
        if(positionY.substring(0,1)=="B"){
        	vHtm.style.bottom = positionY.substring(1);
        } else {
        	vHtm.style.top = positionY;
        }
        vHtm.style.width = sizeX;
        vHtm.style.height = sizeY;
        vHtm.style.zIndex = '100';
        vHtm.appendChild(htmlSrc);
        if(method=='replace'){
        	document.getElementById(targetName).replaceChild(htmlSrc, document.getElementById(htmlSrc.id));
        } else {
        	document.getElementById(targetName).appendChild(vHtm);
        }
    }
    //document.getElementById("kosisBarTable").style.display = "block";
}


 /**
  *  @Description    : Element Á¦°ÅÇÔ¼ö
  *  @Page           : index.jsp (´Ù¸¥ ÆäÀÌÁö¿¡¼­µµ »ç¿ë °¡´ÉÇÔ)
  *  @Author         : ¼ÕÇü¼ö
  *  @Input          : parentId      : »èÁ¦ÇÒ ElementÀÇ parent(ÁÖ·Î div) Id
  *  @Input          : frameId       : »ý¼ºÇÒ ElementÀÇ id¸¦ ÁöÁ¤ÇÔ 
  *                                    frameIdÀÇ °ªÀÌ 'ALL_DELETE'ÀÌ¸é parentIdÀÇ ÀüÃ¼ Child¸¦ »èÁ¦ÇÑ´Ù.
  *                                    frameIdÀÇ Element°¡ Á¸ÀçÇÏ¸é ÇØ´ç Element¸¸ »èÁ¦ÇÑ´Ù.
  *  @Input			 : method		 : replaceÀÇ ¹æ¹ýÀ¸·Î »ý¼ºµÇ´Â ÇÁ·¹ÀÓÀ» À§ÇÏ¿© ´Ù¸¥ Á¦°Å¹æ¹ýÀ» ÁöÁ¤ÇÑ´Ù.
  *  								   'replace'ÀÇ °ªÀÌ Àû¿ëµÉ °æ¿ì¿¡´Â ÇÁ·¹ÀÓÀ» »èÁ¦ÇÏÁö ¾Ê°í º¸ÀÌÁö ¾Êµµ·Ï ¼û±â±â¸¸ ÇÑ´Ù.
  *  @Output         : ÇØ´ç¿ä¼ÒÀÇ Á¦°Å
  */
function closeKDetail(parentId, frameId, method)
{
    var varFrame = document.getElementById(parentId);

    if(varFrame)
    {
    	if(frameId == 'ALL_DELETE'){
    	    varFrame.innerHTML = "";
    	} else if (document.getElementById(frameId)){
    		if(method=="replace"){
    			//varFrame.removeChild(document.getElementById(frameId));
    			document.getElementById(frameId).style.display = "none";
    		} else {
    			varFrame.removeChild(document.getElementById(frameId));
    		}
    	} else {
        	//alert("Delete Error!!!!!\nSGSHS...");
    	}
    }
}

/**
 *  @Description	: target Element ¿¡ ÁöÁ¤ÇÑ uriÀÇ µ¥ÀÌÅÍ¸¦ »Ñ·ÁÁØ´Ù.
 *  @author			: ¼ÕÇü¼ö
 *  @Input			: fullUri    - µ¥ÀÌÅÍ¸¦ º¸³»ÁÙ ÆäÀÌÁöÀÇ ÀüÃ¼ uri
 *  @Input			: targetName - ¹Þ¾Æ¿Â µ¥ÀÌÅÍ¸¦ Ãß°¡ÇÒ ElementÀÇ id
 *  @Process		: target Element ¿¡ µ¥ÀÌÅÍ¸¦ ³Ö¾îÁØ´Ù(innerHTML)
 *  @Output			: ¾øÀ½
 */
function openPage(fullUri, targetName)
{
	var loadRequest = sendHttpRequest("GET", fullUri);
	var result = cfTrim(loadRequest.responseText);
	
	document.getElementById(targetName).innerHTML = result;
	document.getElementById(targetName).style.display="block";
}

function showPage(targetName){
	document.getElementById(targetName).style.display = "block";
}

function hidePage(targetName){
	document.getElementById(targetName).style.display = "none";
}

/**
 * uri¿Í targetÀ» ÀÔ·ÂÇÏ¸é ÇØ´ç ÆÄ¶ó¹ÌÅÍµéÀ» °¡Áö´Â ÆûÀ» ¸®ÅÏÇØÁÖ´Â ÇÔ¼ö
 * ¸®´ª½º µî¿¡¼­ get¹æ½Ä Àü¼Û¿¡ ÇÑ±Û±úÁüÀ» ¸·±â À§ÇØ »ç¿ëÇÔ
 * @param uri      : ÁÖ¼Ò¸¦ Æ÷ÇÔÇÑ ÀüÃ¼ uri, get ¹æ½ÄÀ¸·Î Àü¼ÛÇÏ´Â ÆÄ¶ó¹ÌÅÍ Æ÷ÇÔ.. 
 * @param target   : submitÀ» º¸³¾ target¸¦ ÀÔ·ÂÇÑ´Ù. frame°¡ µÇ´øÁö window°¡ µÇ´øÁö..
 * 				    ÇÏÁö¸¸ divµîÀÇ ÅÂ±×´Â ´Ù¸¥ ¹æ¹ýÀ» ÀÌ¿ëÇÏµµ·Ï ÇÏÀÚ!!
 * @return postFrm : °¢ ÆÄ¶ó¹ÌÅÍµéÀ» input ÅÂ±×·Î °¡Áö´Â formÀ» ¸®ÅÏÇØÁØ´Ù.
 * 					 ÆÄ¶ó¹ÌÅÍ°¡ ÇÏ³ªµµ ¾ø°Å³ª uri¿¡ "?"¹®ÀÚ°¡ Æ÷ÇÔµÇÁö ¾Ê¾ÒÀ» °æ¿ì¿¡´Â nullÀÌ ¸®ÅÏµÈ´Ù.
 * @notation	   : ÆûÀ» ¸®ÅÏÇÑ´Ù°í ÇØ¼­ ÀÌ ÆûÀÌ ¹Ù·Î ÀÛµ¿ÇÏÁö´Â ¾Ê´Â´Ù!!
 * 					 ¹Ýµå½Ã ¹®¼­¿¡µç ¾î´À Æ¯Á¤ ÅÂ±×¿¡µç appendChild ¸¦ ÇØÁÖ°í³ª¼­ ÀÌ ÆûÀ» submitÇÏµµ·Ï ÇÏÀÚ!!!
 * 				     submit ÈÄ¿¡ ¹Ù·Î removeChild¸¦ ÀÌ¿ëÇÏ¿© ÆûÀ» Áö¿ì´õ¶óµµ ÇÁ·Î¼¼½º¿¡´Â ¹®Á¦°¡ ¾ø´Ù.
 */
function makeFrm(uri, target){
	
	if(uri.indexOf("?") < 0) return null;
	
	var URL = uri.split("?");
	var url_not_param = URL[0];
	
	if(URL[1] == "") return null;
	
	var PARAM = URL[1];
	var param_list = PARAM.split("&");
	var cntParam = param_list.length;
	
	var postFrm = document.createElement("form");
	postFrm.method="post";
	postFrm.action= url_not_param;
	postFrm.target= target;
	
	for( var i = 0 ; i < cntParam ; i ++){
		var attrList = param_list[i].split("=");
		var attrName = attrList[0];
		var attrValue = attrList[1];
		var frmElement = document.createElement("input");
		frmElement.type = "hidden";
		frmElement.id = attrName;
		frmElement.name = attrName;
		frmElement.value = attrValue;
		
		postFrm.appendChild(frmElement);
	}
	return postFrm;
}


/**
 * ³»    ¿ë: ÇØ´ç ½ºÆ®¸µÀÌ Á¸Àç ÇÏ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹®ÀÚ
 * ¸® ÅÏ °ª: null or String
 * Âü°í»çÇ×: .
 * ¿¹    Á¦: chkStringReturnId("weight",queryAtValue);
 */
function chkStringReturnId(codeString,originString) {
	//alert(codeString+originString);
	var impIDs = codeString;  //ID¿¡ Æ÷ÇÔ ºÒ°¡ÇÑ Ç×¸ñµé
	
		if (originString.indexOf(impIDs)>=0) {
			return impIDs;
    	}
	
	return null;
}




/**
 * ³»    ¿ë: ÇØ´ç ½ºÆ®¸µÀÌ Á¸Àç ÇÏ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ
 * ÆÄ¶ó¹ÌÅÍ: ¹®ÀÚ, ¹è¿­
 * ¸® ÅÏ °ª: null or String
 * Âü°í»çÇ×: .
 * ¿¹    Á¦: chkStringReturnId("weight",queryAtValue);
 */
function chkStringReturnIdArray(codeString,originString){
	var impIDs = originString;
	//ID¿¡ Æ÷ÇÔ ºÒ°¡ÇÑ Ç×¸ñµé
	for (var i=0; i<impIDs.length; i++){
	    if (p.indexOf(impIDs[i])>=0){
	    	return impIDs[i];
	    }
	}
	return null;
}


function toHtml(s)
{
    if(s == null)
    {
        return null;
    } else
    {
        s = cfReplace(s, "&", "&amp;");
        s = cfReplace(s, "<", "&lt;");
        s = cfReplace(s, ">", "&gt;");
        s = cfReplace(s, "\n", "<br>");
        s = cfReplace(s, "\"", "&quot;");
        s = cfReplace(s, "(", "[");
        s = cfReplace(s, ")", "]");
        return s;
    }
}