//---------------------------------------------------------------------------//
//								  StringUtil								 //
//---------------------------------------------------------------------------//

/**----------------------------------------------------------------------------
 함수명	: removeWhiteSpace()
 설	 명	: 문자열에 포함된 공백,	개행문자 제거
 인자값	: String strTarget - 문자열에 포함된
							 공백, 개행문자를 제거하고자하는 문자열
 리	 턴	: String - 좌우	공백이 제거된 문자열
 사용법	: var strResult	= trim('  문 자	열	');
		  return '문자열'
-----------------------------------------------------------------------------*/
function removeWhiteSpace(strTarget)
{
	var	strEliminate = /\s+/g;

	if(strTarget)
	{
		return strTarget.replace(strEliminate,"");
	}
	else
	{
		return strTarget;
	}
 }


/**----------------------------------------------------------------------------
 함수명	: trim()
 설	 명	: 좌우 공백	제거
 인자값	: String strTarget - 좌우 공백을 없애고자하는 문자열
 리	 턴	: String - 좌우	공백이 제거된 문자열
 사용법	: var strResult	= trim('  문 자	열	');
		  return '문 자	열'
-----------------------------------------------------------------------------*/
function trim(strTarget)
{
	var	strEliminate = /(^\s*)|(\s*$)/gi;
	
	if(strTarget)
	{
		return strTarget.replace(strEliminate,"");
	}
	else
	{
		return strTarget;
	}
 }


/**----------------------------------------------------------------------------
 함수명	: ltrim()
 설	 명	: 좌측 공백	제거
 인자값	: String strTarget - 좌측 공백을 없애고자하는 문자열
 리	 턴	: String - 좌측	공백이 제거된 문자열
 사용법	: var strResult	= ltrim('  문 자 열	 ');
		  return '문 자	열 '
-----------------------------------------------------------------------------*/

function ltrim(strTarget)
{
	while(strTarget.substring(0,1)==" ")
	{
		strTarget =	strTarget.substring(1);
	}
	return strTarget;
}


/**----------------------------------------------------------------------------
 함수명	: rtrim()
 설	 명	: 우측 공백	제거
 인자값	: String strTarget - 우측 공백을 없애고자하는 문자열
 리	 턴	: String - 우측	공백이 제거된 문자열
 사용법	: var strResult	= rtrim('  문 자 열	 ');
		  return ' 문 자 열'
-----------------------------------------------------------------------------*/
function rtrim(strTarget)
{
	var	len	= strTarget.length;
	
	while(strTarget.substring(len-1,len)=="	")
	{
		strTarget =	strTarget.substring(0,len-1);
		len	= strTarget.length;
	}
	return strTarget;
 }


/**----------------------------------------------------------------------------
 함수명	: replaceAll()
 설	 명	: 소스문자열에 포함된 문자를 원하는	문자로 변환
		  공백 또는	'0'을 자리수만큼 채운 문자열 
 인자값	: String strSrc	- 소스 문자열
		  String strOld	- 총 자릿수
		  String strNew	- 숫자인가?				(옵션 default :	false)
 리	 턴	: String - 소스	문자열을 포함해	원하는 위치에 
				   공백	또는 '0'을 자리수만큼 채운 문자열
 사용법	: var strResult	= packValue('1234',	8, true, true);
		  return '00001234'
-----------------------------------------------------------------------------*/
function replaceAll(strSrc,	strOld,	strNew)	
{

	var	retValue = "";

	if(strOld == null)
	{
		return strSrc;
	}
	if (strSrc != "" &&	strOld != strNew)
	{
		retValue = strSrc;

		while (retValue.indexOf(strOld)	> -1)
		{
			retValue = retValue.replace(strOld,	strNew);
		}
	}
	return retValue;
}


// 문자	변환 함수 (=replaceAll() 함수와	동일)----------------------------------
function alterString(strSrc, strOld, strNew) 
{
	var	retValue = "";

	for(i =	0; i < strSrc.length; i++)
	{
		var	value =	strSrc.charAt(i);
		var	index =	strOld.indexOf(value);

		if(index >=	0)
		{ 
			value =	strNew.charAt(index);
		}
		retValue +=	value;
	}
	return retValue;
}


