Selecting objects of selected layer only

 From:  wastzzz
6310.1 
Hi there,
is there a script which allows the user to select only the objects of the selected layer? I'm talking about maybe a sort of "lock with memory", locking all the other layers except the selected one, so I can marquee part of the current layer without worrying about selecting other stuff. Pressing for example L, selecting what I need, then pressing L again and going back to the previous state? Not talking about isolating because I would like to see the other layers while I do the selection.
Thanks very much.
Max.