function editCreateTable(row,col){var temp="";temp="<table style='width:50%' border='1'>";for(var i=0;i<row;i++){temp+="<tr>";for(var j=0;j<col;j++){if(globalFirstTableRowIsHeader&&i==0)temp+="<th>&nbsp;</th>";else temp+="<td>&nbsp;</td>"}temp+="</tr>"}temp+="</table>";editInsertHtml(temp)};function __editInsertRow(mode){try{var newRow=currentRow.cloneNode(true);var aCells=currentRow.cells;for(var i=0;i<aCells.length;i++){aCells[i].innerHTML="&nbsp;"}if(mode==1)currentRow.parentNode.insertBefore(newRow,currentRow);else currentRow.parentNode.insertBefore(newRow,currentRow.nextSibling)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteRow(){try{currentRow.parentNode.removeChild(currentRow)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editConvertRow(){try{for(var i=0;i<currentRow.cells.length;i++){var cell=currentRow.cells[i];if(cell.tagName=="TD"){var th=getDoc().createElement("th");th.innerHTML=cell.innerHTML;currentRow.replaceChild(th,cell)}if(cell.tagName=="TH"){var td=getDoc().createElement("td");td.innerHTML=cell.innerHTML;currentRow.replaceChild(td,cell)}}__editOnChanged(true)}catch(Error){};__editHidePopup()};function __editInsertColumn(mode){try{if(browser.ie){var index;if(mode==0){index=currentCol.cellIndex}else{index=currentCol.cellIndex+1}for(var i=0;i<table.rows.length;i++){table.rows[i].insertCell(index)}popup.hide()}else{if(mode==0){index=currentCol.cellIndex}else{index=currentCol.cellIndex+1}for(var i=0;i<table.rows.length;i++){var tr=table.rows[i];var curtd=tr.cells[index];var newtd=getDoc().createElement("td");newtd.innerHTML="&nbsp;";tr.insertBefore(newtd,curtd)}}}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteColumn(){try{var index=currentCol.cellIndex;for(var i=0;i<table.rows.length;i++){var tr=table.rows[i];var curtd=tr.cells[index];tr.removeChild(curtd)}}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteCell(){try{currentRow.removeChild(currentCol)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editColSpan(){try{var colspan1=table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].colSpan;var colspan2=table.rows[currentRow.rowIndex].cells[currentCol.cellIndex+1].colSpan;table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].innerHTML=table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].innerHTML+table.rows[currentRow.rowIndex].cells[currentCol.cellIndex+1].innerHTML;table.rows[currentRow.rowIndex].deleteCell(currentCol.cellIndex+1);table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].colSpan=(colspan1+colspan2)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDivideCell(){__editBuildTableMatrix();try{if(currentCol.colSpan>1){currentCol.colSpan=currentCol.colSpan-1;var newtd=getDoc().createElement("td");newtd.innerHTML="&nbsp;";currentRow.insertBefore(newtd,currentCol)}else{var index=currentCol.cellIndex;for(var i=0;i<table.rows.length;i++){var tr=table.rows[i];if(currentRow.rowIndex==i){var newtd=getDoc().createElement("td");newtd.innerHTML=currentCol.innerHTML;tr.insertBefore(newtd,currentCol);currentCol.innerHTML=""}else{var el=__editGetMatrixElement(i,index);var curtd=tr.cells[el];curtd.colSpan=curtd.colSpan+1}}}}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editRemoveTable(){try{var range=getDoc().createRange();var referenceNode=getDoc().body;range.selectNode(referenceNode);table.parentNode.removeChild(table)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editRowSpan(){try{var rowspan=table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].rowSpan;table.rows[currentRow.rowIndex+rowspan].deleteCell(currentCol);table.rows[currentRow.rowIndex].cells[currentCol.cellIndex].rowSpan=rowspan+1}catch(Error){};__editOnChanged(true);__editHidePopup()}function __editAddCell(){try{var cells=table.rows[currentRow.rowIndex].cells.length;if(currentRow.rowIndex>=1){var cellAll=table.rows[currentRow.rowIndex-1].cells.length;if(cellAll>cells)table.rows[currentRow.rowIndex].insertCell(cells)}else if(table.rows.length-1>currentRow.rowIndex){var cellAll=table.rows[table.rows.length-1].cells.length;if(cellAll>cells)table.rows[currentRow.rowIndex].insertCell(cells)}}catch(Error){};__editOnChanged(true);__editHidePopup()}var __editTableMatrix=null;function __editBuildTableMatrix(){__editTableMatrix=new Array(table.rows.length-1);for(var i=0;i<table.rows.length;i++){var tr=table.rows[i];var aCell=new Array();var curCol=0;for(var j=0;j<tr.cells.length;j++){var colspan=tr.cells[j].colSpan;if(colspan==1){aCell[curCol]=j;curCol++}else{for(var k=0;k<colspan;k++){aCell[curCol]=j;curCol++}}}__editTableMatrix[i]=aCell}}function __editGetMatrixElement(row,col){var cells=__editTableMatrix[row];return cells[col]}