if(location.href.toLowerCase().indexOf("pagesize=")!=-1)ShowPagerClone();
function ShowPagerClone(){
var strs = window.location.search.substr(1).split("&");var par1="0";for(i=0;i<strs.length;i++){if([strs[i].split("=")[0]]=="pagesize")par1=unescape(strs[i].split("=")[1]);}
if(document.getElementById("AspNetPager1")&&parseInt(par1)>20)if(document.getElementById("DataPagerCopy")){document.getElementById("DataPagerCopy").style.display="block";}
}


var SelectEd=0;
function selectAll(tablename){
if(SelectEd==0){theBool=true;SelectEd=1;}else if(SelectEd==1){theBool=false;SelectEd=0;}
var ctl = document.getElementById(tablename);var checkbox = ctl.getElementsByTagName("input"); 
var k=0;for(var j=0;j<checkbox.length;j++){if(checkbox[j].type=="checkbox"){if(checkbox[j].checked==true)k++;}}
if(k>0) for(var i=0;i<checkbox.length;i++){if(checkbox[i].type=="checkbox"){if(checkbox[i].checked==true)checkbox[i].checked = 0;else checkbox[i].checked = 1;tdsel(checkbox[i])}}   
else for(var i=0;i<checkbox.length;i++){if(checkbox[i].type=="checkbox"){checkbox[i].checked = theBool;tdsel(checkbox[i])}}
}


function orderby(obj1){
var objL=obj1.substring(0,obj1.indexOf("="));
var objR=obj1.substring(obj1.indexOf("=")+1);
var url=location.href.replace("&&","&");if(url.indexOf("#")!=-1)url=url.substring(0,url.indexOf("#"));
if(url.indexOf("ordercustom")!=-1){
var arr1 = location.search.substr(1).split("&");
var p1="";p2="";for(i=0;i<arr1.length;i++){if([arr1[i].split("=")[0]].toString()=="ordercustom"){p1=arr1[i].split("=")[0];p2=arr1[i].split("=")[1];}}
url=url.replace(p1+"="+p2,"");url=url.replace("?&","?");if(url.substring(url.length-1)=="?")url=url.substring(0,url.length-1);if(url.substring(url.length-1)=="&")url=url.substring(0,url.length-1);
}
url=orderby_sub(objL,url);
var search=location.search;
if(search.indexOf(objL+"=")!=-1){
var par1="";var par2="";
var strs = search.substr(1).split("&");for(i=0;i<strs.length;i++){if([strs[i].split("=")[0]]==objL) {par1=unescape(strs[i].split("=")[0]);par2=unescape(strs[i].split("=")[1]);}}
window.location=url.replace(par1+"="+par2,objL+"="+objR);
}
else{url=url.replace(".aspx&",".aspx?");if(url.indexOf("?")!=-1)window.location=url+"&"+obj1;else window.location=url+"?"+obj1;}
}
function orderby_sub(objL,url){
var search=location.search;var par1="";var par2="";
var strs = search.substr(1).split("&");for(i=0;i<strs.length;i++){if([strs[i].split("=")[0]].toString().indexOf("orderby_")!=-1){par1=unescape(strs[i].split("=")[0]);par2=unescape(strs[i].split("=")[1]);}}
if(objL!=par1)url=url.replace("?"+par1+"="+par2,"").replace("&"+par1+"="+par2,"");
return url;}


function act(type,id,ReturlUrl,confirmtip){var do1=true;if(confirmtip!=""){if(!confirm(confirmtip)){do1=false;}}
if(do1){
var url=location.href;url=url.substring(0,url.indexOf("?"));
window.location=url+"?act="+type+"&id="+id+"&ReturnUrl="+base64en(ReturlUrl);
}
}


function tdsel(obj1){if(obj1.checked){if(obj1.parentNode.parentNode.parentNode.className=="tr1")obj1.parentNode.parentNode.parentNode.className="trseltr1";else obj1.parentNode.parentNode.parentNode.className="trsel";}else{if(obj1.parentNode.parentNode.parentNode.className=="trseltr1")obj1.parentNode.parentNode.parentNode.className="tr1";else obj1.parentNode.parentNode.parentNode.className="";}}


document.onkeydown = function chang_page(e){
if(document.getElementById("Panel_Turn")){
var theEvent=window.event||e;var keyNum=theEvent.keyCode||theEvent.which;
if(KeyTurn==1){var id="";var urlsearch=window.location.search;if(urlsearch.indexOf("?")!=-1){var strs = urlsearch.substr(1).split("&");for(i=0;i<strs.length;i++){if([strs[i].split("=")[0]]=="page") id=unescape(strs[i].split("=")[1]);}}
if(id==""){if(document.getElementById("Panel_Turn").innerHTML.indexOf("最后页")!=-1){if(id!=1)if (keyNum== 37 || keyNum == 33)return false;if (keyNum == 39 || keyNum == 34){if(urlsearch.indexOf("?")!=-1)location = urlsearch+"&page=2";else location = urlsearch+"?page=2";return;}}}
var strPrev=urlsearch.replace("page="+id,"page="+(parseInt(id)-1));var strNext=urlsearch.replace("page="+id,"page="+(parseInt(id)+1));
if(id!=1)if (keyNum== 37 || keyNum == 33) location = strPrev;if(document.getElementById("Panel_Turn").innerHTML.indexOf("最后页")!=-1){if (keyNum == 39 || keyNum == 34) location = strNext;}}}}

