function checkAll(checkWhat) {
  // Find all the checkboxes...
  var pat_name=RegExp("^"+checkWhat, "i");  
  
  var inputs = document.getElementsByTagName("input");

  // Loop through all form elements (input tags)
  for(index = 0; index < inputs.length; index++)
  {
//alert(checkWhat);  	
//alert(pat_name.test(inputs[index].name));  	
    // ...if it's the type of checkbox we're looking for, toggle its checked status
//    if(inputs[index].name == checkWhat)
	if (pat_name.test(inputs[index].name)) 
      if(inputs[index].checked == 0)
      {
        inputs[index].checked = 1;
      }
     
  }

}

function uncheckAll(checkWhat) {
  // Find all the checkboxes...
  //var pat_name=/^photoc/;  
  var pat_name=RegExp("^"+checkWhat, "i");  
  var inputs = document.getElementsByTagName("input");

  // Loop through all form elements (input tags)
  for(index = 0; index < inputs.length; index++)
  {
    // ...if it's the type of checkbox we're looking for, toggle its checked status
//    if(inputs[index].name == checkWhat)
	if (pat_name.test(inputs[index].name))
     if(inputs[index].checked == 1)
      {
        inputs[index].checked = 0;
      }
  }

}
