// this is the beginnings of a set of functions that will limit the mount of chars
// a text area can use.  It needs to be made generic.

// Usage:
//<FORM NAME="form" onsubmit="docheck();alert('This javascript will not send.  It is just a sample.')">
//	<TEXTAREA onclick="docheck(125,this)" onkeyup="javascript:doleft(125,this);" id="text" name="text" Rows="6" Cols="24"></TEXTAREA>
//	<BR><BR>You have <INPUT Type="Text" Name="charsleft" value="125" Size="3" readonly id="left"> characters left.<BR><BR>
//	<INPUT Type="submit" Name="" Value="Send!"> &nbsp 
//	<input type="reset" value="Clear"><BR><BR>
//</FORM>

function doleft(maxChars,textAreaObj,charsLeftObj) {
//alert (charsLeftObj.name);
	total = eval(maxChars)
	//alert(eval(charsLeftObj));
	//thisForm = textAreaObj.form
	//alert(textAreaObj.text.value.length)
	//alert(charsLeftObj.value)
	currentChars = eval(textAreaObj.value.length)
	theCharsLeft = eval(total - currentChars)
	if (theCharsLeft <= "-1")
	{
		var dif = eval(currentChars - maxChars)
		var value = textAreaObj.value.substr(0,currentChars-dif);
		textAreaObj.value = value;
		var theCharsLeft = "0";
		charsLeftObj.style.color="red";
		charsLeftObj.style.fontWeight="bold";
		charsLeftObj.value = "Maximum " + maxChars + " characters reached!";
	}
	else 
	{
	charsLeftObj.style.color="black";
	charsLeftObj.value = theCharsLeft + " characters remaining"
	}
}




