/**
* Count form characters - K Hackenberg (Gould) - 12-21-2006

Example of Use --

Note:
text field is named: ws_comments
form is named: cv


The following goes in the form itself right on the page --
--- start --

<textarea name="ws_comments" cols="50" rows="5" id="ws_comments" onBlur="if(ie4)this.style.backgroundColor='ffffff';" onKeyDown="update();"></textarea><br><script type="text/javascript" language="JavaScript1.2"><!--
 document.write('<font color="#666666" size="-2" face="Verdana,Sans-serif">Characters typed: <input '+
  'type="text" size="2" name="counter" value=""'+
  'readonly onfocus="this.form.ws_comments.focus()"> (<font color="#ff0000" size="-2" face="Verdana,Sans-serif">limit: '+
  limit+')');
 //--></script>
 
 --- end --
 
 change "limit" to choice
 rename "form" and "testfield" to choice
 
*/

 function check() {
   if(document.cv.ws_comments.value.length > limit) {
     alert('Too much data!');
     document.cv.ws_comments.focus();
     return false; }
   else
     return true; }
 function update() {
   var old = document.cv.counter.value;
   document.cv.counter.value=document.cv.ws_comments.value.length;
   if(document.cv.counter.value > limit && old <= limit) {
     alert('Too much data in the text box!');
     if(document.styleSheets) {
       document.cv.counter.style.fontWeight = 'normal';
       document.cv.counter.style.color = '#666666'; } }
   else if(document.cv.counter.value <= limit && old > limit
	   && document.styleSheets ) {
       document.cv.counter.style.fontWeight = 'normal';
       document.cv.counter.style.color = '#000000'; } 
   }
   
