// Register the namespace for the control.
Type.registerNamespace("Brainstorming.WebControls.HoveredItem");

Brainstorming.WebControls.HoveredItem.HoveredImageButton = function(element)
{   
    Brainstorming.WebControls.HoveredItem.HoveredImageButton.initializeBase(this, [element]);
    
    this._elem = this.get_element();
   
    this._imageUrl = null;
    this._hoverImageUrl = null;
    
    this._image = new Image();
    this._hoverImage = new Image();
    
};

Brainstorming.WebControls.HoveredItem.HoveredImageButton.prototype =
{
    initialize : function() 
    {
        Brainstorming.WebControls.HoveredItem.HoveredImageButton.callBaseMethod(this, "initialize");
        
        $addHandlers(this.get_element(), 
                     { 'mouseover' : this._onMouseOver,
                       'mouseout' : this._onMouseOut},
                     this);
                     
        this._image.src = this._imageUrl;                     
        this._hoverImage.src = this._hoverImageUrl;                     
        
    }, 
    
    dispose : function()
    {
        $clearHandlers(this._elem);
        
        Brainstorming.WebControls.HoveredItem.HoveredImageButton.callBaseMethod(this, "dispose");
    },
    

    _onMouseOver : function()
    {
        this._elem.src = this._hoverImageUrl;
    },
    
    _onMouseOut : function()
    {
        this._elem.src = this._imageUrl;
    },

    get_hoverImageUrl: function()
    {
        return this._hoverImageUrl;
    },
    
    set_hoverImageUrl : function(value)
    {
        if (this._hoverImageUrl != value)
        {
            this._hoverImageUrl = value;
            this.raisePropertyChanged("hoverImageUrl");
        }
    },
 

    get_imageUrl: function()
    {
        return this._imageUrl;
    },
    
    set_imageUrl : function(value)
    {
        if (this._imageUrl != value) {
            this._imageUrl = value;
            this.raisePropertyChanged("imageUrl");
        }
    }
    
}

Brainstorming.WebControls.HoveredItem.HoveredImageButton.registerClass("Brainstorming.WebControls.HoveredItem.HoveredImageButton", Sys.UI.Control);

if (typeof(Sys) !== "undefined")
{
    Sys.Application.notifyScriptLoaded();
}
