function query_Check(check) {
	Agent = navigator.appName;
	IE = "Microsoft Internet Explorer";
	NS = "Netscape";

	check.query.value = check.query.value.replace(/(^\s*)|(\s*$)/g, "");
	if (Agent == IE) {											//ÀÍ½ºÇÃ·Î¾î´Â ÇÑ±ÛÀ» 1byte Ã³¸®
		if (check.query.value.length < 2) {						//°Ë»ö¾î 2ÀÚ¸® ÀÌ»ó Ã¼Å©
			alert("°Ë»ö¾î´Â 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
			return false;
		}
	}
	else {														//³Ý½ºÄÉÀÌÇÁ´Â ÇÑ±ÛÀ» 2byte Ã³¸®
		Korea = STR_Check(check.query.value);					//ÇÑ±Û À¯¹« Ã¼Å©(Æ¯¼ö¹®ÀÚ Æ÷ÇÔ)
		if (!Korea) {											//°Ë»ö¾î°¡ ÇÑ±Û or Æ¯¼ö¹®ÀÚ·Î ±¸¼ºµÇÁö ¾ÊÀº °æ¿ì
			if (check.query.value.length < 2) {
				alert("°Ë»ö¾î´Â 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
				return false;
			}
		}
		else {													//°Ë»ö¾î°¡ ¸ðµÎ ÇÑ±Û or Æ¯¼ö¹®ÀÚÀÎ °æ¿ì
			if (check.query.value.length < 4) {
				alert("°Ë»ö¾î´Â 2±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
				return false;
			}
		}
	}

	if (/[!-\/:-@\[-\^`\{-~]+/.test(check.query.value)) {
		alert("Æ¯¼ö¹®ÀÚ´Â ¾ð´õ¹Ù(_) ¸¸ °Ë»öÀÌ °¡´ÉÇÕ´Ï´Ù.");
		return false;
	}

	if (check.dir.value) {
		var message = quick_Check();
		if (message == true) return true;
		else {
			alert(message);
			return false;
		}
	}
	else return true;
}

function STR_Check(str) {
	for (var i=0; i < str.length; i++) {
		var ch = escape(str.charAt(i));							//ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ 
		if (STR_CharByte(ch) != 2) return false;
	}
	return true;
}

function STR_CharByte(chStr) {
	if (chStr.substring(0, 2) == "%u") {
		if (chStr.substring(2,4) == "00") return 1;
		else return 2;											//ÇÑ±Û or 2byte Æ¯¼ö¹®ÀÚ
	}
	else if (chStr.substring(0,1) == "%") {
		if (parseInt(chStr.substring(1,3), 16) > 127) return 2;	//ÇÑ±Û or 2byte Æ¯¼ö¹®ÀÚ
		else return 1;
	}
	else return 1;
}

