/*
 * @description Derdubor MapUtilities for use with Norkart js API and our UI (jQuery UI)
 * @version 0.1
 * @since 26.02.2009
 * @author Jan-Petter Jensen <janp@derdubor.no>
 * @constructor
 * @param {AJAXMAP} Norkart ajaxmap to bind all functions in this class to
 */
 
function MapUtilities(map)
{
    this.map = map;
    
    /**
            * Changes map style on map
            * Will additionally set proper jQuery UI-style on the clickedButton if given this parameter and,  if specified, revert a button already active
            *
            * @public
            * @param {int} style  The style to set (allowed values documented in Norkart ajaxmap documentation)
            * @param {null|String|DOMElement|jQuery} activeButton Button(s) to set in active state
            * @param {null|String|DOMElement]jQuery} revertButton Button(s) to revert from active to default state
            */
    this.setMapStyle = function(style, activeButton, revertButton)
    {
        activeButton = typeof(activeButton) == 'undefined' ? null : activeButton;
        revertButton = typeof(revertButton) == 'undefined' ? null : revertButton;
        
        this.map.setMapStyle(style);

        if(revertButton !== null)
        {
            $j(revertButton).addClass('ui-state-default').removeClass('ui-state-highlight');
        }
        if(activeButton !== null)
        {
            $j(activeButton).addClass('ui-state-highlight').removeClass('ui-state-default');
        }        
    }
    
}