/*
Modification or decryption of this file is strictly forbidden - Pintexx GmbH
*/
function __editPrepareTableObjects(){try{currentRow=null;currentCol=null;var curObject=editGetActiveObject();var tag=curObject.tagName.toLowerCase();if(tag=="th"||tag=="td"||tag=="tr"||tag=="table"){if(tag=="th"||tag=="td"||tag=="tr"){var parent=curObject;while(parent.tagName!="TABLE"){parent=parent.parentNode}__editCurrentTable=parent}if(tag=="th"||tag=="td"){currentRow=curObject.parentNode;currentCol=curObject;__editActiveObject=curObject}if(tag=="tr")currentRow=curObject;if(tag=="table"){__editCurrentTable=curObject;__editActiveObject=curObject}return true}else{return false}}catch(Error){return false}}function editCreateTable(row,col){var temp="";var style="";var space=globalUseSpaceInTableCell?"&nbsp;":"";var table="";if(browser.ns)space="<br>"+space;if(globalStaticTables)table="table-layout:fixed;";if(globalUserMode=="0"){temp="<table style='"+table+"width:200px' cellspacing='1' cellpadding='0' border='1'>";style="valign='top' align='left'"}else{temp="<table style='"+table+"empty-cells:show;border:1px solid black;border-collapse:collapse;width:200px' cellspacing='0' cellpadding='0' border='0'>";style="valign='top' align='left' style='width:80px;border: 1px solid black'"}for(var i=0;i<row;i++){temp+="<tr>";for(var j=0;j<col;j++){if(globalFirstTableRowIsHeader&&i==0){temp+="<th "+style+">"+space+"</th>"}else{temp+="<td "+style+">"+space+"</td>"}}temp+="</tr>"}temp+="</table>";editInsertHtml(temp)};function __editInsertRow(mode){try{if(!__editPrepareTableObjects())return;var space=globalUseSpaceInTableCell?"&nbsp;":"";if(browser.ns)space="<br>"+space;var newRow=currentRow.cloneNode(true);var aCells=currentRow.cells;for(var i=0;i<aCells.length;i++){aCells[i].innerHTML=space}if(mode==1)currentRow.parentNode.insertBefore(newRow,currentRow);else currentRow.parentNode.insertBefore(newRow,currentRow.nextSibling)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteRow(){try{if(!__editPrepareTableObjects())return;currentRow.parentNode.removeChild(currentRow)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editConvertRow(){try{if(!__editPrepareTableObjects())return;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(!__editPrepareTableObjects())return;index=currentCol.cellIndex;var space=globalUseSpaceInTableCell?"&nbsp;":"";if(browser.ns)space="<br>"+space;for(var i=0;i<__editCurrentTable.rows.length;i++){var tr=__editCurrentTable.rows[i];var curtd=tr.cells[index];var newtd=curtd.cloneNode(true);newtd.id="__tmpTD";newtd.innerHTML=space;if(mode==0)tr.insertBefore(newtd,curtd);else tr.insertBefore(newtd,curtd.nextSibling)}var newTD=getDoc().getElementById("__tmpTD");newTD.removeAttribute("id","",0);editSelectText(newTD)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteColumn(){try{if(!__editPrepareTableObjects())return;var index=currentCol.cellIndex;for(var i=0;i<__editCurrentTable.rows.length;i++){var tr=__editCurrentTable.rows[i];var curtd=tr.cells[index];tr.removeChild(curtd)}}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDeleteCell(){try{if(!__editPrepareTableObjects())return;currentRow.removeChild(currentCol)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editColSpan(){try{if(!__editPrepareTableObjects())return;var colspan1=__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].colSpan;var colspan2=__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex+1].colSpan;__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].innerHTML=__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].innerHTML+__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex+1].innerHTML;__editCurrentTable.rows[currentRow.rowIndex].deleteCell(currentCol.cellIndex+1);__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].colSpan=(colspan1+colspan2)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editDivideCell(){if(!__editPrepareTableObjects())return;__editBuildTableMatrix();try{var space=globalUseSpaceInTableCell?"&nbsp;":"";if(browser.ns)space="<br>"+space;if(currentCol.colSpan>1){currentCol.colSpan=currentCol.colSpan-1;var newtd=getDoc().createElement("td");newtd.innerHTML=space;currentRow.insertBefore(newtd,currentCol)}else{var index=currentCol.cellIndex;for(var i=0;i<__editCurrentTable.rows.length;i++){var tr=__editCurrentTable.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{if(!__editPrepareTableObjects())return;var range=getDoc().createRange();var referenceNode=getDoc().body;range.selectNode(referenceNode);__editCurrentTable.parentNode.removeChild(__editCurrentTable)}catch(Error){};__editOnChanged(true);__editHidePopup()};function __editRowSpan(){try{if(!__editPrepareTableObjects())return;var rowspan=__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].rowSpan;__editCurrentTable.rows[currentRow.rowIndex+rowspan].deleteCell(currentCol);__editCurrentTable.rows[currentRow.rowIndex].cells[currentCol.cellIndex].rowSpan=rowspan+1}catch(Error){};__editOnChanged(true);__editHidePopup()}function __editAddCell(){try{if(!__editPrepareTableObjects())return;var cells=__editCurrentTable.rows[currentRow.rowIndex].cells.length;if(currentRow.rowIndex>=1){var cellAll=__editCurrentTable.rows[currentRow.rowIndex-1].cells.length;if(cellAll>cells)__editCurrentTable.rows[currentRow.rowIndex].insertCell(cells)}else if(__editCurrentTable.rows.length-1>currentRow.rowIndex){var cellAll=__editCurrentTable.rows[__editCurrentTable.rows.length-1].cells.length;if(cellAll>cells)__editCurrentTable.rows[currentRow.rowIndex].insertCell(cells)}}catch(Error){};__editOnChanged(true);__editHidePopup()}var __editTableMatrix=null;function __editBuildTableMatrix(){__editTableMatrix=new Array(__editCurrentTable.rows.length-1);for(var i=0;i<__editCurrentTable.rows.length;i++){var tr=__editCurrentTable.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]}
