// ==============================================================================================================================
// Class ButtonSet1
// ==============================================================================================================================
function ButtonSet1 () {
	this.construct();
}

//-----------------------------------------------------------------
// Method ButtonSet1.construct()
//-----------------------------------------------------------------
ButtonSet1.prototype.construct = function () {
	this.buttons = new Array();
}

//-----------------------------------------------------------------
// Method ButtonSet1.addButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.addButton = function (oButton) {
	this.buttons[oButton.id] = oButton;
	this.buttons[oButton.id].buttonSet = this;
} // addButton

//-----------------------------------------------------------------
// Method ButtonSet1.getButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.getButton = function (sId) {
	return this.buttons[sId];
} // addButton

//-----------------------------------------------------------------
// Method ButtonSet1.enableAll()
//-----------------------------------------------------------------
ButtonSet1.prototype.enableAll = function () {
	var i;
	for ( i in this.buttons )
		this.buttons[i].enable();
} // enableAll

//-----------------------------------------------------------------
// Method ButtonSet1.disableAll()
//-----------------------------------------------------------------
ButtonSet1.prototype.disableAll = function () {
	var i;
	for ( i in this.buttons )
		this.buttons[i].disable();
} // disableAll

//-----------------------------------------------------------------
// Method ButtonSet1.enableButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.enableButton = function (sId) {
	this.buttons[sId].enable();
} // enableButton

//-----------------------------------------------------------------
// Method ButtonSet1.disableButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.disableButton = function (sId) {
	this.buttons[sId].disable();
} // disableButton

//-----------------------------------------------------------------
// Method ButtonSet1.showButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.showButton = function (sId) {
	this.buttons[sId].show();
} // showButton

//-----------------------------------------------------------------
// Method ButtonSet1.hideButton()
//-----------------------------------------------------------------
ButtonSet1.prototype.hideButton = function (sId) {
	this.buttons[sId].hide();
} // hideButton

//-----------------------------------------------------------------
// Method ButtonSet1.showAll()
//-----------------------------------------------------------------
ButtonSet1.prototype.showAll = function () {
	var i;
	for ( i in this.buttons )
		this.buttons[i].show();
} // showAll

//-----------------------------------------------------------------
// Method ButtonSet1.hideAll()
//-----------------------------------------------------------------
ButtonSet1.prototype.hideAll = function () {
	var i;
	for ( i in this.buttons )
		this.buttons[i].hide();
} // hideAll



Button1.prototype = new InterfaceElement1;
Button1.prototype.constructor = Button1;
Button1.superclass = InterfaceElement1.prototype;

// ==============================================================================================================================
// Class Button1
// ==============================================================================================================================
function Button1 (sId) {
	if ( arguments.length > 0 ) this.construct(sId);
}

//-----------------------------------------------------------------
// Method Button1.construct()
//-----------------------------------------------------------------
Button1.prototype.construct = function (sId) {
	Button1.superclass.construct.call(this, sId);
	this.id = sId;
	this.enabled = true;
	this.hidden = false;
	this.htmlElement = false;
	this.init = false;
	this.buttonSet = false;
}

//-----------------------------------------------------------------
// Method Button1.initHTMLElements()
//-----------------------------------------------------------------
Button1.prototype.initHTMLElements = function () {
	if ( !this.init ) {
		this.init = true;
		this.htmlElement = getElementById('button_' + this.id);
	}
}

//-----------------------------------------------------------------
// Method Button1.hide()
//-----------------------------------------------------------------
Button1.prototype.hide = function () {
	if ( this.hidden )
		return;
	if ( !this.interfaceObject.loaded ) {
		this.interfaceObject.initExecute(this, 'hide');
	} else {
		this.displayHide();
		this.hidden = true;
	}
}  // hide

//-----------------------------------------------------------------
// Method Button1.show()
//-----------------------------------------------------------------
Button1.prototype.show = function () {
	if ( !this.hidden )
		return;
	if ( !this.interfaceObject.loaded ) {
		this.interfaceObject.initExecute(this, 'show');
	} else {
		this.displayShow();
		this.hidden = false;
	}
}  // hide

//-----------------------------------------------------------------
// Method Button1.enable()
//-----------------------------------------------------------------
Button1.prototype.enable = function () {
	if ( this.enabled )
		return;
	if ( !this.interfaceObject.loaded ) {
		this.interfaceObject.initExecute(this, 'enable');
	} else {
		this.displayEnabled();
		this.enabled = true;
	}
}  // enable

//-----------------------------------------------------------------
// Method Button1.disable()
//-----------------------------------------------------------------
Button1.prototype.disable = function () {
	if ( !this.enabled )
		return;
	if ( !this.interfaceObject.loaded ) {
		this.interfaceObject.initExecute(this, 'disable');
	} else {
		this.displayDisabled();
		this.enabled = false;
	}
}  // disable

//-----------------------------------------------------------------
// Method Button1.displayEnabled()
//-----------------------------------------------------------------
Button1.prototype.displayEnabled = function () {
	this.initHTMLElements();
	if ( this.htmlElement ) {
		this.htmlElement.onclick = this.onclick;
		this.htmlElement.style.cursor = 'hand';
	}
}  // displayEnabled

