﻿// JScript File

function KGInterestFilterControl_CheckBoxOnClick_Wrapped(_checkBox, optionListDivID)
{
  // do nothing if the user is checking the box
  if (_checkBox.checked == true)
    return;
  
  // otherwise ensure that at least one other check box is checked
  var checkBoxContainer = document.getElementById(optionListDivID);
  
  if (checkBoxContainer != null)
  {
    // get the checkboxes
    checkBoxArray = checkBoxContainer.getElementsByTagName("input");
    
    var checked = false;
    
    // loop through checkboxes until we find one that's checked
    for (var i=0; i<checkBoxArray.length && !checked; i++)
    {
      checked = checkBoxArray[i].checked;
    }
    // if there are no others checked, keep this one checked
    if (!checked)
      _checkBox.checked = true;
  }
}
