<!--

// Three main functions:
// toggleOnOff(id_str); setToOn(id_str); setToOff(id_str); 

this.toggleOnOff = function (id_str) {
	//alert(id_str);
	if (id_str == null) {
		return false;
	}

	var class_str = this.getClassNameByID(id_str);
	switch (class_str) {
		case "activeOn":
			this.setToOff(id_str);
			break;
		case "activeOff":
			this.setToOn(id_str);
			break;
	}
}

this.setToOn = function (id_str) {
	//alert(id_str);
	if (id_str == null) {
		return false;
	}

	var class_str = "activeOn";

	this.switchClassByID(id_str, class_str);

	//if this activeOnOff ID is part of a set, deal with it
	if (this.setsID_array[id_str] != null) {
		var set_str = this.setsID_array[id_str];
		for (var i in this.sets_array[set_str]) {
			//alert(i);
			if (i != id_str) {
				this.setToOff(i);
			}
		}
		//alert(set_str+" : "+this.sets_array[set_str][id_str]);
		this.sets_array[set_str][id_str] = "on";
	}
}

this.setToOff = function (id_str) {
	//alert(id_str);
	if (id_str == null) {
		return false;
	}

	var class_str = "activeOff";

	this.switchClassByID(id_str, class_str);

	//if this activeOnOff ID is part of a set, deal with it
	if (this.setsID_array[id_str] != null) {
		var set_str = this.setsID_array[id_str];
		this.sets_array[set_str][id_str] = "off";
		//alert(set_str+" : "+this.sets_array[set_str][id_str]);
	}
}

// Use this function if you want turning one item on to turn off the other items in the set:
// addToSet(id_str, set_str); 

this.addToSet = function (id_str, set_str) {
	if (!this.sets_array[set_str]) {
		this.sets_array[set_str] = new Array();
	}
	this.sets_array[set_str][id_str] = "notsetyet";

	this.setsID_array[id_str] = set_str;

}


/////////////////////////////////////////////////////
// Private functions

//these two arrays are only used in the case of sets
this.sets_array = new Array();
this.setsID_array = new Array();



this.switchClassByID = function (id_str, class_str) {
	var a = document.getElementById(id_str);
	a.className = class_str;
}

this.getClassNameByID = function (id_str) {
	var a = document.getElementById(id_str);
	return a.className;
}

//-->
