Bw.Widgets.BooleanLabel = 
{
	superclassName: "Bw.Widgets.Widget",
	selfclassName: "Bw.Widgets.BooleanLabel",
			
	create: function (val)
	{
		var obj = document.createElement ('div');
		obj.setAttribute ("value", val);
		
		Bw.Core.bootstrap (obj, Bw.Widgets.BooleanLabel);
		
		return obj;
	},
	
	initialize: function ()
	{
		Bw.Widgets.Widget.initialize.call (this);
		
		this.draw();
		
		this.setValue (this.getAttribute ("value"));
	},
	
	draw: function ()
	{
		this.style.display = 'inline';
		
		this.checkMark = Bw.Widgets.StockIcon.create();
		this.appendChild (this.checkMark);
	},
	
	setValue: function (val)
	{
		val = (val == 1 || val == 'true' ) ? true : false;
		
		this.value = val;

		var s = this.value ? "checked" : "unchecked";
		
		this.checkMark.setSource (s);
	},

	getValue: function ()
	{
		return this.value;
	}
};

