I tought of this before...
If you got a fixed number of button, you can declare an array of 'switches' to be put to 0 or 1...
Then when you click on the link, you set the switch to 1.
On your onMouseOut='functionName' you just check if the switch is set to 0, if yes, u put back the first...