Here is what I do in .NET
***************************************
Mouse out and mouse over events will check the last character of the gif file name to see what the status of the button is at this time, then if the status is not "c" or CLICKED, it changes the image of the button. The click event and image change is handled on the code behind like this:
private void ResetImageButtons()
{
imbtnCaseManagement.ImageUrl="images/CM_n.gif";
.
.
.
}
private void imbtnCaseManagement_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
ResetImageButtons();
imbtnCaseManagement.ImageUrl="images/CM_c.gif";
}