﻿


//**********************************
//  CONSTRUCTOR
//**********************************
function SimpleButton(oControl, oRootElement) {

    //**********************************
    //  PROPERTIES
    //**********************************
    this.control = oControl;
    this.rootElement = oRootElement;
    var __oScope = this;
    
    //PROPERTIES
    var __oUIProperties = new Object(); 
    var __oAnimationProperties = new Object();

    //**********************************
    //  CLASS INSTANCES
    //**********************************
    var __event = new Events(this.control, this.rootElement, this);
   
    
    //**********************************
    //  CALL BACK EVENTS
    //**********************************
    
    var onReleaseEvent = new Function();
   
    //********************************** 
    // GETTER / SETTERS
    //**********************************
    
    this.setButton = function(oButton){__oUIProperties.button = oButton; return this;};
    this.button = function(){return __oUIProperties.button;};
    
    
    //**********************************
    //  PRIVATE
    //**********************************
    initiateProperties();
    
    function initiateProperties() {};
    
    
    //*********************************
    //  INITIATE GENERAL EVENTS
    //*********************************
    
    function intiateUI() {
        var oButton =  __oScope.button();
        __event.add("MouseLeftButtonDown", oButton, "MouseLeftButtonDown", mouseDownEvent);
        __event.add("MouseLeave", oButton, "MouseLeave", mouseLeaveEvent);
        __event.add("MouseEnter", oButton, "MouseEnter", mouseEnterEvent);
    }
    
    //********************************
    //  UI EVENTS
    //********************************
    
    function mouseDownEvent()
    {
       if(__oScope.onReleaseEvent != undefined) {
            __oScope.onReleaseEvent();
      }
    
    }
    
    function mouseLeaveEvent() {};
    
    function mouseEnterEvent() {};
    
   
    //**********************************
    //  PUBLIC  
    //**********************************
    
    this.initiate = function() {
        intiateUI();
    }

}