  // Constructor
  function cCell(oParent){
    this.m_oParent = oParent
    this.m_Index = 0;
    this.m_oTd = null;
    this.m_Text = '';
    this.m_Align = 'left';
    this.m_backgroundColor = new Array();
    this.m_aObject = new Array();  // image, menu etc
    
    var m_oSelf = this;    
    var m_oTextbox;
    var m_Edit = false;    
    var m_Type;                   // the type string, number    

    this.evt_ondblclick = ondblclick;
    this.evt_endLabelEdit = null;
    
    // -------------------------------------------------------------------
    function unit(value){
      if(value.toString().indexOf('%') != -1){
        return value;
      }
      return value + 'px';        
    };
    // -------------------------------------------------------------------    
    function createElement(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 != null) {
        parent.appendChild(el);
      }
      return el;
    };       
    
    // -------------------------------------------------------------------        
    function evt_onblur(event){
      m_oSelf.m_oTd.removeChild(m_oTextbox);
      m_oSelf.m_oTd.innerHTML = m_oSelf.m_Text;  // we cancel the edition      
    };        
    // -------------------------------------------------------------------     
    function evt_onkeyup(event){
      var evt = window.event || event;
      var keynum =0;
      if(window.event){ // IE
        keynum = evt.keyCode;
      }
      else{ // Netscape/Firefox/Opera
        keynum = evt.which;
      }
      switch(keynum){
        case 13:// return
          if(m_oSelf.m_Type){
            switch(m_oSelf.m_Type){
              case 'string':
                break;
                
              case 'int':  
                if(isNaN(m_oTextbox.value)){
                  alert('Error : the input is not a number');
                  this.focus();
                  return;
                }
                break;
                
              case 'date':
                break;
            }  
          }
          m_oSelf.m_Text = m_oTextbox.value;
          m_oSelf.m_oTd.removeChild(m_oTextbox);
          m_oSelf.m_oTd.innerHTML = m_oSelf.m_Text;
          if(m_oSelf.evt_endLabelEdit) m_oSelf.evt_endLabelEdit;  // If a callback function exist we call
          break;
        case 27:// escape
          m_oSelf.m_oTd.removeChild(m_oTextbox);
          m_oSelf.m_oTd.innerHTML = m_oSelf.m_Text;  // we cancel the edition          
          break;
        
        default:
          break;
      }
    };   
    // -------------------------------------------------------------------         
    function ondblclick(event){
      var evt = window.event || event;
      if(!m_oSelf.m_oTd || !m_Edit) return;

      m_oSelf.m_oTd.innerHTML = '';

      m_oTextbox = createElement('input',m_oSelf.m_oTd);
      with(m_oTextbox){
        type = 'text';
        className = m_oSelf.m_oTd.className;
        value = m_oSelf.m_Text;
        style.borderWidth = unit(1);
        style.width = unit(m_oSelf.m_oTd.offsetWidth - (parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth)));        
        style.textAlign = m_oSelf.m_Align;
        onblur = evt_onblur;
        onkeyup = evt_onkeyup;
        focus();
      }
    };
    // -------------------------------------------------------------------    
    this.setProperties = function(Text, Align, aObject){
      this.m_Text = Text;
      this.m_Align = typeof(Align) == 'undefined' ? 'left' : Align;
      this.m_aObject['empty'] = null;
      
      if(typeof(aObject) != 'undefined'){
        if(aObject['icone']){
          this.m_aObject['icone'] = new cIcone();  //
        }
        if(aObject['menu']){
          this.m_aObject['menu'] = new cMenu();  //
        }
        if(aObject['link']){
          this.m_aObject['link'] = new cLink();  //
        }
      }
    };
    // -------------------------------------------------------------------        
    this.setEdit = function(value){
      m_Edit = value;
    };
    // -------------------------------------------------------------------    
    this.setType=function(value){
      m_Type = value;
    };
    // -------------------------------------------------------------------    

  }
  