/**----------------------------------------------------------------------------
 함수명	: formatString()
 설	 명	: 포멧 문자열 변환
 인자값	: String strSrc	   - 변환하고자	하는 문자열
		  String strFormat - 포멧형식
		  String strDelim  - 포멧 구분자 문자
 리	 턴	: String - 원하고자	하는 포멧으로 변환된 문자열
 사용법	: var strResult	= formatString('20050512', '9999/99/99');
		  return ' 문 자 열'
-----------------------------------------------------------------------------*/
function formatString(strSrc,strFormat)
{
	var	retValue = "";
	var	j =	0; 

	var	strSrc = strSrc.replace(/(\$|\^|\*|\(|\)|\+|\.|\?|\\|\{|\}|\||\[|\]|\-|\/|\:)/g, "");

	for	(var i=0; i< strSrc.length;	i++) 
	{
		retValue +=	strSrc.charAt(i);
		j++;

		if ( (j	< strSrc.length	&& j < strFormat.length) 
			  && (strFormat.charAt(j) != "9"
			  && strFormat.charAt(j).toLower !=	"x"
			  && strFormat.charAt(j) !=	"#")  )
		{
			retValue +=	strFormat.charAt(j++);
		}
	}
	return retValue;
}


/**----------------------------------------------------------------------------
 함수명	: packValue()
 설	 명	: 소스 문자열을	포함해 원하는 위치에 
		  공백 또는	'0'을 자리수만큼 채운 문자열 
 인자값	: String strSrc	- 소스 문자열
		  Int	 nSize	- 총 자릿수
		  bool	 bNum	- 숫자인가?				(옵션 default :	false)
		  bool	 bLeft	- 왼쪽에 위치할	것인지?	(옵션 default :	true )
 리	 턴	: String - 소스	문자열을 포함해	원하는 위치에 
				   공백	또는 '0'을 자리수만큼 채운 문자열
 사용법	: var strResult	= packValue('1234',	8, true, true);
		  return '00001234'
-----------------------------------------------------------------------------*/
function packValue(strSrc, nSize, bNum,	bLeft)
{
	var	retValue = "";
	var	preValue = "";
	var	postValue =	"";
	var	nLen = 0;
	var	i =	0;

	if(bNum	== null)
	{
		bNum = false;
	}
	if(bLeft ==	null)
	{
		bLeft =	true;
	}

	strSrc = ""	+ strSrc;
	nLen = strSrc.length;
	retValue = strSrc;

	if(bNum)
	{
		for(i =	nLen; i	< nSize; i++)
		{
			if(bLeft)
			{
				preValue +=	"0";
			}
			else
			{
				postValue += "0";
			}
		}
	}
	else
	{
		for(i =	nLen; i	< nSize; i++)
		{
			if(bLeft)
			{
				preValue +=	" ";
			}
			else
			{
				postValue += " ";
			}
		}

	}
	retValue = preValue	+ retValue + postValue;

	return retValue;
}


/**----------------------------------------------------------------------------
 함수명	: getByte()
 설	 명	: 문자열의 바이트수	구하기
 인자값	: String strSrc	- 소스 문자열
 리	 턴	: Int -	문자열 바이트수	
 사용법	: var nResult =	getByte('가나다1234');
		  return 10
-----------------------------------------------------------------------------*/
function getByte(strSrc)
{	
	return (strSrc.length+(escape(strSrc)+"%u").match(/%u/g).length	- 1);
}


/**----------------------------------------------------------------------------
 함수명	: toUpper()
 설	 명	: 소문자를 대문자로	변환
 인자값	: String strSrc	- 소스 문자열
 리	 턴	: String - 대문자로	변환된 문자열
 사용법	: var strResult	= toUpper('abc');
		  return 'ABC'
-----------------------------------------------------------------------------*/
function toUpper(strSrc) 
{
	var	str1 = "abcdefghijklmnopqrstuvwxyz";
	var	str2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	return alterString(strSrc, str1, str2);
}


/**----------------------------------------------------------------------------
 함수명	: toLower()
 설	 명	: 대문자를 소문자로	변환
 인자값	: String strSrc	- 소스 문자열
 리	 턴	: String - 소문자로	변환된 문자열
 사용법	: var strResult	= toLower('ABC');
		  return 'abc'
-----------------------------------------------------------------------------*/
function toLower(strSrc)
{
	var	str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var	str2 = "abcdefghijklmnopqrstuvwxyz";

	return alterString(strSrc, str1, str2);
}


