function makeDateFormat(dateString, formatChar){
	dateString = trim(dateString);
	if(dateString.length == 8){
		dateString = dateString.substring(0, 4)+formatChar+dateString.substring(4, 6)+formatChar+dateString.substring(6);
	}
	return dateString;
}
function changeBlank(val){
		if(val==null || val=='undefined' || trim(val)==""){
			val = " ";
		}
		return val;
	}

	// * @::::Added SJD. 2002. 11. 13::::
// ÁÂ¿ì°¡¿îµ¥ ¸ðµÎ ½ºÆäÀÌ½º Á¦°Å
function trim(parm_str){
  return rtrim(ltrim(parm_str));
}

// ÁÂÃø ½ºÆäÀÌ½º Á¦°Å
function ltrim(parm_str){
  str_temp = parm_str;
  while (str_temp.length != 0) {
    if (str_temp.substring(0, 1) == " ") {
      str_temp = str_temp.substring(1, str_temp.length) ;
    }
    else {
      return str_temp ;
    }
  }
  return str_temp ;
}

// ¿ìÃø ½ºÆäÀÌ½º Á¦°Å
function rtrim(parm_str) {
  str_temp = parm_str ;
  while (str_temp.length != 0) {
    int_last_blnk_pos = str_temp.lastIndexOf(" ");
    if ((str_temp.length - 1) == int_last_blnk_pos) {
      str_temp = str_temp.substring(0, str_temp.length - 1);
    }
    else {
      return str_temp;
    }
  }
  return str_temp;
}


	// ºí·Ïµ¥ÀÌÅÍ¸¦ 2Â÷¿ø¹è¿­·Î º¯È¯ÇØ¼­ ¸®ÅÏ
	function GetDataString(nRow, nCol, sData){//nRow: ¸®ÅÏµÇ´Â Çà °³¼ö, nCol: ÄÃ·³ °³¼ö, SData: ½ºÆ®¸µ ¸®½ºÆ®
		var i,j;
		var arrData = new Array(nRow);
		for(i=0; i<nRow; i++){//[nRow][nCol]¹è¿­ »ý¼º
			arrData[i] = new Array(nCol);
			for ( j=0; j<nCol; j++ ){
				arrData[i][j] = " ";
			}
		}

		var rowIdx, colIdx=0, ch;
		rowIdx = 0;
		colIdx = 0;

		for( j=0; j<sData.length; j++ ){
			ch = sData.charAt(j);//Ä³¸¯ÅÍ¸¦ ÇÑÀÚ¾¿ ÀÐ¾î¼­ ch¿¡ ´ëÀÔ			
			if ( ch == '^' ){//°¢ ÄÃ·³Àº ^¸¦ ±¸ºÐÀÚ·Î ÇÑ´Ù.
				colIdx += 1;
				if ( colIdx >= nCol ){//colIdx°¡ nColº¸´Ù Å©°Å³ª °°À¸¸é colIdx¸¦ 0À¸·Î ÃÊ±âÈ­
					colIdx = 0;
				}
				tmpIdx = 0;
			}else if ( ch == '|' ){//°¢ row´Â |¸¦ ±¸ºÐÀÚ·Î ÇÑ´Ù.
				rowIdx += 1;
				if ( rowIdx >= nRow ){
					break;
				}
				colIdx = 0;
				tmpIdx = 0;
			}else{//ch°¡ ±¸ºÐÀÚ·Î ¾²ÀÎ ^³ª |°¡ ¾Æ´Ï¸é ÇØ´ç À§Ä¡ÀÇ °ªÀ» ¹è¿­¿¡ ÀúÀå
				arrData[rowIdx][colIdx] += ch;
			}
		}
		return arrData;
	}
	
	////////////////////onblur½Ã ÇÑ±Û·Î ±Ý¾× ÀÔ·ÂÇÏ±â ½ÃÀÛ////
	function formatCurrency( num ){
		num = num.toString().replace(/\$|\,/g,'');
		if( isNaN(num) ){
			num = "0";
		}

		sign = ( num == ( num = Math.abs(num) ) );
		num = Math.floor(num * 100 + 0.50000000001);
		cents = num % 100;
		num = Math.floor(num / 100).toString();

		if(cents < 10){
			cents = "0" + cents;
		}

		for (var i = 0; i < Math.floor((num.length-(1 + i)) / 3); i++){
			num = num.substring(0,num.length-(4 * i + 3))+','+num.substring(num.length-(4 * i + 3));
		}

		return (((sign)?'':'-') + num);
	}

	//*********************************************************
	// Å°º¸µåÀÇ Å°°¡ ¼ýÀÚÀÏ°æ¿ì¿¡¸¸ ÀÔ·ÂÀ» ¹Þµµ·Ï
	// text box¿¡ Ãß°¡ : onkeypress="return check_key_number(event.keyCode)"
	//*********************************************************
	function check_key_number(ch) {
		if(ch>47 && ch<58)	return true;
		else	return false;
	}
	////////////////////onblur½Ã ÇÑ±Û·Î ±Ý¾× ÀÔ·ÂÇÏ±â ³¡////
	
	function addCommas(strValue){
		var objRegExp = new RegExp("(-?[0-9]+)([0-9]{3})");

		underDot = "";
		if (strValue.indexOf('.') > -1){//////////////////////
			underDot = strValue.substr(strValue.indexOf('.'));
			strValue = strValue.substr(0, strValue.indexOf('.'));
		}
		while(objRegExp.test(strValue)) {
			strValue = strValue.replace(objRegExp, "$1,$2");
		}
		if (underDot != ""){
			strValue = strValue + underDot;
		}
		return strValue;
	}
	


	/******************************************************************************
	 ±Ý¾×¿¡ 1000´ÜÀ§·Î ±¸ºÐÀÚ(ÄÞ¸¶ ',')¸¦ Ç¥½ÃÇÑ´Ù.
	 ¼ýÀÚ°¡ ¾Æ´Ï¸é ÀÔ·Â°ªÀ» ¸®ÅÏÇÑ´Ù.
 ******************************************************************************/
