Is it possible to attach scripts to GUI objects?

Is it possible to attach a script containing functions such as MouseOver to a GUI object? How? Basically, I have a game where a gun follows the mouse. I have that part working, a little too well. I click to shoot, but when I click on a GUI, it obviously shoots anyway. So, my question is, is it possible to attach scripts to the GUI so I can disable shooting when my mouse is over the GUI?

I first thought you meant, how to add mouse-checking to a GUITexture type object, which would be simple to add an OnMouseOver function to. Then it occurred to me, if you're talking about OnGui() objects, that wouldn't work:)

I'm not sure how the OnGui() objects work, but worst case - you could make a GUITexture the size of your Gui layout, and give it an OnMouseOver function.

The simplest way to create a GUITexture is in the Editor: GameObject->Create Other->GUITexture. It defaults to a Unity icon, so change it to be something like a blank texture, position the rectangle where your OnGui Objects will be.