This example demonstrates how to create a menu for toggling layer visibility.
Note that the js is not minified so it is readable. See layermenu.js.