function updateChar(length_limit, seq)
{

	var comment='';
	comment = eval("document.frm_comment.comment_"+seq);
	
	var form = document.frm_comment;
//	alert(comment.value);
	var length = calculate_msglen(comment.value);
//	max_text.innerText = length;
	if (length > length_limit) {
		alert("ÃÖ´ë " + length_limit + "byte¸¸ ÀÔ·ÂÀÌ °¡´ÉÇÕ´Ï´Ù.\nÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		comment.value = comment.value.replace(/\r\n$/, "");
		comment.value = assert_msglen(comment.value, length_limit);
/*
	} else if (length == length_limit) {
		form.comment.value = form.comment.value.replace(/\r\n$/, "");
*/
	}
}
function calculate_msglen(message)
{
	var nbytes = 0;

	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}

	return nbytes;
}
function assert_msglen(message, maximum)
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}
//	max_text.innerText = nbytes;
	return msg;
}