function showhidefun(){
if(document.getElementById("funwrap").style.display=="none"){document.getElementById("funwrap").style.display="";document.getElementById("funwrap_show").style.display="none";SetCookie("CK_funwrap","block",1);}
else{document.getElementById("funwrap").style.display="none";document.getElementById("funwrap_show").style.display="";SetCookie("CK_funwrap","none",1);}}
function showhidefun_Auto(){if(GetCookie("CK_funwrap")=="none"){document.getElementById("funwrap").style.display="none";document.getElementById("funwrap_show").style.display="";}}


//单元格栏（-1则不进行单元格双击），数据表，数据字段，数据类型（N数字B布尔D时间T文本），显示表单元素（text、textarea、select、editor），表单元素宽，表单元素高（为0则不限制），限制长度（不限制则为0，只对text有效），是否修改（1或者0），字段中文说明
function ListMiniViewEdit(tableid,pars,indexkeyid){
if(document.getElementById(tableid)){
var parsarrstr="";for(m=0;m<pars.length;m++)parsarrstr+=pars[m]+".";
var theTable=document.getElementById(tableid);
for(i=0;i<theTable.rows.length;i++){
for(j=0;j<theTable.rows[i].cells.length;j++){
for(k=0;k<pars.length;k++){
var par=pars[k];
if(i!=0&&j==par.substring(0,par.indexOf(","))){
ListMiniViewEdit_dbclick(tableid,par,i,j,indexkeyid,parsarrstr); 
}
} 
}}}}
function ListMiniViewEdit_dbclick(tableid,par,trindex,tdindex,indexkeyid,parsarrstr){
document.getElementById(tableid).rows[trindex].cells[tdindex].onclick=function(){
ListMiniViewEdit_do(tableid,par,trindex,tdindex,indexkeyid,parsarrstr);
}}

function ListMiniViewEdit_do(tableid,par,trindex,tdindex,indexkeyid,parsarrstr){
var theTable=document.getElementById(tableid);
var indexkeyvalue=theTable.rows[trindex].cells[indexkeyid].innerHTML.toLowerCase();
if(indexkeyvalue.indexOf("<a")!=-1){
if(indexkeyvalue.indexOf("target=\"_blank\">")!=-1)indexkeyvalue=indexkeyvalue.substring(indexkeyvalue.indexOf("target=\"_blank\">")+("target=\"_blank\">").length);
if(indexkeyvalue.indexOf("target=_blank>")!=-1)indexkeyvalue=indexkeyvalue.substring(indexkeyvalue.indexOf("target=_blank>")+("target=_blank>").length);
indexkeyvalue=indexkeyvalue.substring(0,indexkeyvalue.indexOf("</a>"));
}
var pararr=par.split(",");var strwidth=pararr[5];var strheight=pararr[6];strwidth=(parseInt(strwidth)+4).toString();if(strheight=="0")strheight=(parseInt(strheight)+77).toString();else strheight=(parseInt(strheight)+57).toString();
KeyTurn=0;TINY.box.show("ListMiniDo.aspx?rd="+Math.random()+"&tableid="+tableid+"&trindex="+trindex+"&tdindex="+tdindex+"&indexkeyid="+indexkeyid+"&indexkeyvalue="+indexkeyvalue+"&par="+par+"&parsarrstr="+parsarrstr,1,strwidth,strheight,1,0);
pararr=null;
}

function doMiniEdit(obj1,sqltable,tablefield,indexkeyvalue)
{
var strContent=document.getElementById(obj1).value;
var strUrl="ListMiniDo.aspx?act=save&rd="+Math.random();var strPar="rd="+Math.random()+"&sqltable="+sqltable+"&tablefield="+tablefield+"&indexkeyvalue="+indexkeyvalue+"&content="+base64en(strContent)+"&ReturnUrl="+base64en(location.href);
ajax("post",strUrl,strPar,function OnHandler(){if(xmlHttp.readyState == 4){doMiniEdit_Return(xmlHttp.responseText);}});
}
function doMiniEdit_Return(str1){
if(str1!=""){
var sta1=str1.substring(0,1);sta2=str1.substring(1);
if(sta1=="1"){if(confirm("修改成功，是否刷新本页面！")){window.location=sta2;}}
else{alert("修改失败，请检查是否输入错误！");}
}
}