/**----------------------------------------------------------------------------
 함수명	: removeComma()
 설	 명	: 문자열에 포함된 ','를	제거
 인자값	: String strSrc	- 소스 문자열
 리	 턴	: String - ','가 제거된	문자열
 사용법	: var nResult =	removeComma('123,456,789');
		  return '123456789'
-----------------------------------------------------------------------------*/
function removeComma(strSrc) 
{
	return strSrc.replace(/,/gi,"");
}


/**----------------------------------------------------------------------------
 함수명	: removeFormat()
 설	 명	: 문자열에 포함된 포멧문자 ", .	- /	:"를 제거
 인자값	: String strSrc	- 소스 문자열
 리	 턴	: String - ", .	- /	:"가 제거된	문자열
 사용법	: var nResult =	removeComma('2005/03/12	12:24:00');
		  return '20050312 122400'
-----------------------------------------------------------------------------*/
function removeFormat(strSrc)
{
	return strSrc.replace(/(\,|\.|\-|\/|\:)/g,""); 
}


/**----------------------------------------------------------------------------
 함수명	: addComma()
 설	 명	: 문자열에 포함된 ','를	제거
 인자값	: String strSrc	- 소스 문자열
		  bool	 bSymbol - '+' 부호일때	보일것인가?
 리	 턴	: String - ','가 제거된	문자열
 사용법	: var nResult =	addComma('1234567.12', true);
		  return '+1,234,567.12'
-----------------------------------------------------------------------------*/
function addComma(strSrc, bSymbol)
{
	var	strSymbol =	'';
	var	retValue  =	'';
	var	strTempSymbol =	'';
	var	strTempDotValue	= '';

	var	nLen	  =	0;

	try
	{
		if(bSymbol == null)
		{
			bSymbol	= false;
		}

		strSrc = strSrc.trim();

		strTempSymbol =	strSrc.substr(0,1);
		if(strTempSymbol ==	'+')
		{
			strSymbol =	'+';
			strSrc = strSrc.substring(1);
		}
		if(strTempSymbol ==	'-')
		{
			strSymbol =	'-';
			strSrc = strSrc.substring(1);
		}

		nLen = strSrc.length;

		for(var	i=1; i <= nLen;	i++) 
		{
			retValue = strSrc.charAt(nLen -	i) + retValue;

			if((i %	3 == 0)	&& ((nLen -	i) != 0))
			{
				retValue = "," + retValue;
			}
		}

		if(strSrc.indexOf('.') > -1)
		{
			var	nIndex = strSrc.indexOf('.');
			strTempDotValue	= strSrc.substring(nIndex);
			strSrc = strSrc.substring(0, nIndex);
		}
	
		if(bSymbol)
		{
			if(strSymbol ==	'')
			{
				strSymbol =	'+';
			}
		}
		else
		{
			if(strSymbol ==	'+')
			{
				strSymbol =	'';
			}
		}

		return strSymbol + retValue	+ strTempDotValue;
	}
	catch(e)
	{
	}
}

function isAlpha(val) 
{
	return isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}

function isComma(val)
{
	return isStringCustom(val, "1234567890,");
}

function isNumber(val) 
{
	return isStringCustom(val, "1234567890");
}

function isDateNumber(val)
{
	return isStringCustom(val, "1234567890-");
}

function isPhoneNumber(val)
{
	return isStringCustom(val, "1234567890-");
}

function isSeatNo(val) {
	var result = val.length == 3;

	if (result) {
		result = isNumber(val.substring(0,2)) && isStringCustom(val.substring(2), "ABCDEFGHIJKabcdefghijk");
	}

	return result;
}

function isPassportNo(val) {
	return isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
}

function isUserID(val) {
	return (getByte(val) >= 3 && getByte(val) <= 15) && isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
}

function isNormalChk(val) {
	return (getByte(val) >= 3 && getByte(val) <= 15) && isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ");
}

function isUserIDLogin(val) {
	return (getByte(val) >= 1 && getByte(val) <= 15) && isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.");
} 

function isUserName(val, lang) {
	var result = isStringNonCustom(val, "0123456789`~!@#$%^&*()_+-='\",.<>");

	if (lang == "en") {
		result = isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/");
	}

	return result;
}

function isPaxName(val) {
	var result	= isStringNonCustom(val, "0123456789`~!@#$%^&*()_+-='\",.<>");
	var tmp		= isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/");

	if (tmp) {
		if (val.indexOf("/") < 0) result = false;
		else result = true;
	}

	return result;
}

