May Jeff,
That would depend, are layer 1 and 2 sublayers of a map service or are they whole map services? Basically you need to get the 'map' object and use getLayer to get the Map Service (layer) based on the Map Services id and then if layer 1 is the name of a layer in that map service then you need to set the visibleLayers property for the ArcGISDynamicMapServiceLayer (i.e. remove the id number that represents your layer 1 from the visibleLayers ilist).