function Label(title)
{
	extend(this, Widget);
	
	this.setTitle(title);
}

Label.prototype = new Widget();

Label.DEFAULT_COLOR = "#BBBBBB";
Label.FOCUS_COLOR = "#000000";

Label.prototype.setTitle = function Label_setTitle(title)
{
	if(!title)
	{
		raise("Parameter 'title' cannot be null");
	} else if(title != this.title)
	{
		var thisRef = this;
		this.title = title;
		
		if(this.label)
		{
			this.label.onmousedown = null;
		}
		
		this.label = document.createElement("nobr");
		this.label.style.color = Label.DEFAULT_COLOR;
		
		this.label.onmouseenter = function()
		{
			thisRef.label.style.color = Label.FOCUS_COLOR;
		};
		
		this.label.onmouseleave = function()
		{
			thisRef.label.style.color = Label.DEFAULT_COLOR;
		};
		
		this.label.innerHTML = title;
		this.label.onmousedown = function()
		{
			if(thisRef.onClicked)
			{
				thisRef.onClicked(thisRef);
			}
		};
		
		this.domContainer.innerHTML = "";
		this.domContainer.appendChild(this.label);
		
		if(this.onTitleChanged)
		{
			this.onTitleChanged(this, title);
		}
	}
};

Label.prototype.update = function()
{
	if(this.label)
	{
		with(this.label.style)
		{
			position = "absolute";
			left = 0;
			top = this.getHeight()/2 - this.label.clientHeight/2 - 1;
			width = this.label.clientWidth;
			height = this.label.clientHeight;
		}
	}
};

Label.prototype.getWidgetName = function()
{
	return "label";
};
