/**
 *Show or hide the loading message when using AJAX.
 */
 
var LoadingMessageBox = {
  
  //ID for the messageBox
  boxName: 'LoadingMessageBox',
  
  //Number of open AJAX calls.
  count: 0,
  
  //Increment the counter.
  increment: function(){
    
    this.count = this.count + 1;
  
    if( this.count > 0)
      this.show();
  },
  
  //Decrement.
  decrement: function(){ 
  
    this.count = this.count - 1;
    
    if( this.count <= 0){
      
      this.count = 0;
      
      this.hide();
    }
  },
  
  //Show the Loading message box.
  show: function(){
    
    var element = dojo.byId( this.boxName );
    
    dojo.html.setDisplay(    element, 'block'   );
    dojo.html.setVisibility( element, 'visible' );
  },
  
  //Hide the Loading message box.
  hide: function(){
    
    var element = dojo.byId( this.boxName );
    
    dojo.html.setDisplay(    element, 'none'   );
    dojo.html.setVisibility( element, 'hidden' );
  }
};
