// This function deselects all options in a specified div
function deselectAllOptions(id, parent_id) {
  for(x = 0; x < document.getElementById(id).options.length; x++) {
    document.getElementById(id).options[x].selected = false;
  }

  // Change to the function of "Select All"
  //var new_link = document.getElementById(parent_id).getElementsByTagName('a');

  //new_link[0].setAttribute('onclick', '');
  //new_link[0].innerHTML = '';

  //new_link[0].setAttribute('onclick', 'selectAllOptions(\'' + id + '\', \'' + parent_id + '\')');
  //new_link[0].innerHTML = 'Select All';

  return false;
}

function selectAllOptions(id, parent_id) {
  for(x = 0; x < document.getElementById(id).options.length; x++) {
    document.getElementById(id).options[x].selected = true;
  }

  // Change to the function of "Clear All"
  //var new_link = document.getElementById(parent_id).getElementsByTagName('a');


  //new_link[0].setAttribute('onclick', '');
  //new_link[0].innerHTML = '';

  //new_link[0].setAttribute('onclick', 'deselectAllOptions(\'' + id + '\', \'' + parent_id + '\')');
  //new_link[0].innerHTML = 'Clear All';

  return false;
}

// This function deselects all items in a checkbox area
function deselectAllCheckboxes(id) {
  var checkboxes = document.getElementById(id).getElementsByTagName('input');

  for(x = 1; x < checkboxes.length; x++) {
    checkboxes[x].checked = false;
  }

  // Change to the function of "Select All"
  //var new_link = document.getElementById(id).getElementsByTagName('a');

  //new_link[0].setAttribute('onclick', '');
  //new_link[0].innerHTML = '';

  //new_link[0].setAttribute('onclick', 'selectAllCheckboxes(\'' + id + '\')');
  //new_link[0].innerHTML = 'Select All';

  return false;
}

function selectAllCheckboxes(id) {
  var checkboxes = document.getElementById(id).getElementsByTagName('input');

  for(x = 1; x < checkboxes.length; x++) {
    checkboxes[x].checked = true;
  }

  // Change to the function of "Select All"
  //ar new_link = document.getElementById(id).getElementsByTagName('a');

  //new_link[0].setAttribute('onclick', '');
  //new_link[0].innerHTML = '';

  //new_link[0].setAttribute('onclick', 'deselectAllCheckboxes(\'' + id + '\')');
  //new_link[0].innerHTML = 'Clear All';

  return false;
}