﻿/*Set properties HTML Table*/
function htmltable()
{
  this.x=null;
  this.y=null;
  this.srcTable=null;
}

htmltable.prototype.createtable=function(tbname,divname,cellSpacing,cellPadding,width,height,border)
{
 if ($(tbname))
 {
   $(divname).removeChild($(tbname)) 
 }

   this.srcTable = document.createElement("table");
   this.srcTable.id=tbname;
   this.srcTable.border = border;
   this.srcTable.cellSpacing = cellSpacing;
   this.srcTable.cellPadding = cellPadding;
   this.srcTable.height = height;
   this.srcTable.width = width;
   $(divname).appendChild(this.srcTable);
}






htmltable.prototype.insertrow=function(TB,rowindex)
{
 
 $(TB).insertRow(rowindex);

}

htmltable.prototype.createcell=function(TB,rowindex,cellindex,value)
{
 this.x=$(TB).rows[rowindex];
 this.Y=this.x.insertCell(cellindex);
 this.Y.innerHTML=value

}

htmltable.prototype.updatecell=function(TB,rowindex,cellindex,value)
{
 this.x=$(TB).rows[rowindex].cells[cellindex];
 this.x.innerHTML=value;

}


htmltable.prototype.getcontentcell=function(TB,rowindex,cellindex)
{
 this.x=$(TB).rows[rowindex].cells[cellindex];
 return this.x.innerHTML

}


htmltable.prototype.deleterow=function(TB,numrow,rowindex)
{


for (var i=0;i<numrow;i++)
{
  $(TB).deleteRow(rowindex);
}



}

htmltable.prototype.setclassrow=function(TB,rowindex,css)
{
 this.x=$(TB).rows[rowindex]
 this.x.className=css;

}

htmltable.prototype.setclasscell=function(TB,rowindex,cellindex,css)
{
 this.x=$(TB).rows[rowindex].cells[cellindex];
 this.x.className=css;

}


htmltable.prototype.setmultipleclasscell=function(TB,rowindex,total_cell,css)
{

for (var i=0;i<total_cell;i++)
{
this.x=$(TB).rows[rowindex].cells[i]
this.x.className=css;
}


}












htmltable.prototype.setwidthcell=function(TB,rowindex,cellindex,w)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.width=w;

}

htmltable.prototype.setheightcell=function(TB,rowindex,cellindex,h)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.height=h;

}


htmltable.prototype.setaligncell=function(TB,rowindex,cellindex,align)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.align=align;

}

htmltable.prototype.setvaligncell=function(TB,rowindex,cellindex,valign)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.vAlign=valign;

}

htmltable.prototype.setclosspancell=function(TB,rowindex,cellindex,colspan)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.colSpan=colspan;

}

htmltable.prototype.setidcell=function(TB,rowindex,cellindex,id)
{

  this.x=$(TB).rows[rowindex].cells[cellindex];
  this.x.id=id;

}