function paiXu(obj)
{	
var lie_id=obj.cellIndex;
var tb=document.getElementById("tb_data"); 
var tdValue
var arr_col=[]
for(var i=tb_head;i<tb.rows.length;i++)
{
tdValue=tb.rows[i].cells[lie_id].innerHTML;
tdValue=right("00000000000"+tdValue,10);
tdValue=tdValue+"-"+i;
arr_col[i-tb_head]=tdValue;
}
arr_col.sort();
var col_count=tb.rows[tb_head].cells.length;
var arr=new Array();
for(var i=0;i<arr_col.length;i++)
{
arr[i]=new Array();
var id=arr_col[i];
id=id.substring(id.lastIndexOf('-')+1)
for(var j=0;j<col_count-1;j++)
{
v=tb.rows[id].cells[j+1].innerHTML;
arr[i][j]=v;
}
}
colName=tb.rows[0].cells[lie_id].innerHTML
clear_jianTou()
new_colName=tb.rows[0].cells[lie_id].innerHTML
if(colName.indexOf("↓")>-1)
{
for(var i=0;i<arr.length;i++)
{
for(var j=0;j<arr[i].length;j++)
{
tb.rows[i+tb_head].cells[j+1].innerHTML=arr[i][j];
}
}
tb.rows[0].cells[lie_id].innerHTML=new_colName+"↑"
}
else
{
var l=tb_head;
for(var i=arr.length-1;i>=0;i--)
{	
for(var j=0;j<arr[i].length;j++)
{			
tb.rows[l].cells[j+1].innerHTML=arr[i][j];				
}
l++;
}
tb.rows[0].cells[lie_id].innerHTML=new_colName+"↓"
}
}
function clear_jianTou()
{
var tb=document.getElementById("tb_data");
for(var i=1;i<tb.rows[0].cells.length;i++)
{
tdValue=tb.rows[0].cells[i].innerHTML;	
tdValue=tdValue.replace("↓","")
tdValue=tdValue.replace("↑","")
tb.rows[0].cells[i].innerHTML=tdValue
}
}
function add_changYong()
{	var span=document.getElementById("span_show").style.display
if(span=='none')
{
document.getElementById("span_show").style.display=''
return;
}
var checkbox1=document.getElementById("checkbox1").checked
var checkbox2=document.getElementById("checkbox2").checked
var checkbox3=document.getElementById("checkbox3").checked
var tb_width=document.getElementById("tb_data").width
var but_cur
if(document.getElementById('but_baoBiao').className=='menu_but_cur')
{
but_cur='but_baoBiao'
}
if(document.getElementById('but_zhuXingTu').className=='menu_but_cur')
{
but_cur='but_zhuXingTu'
}	
if(document.getElementById('but_tiaoXingTu').className=='menu_but_cur')
{
but_cur='but_tiaoXingTu'
}	
if(document.getElementById('but_bingXingTu').className=='menu_but_cur')
{
but_cur='but_bingXingTu'
}	
if(document.getElementById('but_mianJiTu').className=='menu_but_cur')
{
but_cur='but_mianJiTu'
}	
var url=document.location.href;
var arr=url.split("/sys/");	
url="../../../sys/"+arr[1];
url+="&tb_width="+tb_width+"&checkbox1="+checkbox1+"&checkbox2="+checkbox2+"&checkbox3="+checkbox3+"&but_cur="+but_cur
siv('url',url);
form2.submit();
}
function onLoad_show()
{
var url=document.location.href;
if(url.indexOf("button=hide") > 0)
{	
document.getElementById('tianJia_new_form').disabled='disabled';
}
if(url.indexOf("checkbox1=false") > 0)
{
document.getElementById('menu_bar').style.display='none'
} 
if(url.indexOf("checkbox2=false") > 0)
{
document.getElementById('button_id').style.display='none'
document.getElementById('tianJia_new_form').style.display='none'
}
var tb_width=request("tb_width");
if(tb_width=="")tb_width=700;
document.getElementById('tb_data').width=tb_width;
var na
if(url.indexOf("but_cur=but_baoBiao") > 0)
{
show_baoBiao(this)
document.getElementById('but_baoBiao').className='menu_but_cur'
var a=gid("title_id").value
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
gid("title_id").value=arr[0]+'【报表】'
}
}
siv("title_id","【报表】")
if(url.indexOf("but_cur=but_zhuXingTu") > 0)
{
show_zhuXinTu(this)
document.getElementById('but_zhuXingTu').className='menu_but_cur'			
}
if(url.indexOf("but_cur=but_tiaoXingTu") > 0)
{
show_tiaoXinTu(this)
document.getElementById('but_tiaoXingTu').className='menu_but_cur'
}
if(url.indexOf("but_cur=but_bingXingTu") > 0)
{
show_bingXinTu(this)
document.getElementById('but_bingXingTu').className='menu_but_cur'
}
if(url.indexOf("but_cur=but_mianJiTu") > 0)
{
show_mianJiTu(this)
document.getElementById('but_mianJiTu').className='menu_but_cur'
}
}
function show_title()
{	
var obj=document.getElementsByName("save_type")
for(var i=0;i<obj.length;i++)
{
if(obj[i].checked==true)
{
if(obj[i].value=='modify')
{
document.getElementById('title_123').style.display='none';
}
else if(obj[i].value=='reName')
{
document.getElementById('title_123').style.display='';
}
}
}
}
function clearradio()
{	
var radio_a=document.getElementsByName("save_type");
for(var i=0;i<radio_a.length;i++)
{	
if(radio_a[i].checked==true)
{
radio_a[i].checked=false;
}
}
}
function set_tb_width()
{
var tb=gid("tb_data")
if(tb)
{
tb.width=giv('tb_width');
}
}
function show_mianJiTu(obj,type)
{
document.getElementById("span_show").style.display='none';
document.getElementById("div_save_type").style.display="none";
gid('tool_tbale').style.display='none';
gid('tool_tu').style.display='';
gid('span_mianJitu').style.display='';
gid('span_zhuXingtu').style.display='none';
gid('span_tiaoXingtu').style.display='none';
gid('div_tu').style.display='';
gid('div_baoBiao').style.display='none';
if(type=='100%')
{
w='100%'
}
else
{
var tb=document.getElementById('tb_data')
var c=tb.rows.length;
var w=c*20;
if(w<700)w=700;
w=w+"px"
}
var div_chart_box=document.getElementById("chart_box")
div_chart_box.style.width=w;
div_chart_box.style.height='500px';
get_source_mianJi();
show_chart();
var a=gid("title_id").value
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
gid("title_id").value=arr[0]+'【面积图】'
}
show_cur(obj);
}
function get_source_mianJi()
{	
var s= get_chart_option_y_standard_mianJi();
var box=document.getElementById("option_source");
box.value=s; 
} 
function get_source()
{    
var s= get_chart_option_y_standard();
var box=document.getElementById("option_source");
box.value=s;
}
function get_source_tiaoXin()
{	
var s= get_chart_option_y_standard_tiaoXin();
var box=document.getElementById("option_source");
box.value=s; 
}
function get_source_bingXin()
{	
var s= get_chart_option_y_standard_bingXin();
var box=document.getElementById("option_source");
box.value=s; 
}
function show_chart()
{	
var box=document.getElementById("option_source");
var myChart =echarts.init(document.getElementById('chart_box'));	
eval(box.value) 
myChart.setOption(option);
window.onresize = function ()
{
myChart.resize();
}
}
function print_this()
{	
document.getElementById("div_save_type").style.display="none";
document.getElementById("tt").style.display="none";
window.print();
document.getElementById("tt").style.display="";
}
function down_this_page(typ)
{	
document.getElementById("div_save_type").style.display="none";
var tb=document.getElementById("tb_data");
var trs="";
var docs="";
for(var i=0;i<tb.rows.length;i++)
{	
var tr="";
var doc="";
var douHao="";
for(var j=0;j<tb.rows[i].cells.length;j++)
{
if(j>0)douHao=",";
var v=tb.rows[i].cells[j].innerHTML;
if(v.indexOf(',')>-1)v='"'+v+'"';
tr+=douHao+v;
doc+="<td>"+v+"</td>"
}
trs+=tr+"\n\r";
docs+="<tr>"+doc+"</tr>";
}
var f=new Date().toLocaleString();
f=f.replace(/:/g,"：");
if (typ=='doc')
{	
f="报表"+f+".doc";
var s="<html><head>"
s+="<meta http-equiv=Content-Type content='text/html; charset=gb2312'>";
s+="<meta name=Generator content='Microsoft Word 11 (filtered)'>";
s+="</head>";
s+="<body>";
s+="<table>"+docs+"</table>";
s+="</body>";
s+="</html>";
if(js_save_file(f,s)==false)
{
down_this_page_sub(s,f)	;
}
}
else
{
f="报表"+f+".csv";
down_this_page_sub(trs,f);	
}
}
function down_this_page_sub(s,f)
{
var box=document.getElementById('down_box');
if(box)
{
box.value=s;
var file_box=document.getElementById('file_box');
file_box.value=f;
form1.action="?exe=down_tb";
form1.submit();
}else
{
alert("下载失败");	
}
}
function save_this_page(classID)
{
window.showModelessDialog('../main/dialog.htm?go=../asp/baoBiao_save.asp?exe=show_add&classID='+classID,window,'status:no;resizable:yes;help:no;dialogWidth:500px;dialogHeight:350px')
}
function show_baoBiao(obj)
{
document.getElementById("span_show").style.display='none';
document.getElementById("div_save_type").style.display="none";
gid('tool_tbale').style.display='';
gid('tool_tu').style.display='none';
gid('div_tu').style.display='none';
gid('div_baoBiao').style.display='';
show_cur(obj);
var a=giv("title_id");
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
siv("title_id",arr[0]+'【报表】')
}
}
function show_zhuXinTu(obj,type)
{
document.getElementById("span_show").style.display='none';
document.getElementById("div_save_type").style.display="none";
gid('tool_tbale').style.display='none';
gid('tool_tu').style.display='';
gid('span_zhuXingtu').style.display='';
gid('span_tiaoXingtu').style.display='none';
gid('span_mianJitu').style.display='none';
gid('div_tu').style.display='';
gid('div_baoBiao').style.display='none';
if(type=='100%')
{
w='100%'
}
else
{
var tb=document.getElementById('tb_data')
var c=tb.rows.length;
var w=c*20;
if(w<700)w=700;
w=w+"px"
}
var div_chart_box=document.getElementById("chart_box")
div_chart_box.style.width=w;
div_chart_box.style.height='500px';
get_source();	
show_chart();
var a=gid("title_id").value
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
gid("title_id").value=arr[0]+'【柱形图】'
}
show_cur(obj);
}
function show_tiaoXinTu(obj,type)
{
document.getElementById("span_show").style.display='none';
document.getElementById("div_save_type").style.display="none";
gid('tool_tbale').style.display='none';
gid('tool_tu').style.display='';
gid('span_zhuXingtu').style.display='none';
gid('span_tiaoXingtu').style.display='';
gid('span_mianJitu').style.display='none';
gid('div_tu').style.display='';
gid('div_baoBiao').style.display='none';
if(type=='100%')
{
h='700'
}
else{
var tb=document.getElementById('tb_data')
var c=tb.rows.length;
var h=c*20;
if(h<400)h=400;
h=h+"px"
}
var div_chart_box=document.getElementById("chart_box")
div_chart_box.style.height=h;
div_chart_box.style.width='800px';
get_source_tiaoXin();
show_chart();
var a=gid("title_id").value
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
gid("title_id").value=arr[0]+'【条形图】'
}
show_cur(obj);
}
function show_bingXinTu(obj)
{
document.getElementById("span_show").style.display='none';
document.getElementById("div_save_type").style.display="none";
gid('tool_tbale').style.display='none';
gid('tool_tu').style.display='';
gid('span_zhuXingtu').style.display='none';
gid('span_tiaoXingtu').style.display='none';
gid('span_mianJitu').style.display='none';
gid('div_tu').style.display='';
gid('div_baoBiao').style.display='none';
var tb=document.getElementById('tb_data')
var c=tb.rows.length;
var h=c*7;
var w=700+2*c
if(h<500)h=500;
h=h+"px"
w=w+"px"
var div_chart_box=document.getElementById("chart_box")
div_chart_box.style.height=h;
div_chart_box.style.width=w;
get_source_bingXin();	
show_chart();
var a=gid("title_id").value
var arr
if(a.indexOf("【")>0)
{
arr=a.split("【")
gid("title_id").value=arr[0]+'【饼形图】'
}
show_cur(obj);
}
function show_cur(obj)
{
var buts=gid('menu_bar').getElementsByTagName("BUTTON");
for(var i=0;i<buts.length;i++)
{
buts[i].className='menu_but'
}
obj.className='menu_but_cur'
}