OK, that's a bit more clear. You can use this code as a doc-level script:
function showOneLayer(allLayers, layerToShow) { var docOCGs = this.getOCGs(); for (var x=0; x < docOCGs.length; x++) { var layer = docOCGs[x]; if (allLayers.indexOf(layer.name)!=-1) { layer.state = (layerName==layerToShow); } } }
And then call it from your check-boxes like this (to make the first layer visible, for example):
showOneLayer(["Layer1", "Layer2", "Layer3", "Layer4"], "Layer1");