
	function chkBlank(str){
		if (str.indexOf(" ") != -1){
			return false;
		}else{
			return true;
		}
	}

	function chkStrLen(str) {
		var strCnt = 0;
		for(var i = 0; i < str.length; i++){
			strCnt += (str.charCodeAt(i) > 127) ? 2: 1;
		}
		return strCnt;
	}

	function chkRegPattern(pType,strInput){
		var regPattern;
		var arrResult;
		if(pType != 'undefined' && strInput != 'undefined'){
			switch (pType){
				case 'num' : regPattern = /^[\d]+[\d]$/;break;
				case 'han' : regPattern = /^[°¡-ÆR]+[°¡-ÆR]$/;break;
				case 'eng' : regPattern = /^[a-zA-Z]+[a-zA-Z]$/;break;
				case 'ju1' : regPattern = /^([\d]{2})(0[1-9]{1}|1[0-2]{1})(0[1-9]{1}|[1-2][\d]{1}|3[0-1]{1})$/;break;
				case 'ju2' : regPattern = /^([1-4]{1})([\d]{6})$/;break;
				case 'uid' : regPattern = /^([a-zA-Z]{1})([\w-]{5,14})/;break;
				case 'pwd' : regPattern = /^[\w]{6,15}/;break;
				case 'ans' : regPattern = /^[°¡-ÆR\w\s-]{2,20}/;break;
				case 'ma1' : regPattern = /^[\w]+/;break;
				case 'ma2' : regPattern = /^[\w.-]+.[a-zA-Z]{2,5}/;break;
				case 'con1' : regPattern = /^[0]{1}[1-6]{1}[0-9]{0,1}/;break;
				case 'con2' : regPattern = /^[1-9]{1}[0-9]{2,3}/;break;
				case 'con3' : regPattern = /^[0-9]{4}/;break;
				case 'nick' : regPattern = /^[a-zA-Z°¡-ÆR]{1}[°¡-ÆR\w-]{1,11}/;break;
				case 'char' : regPattern = /^[a-zA-Z°¡-ÆR]{1}[a-zA-Z°¡-ÆR]{1,19}/;break;
				default : return false; break;
			}
			result = regPattern.test(strInput);
			return result;
			//result = strInput.match(regPattern);
			/*result = regPattern.exec(strInput);
			if ( result.split(",")(0) == strInput){return true;
			}else{return false;}*/
		}else{
			return false;
		}
	}

	function openNickWin(objNick){
		if (chkBlank(objNick.value) == false){
			errMsg(objNick, '»ç¿ëÇÏ½Ç ´Ð³×ÀÓ¿¡ ºó°ø°£ÀÌ Æ÷ÇÔµÇ¾îÀÖ½À´Ï´Ù.'); return false;
		}
		if( chkStrLen(objNick.value) < 4 ){
			errMsg(objNick, '»ç¿ëÇÏ½Ç ´Ð³×ÀÓÀ» ¿µ¹® 4±ÛÀÚ ÀÌ»ó ÇÑ±Û 2±ÛÀÚ ÀÌ»óÀÇ ÇÑ±Û, ¿µ¹®, ¼ýÀÚ·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä'); return false;
		}
		winNic = window.open('about:blank','winUserNic','width=300px,height=280px,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');
		if( winNic != undefined && winNic != null){
			var frm=createForm("frmDup", "post", 'member_makenick_pop.asp', "winUserNic");
			frm=addHidden(frm, "userNick", objNick.value);
			document.insertBefore(frm);
			frm.submit();
			winNic.focus();
		}else{
			alert('ÆË¾÷Â÷´ÜÀ» ÇØÁ¦ÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.');return false;
		}
	}

	function setCharGender(strA){
		switch (strA){
		case '0' : return '³²ÀÚ'; break;
		case '1' : return '¿©ÀÚ'; break;
		default : return null; break;
		}
	}

	function setCharacterJob(strA){
		switch (strA){
		case '0' : return 'Àü»ç'; break;
		case '1' : return '¼ú»ç'; break;
		case '2' : return 'µµ»ç'; break;
		case '3' : return '»ì¼ö'; break;
		default : return null; break;
		}
	}

	function setServerChar(){
		var arrChar, arrCharInfo;
		if(this.req.readyState == 4) {
			if(this.req.status == 200) {
				if ( this.req.responseText.length > 4){
					arrChar = this.req.responseText.split(',');
					for (var i = 0; i < arrChar.length ; i++){
						if (arrChar[i].length > 4){
							if ( arrChar[i].indexOf('|||') > 0)	{
								arrCharInfo = arrChar[i].split('|||');
								if (arrCharInfo.length == 4){
									addSelectOpt('selCharacter', arrChar[i], arrCharInfo[0]+'('+setCharacterJob(arrCharInfo[1])+'\/'+'Lv.'+arrCharInfo[2]+'\/'+setCharGender(arrCharInfo[3])+')');
								}
							}
						} // length
					} // for
				}
			} // status
		} //readyState
	}

	function chgCharServer(selVal){
		//resetCharInfo();
		resetSelectOpt('selCharacter','')
		if (selVal.length > 8){
			var strParams = "";
			var str_Url =  "/sitelib/get_serverchar.asp?s="+selVal;
			var myAjax = new net.ContentLoader(str_Url, setServerChar, null, "POST", strParams);
		}
	}



	function chgCharacter(selVal){
		var charInfo;
		var charFlag = false;
		var objServer = document.getElementById('selServer');
		var objChar = document.getElementById('selCharacter');
		if (objServer != undefined && objServer.options[objServer.selectedIndex].value.length > 4){
			document.getElementById('txtServer').value = objServer.options[objServer.selectedIndex].value;
			if (selVal != undefined){
				charInfo = selVal;
			}else{
				charInfo = objChar.options[objChar.selecetedIndex].value;
			}
			if (charInfo.indexOf('|||') > 0){
				var arrCharInfo = charInfo.split('|||');
				if (arrCharInfo.length == 4){
					charFlag = true;
					document.getElementById('txtCharacter').value = arrCharInfo[0].trim();
					document.getElementById('txtCharJob').value = arrCharInfo[1].trim();
					document.getElementById('txtCharLevel').value = arrCharInfo[2].trim();
					document.getElementById('txtCharGender').value = arrCharInfo[3].trim();
					document.getElementById('tdButton').innerHTML = '<a href="#self" onfocus="this.blur();" onclick="goPayItem()"><img src="images/b_next.gif" width="174" height="28" border="0"></a>';
				}else{
					charFlag = false;
				}
			}else{
				charFlag = false;
			}
		}else{
			charFlag = false;
		}
		if (charFlag == false){
			resetCharInfo();
		}
	}

	function resetCharInfo(){
	/*
		document.getElementById('txtCharacter').value = '';
		document.getElementById('txtCharJob').value = '';
		document.getElementById('txtCharLevel').value = '';
		document.getElementById('txtCharGender').value = '';
		document.getElementById('tdButton').innerHTML = '';
		*/
	}
