function overIt(){
if(dragStart)return;
var the_obj = event.srcElement;
var i = 0;
if(the_obj.tagName.toLowerCase() != "table"){
var the_td = get_Element(the_obj,"td");
if(the_td==null) return;
var the_tr = the_td.parentElement;
var the_table = get_Element(the_td,"table");
if(the_tr.rowIndex!=0){
for(i=0;i<the_tr.cells.length;i++){
with(the_tr.cells[i]){
runtimeStyle.backgroundColor=act_bgc;
runtimeStyle.color=act_fc;
}
}
}else{
for(i=1;i<the_table.rows.length;i++){
with(the_table.rows[i].cells(the_td.cellIndex)){
runtimeStyle.backgroundColor=act_bgc;
runtimeStyle.color=act_fc;
}
}
if(the_td.mode==undefined)the_td.mode = false;
the_td.style.cursor=the_td.mode?"n-resize":"s-resize";
}
}
}function outIt(){
var the_obj = event.srcElement;
var i=0;
if(the_obj.tagName.toLowerCase() != "table"){
var the_td = get_Element(the_obj,"td");
if(the_td==null) return;
var the_tr = the_td.parentElement;
var the_table = get_Element(the_td,"table");
if(the_tr.rowIndex!=0){
for(i=0;i<the_tr.cells.length;i++){
with(the_tr.cells[i]){
runtimeStyle.backgroundColor='';
runtimeStyle.color='';
}
}
}else{
var the_table=the_tr.parentElement.parentElement;
for(i=0;i<the_table.rows.length;i++){
with(the_table.rows[i].cells(the_td.cellIndex)){
runtimeStyle.backgroundColor='';
runtimeStyle.color='';
}
}
}
}
}var charPYStr = "啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶";
var charBHStr = "一乙丁七乃九了二人儿入八几刀刁力十卜厂又万丈三上下个丫丸久么义乞也习乡于亏亡亿凡刃勺千卫叉口土士";
function judge_CN(char1,char2,mode){
var charSet=charMode?charBHStr:charPYStr;
for(var n=0;n<(char1.length>char2.length?char1.length:char2.length);n++){
if(char1.charAt(n)!=char2.charAt(n)){
if(mode) return(charSet.indexOf(char1.charAt(n))>charSet.indexOf(char2.charAt(n))?1:-1);
else  return(charSet.indexOf(char1.charAt(n))<charSet.indexOf(char2.charAt(n))?1:-1);
break;
}
}
return(0);
}function sort_tab(the_tab,col,mode){
var tab_arr = new Array();
var i;
var start=new Date;
for(i=1;i<the_tab.rows.length;i++){
tab_arr.push(new Array(the_tab.rows[i].cells[col].innerText.toLowerCase(),the_tab.rows[i]));
}
function SortArr(mode) {
return function (arr1, arr2){
var flag;
var a,b;
a = arr1[0];
b = arr2[0];
if(/^(\+|-)?\d+($|\.\d+$)/.test(a) && /^(\+|-)?\d+($|\.\d+$)/.test(b)){
a=eval(a);
b=eval(b);
flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
}else{
a=a.toString();
b=b.toString();
if(a.charCodeAt(0)>=19968 && b.charCodeAt(0)>=19968){
flag = judge_CN(a,b,mode);
}else{
flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
}
}
return flag;
};
}
tab_arr.sort(SortArr(mode));

for(i=0;i<tab_arr.length;i++){
the_tab.lastChild.appendChild(tab_arr[i][1]);
} window.status = " (Time spent: " + (new Date - start) + "ms)";
}function change_row(the_tab,line1,line2){
the_tab.rows[line1].swapNode(the_tab.rows[line2])
}function change_col(the_tab,line1,line2){
for(var i=0;i<the_tab.rows.length;i++)
the_tab.rows[i].cells[line1].swapNode(the_tab.rows[i].cells[line2]);
}function Move_up(the_table){
event.cancelBubble=true;
if(cur_row==null || cur_row<=1)return;
change_row(the_table,cur_row,--cur_row);
}function Move_down(the_table){
event.cancelBubble=true;
if(cur_row==null || cur_row==the_table.rows.length-1 || cur_row==0)return;
change_row(the_table,cur_row,++cur_row);
}function Move_left(the_table){
event.cancelBubble=true;
if(cur_col==null || cur_col==0)return;
change_col(the_table,cur_col,--cur_col);
if(cur_col==sort_col)sort_col=cur_col+1;
else if(cur_col+1==sort_col)sort_col=cur_col;
}function Move_right(the_table){
event.cancelBubble=true;
if(cur_col==null || cur_col==the_table.rows[0].cells.length-1)return;
change_col(the_table,cur_col,++cur_col);
if(cur_col==sort_col)sort_col=cur_col-1;
else if(cur_col-1==sort_col)sort_col=cur_col;
}function add_row(the_table) {
event.cancelBubble=true;
var the_row,the_cell;
the_row = cur_row==null?-1:(cur_row+1);
clear_color();
var newrow=the_table.insertRow(the_row);
for (var i=0;i<the_table.rows[0].cells.length;i++) {
the_cell=newrow.insertCell(i);
the_cell.innerText="NewRow_" + the_cell.parentElement.rowIndex;
}
read_def(the_table);
}function del_row(the_table) {
if(the_table.rows.length==1) return;
var the_row;
the_row = (cur_row==null || cur_row==0)?-1:cur_row;
the_table.deleteRow(the_row);
cur_row = null;
cur_cell=null;
}function add_col(the_table) {
event.cancelBubble=true;
var the_col,i,the_cell;
the_col = cur_col==null?-1:(cur_col+1);
var the_title=prompt("Please input the title: ","Untitled");
if(the_title==null)return;
if(the_col!=-1 && the_col<=sort_col && sort_col!=null)sort_col++;
the_title=the_title==""?"Untitled":the_title
clear_color();
for(var i=0;i<the_table.rows.length;i++){
the_cell=the_table.rows[i].insertCell(the_col);
the_cell.innerText=i==0?the_title:("NewCol_" + the_cell.cellIndex);
}
read_def(the_table);
}function del_col(the_table) {
if(the_table.rows[0].cells.length==1) return;
var the_col,the_cell;
the_col = cur_col==null?(the_table.rows[0].cells.length-1):cur_col;
if(the_col!=-1 && the_col<sort_col && sort_col!=null)sort_col--;
else if(the_col==sort_col)sort_col=null;
for(var i=0;i<the_table.rows.length;i++) the_table.rows[i].deleteCell(the_col);
cur_col = null;
cur_cell=null;
}function res_tab(the_table){
the_table.outerHTML=Org_con;
init();
}function exp_tab(the_table){
var the_content="";
document.onclick();
the_content=the_table.outerHTML;
the_content=the_content.replace(/ style=\"[^\"]*\"/g,"");
the_content=the_content.replace(/ mode=\"(false|true)"/g,"");
the_content=the_content.replace(/ oBgc=\"[\w#\d]*\"/g,"");
the_content=the_content.replace(/ oFc=\"[\w#\d]*\"/g,"");
the_content=the_content.replace(/<span>(5|6)<\/span>/gi,"");
the_content=the_content.replace(/<DIV contentEditable=false>(.*)<\/DIV>/ig,"$1");
the_content="<style>table{font-size: 9pt;word-break:break-all;cursor: default;BORDER: black 1px solid;background-color:#eeeecc;border-collapse:collapse;border-Color:#999999;align:center;}</style>\n"+the_content;
var newwin=window.open("about:blank","_blank","");
newwin.document.open();
newwin.document.write(the_content);
newwin.document.close();
newwin=null;
}