// JavaScript Document
<!-- Begin
function textCounter(field, countfield, maxlimit) 
{
	// modified to count and exclude html tags
	start_html = 0;
	len = field.value.length;
	real_length = 0;
	//alert(field.value);
	//alert(len);
	bl = 0;
	bl_rep = 0;
	nl = 0;
	trunc_len = 0;
	
	for(i=0; i<len; i++)
	{
		// alert(i + ':' + field.value.charAt(i));
		if( field.value.charAt(i) == '<' )
		{
			start_html = 1;
		}
		else
		if( start_html )
		{
			if( field.value.charAt(i) == '>' )
			{
				start_html = 0;
			}
		}
		else
		{
			if( field.value.charAt(i) == " " )
			{
				bl++;
				if( blank )
				{
					bl_rep++;
					// alert('not counted');
				}
				else
				{
					// real_length++;
				}
				blank = 1;
			}
			else
			if( field.value.charAt(i) == '\n' )
			{
				nl++;
			}
			else
			{
				// for debugging only
//				if( alphaArray.indexOf( field.value.charAt(i) ) < 0 )
	//				alert( i + " : " + field.value.charAt(i) + " : " + alphaArray.indexOf( field.value.charAt(i) ) );
				blank = 0;
				real_length++;
			}
		}
		
		if( real_length == maxlimit )	
			trunc_len = i+1;
	}

	// if exceeds maximum, truncate
	if( real_length > maxlimit )	
	{
		field.value = field.value.substring(0, trunc_len);
		countfield.value = 0;
	}
	else	
		countfield.value = maxlimit - real_length;
}
// End -->