  function cLoading(src){
    this.m_sSrc = src;   // source de l'image
    var m_oParent;
    var m_oOpacity;
    var m_oImage;
    // -----------------------------------------------------           
    // Private method
    createElement = function(type, parent) {
    	var el = null;
	    if(document.createElementNS) {
		    // use the XHTML namespace; IE won't normally get here unless
    		// _they_ "fix" the DOM2 implementation.
		    el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
	    } 
	    else{
		    el = document.createElement(type);
	    }
	    if (typeof(parent) != "undefined") {
		    parent.appendChild(el);
	    }
	    return el;
    };   
    
    // -----------------------------------------------------               
    this.show = function(link){
      link = typeof(link) == 'undefined' ? null : link;
      if(m_oOpacity)      
        m_oOpacity.style.display = 'block';

      if(m_oImage)
        m_oImage.style.display = 'block';   
        
      if(link){
        window.location.href = link;
      }
    }

    // -----------------------------------------------------               
    this.build = function(){
      m_oParent = document.getElementsByTagName("body")[0];
      if(m_oParent){
        if(!m_oOpacity)      
          m_oOpacity = createElement('div',m_oParent);
    
        if(!m_oImage)
          m_oImage = createElement('img',m_oParent);
          
        with(m_oImage){
          style.display = 'none';            
          id = 'loading-img';
          src = this.m_sSrc;
          style.zIndex = 400;
        }
        with(m_oOpacity){
          style.display = 'none';    
          id = 'loading-opacity';
          style.width = '100%';  
          style.height = '100%';  
          style.position = "absolute";
          style.top = '0px';
          style.left = '0px';
          style.margin = '0px';
          style.zIndex = 400;
        }
      }
    }

    // -----------------------------------------------------                         
    this.hide = function(){    
      if(m_oImage){
        m_oImage.style.display = 'none';
      }
      if(m_oOpacity){
        m_oOpacity.style.display = 'none';
      }
    }
  }