function isUserKoreanName(val) {
	var result = true;

	for (var i=0; i<val.length; i++) {
		if (!((val.charCodeAt(i) > 0x3130 && val.charCodeAt(i) < 0x318F) || (val.charCodeAt(i) >= 0xAC00 && val.charCodeAt(i) <= 0xD7A3))) {
			result = false;
			break;
		}
	}

	return result;
}

function isUserNo(val) {
	return (isNumber(val) && (val.length == 9 || val.length == 13));
}

function isPassword(val, type) {
	var result		= true;
	var birthDate	= "";
	var obj			= document.getElementsByName("birthDate");
	var obj1		= document.getElementsByName("birthDate1");
	var obj2		= document.getElementsByName("birthDate2");
	var obj3		= document.getElementsByName("birthDate3");

	if (type == null) type = "1";

	try {
		// 스크립트 제한 by 20081117 lhw
		if (type == "1") {
			if (val.indexOf("--") > -1 || val.toLowerCase().indexOf("<sc") > -1) return false;
		}

		if (obj.length > 0) birthDate = obj[0].value;
		else if (obj1.length > 0 && obj2.length > 0 && obj3.length > 0) birthDate = obj1[0].value + obj2[0].value + obj3[0].value;

		if (val.length < 4 || val.length > 20) result = false;

		// 동일한 값인지 체크
		var cnt = 0;
		var chk = val.substring(0,1);
		for (var i=0; i<val.length; i++) {
			if (chk == val.substring(i, i+1)) cnt++;
		}
		if (cnt == val.length) result = false;

		// 연속된 값인지 체크
		
		var tmp = val.charCodeAt(0);
		cnt = 0;
		for (i=1; i<val.length; i++) {
			if (parseInt(tmp)+i == parseInt(val.charCodeAt(i))) cnt++;
		}
		if (cnt == val.length-1) result = false;
	

		// 생일과 동일 여부 확인
		if (birthDate != "" && birthDate == val) result = false;
		if (birthDate != "" && birthDate.indexOf(val) >= 0) result = false;
	}
	catch(e) {
		result = false;
	}

	return result;
}

function isPasswdHint(val) {
	return isComment(val);
}

function isPasswdHintAnswer(val) {
	return isComment(val);
}

function isSocialNo(val) {
	val = trim(val);
	if (val.length != 13 || !isNumber(val)) {
		return false;
	}

	var hap = 0;
	for (i=0; i< 8; i++)
	hap = hap + (i+2)* val.substring(i,i+1);

	for (i=8; i<12; i++)
	hap = hap + (i-6) * val.substring(i,i+1);

	hap=hap%11;
	hap=11-hap;
	hap=hap%10;

	if (hap != val.substring(12,13)) return false;
	return true;
}

function isZipCode(val) {
	return isStringCustom(val, "1234567890-");
}

