/**
*
* egButton Class
*/
function egButton(id, label, width, height) {
	 this.id = 'egButton_'+id;
	 this.x = 0;
	 this.y = 0;
	 this.width = 0;
	 this.height = 0;

	 this.getHeight = egWindow_getHeight;
	 this.getWidth  = egWindow_getWidth;

	 this.show = egWindow_show;
	 this.hide = egWindow_hide;
	 this.moveTo = egWindow_moveTo;
	 this.displayAt = egWindow_displayAt;

	 this.getValue = egCheckBox_getValue;

	 divRoot = document.getElementById('easy-GUI_mainLayer');

	 divRoot.innerHTML += '<div id="'+this.id+'" class="egButton" onmouseover="javascript:egSetActive(this);" onmouseout="javascript:egSetInactive(this);" onmousedown="javascript:egSetPressed(this);" onmouseup="javascript:egSetUnPressed(this);">'+label+'</div>';

	 div = document.getElementById(this.id);
	 div.style.width  = width+'px';
}

function egSetPressed(item){
  var pos = 0;

	if( (pos = item.className.indexOf('Pressed')) < 0 ) {
		item.className = item.className + 'Pressed';
	}
}

function egSetUnPressed(item){
	var pos = 0;

	if( (pos = item.className.indexOf('Pressed')) > 0 ) {
		item.className = item.className.substring(0, pos);
	}
	if((pos = item.className.indexOf('Unchecked')) > 0 ) {
		item.className = 'egCheckBoxChecked';
	}
	else {
		item.className = 'egCheckBoxUnchecked';
	}

}

function egSetActive(item){
	var pos = 0;

	if( (pos = item.className.indexOf('Hover')) < 0 ) {
		item.className = item.className + 'Hover';
	}
}

function egSetInactive(item){
	var pos = 0;

	if( (pos = item.className.indexOf('Hover')) > 0 ) {
		item.className = item.className.substring(0, pos);
	}
}
