﻿/*******************************************************
 * JavaScript utilities file for the calendar project
 *******************************************************/

function onPickerChange(picker)
{
  calendarPicker.SetSelectedDate(picker.GetSelectedDate());
}
function onCalendarChange(calendar)
{
  labelPicker.SetSelectedDate(calendar.GetSelectedDate());
}

// OnClickToggleAll function: toggles all checkboxes that are children of the CheckBoxList
// with ClientID = baseid. Recall that the children checkboxes will have an ID value equal to
// baseid_0, baseid_1, etc. The count parameter is the number of children checkboxes so the
// function knows how many checkboxes it has to toggle. Finally, flag is a string with the
// value 'true' or 'false' specifying whether the checkboxes need to be cleared (false) or
// set (true).
function OnClickToggleAll(baseid, count, flag)
{
  if (!isW3C && !isIE4) {
    alert('This link does not work in your browser.');
    return;
  }
  var id;
  for (i = 0; i < count; i++ )
  {
    id = baseid + '_' + i;
    if (isW3C) {
      document.getElementById(id).checked = flag;
    }
    else if (isIE4) {
      document.all[id].checked = flag;
    }
  }
}
