function validateCheckArray(whichForm,whichCheckBoxArray,myMin){
  var myForm = document.getElementById(whichForm);
  var _countChecked = 0;
  var dirty = 0;
  if(myForm[whichCheckBoxArray].length == undefined){
    if(myForm[whichCheckBoxArray].checked == true){
      _countChecked++;
    }
  } else {
    /* iterate through all the elements in the checkbox array */
    for(i=0;i<myForm[whichCheckBoxArray].length;i++){
      if(myForm[whichCheckBoxArray][i].checked===true)
      {
	_countChecked++;
      }
    }
  }
  if(_countChecked < myMin){
    dirty = 1;
  } else {
    dirty = 0;
  }
  return dirty;
}


function checkAllArray(whichForm,whichCheckBoxArray){
  var whichForm = document.getElementById(whichForm);
  for(i=0;i<whichForm[whichCheckBoxArray].length;i++)
    {
      whichForm[whichCheckBoxArray][i].checked=true;
    }
}

function uncheckAllArray(whichForm,whichCheckBoxArray){
  var whichForm = document.getElementById(whichForm);
  for(i=0;i<whichForm[whichCheckBoxArray].length;i++)
    {
      whichForm[whichCheckBoxArray][i].checked=false;
    }
}


function checkUpdateString(whichForm, whichCheckBoxArray){
  var checkedString = '';
  var cnt = 0;

  if(document[whichForm][whichCheckBoxArray].length == undefined){
    if(document[whichForm][whichCheckBoxArray].checked == true){
      checkedString = document[whichForm][whichCheckBoxArray].value;
    }
  } else {
    for(i=0;i<document[whichForm][whichCheckBoxArray].length;i++)
      {
        if(document[whichForm][whichCheckBoxArray][i].checked==true){
          if(cnt > 0){checkedString = checkedString + ','};
	  checkedString = checkedString + document[whichForm][whichCheckBoxArray][i].value;
          cnt++;
	}//end if
      }//end for
    }//end if	
  return checkedString;
}

