function SwitchCollection()
{
	var itsState = new Properties();
	var itsSwitches = new Properties();

	Publisher(this);

	this.addSwitch = function(inName,inSwitch)
	{
		itsSwitches.setProperty(inName,inSwitch);
		inSwitch.setName(inName);
		itsState.setProperty(inName,inSwitch.getControlState());
		inSwitch.addSubscriber(this,this.updateState);
	};

	//only expand the 1st switch
	this.reset = function(inProperties,inFlag)
	{
		if (inFlag)
		{
			var theKeys = itsSwitches.getKeys();
			for (var i = 0; i < theKeys.length; i++)
			{
				var theSwitch = itsSwitches.getProperty(theKeys[i]);
				if (i == 0)
					theSwitch.show();
				else
					theSwitch.hide();
				this.updateState(theSwitch);
			}
		}
	};

	this.setState = function(inProperties)
	{
		var theKeys = itsSwitches.getKeys();
		for (var i = 0; i < theKeys.length; i++)
		{
			if (inProperties.getProperty(theKeys[i]) == 1)
				itsSwitches.getProperty(theKeys[i]).show();
			else
				itsSwitches.getProperty(theKeys[i]).hide();
		}
	};

	this.updateState = function(inSwitch)
	{
		itsState.setProperty(inSwitch.getName(),inSwitch.getControlState());
		this.notifySubscribers(itsState);
	}
}