function getFormattedNumber(data){ 
	data = String(data);
	strNumber = data.replaceAll(',','');
	isMinus = isMinusValue(strNumber);
	strNumber = strNumber.replaceAll('-','');

    var result = ""; 

	if (isNaN(strNumber)) {
		result = "";
		return result;
	}

	var regexp = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
	arrNumber = strNumber.split('.');
    arrNumber[0] += '.';
    do {
	arrNumber[0] = arrNumber[0].replace(regexp, '$1,$2');
    } while (regexp.test(arrNumber[0]));

    if (arrNumber.length>1) result = arrNumber.join(''); 
    else					result = arrNumber[0].split('.')[0]; 
 
	if (isMinus) {
		result = "-" + result;
	}
    return result; 
}

function isMinusValue(v){
	if (v.indexOf('-') > -1) {
		t = v.replace('-','');
		if (t.indexOf('-') > -1) {
			return false;	// -  - => +
		} else {
			return true;	//	-	=> -
		}
	}
	return false;			//	+
}

/**
* ¹®ÀÚ¿­ Ä¡È¯ »ç¿ë¹ý replaceAll(¿ø¹® , ¹Ù²ð¹®ÀÚ¿­ , ¹Ù²Ü¹®ÀÚ¿­)
 */
function replaceAll(str, sep, pad) {
    while (str.indexOf(sep) > -1) {
        str = str.replace(sep, pad);
    }
    return str;
}

/******************************************************************************
 	¹®ÀÚ¿­ Ä¡È¯ ÇÔ¼ö
 ******************************************************************************/
String.prototype.replaceAll = function (sourceChar, targetChar) {
    var temp = "";
    if (this.trim() != "" && sourceChar != targetChar) {
        temp = this.trim();
        while (temp.indexOf(sourceChar) > -1) {
            temp = temp.replace(sourceChar, targetChar);
        }
    }
    return temp;
};