// Function to change a given form's checkboxes to the given state
function change_form_cb_state(formname, state)
{
   /* N.B.: Unfortunately, getting an array of a form's input controls gives you all the form's input types, not just checkboxes */

   /* Get the array of this form's inputs */
   var inputs = document.getElementById(formname).getElementsByTagName("input");

   /*Cycle through each of this form's input controls & if it's a checkbox, then change its checked status to the given state */
   for(var i = 0; i < inputs.length; i++)
   {
      if(inputs[i].type == "checkbox") { inputs[i].checked = state; }
   }

   if (document.getElementById('download')) { enableButton(); }
}

function beginDownload()
{
   var button      = document.getElementById('download');
   button.value    = 'Preparing download. . .';
   button.disabled = true;
}

function enableButton()
{
   document.getElementById('download').disabled = false;
   document.getElementById('download').value    = 'Download';
}  

