<html>
<head
<title>Possible LayerSwitcher bug</title>
<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
<div id="map" style="width:600px; height:300px"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var layerSwitcher = new OpenLayers.Control.LayerSwitcher();
map.addControl(layerSwitcher);
// The base layer
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
// We create two overlays but only display the North Atlantic data
// in the layer switcher
var natl = new OpenLayers.Layer.WMS( "North Atlantic",
"http://lovejoy.nerc-essc.ac.uk:8080/ncWMS/wms",
{layers: 'MERSEA_NATL/temperature', transparent: 'true'} );
natl.displayInLayerSwitcher = true;
var global = new OpenLayers.Layer.WMS( "Global",
"http://lovejoy.nerc-essc.ac.uk:8080/ncWMS/wms",
{layers: 'GENIE/temp', transparent: 'true'} );
global.displayInLayerSwitcher = false;
map.addLayers([wms, natl, global]);
map.zoomToMaxExtent();
// Now we will switch the overlay that is displayed in the layer switcher
natl.displayInLayerSwitcher = false;
global.displayInLayerSwitcher = true;
// Now we'll redraw the layer switcher
layerSwitcher.redraw();
// However, you should see that only the North Atlantic layer displays
// in the layer switcher. BUT if you then click the North Atlantic checkbox
// the layer switcher seems to sort itself out.
</script>
</body>
</html>