/**
  * Site: BlueDilla.com
  * File: ProcessingBox.js - Places an informational "Processing..." div on screen when user
  *       initiates any AJAX call.
  * @author Chad E. Jennings
  * @copyright 2007, Bluedilla, LLC 
  * @version $Id: v 1.0.2 06/18/2007 $;
  *
  * Changelog:
  *
  * ver 1.0.2 (06/18/2007)
  *   Modified: Changed to place "Processing..." box in center of window regardless of
  *             scrolling position. - Chad
  *
  * ver 1.0.1 (03/20/2007)
  *   Modified: Re-worked to place "Processing..." box in center of element that processing is taking
  *             place in. - Chad
  *
  * ver 1.0.0 (03/05/2007)
  *   Added: Wrote initial code. - Chad
  */
var ProcessingBox = {
    '_container': null,
    '_scrollingPosition': null,
    '_viewPortSize': null,
    '_left': 0,
    '_top': 0,

  /*
     ############################################################
     # NOTE: Container must be a relatively positioned element. #
     ############################################################
  */
     
    initialize: function(container) {
        ProcessingBox._container = container;
        ProcessingBox._scrollingPosition = GetPositions.getScrollingPosition();
        ProcessingBox._viewPortSize = GetPositions.getViewPortSize();
        
        ProcessingBox._left = ProcessingBox._scrollingPosition[0] + parseInt(ProcessingBox._viewPortSize[0] / 2) - (179 / 2) + "px";
        ProcessingBox._top = ProcessingBox._scrollingPosition[1] + parseInt(ProcessingBox._viewPortSize[1] / 2) - (82 / 2) + "px";
    },
    
    drawDiv: function() {
        ProcessingBox.processingDiv =
            Builder.node('div', {id: 'processing', style: 'top: ' + ProcessingBox._top + '; left: ' + ProcessingBox._left + ';'},
                [Builder.node('p', 'Processing...'),
                 Builder.node('img', {src: 'images/progress_bar2.gif'})
                ]
            );
    },
    
    showDiv: function() {
        /*$(ProcessingBox._container).insertBefore(ProcessingBox.processingDiv, $(ProcessingBox._container).childNodes[0]);*/
        document.getElementsByTagName("body")[0].appendChild(ProcessingBox.processingDiv);
    },
    
    removeDiv: function() {
        $('processing').remove();
    }
}
