var mytable = {

  colhead1  : '',
  colhead2  : '',
  colhead3  : '',  
  numparts  : 0,
  width     : 0,
  top       : 0,
  left      : 0,   
  coldet1   : new Array(),   //detail col 1
  coldet2   : new Array(),   //detail col 2
  coldet3   : new Array(),   //detail col 3
  tablecontent : '',

  initialize  : function () {
 
    // bind functions
    this.maketableopen      = this.def_maketableopen.bind(this);
    this.maketableclose     = this.def_maketableclose.bind(this);
    this.makehead           = this.def_makehead.bind(this);
    this.makerow            = this.def_makerow.bind(this);
    this.render             = this.def_render.bind(this); 
  },     
      
  def_maketableopen: function () {
    this.tablecontent= this.tablecontent + '<table cellpadding="0" cellspacing="0" align="center" class="kittable">';
  },

  def_maketableclose :function (){
    this.tablecontent= this.tablecontent + '</table>';
  },

  
  def_makehead: function (incolhead1,incolhead2,incolhead3) {
  
    this.tablecontent= this.tablecontent + '<tr>'; 
    if (incolhead1 != '') {
      this.tablecontent= this.tablecontent + '<td class="head"><div align="center">' + incolhead1 + '</div></td>';
    }
    if (incolhead2 != '') {
      this.tablecontent= this.tablecontent + '<td class="head"><div align="center">' + incolhead2 + '</div></td>';
    }
    if (incolhead3 != '') {
      this.tablecontent= this.tablecontent + '<td class="head"><div align="center">' + incolhead3 + '</div></td>'; 
    }
    this.tablecontent= this.tablecontent + '</tr>';
  },
  
  def_makerow: function (indet1,indet2,indet3,instripe) {
  
    if (instripe=='on') {
      this.tablecontent= this.tablecontent + '<tr class="stripe"> '; 
    } else {
      this.tablecontent= this.tablecontent + '<tr> '; 
    }
    if (this.colhead1 != '') {
      this.tablecontent= this.tablecontent + '<td><div align="center"><a href=\"javascript:getonepart(' + "'" +indet1 + "'" + ');\">' + indet1 + '</a></div></td>'; 
    }
    if (this.colhead2 != '') {
      this.tablecontent= this.tablecontent + '<td><div align="center">' + indet2 + '</div></td>'; 
    }
    if (this.colhead3 != '') {
      this.tablecontent= this.tablecontent + '<td><div align="center">' + indet3 + '</div></td>'; 
    }
    this.tablecontent= this.tablecontent + '</tr>'; 
  },
  
  def_render : function() {
      this.tablecontent='';
      this.maketableopen();
      this.makehead(this.colhead1,this.colhead2,this.colhead3);
      var stripe='off';
      for (var i=0;i<this.numparts;i++) {
         this.makerow(this.coldet1[i],this.coldet2[i],this.coldet3[i],stripe);
         if (stripe=='on') {
            stripe='off';
         } else {
            stripe='on';
         }   
      } 
      this.maketableclose();
      return this.tablecontent;
  }
  
}
