// JavaScript Document

// Function to check all and uncheck all checkboxes in a group of checkboxes.
<!-- Begin
var checkflag = "false";
function chkUnChk(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";}
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";}
}
// End -->

// Function for limiting the amount of text within a textarea field.
// **For remaining characters use: <input disabled type="text" name="charRem" size=3 maxlength=3 value="100"></td>
// **Use this as the text area field: <textarea name="fieldname" cols="60" rows="4" id="fieldname" onKeyDown="textCounter(this.form.fieldname,this.form.charRem,100);" onKeyUp="textCounter(this.form.fieldname,this.form.charRem,100);"></textarea>
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long, trim it and alert user
{
field.value = field.value.substring(0, maxlimit);
window.alert("You've entered too many characters, only " + maxlimit + " max allowed.");
}
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
// End -->

// Function to open a popup window displaying the help topic.
<!-- Begin
function win(fileName) {
     myWin = window.open('','myWindow','scrollbars=no,directories=no,status=no,resizable=yes,toolbar=no,history=no,location=no,menubar=no,width=840,height=550,scrollbars=yes')
     myWin.location.href = fileName;
}
// End -->

// Function to show/hide div tags.  Used for displaying additional information.
<!-- Begin
// quick browser tests
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var ie5 = (document.all && document.getElementById) ? true : false;
var ns6 = (!document.all && document.getElementById) ? true : false;

function show(sw,obj) {
	// show/hide the divisions
	if (sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'visible';
	if (!sw && (ie4 || ie5) ) document.all[obj].style.visibility = 'hidden';
	if (sw && ns4) document.layers[obj].visibility = 'visible';
	if (!sw && ns4) document.layers[obj].visibility = 'hidden';
}
// End -->

// Function to deny specific characters (place characters in a hidden field such as:
// <input type="hidden" name="deny_chars" value="!@#%^*+=?:" />
<!-- Begin
function deny_chars(e, arraytodeny) 
{ 
   var key; 
   var keychar; 
   if (window.event) 
     key = window.event.keyCode; 
   else if (e) 
     key = e.which; 
   else 
     return true; 
  
   keychar = String.fromCharCode(key); 
    
   if ((key == null) || (key == 0) || (key == 8) || (key == 13) || (key == 27) || (key == 9)) 
     return true; 
   else if (arraytodeny.indexOf(keychar) > -1) 
     return false; 
   else if ((arraytodeny.indexOf(keychar) == -1)) { 
     return true; 
   } else { 
     return true; 
	} 
 } 
// End -->