function isAddress(val, nationality) {
	var result = true;

	if (nationality == "KR") {
		result = isStringNonCustom(val, "`!@#$%^&*_+='\"<>");
	}
	else {
		result = isStringCustom(val, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/-() ");
	}

	return result;
}

function isEmail(val) {
	var result = isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@.-_");

	if (val.indexOf("@") < 0) result = false;
	if (val.indexOf(".") < 0) result = false;
	if (val.indexOf("@") > val.lastIndexOf(".")) result = false;

	return result;
}

function isComment(val) {
	return isStringNonCustom(val, "`~!@#$%^&*_+-=<>");
}

function isGroupCode(val) {
	return (val.length == 2 && isStringCustom(val, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
}

function isCode(val) {
	return isStringCustom(val, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}

function isFileName(val) {
	return isStringCustom(val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-");
}

function isCompanyName(val) {
	return isComment(val);
}

function isDepartment(val) {
	return isComment(val);
}

function isPnrNo(val) {
	val = val.toUpperCase();
	return ((isNumber(val) && val.length == 7) || (isStringCustom(val, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ") && val.length == 6))
}

function isSeatList(val) {
	var result = true;
	var list = val.split(",");

	for (var i=0; i<list.length; i++) {
		// 열 체크
		if (list[i].length == 1) {
			result = isStringCustom(list[i], "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
			if (!result) break;
		}
		// 행 체크
		else if (list[i].length == 2) {
			result = isStringCustom(list[i], "0123456789");
			if (!result) break;
		}
		// 일반좌석 체크
		else if (list[i].length == 3) {
			result = isStringCustom(list[i].substring(0,2), "0123456789") && isStringCustom(list[i].substring(2,3), "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
			if (!result) break;
		}
		else {
			result = false;
		}
	}
	return result;
}

function isStringCustom(val, check) 
{
	var comp = check;
	var len=val.length;
	for(i=0;i<len;i++) 
	{
		if(comp.indexOf(val.substring(i,i+1).toUpperCase()) < 0 ) {
			return false;
		}
	}
	return true;
}

function isStringNonCustom(val, check) {
	var comp = check;
	var len=val.length;
	for(i=0;i<len;i++) 
	{
		if(comp.indexOf(val.substring(i,i+1).toUpperCase()) > -1 ) {
			return false;
		}
	}
	return true;
}

function isDateTime(val) {
	var ret = false;
	var pos;

	pos = val.indexOf(" ");

	if (pos < 0) {
		ret = isDate(val);
	}
	else {
		ret = isDate(val.substring(0, pos));

		if (ret) {
			ret = isTime(val.substring(pos+1));
		}
	}

	return ret;
}

function isDate(val) {
	var ret = false;
	var year, month, day;
	var thisMonth, nextMonth, maxDay;
	
	year = month = day = 0;
	if (isNumber(val) && val.length == 8) {
		year	= DecimalNumber(val.substring(0, 4));
		month	= DecimalNumber(val.substring(4, 6));
		day		= DecimalNumber(val.substring(6));
	}
	else if (isDateNumber(val) && val.split("-").length == 3) {
		year	= DecimalNumber(val.split("-")[0]);
		month	= DecimalNumber(val.split("-")[1]);
		day		= DecimalNumber(val.split("-")[2]);
	}

	if (year >= 1900 && (month >= 1 && month <=12)) {
		thisMonth	= new Date(year, month-1, 1);
		nextMonth	= new Date(year, month, 1);
		
		maxDay		= (nextMonth - thisMonth) / 1000 / 60 / 60 / 24;
		
		if (day >= 1 && day <= maxDay)
			ret = true;
	}
	
	return ret;
}

function isTime(val) {
	var ret = false;
	var nHour, nMinute, nSecond;

	nHour = nMinute = nSecond = -1;
	if (isStringCustom(val, "1234567890:") && val.split(":").length >= 2) {
		nHour	= DecimalNumber(val.split(":")[0]);
		nMinute	= DecimalNumber(val.split(":")[1]);

		nSecond	= 0;
		if (val.split(":").length >= 3)
			nSecond	= DecimalNumber(val.split(":")[2]);
	}
	else if (isNumber(val) && (val.length == 4 || val.length == 6)) {
		nHour	= DecimalNumber(val.substring(0, 2));
		nMinute	= DecimalNumber(val.substring(2, 4));

		nSecond	= 0;
		if (val.length == 6)
			nSecond	= DecimalNumber(val.substring(4));
	}

	if (nHour >= 0 && nHour <= 23 && nMinute >= 0 && nMinute <= 59 && nSecond >= 0 && nSecond <= 59) {
		ret = true;
	}

	return ret;
}

function getStrToDate(val) {
	var ret = null;
	var year, month, day;
	var thisMonth, nextMonth, maxDay;
	
	year = month = day = 0;
	if (isNumber(val) && val.length == 8) {
		year	= DecimalNumber(val.substring(0, 4));
		month	= DecimalNumber(val.substring(4, 6));
		day		= DecimalNumber(val.substring(6));
	}
	else if (isDateNumber(val) && val.split("-").length == 3) {
		year	= DecimalNumber(val.split("-")[0]);
		month	= DecimalNumber(val.split("-")[1]);
		day		= DecimalNumber(val.split("-")[2]);
	}

	ret = new Date(year, month-1, day);

	return ret;
}

function getMoveDate(date, move) {
	var year	= parseInt(date.substring(0,4));
	var month	= parseInt(date.substring(4,6), 10) - 1;
	var day		= parseInt(date.substring(6,8), 10)+parseInt(move);
	var newDate	= new Date(year, month, day);

	year	= newDate.getFullYear();
	month	= ""+(newDate.getMonth()+1);
	day		= ""+newDate.getDate();

	if (year < 1900)		year	+= 1900;
	if (month.length < 2)	month	= "0"+month;
	if (day.length < 2)		day		= "0"+day;

	return year + month + day;
}

function getDateWeekName(date, lang) {
	var year		= parseInt(date.substring(0,4));
	var month		= parseInt(date.substring(4,6), 10) - 1;
	var day			= parseInt(date.substring(6,8), 10);
	var newDate		= new Date(year, month, day);
	var week		= newDate.getDay();
	var weekName	= null;

	if (lang == "ko") {
		weekName	= new Array("일", "월", "화", "수", "목", "금", "토");
	}
	else if (lang == "en") {
		weekName	= new Array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT");
	}

	return weekName[week];
}

function getDateKSTName(date, flag) {
	var result = date;

	if (result.length == 8) {
		result = date.substring(0,4) + flag + date.substring(4,6) + flag + date.substring(6,8);
	}

	return result;
}

function getDateKSTMonthName(date, flag) {
	var result = getDateKSTName(date, flag);

	return result.substring(5);
}

function getSimpleDateName(date, lang) {
	var result = date;

	if (lang == "ko") {
		result = date.substring(0,4) + "-" + date.substring(4,6) + "-" + date.substring(6,8) + " (" + getDateWeekName(date, lang) + ")";
	}

	return result;
}

function getDateTimeName(date, lang) {
	var result = date;

	if (result == "") {
		result = "-";
		return result;
	}

	if (lang == "ko") {
		result = date.substring(6,8) + "일 " + date.substring(8,10) + ":" + date.substring(10,12);
	}

	return result;
}

function getTimeName(time, lang) {
	var result = time;

	if (result == "") {
		result = "-";
		return result;
	}

	if (lang == "ko") {
		if (time.indexOf(":") < 0 && time.length == 4) {
			result = parseInt(time.substring(0,2),10) + "시간 ";
			if (parseInt(time.substring(2,4),10) != 0) result += parseInt(time.substring(2,4),10) + "분";
		}
		else if (time.indexOf(":") > -1) {
			var tmp = time.split(":");
			result = parseInt(tmp[0],10) + "시간 ";
			if (parseInt(tmp[1],10) != 0) result += parseInt(tmp[1],10) + "분"; 
		}
	}

	return result;
}

function getTime(time) {
	var result = "";

	if (time.length == 4) {
		result = time.substring(0,2) + ":" + time.substring(2,4);
	}

	return result;
}

function DecimalNumber(val) {
	var i;
	var find = true;

	while (find) {
		if (val.charAt(0) != "0") {
			find = false;
			break;
		}

		if (val.length > 1)
			val = val.substring(1);
		else break;
	}

	return parseInt(val);
}

function getAge(depDate, birthDate) {
	var date = new Date();
	var year = date.getYear();
	if (year < 1900) year += 1900;

	if (birthDate.length == 6) birthDate = "20" + birthDate;
	if (year < parseInt(birthDate.substring(0,4))) birthDate = "19" + birthDate.substring(2);

	var age = parseInt(depDate.substring(0,4)) - parseInt(birthDate.substring(0,4)) - 1;

	if (parseInt(depDate.substring(4,8),10) >= parseInt(birthDate.substring(4,8),10)) age++;

	return age;
}

function textbox_KeyDown()
{
    if (event.keyCode == 86 && event.ctrlKey)

   {
        event.keyCode = 0; 
        event.cancelBubble = true; 
    }
}

/**----------------------------------------------------------------------------
   윗 함수 사용법 :	trim('aaa'); ->	변수.trim(); 또는 문자열.trim();
-----------------------------------------------------------------------------*/
String.prototype.removeWhiteSpace =	function()
{
	return removeWhiteSpace(this);
}

String.prototype.trim =	function()
{
	return trim(this);
}

String.prototype.ltrim = function()
{
	return ltrim(this);
}

String.prototype.rtrim = function()
{
	return rtrim(this);
}

String.prototype.replaceAll	= function(strOld, strNew) 
{
	return replaceAll(this,	strOld,	strNew);
}

String.prototype.formatString =	function(strFormat)	
{
	return formatString(this, strFormat);
}

String.prototype.packValue = function(nSize, bNum, bLeft)
{
	return packValue(this, nSize, bNum,	bLeft);
}

String.prototype.getByte = function()
{
	return getByte(this);
}

String.prototype.toUpper = function()
{
	return toUpper(this);
}

String.prototype.toLower = function()
{
	return toLower(this);
}

String.prototype.removeComma = function()
{
	return removeComma(this);
}

String.prototype.removeFormat =	function()
{
	return removeFormat(this);
}

String.prototype.addComma =	function(bSymbol)
{
	return addComma(this, bSymbol);
}