/**
 * Javascript SwatCheckboxList component
 *
 * @param id string Id of the matching {@link SwatCheckboxList} object.
 */
function SwatCheckboxList(id) {
	var self = this;
	this.check_list = document.getElementsByName(id + '[]');
	this.check_all = null; //a reference to a checkall widget (if it exists - set by the SwatCheckAll widget)

	var is_ie = (document.addEventListener) ? false : true;

	for (i = 0; i < this.check_list.length; i++) {
		if (is_ie)
			this.check_list[i].attachEvent("onclick", eventHandler);
		else 
			this.check_list[i].addEventListener("change", eventHandler, false);
	}


	function eventHandler(event) {
		self.checkAllInit();
	}
}

SwatCheckboxList.prototype.checkAllInit = function () {
	if (this.check_all == null)
		return;

	var count = 0;
	for (i = 0; i < this.check_list.length; i++)
		if (this.check_list[i].checked)
			count++;
		else if (count > 0)
			break; //can't possibly be all checked or none checked

	this.check_all.setState(count == this.check_list.length);
}

SwatCheckboxList.prototype.checkAll = function(checked) {
	for (i = 0; i < this.check_list.length; i++)
		this.check_list[i].checked = checked;
}

@@ -146,17 +146,17 @@
 List(id)
- 
+%0A
 %7B%0A%09var s
@@ -287,56 +287,8 @@
 dget
- (if it exists - set by the SwatCheckAll widget)
 %0A%0A%09v
@@ -442,17 +442,17 @@
 ent(
-%22
+'
 onclick
-%22
+'
 , ev
@@ -515,16 +515,16 @@
 ner(
-%22
+'
 change
-%22
+'
 , ev
@@ -547,17 +547,16 @@
 e);%0A%09%7D%0A%0A
-%0A
 %09functio
@@ -576,17 +576,18 @@
 r(event)
- 
+%0A%09
 %7B%0A%09%09self
@@ -662,17 +662,17 @@
 ction ()
- 
+%0A
 %7B%0A%09if (t
@@ -1011,17 +1011,17 @@
 checked)
- 
+%0A
 %7B%0A%09for (

Bring checkbox list JavaScript coding standards to 2006.