function keyPressedNumber(e) { var keynum; if(window.event) //IE keynum = e.keyCode; else keynum = e.which; return keynum; } function isEnterOrTabPressed(e) { var keynum = keyPressedNumber(e); if(keynum == 9 || keynum == 13) return true; else return false; } function setSelectionRange(obj) { if(obj && typeof(obj) == "object" && (obj.type == "text" || obj.type == "textarea")) { if(obj.createTextRange) { var range = obj.createTextRange(); range.moveStart("character", 0); range.moveEnd("character", obj.value.lengh-1); range.select(); } else { if(obj.setSelectionRange) { obj.setSelectionRange(0,obj.value.length); } } obj.focus(); } if(obj && typeof(obj) == "object" && obj.options) { obj.focus(); } } function paramsMT(name) { this.myTableName = name; this.table = document.getElementById(this.myTableName); this.thead = this.table.tHead; this.tbody = this.table.tBodies.item(0); this.cellSelectedClass = 'selectedCell'; this.rowSelectedClass = 'selectedRow'; this.selectedRow; this.selectedCell; this.rowCount = function() { return this.tbody.rows.length; } this.colCount = function() { return this.thead.rows.item(0).cells.length; }; this.colWidth = function(i) { return this.thead.rows.item(0).cells.item(i).width; }; this.moveUpRow = function() { if(this.selectedRow) this.selectedRow.moveUp(); }; this.moveDownRow = function() { if(this.selectedRow) this.selectedRow.moveDown(); }; this.insertRow = function(row, newRow) { if(!row) if(this.rowCount()) if(typeof(row) == "number") row = this.tbody.rows.item(row); else row = this.tbody.rows.item(this.tbody.rows.length-1); var row_tmp; if((newRow) && (row)) row_tmp = newRow; else { row_tmp = this.createRow(); this.fillWithDefaultData(row_tmp); } if(this.rowCount() > 0 && row.nextSibling) this.tbody.insertBefore(row_tmp, row.nextSibling); else this.tbody.appendChild(row_tmp); return row_tmp; }; this.refreshRowIndex = function() { for(var i=0; i 0) { this.previousSibling.select(); return this.previousSibling; }else return this; } row.deleteRow = function(noNew) { if(this.myTable.selectedCell) this.myTable.selectedCell.deselect(); if(this.myTable.selectedRow) this.myTable.selectedRow.deselect(); if(this.myTable.rowCount() == 1 && !noNew) { var MyTaBlE = this.myTable; setTimeout( function() { MyTaBlE.addRow(); refreshPositionIndex();} , 1000); } this.myTable.tbody.removeChild(this); this.myTable.refreshRowIndex(); } row.moveUp = function() { if(!this.previousSibling) return; this.myTable.tbody.insertBefore(this,this.previousSibling); this.myTable.refreshRowIndex(); } row.moveDown = function() { if(!this.nextSibling) this.myTable.addRow(row); this.myTable.tbody.insertBefore(this.nextSibling,this); this.myTable.refreshRowIndex(); } row.setData = function(data) { if(!data || typeof(data) != "object") { return; }; for(var i=0; i