{tikimodule error=$module_params.error title=$tpl_module_title name="map_layer_selector" flip=$module_params.flip decorations=$module_params.decorations nobox=$module_params.nobox notitle=$module_params.notitle}
{if $controls.baselayer} {/if} {if $controls.optionallayers}
{/if}
{jq} $('.map-layer-selector').hide(); $(function () { $('.map-container').one('initialized', function () { $('.map-layer-selector').removeClass('map-layer-selector').each(function () { var refreshLayers, map = $(this).closest('.tab, #appframe, body').find('.map-container:first')[0] , baseLayers = $(this.baseLayers) , optionalLayers = $('.optionalLayers', tr(this)) /* e.g. tr('Editable') to be translatable via lang/../language.js */ ; if (! map) { return; } $(this).show(); baseLayers.change(function () { if (map.map) { var layer = map.map.layers[$(this).val()]; map.map.setBaseLayer(layer); if (layer.isBlank) { layer.setVisibility(false); } } }); refreshLayers = function () { baseLayers.empty(); optionalLayers.empty(); $.each(map.map.layers, function (k, thisLayer) { if (! thisLayer.displayInLayerSwitcher) { return; } if (thisLayer.isBaseLayer) { baseLayers.append($('