var mapConfigurator = null;

MapConfiguratorTool = function(map, floatingPanelId, behaviorId)
{
    this.map = map;
	this.floatingPanelId = floatingPanelId;
	this.mapConfig_option_trans = $get("mapConfig_option_trans");
    this.map.showHelpByDefault = true;
    
    
	this._slider = $find(behaviorId);				   	
	this._slider.set_Value(this._getMapTransparency());
	this._slider.add_valueChanged(Function.createDelegate(this, this._updateMapTransparency));
}

MapConfiguratorTool.prototype = 
{	
	show : function()
	{
		floatingPanelManager.closeAll();
		floatingPanelManager.open(this.floatingPanelId);
		this.open = true;
	},
	
	_updateMapTransparency: function(sender, e)
	{			
		this._setMapTransparency(parseInt(this._slider.get_Value()));
	},
	
	_getMapTransparency: function(transparency)
	{
		return 100 - this.map.get_dynamicLayerOpacity();
	},
	
	_setMapTransparency: function(transparency)
	{
		if (transparency >= 0 && transparency <= 100) {
			var opacity = 100 - transparency;
	        this.map.set_dynamicLayerOpacity(opacity);  
	        this.map.draw();    
	    } 
	}
};

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();