/*****************************************************************************************
		¡Ø ÆûÃ¼Å© À¯Æ¿ ¸ðÀ½..
*****************************************************************************************/

	// È÷µçÇÁ·¹ÀÓÀ¸·Î Æû Àü¼Û..
	function submitHiddenFrame( oForm, sSourceUrl, bDebugMode ){
		var oHiddenFrame = $("__hiddenFrameForExcute__");

		if( !oHiddenFrame ){
			oHiddenFrame = document.createElement("IFRAME");
			oHiddenFrame.id = "__hiddenFrameForExcute__";
			oHiddenFrame.name = "__hiddenFrameForExcute__";
			oHiddenFrame.style.display = "none";

			document.body.appendChild( oHiddenFrame );
		}

		if( bDebugMode ){
			oHiddenFrame.style.width = "100%";
			oHiddenFrame.style.height = "200px";
			oHiddenFrame.style.display = "block";
		}


		oForm.target = "__hiddenFrameForExcute__";
		oForm.method = "post";
		oForm.action = sSourceUrl;
		oForm.submit();
	}


	// ·Îµù »óÅÂÃ¢ °¨Ãß±â
	function hideProgressBar(){
		var oDisableZone = document.getElementById("Disable_Zone");

		if(oDisableZone)
			oDisableZone.style.display = "none";
	}


	// ·Îµù »óÅÂÃ¢ º¸ÀÌ±â
	function showProgressBar(){
		var oDisableZone = document.getElementById("Disable_Zone");
			
		if(!oDisableZone){
			oDisableZone = document.createElement("div");
			oDisableZone.id = "Disable_Zone";

			oDisableZone.style.zIndex = 1000;
			oDisableZone.style.left = "0px";
			oDisableZone.style.top = "0px";
			oDisableZone.style.width = document.body.scrollWidth;
			oDisableZone.style.height = document.body.scrollHeight;
			oDisableZone.style.display = "none";
			oDisableZone.style.position = "absolute";

			oDisableZone.style.background = "white";
			oDisableZone.style.display = "none";
			oDisableZone.style.position = "absolute";

			oDisableZone.style.opacity = (50 / 100);
			oDisableZone.style.MozOpacity = (50 / 100);
			oDisableZone.style.KhtmlOpacity = (50 / 100);
			oDisableZone.style.filter = "alpha(opacity=" + 50 + ")";



			var oImage = new Image(72, 21);

			oImage.src = "/js/images/status.gif";
			oImage.align = "absmiddle";
			oImage.style.zIndex = oDisableZone.style.zIndex + 10;
			oImage.style.left = (document.body.scrollWidth / 2) - 100 + "px";
			oImage.style.top = (document.body.scrollHeight / 2) - 20 + "px";
			oImage.style.position = "absolute";

			oDisableZone.appendChild( oImage );
			document.body.appendChild( oDisableZone );
		}

		oDisableZone.style.display = "block";
	}


	/*---------------------------------------------------------------------------------*\
	*  KeyUp ÀÌº¥Æ® ¹ß»ý½Ã..
	\*---------------------------------------------------------------------------------*/
	//-----------------------------------------------------------------------------
	// ÇÑ±Û¸¸ ÀÔ·Â°¡´ÉÇÏ°Ô ÇÑ´Ù.
	// @return : null
	// ex) (text-field).onkeyup = onlyKorean;
	//-----------------------------------------------------------------------------
	function onlyKorean() {
		var oElement = (arguments[0] != null) ? arguments[0] : this;
		var charChk;

		for(var i=0; i<oElement.value.length; i++){
			charChk = oElement.value.charCodeAt(i);

			if(charChk > 31 && charChk < 127) {
				alert("°ø¹é¾øÀÌ ÇÑ±Û·Î¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				oElement.value = oElement.value.substring(0, i);
				oElement.focus();
				return;
			}
		}
	}


	//-----------------------------------------------------------------------------
	// ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÏ°Ô ÇÑ´Ù.
	// @return : null
	// ex) (text-field).onkeyup = onlyNumber;
	//-----------------------------------------------------------------------------
	function onlyNumber() {
		var oElement = (arguments[0] != null) ? arguments[0] : this;
		var charChk;

		for(var i=0; i<oElement.value.length; i++){
			charChk = oElement.value.charCodeAt(i);

			if(charChk > 57 || charChk < 48){
				alert("°ø¹é¾øÀÌ ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				oElement.value = oElement.value.substring(0, i);
				oElement.focus();
				return;
			}
		}
	}


	//-----------------------------------------------------------------------------
	// ¿µ¹®¸¸ ÀÔ·Â°¡´ÉÇÏ°Ô ÇÑ´Ù.
	// @return : null
	// ex) (text-field).onkeyup = onlyEnglish;
	//-----------------------------------------------------------------------------
	function onlyEnglish() {
		var oElement = (arguments[0] != null) ? arguments[0] : this;
		var charChk;

		for(var i=0; i<oElement.value.length; i++){
			charChk = oElement.value.charCodeAt(i);

			if((charChk < 65 || charChk > 90) && (charChk < 97 || charChk > 122)){
				alert("°ø¹é¾øÀÌ ¿µ¹®À¸·Î¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				oElement.value = oElement.value.substring(0, i);
				oElement.focus();
				return;
			}
		}
	}



	//-----------------------------------------------------------------------------
	// ¿µ¹®°ú ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÏ°Ô ÇÑ´Ù.
	// @return : null
	// ex) (text-field).onkeyup = onlyEngNum;
	//-----------------------------------------------------------------------------
	function onlyEngNum() {
		var oElement = (arguments[0] != null) ? arguments[0] : this;
		var charChk;

		for(var i=0; i<oElement.value.length; i++){
			charChk = oElement.value.charCodeAt(i);

			if( ((charChk < 65 || charChk > 90) && (charChk < 97 || charChk > 122)) && (charChk > 57 || charChk < 48) ){
				alert("°ø¹é¾øÀÌ ¿µ¹®°ú ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				oElement.value = oElement.value.substring(0, i);
				oElement.focus();
				return;
			}
		}
	}




	/*---------------------------------------------------------------------------------*\
	*  ÇÊµå°ªÀÌ ¸ðµÎ Ã¤¿öÁø ´ÙÀ½..
	\*---------------------------------------------------------------------------------*/
	function isNull(oElement){
		if(oElement.value.trim() == ""){
			oElement.value = "";
			return true;
		} else{
			return false;
		}
	}


	//-----------------------------------------------------------------------------
	// ÅØ½ºÆ®ÇÊµå ³Î°ªÃ¼Å©..
	// @return : null
	// ex) chkNull(ÇÊµå, °æ°í¸Þ¼¼Áö);
	//-----------------------------------------------------------------------------
	function chkNull(oElement, strMessage){
		if(oElement.value.trim() == ""){
			alert(strMessage + " ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			oElement.value = "";
			oElement.focus();
			return true;

		} else{
			return false;
		}
	}





	//-----------------------------------------------------------------------------
	// ¶óµð¿À¹öÆ°ÀÇ ¼±ÅÃµÈ ÀÎµ¦½º ±¸ÇÏ±â..
	// @return : int (¼±ÅÃµÈ°ÍÀÌ ¾øÀ¸¸é -1)
	// ex) checkedIndex(¶óµð¿ÀÇÊµå);
	//-----------------------------------------------------------------------------
	function checkedIndex(oElement){
		var index = -1;

		if(!oElement){
			alert("radio °´Ã¼°¡ ÇÒ´çµÇÁö ¾ÊÀ½..");
			return -1;
		} else{
			if(oElement.length){
				for(var i=0; i<oElement.length; i++){
					if(oElement[i].checked)
						index = i;
				}
			} else{
				index = 0;
			}
		}

		return index;
	}





	//-----------------------------------------------------------------------------
	// °°ÀºÀÌ¸§À» °¡Áø Ã¼Å©¹Ú½ºÀÇ ¼±ÅÃµÈ °¹¼ö ±¸ÇÏ±â..
	// @return : int
	// ex) getCheckedCount(Ã¼Å©¹Ú½º);
	//-----------------------------------------------------------------------------
	function getCheckedCount(oElement){
		var iCount = 0;

		if(!oElement || !oElement.length){
			return 0;
		} else {
			for(var i=0; i<oElement.length; i++){
				if(oElement[i].checked)
					iCount++;
			}

			return iCount;
		}
	}



	//-----------------------------------------------------------------------------
	// ÆÄÀÏÀÇ È®ÀåÀÚ ±¸ÇÏ±â..
	// @return : String						ex) getFileExt(form.file) => "zip";
	// ex) getFileExt(ÆÄÀÏ°´Ã¼);
	//-----------------------------------------------------------------------------
	function getFileExt(oElement){
		var strFileName = oElement.value;

		return strFileName.substring( strFileName.lastIndexOf(".") + 1, strFileName.length ).toLowerCase();
	}



	//-----------------------------------------------------------------------------
	// ÀÌ¸ÞÀÏ À¯È¿¼º °ËÁõ..
	// @return : boolean
	// ex1) isEmail(ÇÊµå);
	// ex2) isEmail(ÇÊµå1, ÇÊµå2);
	// ex3) isEmail(ÇÊµå1, ÇÊµå2, °æ°í¸Þ¼¼Áö);
	// ex4) isEmail(ÇÊµå1, null, °æ°í¸Þ¼¼Áö);
	//-----------------------------------------------------------------------------
	function isEmail() {
		var strEmail;
		var strMessage = (arguments[2]) ? arguments[2] : "ÀÌ¸ÞÀÏÀÌ ºÎÁ¤È®ÇÕ´Ï´Ù.";


		if(!arguments[0]) {
			alert("Nothing Parameters..");
			return false;

		} else if(arguments[0] && !arguments[1]) {
			strEmail = arguments[0].value;

		} else {
			strEmail = arguments[0].value + "@" + arguments[1].value;

		}

		if( (/[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/).test(strEmail) ){
			return true;

		} else{
			alert(strMessage);

			return false;
		}
	}





	//-----------------------------------------------------------------------------
	// ÁÖ¹Îµî·Ï¹øÈ£ À¯È¿¼º °ËÁõ..
	// @return : boolean
	// ex1) chkJumin(ÇÊµå);
	// ex2) chkJumin(ÇÊµå1, ÇÊµå2);
	// ex3) chkJumin(ÇÊµå1, ÇÊµå2, °æ°í¸Þ¼¼Áö);
	// ex4) chkJumin(ÇÊµå1, null, °æ°í¸Þ¼¼Áö);
	//-----------------------------------------------------------------------------
	function chkJumin(){
		var strJumin;
		var strMessage = (arguments[2]) ? arguments[2] : "ÁÖ¹Îµî·Ï¹øÈ£°¡ ºÎÁ¤È®ÇÕ´Ï´Ù.";


		if(!arguments[0]) {
			alert("Nothing Parameters..");
			return false;

		} else if(arguments[0] && !arguments[1]) {
			strJumin = arguments[0].value.replace("-", "");

		} else {
			strJumin = arguments[0].value + arguments[1].value;

		}


		if( !(/[0-9]{13}/).test(strJumin) || (strJumin.length != 13) ){
			alert(strMessage);
			return false;

		} else {
			var intSum = 0;
			var intLast = parseInt(strJumin.charAt(12));
			
			intSum += strJumin.charAt(0) * 2;
			intSum += strJumin.charAt(1) * 3;
			intSum += strJumin.charAt(2) * 4;
			intSum += strJumin.charAt(3) * 5;
			intSum += strJumin.charAt(4) * 6;
			intSum += strJumin.charAt(5) * 7;
			intSum += strJumin.charAt(6) * 8;
			intSum += strJumin.charAt(7) * 9;
			intSum += strJumin.charAt(8) * 2;
			intSum += strJumin.charAt(9) * 3;
			intSum += strJumin.charAt(10) * 4;
			intSum += strJumin.charAt(11) * 5;

			if( ( (11 - (intSum%11)) % 10 ) != intLast ){
				alert(strMessage);
				return false;
			} else{
				return true;
			}
		}
	}




	//-----------------------------------------------------------------------------
	// »ç¾÷ÀÚµî·Ï¹øÈ£ À¯È¿¼º °ËÁõ..
	// @return : boolean
	// ex1) chkBizNum(ÇÊµå);
	// ex2) chkBizNum(ÇÊµå, °æ°í¸Þ¼¼Áö);
	//-----------------------------------------------------------------------------
	function chkBizNum(){
		var strBizNum;
		var strMessage = (arguments[1]) ? arguments[1] : "»ç¾÷ÀÚµî·Ï¹øÈ£°¡ ºÎÁ¤È®ÇÕ´Ï´Ù.";

		if(!arguments[0]) {
			alert("Nothing Parameters..");
			return false;
		} else{
			strBizNum = arguments[0].value;
		}



		if( !(/[0-9]{10}/).test(strBizNum) || (strBizNum.length != 10) ){
			alert(strMessage);
			return false;

		} else {
			var intSum = parseInt(strBizNum.charAt(0), 10);
			var aRegular = [0, 3, 7, 1, 3, 7, 1, 3];

			for(var i=1; i<8; i++){
				intSum += ( parseInt(strBizNum.charAt(i), 10) * aRegular[i] ) % 10;
			}

			intSum += Math.floor( parseInt(strBizNum.charAt(8), 10) * 5 / 10);
			intSum += (( parseInt(strBizNum.charAt(8), 10) * 5 ) % 10) + parseInt(strBizNum.charAt(9), 10);

			if( (intSum % 10) == 0 ){
				return true;
			} else{
				alert(strMessage);
				return false;
			}
		}
	}





	// ÁÖ¹Îµî·Ï¹øÈ£·Î (¸¸)³ªÀÌ±¸ÇÏ±â..
	function getAge(jumin1, jumin2){
		var birthYY, sexCD;
		var today = new Date();
		var year, birthYear;

		year	= today.getFullYear();
		birthYY	= parseInt( jumin1.value.substring(0, 2) );
		sexCD	= parseInt( jumin2.value.substring(0, 1) );

		if( sexCD >= 3 ){
			birthYear = 2000 + birthYY;
		} else{
			birthYear = 1900 + birthYY;
		}

		return (year - birthYear);
	}



	// ÇÑ±Û/¿µ¹® ±¸ºÐÇØ¼­ ÀÔ·Â¹Þ´Â ±ÛÀÚ¼ö Á¦ÇÑ..
	function limitLength(oElement, iMaxCount) {
		var strTemp = "", strChar;
		var intCounter = 0;

		for(var i=0; i<oElement.value.length; i++){
			strChar = oElement.value.charAt(i);
			strChar.getbyte;
			
			if(escape(strChar).length > 4){
				intCounter += 2;
			} else{
				intCounter++;
			}
			

			if(intCounter > iMaxCount){
				alert("ÀÔ·ÂÀº ÃÖ´ë ÇÑ±Û " + iMaxCount/2 + "±ÛÀÚ, ¿µ¹® " + iMaxCount + "±ÛÀÚ¸¸Å­ °¡´ÉÇÕ´Ï´Ù.");
				
				oElement.value = oElement.value.substring(0, i);
				oElement.focus();
			}
		}
	}



















/*****************************************************************************************
		¡Ø String °´Ã¼ È®Àå..
*****************************************************************************************/

	//-----------------------------------------------------------------------------
	// ¹®ÀÚÀÇ ÁÂ, ¿ì °ø¹é Á¦°Å
	// @return : String
	// ex) ¹®ÀÚ¿­.trim();
	//-----------------------------------------------------------------------------
	String.prototype.trim = function() {
		return this.replace(/(^\s*)|(\s*$)/g, "");
	};



	//-----------------------------------------------------------------------------
	// ¹®ÀÚÀÇ ÁÂ °ø¹é Á¦°Å
	// @return : String
	// ex) ¹®ÀÚ¿­.ltrim();
	//-----------------------------------------------------------------------------
	String.prototype.ltrim = function() {
		return this.replace(/(^\s*)/, "");
	};



	//-----------------------------------------------------------------------------
	// ¹®ÀÚÀÇ ¿ì °ø¹é Á¦°Å
	// @return : String
	// ex) ¹®ÀÚ¿­.rtrim();
	//-----------------------------------------------------------------------------
	String.prototype.rtrim = function() {
		return this.replace(/(\s*$)/, "");    
	};




	//-----------------------------------------------------------------------------
	// ÀÌ¸ÞÀÏÀÇ À¯È¿¼ºÀ» Ã¼Å©
	// @return : boolean
	// ex) ¹®ÀÚ¿­.isEmail();
	//-----------------------------------------------------------------------------
	String.prototype.isEmail = function() {
		return (/\w+([-+.]\w+)*@\w+([-.]\w+)*\.[a-zA-Z]{2,4}$/).test(this.trim());
	};





	//-----------------------------------------------------------------------------
	// ¹®ÀÚ¿­ÀÇ ¹ÙÀÌÆ®¼ö ¸®ÅÏ
	// @return : int
	// ex) ¹®ÀÚ¿­.bytes();
	//-----------------------------------------------------------------------------
	String.prototype.bytes = function() {
		var cnt = 0;

		for (var i = 0; i < this.length; i++) {
			if (this.charCodeAt(i) > 127)
				cnt += 2;
			else
				cnt++;
		}

		return cnt;
	};




	//-----------------------------------------------------------------------------
	// Á¤¼öÇüÀ¸·Î º¯È¯
	// @return : int
	// ex) ¹®ÀÚ¿­.int();
	//-----------------------------------------------------------------------------
	String.prototype.int = function() {
		if(!isNaN(this)) {
			return parseInt(this, 10);
		}
		else {
			return null;    
		}
	};



	//-----------------------------------------------------------------------------
	// ¼ýÀÚ¿¡ 3ÀÚ¸®¸¶´Ù , ¸¦ Âï¾î¼­ ¹ÝÈ¯
	// @return : º¯È¯µÈ String ( ex) 12,345,678 )
	// ex) ¹®ÀÚ¿­.money();
	//-----------------------------------------------------------------------------
	String.prototype.money = function() {
		var num = this.trim();

		while((/(-?[0-9]+)([0-9]{3})/).test(num)) {
			num = num.replace((/(-?[0-9]+)([0-9]{3})/), "$1,$2");
		}

		return num;
	};




	//-----------------------------------------------------------------------------
	// ¼ýÀÚÀÇ ÀÚ¸®¼ö(cnt)¿¡ ¸Âµµ·Ï ¹ÝÈ¯
	// @return : º¯È¯µÈ String			ex) "33".digits(4) => "0033";
	// ex) ¹®ÀÚ¿­.digits(ÀÚ¸®¼ö);
	//-----------------------------------------------------------------------------
	String.prototype.digits = function(cnt) {
		var digit = "";

		if (this.length < cnt) {
			for(var i = 0; i < cnt - this.length; i++) {
				digit += "0";
			}
		}

		return digit + this;
	};



	//-----------------------------------------------------------------------------
	// ¹®ÀÚ¿­¿¡ Æ÷ÇÔµÈ ¼ýÀÚ¸¸ °¡Á® ¿À±â
	// @return : String					ex) "-123$asdf456".num() => "123456";
	// ex) ¹®ÀÚ¿­.num();
	//-----------------------------------------------------------------------------
	String.prototype.num = function() {
		return (this.trim().replace(/[^0-9]/g, ""));
	};
