
/**
 * Constructs a CtrlButtons Object, used for managing a list of control buttons available on the page.
 *
 * @param arguments ID list of buttons to declare
 *
 * @return CtrlButtons Object
 */
function CtrlButtons () {
	
	this.buttons = new Object();
	
	var sButton, oButton;
	with (CtrlButtons) {
		for (var i=0; i<arguments.length; i++) {
			sButton	= arguments[i];
			oButton = document.getElementById ? document.getElementById(sButton) : document.all ? document.all(sButton) : null; 
			if (oButton!=null) this.buttons[sButton] = oButton;
		}
	}
	
	return this
}

/**
 * Enable / Disable a button
 *
 * @param bEnabled should the button be enabled (true) or not (false) ?
 * @param button ID of button
 *
 */
CtrlButtons.prototype.toggle = function (bEnabled, sButton) {

	var oButton = this.buttons[sButton];

	if (oButton && oButton.className) {		
		if (bEnabled)  {
			//oButton.disabled = false;
			oButton.className = oButton.className.replace(/ disabled/," enabled");
		} else {
			//oButton.disabled = true;
			oButton.className = oButton.className.replace(/ enabled/," disabled");
		}
	}

}

