/**
*
***/
function Message(){
    var text = null;
    var messageContainer = "gameMessage";
    var displayTimeLength = 1500; // Amount of time to display the message on screen for, in milliseconds
    var timeout = null;
    
    var blink = true;
    var blinkNum = 3;               // The number of times text should blink before the timeout count begins
    var blinkCount = 0;             // The total number of times the text HAS blinked
    var blinkIntervalLength = 250;
    var blinkInterval = null;
    var runAfterBlink = true;
    /**
    *
    **/
    this.init = function(o){
       text = (o.text != undefined) ? o.text: text;
       messageContainer = (o.messageContainer != undefined ) ? o.messageContainer: messageContainer;
       displayTimeLength = (o.displayTimeLength != undefined ) ? o.displayTimeLength: displayTimeLength;
       blink = (o.blink != undefined ) ? o.blink: blink;
       blinkCount = (o.blinkCount != undefined ) ? o.blinkCount: blinkCount;
    }
    
    /**
    * @param i  string  The string we're placing into the text data member
    **/
    this.setMessage = function(i){  text = i; }
    
    /**
    *
    **/
    this.getMessage = function(){ return text; }
    
    /**
    *
    **/
    this.displayMessage = function(){        
        
        // Write the message out immediately so the timeout can remove it when complete
        this.writeMessage();
        
        if( timeout == null ){    
            // Now set the timeout to destroy it
            var func = this.destroyMessage;            
            timeout = setTimeout( func, displayTimeLength );
        }
    }
    
    this.blinkMessage = function(){
        
    }
    
    this.writeMessage = function(){
        document.getElementById( messageContainer ).innerHTML = text;
    }
    
    /**
    *
    **/
    this.destroyMessage = function(){
       timeout = null;
       document.getElementById( messageContainer ).innerHTML = "&nbsp;";
        
    }
}
