Change a GUI Box backround image on the fly

I have a bunch of images attached to a game object using GUIStyle, adding them as background images in the inspector. They all appear on screen during gameplay. Its a pretty simple match 3 type of game, and when you get a certain color, I want the picture of the empty red circle, for example, to change to a picture I have of a full red circle.

Is there a way to use javascript to change a GUI background image like that? Maybe using a switch statement?

Thanks!

The following code should work but I haven’t tested it though.

var style : GUIStyle;
var newBackgroundImage : Texture2D;

function OnGUI ()
{
     if (GUILayout.Button ("Swap background image"))
          style.normal.background = newBackgroundImage;
}