function TControlButton(options)
{
	// save params
	this._options = options;
	this._active = options && options.active;

	// styles
	this._selected_style = 'color: black; border-style: solid; border-color: rgb(52, 86, 132) rgb(108, 157, 223) rgb(108, 157, 223) rgb(52, 86, 132); border-width: 1px; font-size: 12px; font-weight: bold;';
	this._not_selected_style = 'color: black; border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;';

	// check width
	if(options && options.width) { this._selected_style += " width: "+(options.width-2)+"px;"; this._not_selected_style += " width: "+(options.width-2)+"px;"; }
}

TControlButton.prototype = new GControl();
TControlButton.prototype.initialize = function (map)
{
        // store map reference
        this._map = map;

        // create elements
	this._container = new Element('div', {
		title: this._options.title,
		style: 'border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer;'+
                                        ((this._options && this._options.width)?" width:"+this._options.width+"px;":"")
	}).insert(new Element('div', {
		style: (this._active)?this._selected_style:this._not_selected_style
	}).update(this._options.text));

	// setup event listeners
	var me = this;
	GEvent.addDomListener(this._container,"click",function () 
	{
		if(me._options.callback) me._options.callback(me);
	});

	// add to map	
        map.getContainer().appendChild(this._container);

        return this._container;
}
TControlButton.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(0,0)); }
TControlButton.prototype.printable = function () { return true; }
TControlButton.prototype.selectable = function () { return false; }

TControlButton.prototype.isActive = function () { return this._active; }

TControlButton.prototype.toggle = function ()
{
	if(this.isActive()) this.deactivate();
	else this.activate();
}

TControlButton.prototype.changeTitle = function (title) { this._container.setAttribute('title',title); }
TControlButton.prototype.activate = function () { this._container.firstChild.writeAttribute('style',this._selected_style); this._active = true; }
TControlButton.prototype.deactivate = function () { this._container.firstChild.writeAttribute('style',this._not_selected_style); this._active = false; }

