/**
 * Grid layout basic
 */
jslt.Grid=function(cols,rows){
	this.size=[cols,rows]
	this.gridRef=document.createElement('table')
	var tb=document.createElement('tbody')
	this.gridRef.appendChild(tb)
	for ( var i = 0; i < rows; i++) {
		var tr=document.createElement('tr')
		tb.appendChild(tr)
		for ( var j = 0; j < cols; j++) {
			var td=document.createElement('td')
			tr.appendChild(td)
		}
	}
	this.getCell=function(col,row){
			return this.gridRef.childNodes[0].childNodes[row].childNodes[col]
	}
	this.nextCounters=[0,0,0]
	this.next=function(){
		var ret=this.getCell(this.nextCounters[0],this.nextCounters[1])
		this.nextCounters[2]+=1
		if(this.nextCounters[2]%this.size[0]==0){
			this.nextCounters[1]+=1
			this.nextCounters[0]=0
		}else{
			this.nextCounters[0]+=1
		}
		return ret
	}
}