//-----------------------------------------------------------------
// Method Button1.displayDisabled()
//-----------------------------------------------------------------
Button1.prototype.displayDisabled = function () {
	this.initHTMLElements();
	if ( this.htmlElement ) {
		this.onclick = this.htmlElement.onclick;
		this.htmlElement.onclick = new Function('return false;');
		this.htmlElement.style.cursor = 'default';
	}
}  // displayDisabled

//-----------------------------------------------------------------
// Method Button1.displayShow()
//-----------------------------------------------------------------
Button1.prototype.displayShow = function () {
	this.initHTMLElements();
	if ( this.htmlElement )
		showElement(this.htmlElement);
}  // displayShow

//-----------------------------------------------------------------
// Method Button1.displayHide()
//-----------------------------------------------------------------
Button1.prototype.displayHide = function () {
	this.initHTMLElements();
	if ( this.htmlElement )
		hideElement(this.htmlElement);
}  // displayHide

//-----------------------------------------------------------------
// Method Button1.toString()
//-----------------------------------------------------------------
Button1.prototype.toString = function () {
	var sStr = '';
	sStr += 'button[\n';
	sStr += 'id      = ' + this.id + '\n';
	sStr += 'enabled = ' + this.enabled + '\n';
	sStr += 'hidden  = ' + this.hidden + '\n';
	sStr += 'init    = ' + this.init + '\n';
	sStr += 'html    = ' + this.htmlElement + '\n';
	sStr += ']\n';
	return sStr;
}  // displayDisabled

// ==============================================================================================================================
// Class IconButton1
// ==============================================================================================================================
IconButton1.prototype = new Button1;
IconButton1.prototype.constructor = IconButton1;
IconButton1.superclass = Button1.prototype;

function IconButton1 (sId) {
	if ( arguments.length > 0 ) this.construct(sId);
}

//-----------------------------------------------------------------
// Method IconButton1.initHTMLElements()
//-----------------------------------------------------------------
IconButton1.prototype.initHTMLElements = function () {
	if ( !this.init ) {
		IconButton1.superclass.initHTMLElements.call(this);
		this.htmlElement = getElementById('button_' + this.id );
	}
}

//-----------------------------------------------------------------
// Method IconButton1.displayDisabled()
//-----------------------------------------------------------------
IconButton1.prototype.displayDisabled = function () {
	 IconButton1.superclass.displayDisabled.call(this);
	 if ( this.htmlElement )
		changeOpacity(this.htmlElement, 50); 
}  // displayDisabled

//-----------------------------------------------------------------
// Method IconButton1.displayEnabled()
//-----------------------------------------------------------------
IconButton1.prototype.displayEnabled = function () {
	IconButton1.superclass.displayEnabled.call(this);
	if ( this.htmlElement )
		changeOpacity(this.htmlElement, 100); 
}  // displayEnabled

//-----------------------------------------------------------------
// Method IconButton1.toString()
//-----------------------------------------------------------------
IconButton1.prototype.toString = function () {
	 var sStr = '';
	 sStr += 'icon-button[\n';
	 sStr += 'id      = ' + this.id + '\n';
	 sStr += 'enabled = ' + this.enabled + '\n';
	 sStr += 'hidden  = ' + this.hidden + '\n';
	 sStr += 'init    = ' + this.init + '\n';
	 sStr += 'html    = ' + this.htmlElement + '\n';
	 sStr += ']\n';
	 return sStr;
}  // toString




// ==============================================================================================================================
// Class TextButton1
// ==============================================================================================================================
TextButton1.prototype = new Button1;
TextButton1.prototype.constructor = TextButton1;
TextButton1.superclass = Button1.prototype;

function TextButton1 (sId) {
	if ( arguments.length > 0 ) this.construct(sId);
}

//-----------------------------------------------------------------
// Method TextButton1.displayDisabled()
//-----------------------------------------------------------------
TextButton1.prototype.displayDisabled = function () {
	TextButton1.superclass.displayDisabled.call(this);
	if ( this.htmlElement ) {
	  this.htmlElement.style.borderColor = '#aaaaaa';
	  this.htmlElement.style.color = '#aaaaaa';
	}
}

//-----------------------------------------------------------------
// Method TextButton1.displayEnabled()
//-----------------------------------------------------------------
TextButton1.prototype.displayEnabled = function () {
	TextButton1.superclass.displayEnabled.call(this);
	if ( this.htmlElement ) {
		this.htmlElement.style.borderColor = '#000000';
		this.htmlElement.style.color = '#000000';
	}
}


//-----------------------------------------------------------------
// Method TextButton1.toString()
//-----------------------------------------------------------------
TextButton1.prototype.toString = function () {
	 var sStr = '';
	 sStr += 'text-button[\n';
	 sStr += 'id      = ' + this.id + '\n';
	 sStr += 'enabled = ' + this.enabled + '\n';
	 sStr += 'hidden  = ' + this.hidden + '\n';
	 sStr += 'init    = ' + this.init + '\n';
	 sStr += 'html    = ' + this.htmlElement + '\n';
	 sStr += ']\n';
	 return sStr;
}  // toString