﻿/* Author: N/A (client) */

function VGIButtonMenuHandler(OnClick_HandlerFunction,
                              OnMouseOver_HandlerFunction,
                              OnMouseOut_HandlerFunction,
                              CurSelection,
                              MenuHelpItemId,
                              CssClassSelection, 
                              CssClassHighlight)                      
{
   this._OnClick_HandlerFunction     = OnClick_HandlerFunction;
   this._OnMouseOver_HandlerFunction = OnMouseOver_HandlerFunction;
   this._OnMouseOut_HandlerFunction  = OnMouseOut_HandlerFunction;
   this._MenuHelpItemId              = MenuHelpItemId;
   this._CssClassSelection           = CssClassSelection;
   this._CssClassHighlight           = CssClassHighlight;
   this._CurSelection                = CurSelection;
   
   this.OnClick = function(ClientId, ServerId)
   {
       if(this._OnClick_HandlerFunction != null)
           this._OnClick_HandlerFunction(ClientId, ServerId);
   }
   this.OnMouseOver = function(ClientId, ServerId)
   {
       if(VGIButton_GetState(ClientId) == "ON")
          this._ShowMenuHelp(ClientId, ServerId, this._CssClassSelection);   
       else
          this._ShowMenuHelp(ClientId, ServerId, this._CssClassHighlight);        
           
       if(this._OnMouseOver_HandlerFunction != null)
           this._OnMouseOver_HandlerFunction(ClientId, ServerId);
   }
   this.OnMouseOut = function(ClientId, ServerId)
   {
        this._ShowMenuHelp(this._CurSelection, ServerId, this._CssClassSelection);
        
        if(this._OnMouseOut_HandlerFunction != null)
           this._OnMouseOut_HandlerFunction(ClientId, ServerId);
   }
   this._ShowMenuHelp = function(ClientId, ServerId, Class)
   {
       var HelpItem = document.getElementById(this._MenuHelpItemId);
       if(HelpItem != null)
       {
           var Elem = document.getElementById(ClientId);
           if(Elem != null)
           {     
               HelpItem.className = Class;
               HelpItem.innerHTML = Elem.getAttribute("help");
               return;            
           }
       }   
   }
}
/* Log: N/A (client) */