//////////////////////////////////////////////////////////
// Copyright (C) 2007 LCSoft Inc. All rights reserved.
//////////////////////////////////////////////////////////

/**
 * A simple image button that provides roll over and disabled styles.
 */
function UI_PushButton(sIcon, sStyle, fAction)
{
    pButton = document.createElement("IMG");

    pButton.src = UI.image + "empty.png";
    pButton.disabled = false;
    pButton.className = sStyle;
    pButton.style.backgroundImage = "url(" + sIcon + ")";

    pButton.onclick     = fAction;
    pButton.onmouseup   = function(){ if (!this.disabled) this.className = sStyle + "_over"; };
    pButton.onmouseout  = function(){ if (!this.disabled) this.className = sStyle; };
    pButton.onmouseover = function(){ if (!this.disabled) this.className = sStyle + "_over"; };
    pButton.onmousedown = function(){ if (!this.disabled) this.className = sStyle + "_down"; };

    pButton.setDisabled = function(bDisabled)
    {
        pButton.disabled = bDisabled;
        pButton.className = sStyle + (bDisabled ? "_disabled" : "");
    };

    return pButton;
}