function Button(){
	this.ID=null;
	this.VariableName=null;
	this.Text='';
	this.ImagePath=null;
	this.SetText=_setText;
	this.SetImage=_setImg;
	this.SetEnabled=_setEnabled;
	this.CssClass=null;
	this.HoverCssClass=null;
	this.DisabledCssClass=null;
	this.Enabled=true;
	this.CommandArgument=null;
	this.OnHover=_onHover;//private
	this.InvokeClick=_invokeclick;
	this.LeftImage=new EndImage();
	this.RightImage=new EndImage();
	this.Functional=true;
	this.SetVisible=_setVisible;
	
	function _invokeclick(){
		document.getElementById(this.ID).onclick();
	}
	function _onHover(over){
		if(!this.Enabled)
			return;
			
		//var lImg=document.getElementById(this.ID+'_lImg'+tabindx);
		//var rImg=document.getElementById(this.ID+'_rImg'+tabindx);
		var m=document.getElementById(this.ID+'_mid');
		if(over){
//			if(tab.LeftImage.HoverImagePath!=null)
//				lImg.src=tab.LeftImage.HoverImagePath;
//			if(tab.RightImage.HoverImagePath!=null)
//				rImg.src=tab.RightImage.HoverImagePath;
			if(this.HoverCssClass!=null)
				m.className=this.HoverCssClass;
		}else{
//			lImg.src=tab.LeftImage.ImagePath;
//			rImg.src=tab.RightImage.ImagePath;
			m.className=this.CssClass;
		}
	}
	function _setEnabled(value){
	    if(!this.Functional) //this way we can set non-functional on the server and then the client cannot enable the button
	        return;
		var div=document.getElementById(this.ID+'_mid');
		var l=document.getElementById(this.ID+'_leftimg');
		var r=document.getElementById(this.ID+'_rightimg');
		this.Enabled=value;
		if(value){
			div.className=this.CssClass;
			l.src=this.LeftImage.ImagePath;
			r.src=this.RightImage.ImagePath;
		}else{
			div.className=this.DisabledCssClass;	
			l.src=this.LeftImage.DisabledImagePath;
			r.src=this.RightImage.DisabledImagePath;	
		}
	}
	function _setVisible(value){
		if(!value)
			document.getElementById(this.ID).style.display='none';
		else
			document.getElementById(this.ID).style.display='block';
	}
	function _setText(value){
		var div=document.getElementById(this.ID+'_mid');
		div.innerHTML=value;
		this.Text=value;
	}
	function _setImg(value){
		var div=document.getElementById(this.ID+'_mid');
		div.innerHTML='<img src="'+value+'" border="0">';
		this.ImagePath=value;
	}
}
