// These are for toggling programs of interest blocks
var programSwitch = new Object();
Object.extend(programSwitch, {
	init: function(aRadios, aPrograms)
	{
		this.theRadios = aRadios;
		this.thePrograms = aPrograms;
		this.assignProgramListeners();
	},
	
	assignProgramListeners: function()
	{
		var __method = this;
		
		for(var i=0; i<this.theRadios.length; i++)
		{
			__method.theRadios[i].onclick = function() { programSwitch.listProgram(this.alt) };
		}
	},
	
	listProgram: function(aProgram)
	{
		for(var i=0; i<this.thePrograms.length; i++)
		{
			var disp = (this.thePrograms[i].id == aProgram) ? 'block' : 'none';
			this.thePrograms[i].style.display = disp;
		}
	}
});

InterestSwitch = function()
{
	
	this.init = function(aController, aSwing, anObject)
	{
		this.theController = aController;
		this.theSwing = aSwing;
		this.theObjects = anObject;
		this.InstallListener();
		
		var theCur = this.theController[this.theController.selectedIndex].value;
		this.ListInterests(theCur);
	};
	
	this.InstallListener = function()
	{
		var __method = this;
		
		//__method.theController.onchange = function() { interestSwitch.ListInterests(this[this.selectedIndex].value) };
		addEvent(this.theController, 'change', function() { __method.ListInterests(this[this.selectedIndex].value) });
	};
	
	this.ListInterests = function(anIndex)
	{
		for(var i=0; i<this.theObjects.length; i++)
		{
			var theDisplay = (this.theObjects[i].id == this.theSwing[anIndex]) ? 'block' : 'none';
			this.theObjects[i].style.display = theDisplay;
		}
	};
	
};

