FormFunctions.js

    //checks all DataGrid CheckBoxes with the given name with the given value

    function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal) {
        re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon
        for(i = 0; i < document.forms[0].elements.length; i++) {
            elm = document.forms[0].elements[i]
            if (elm.type == 'checkbox') {
                if (re.test(elm.name)) {
                    elm.checked = checkVal
                }
            }
        }
    }


// THESE ARE USED IN THE CALCULATOR
function process(field){
  var res=document.getElementById('result'); // the id of the result div box
  var line=field.value.split("");
  var key=line.pop();
     if ( key=='=' )
        {
         if (check_eval(line.join(''))==1) eval('x='+line.join('')+'; res.innerHTML=x;');
         else res.innerHTML='Invalid expression!';
        }

  return 1;
}

function check_eval(line)
{
numcheck = /\*\/|\/\*|\-\*|\+\*|\-\/|\+\/|\=|\.\*|\.\-|\.\+|\.\/|\.\d+\.|\d +\d/;
if (!numcheck.test(line)) return 1;
else return 0;
}

function rightchars(e,field)
{
var keynum;
var keychar;
var check_2;
if(window.event) // IE
  {
  keynum = e.keyCode;
  keychar = String.fromCharCode(keynum);
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  keychar = String.fromCharCode(keynum);
  if (keynum==8) keychar=0; //delete firefox bug
  }
else keychar=0; // firefox bug
check_2 =/\d|\+|\-|\/|\*|\.|\=/
return (check_2.test(keychar));
}
