/*requires jquery-1.3.2.min.js*/

/*
	Requires the jQuery library
*/
$(function() { // bind to document ready state (triggers when document has loaded)
	var selectorCB = $("#SelectorCheckBox");
	selectorCB.click(function() {
		// for each checkbox with id attribute that starts with "cb_"
		$("input:checkbox[id^='cb_']").each(function() {
			// if current cb is not disabled, set checked status to same as the selector cb
			if ($(this).is(":not(:disabled)")) $(this).attr("checked", selectorCB.attr("checked"));
			$(this).click(function() {
				// if current cb is unchecked, also uncheck the selector cb
				if (selectorCB.is(":checked") && $(this).is(":not(:checked)"))
					selectorCB.attr("checked", false);
			});
		});
	});
});
