﻿// JScript 文件
var URLParams = new Object() ;
var aParams = document.location.search.substr(1).split('&') ;
for (i=0 ; i < aParams.length ; i++) {
	var aParam = aParams[i].split('=') ;
	URLParams[aParam[0]] = aParam[1] ;
}

var __pageCount;

var Params = document.location.search.substr(1);
Params=Params.replace(/&page=(\d+|.*)/g,"");

String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function w_open(url,name,width,height,scroll){
	window.open(url,name,"top="+(window.screen.availHeight-height)/2+",left="+(window.screen.availWidth-width)/2+",width="+width+",height="+height+",scrollbars="+scroll)
}
function w_m_open(url,name,width,height,scroll){
	mx=event.x+window.screenLeft+5;
	my=event.y+window.screenTop+5;
	window.open(url,name,"top="+my+",left="+mx+",width="+width+",height="+height+",scrollbars="+scroll)
}

function window_dialog(url,width,height){
	window.showModalDialog(url,window,"dialogWidth:"+width+"px;dialogHeight:"+height+"px;scroll:no;status:no;help:no;")
}

function Select_All(obj_select,obj_check){
	if(obj_check.checked==true){
		if(document.all[obj_select].length>0){
			for(i=0;i<document.all[obj_select].length;i++){
			document.all[obj_select].item(i).checked=true;}
		}else{
			document.all[obj_select].checked=true;
		}		
	}else{
		if(document.all[obj_select].length>0){
			for(i=0;i<document.all[obj_select].length;i++){
			document.all[obj_select].item(i).checked=false;}
		}else{
			document.all[obj_select].checked=false;
		}		
	}
}

function __gopg(p,pcount){
 var _pi;
 try{_pi=parseInt(p.value);}catch(e){return;}
 if(!_pi||_pi<1){p.value='';p.focus();return;}
 if(pcount){
  var _pc=parseInt(pcount);
  if(_pi>_pc){p.value='';p.focus(); return;}
 }
	var tParams = document.location.search.substr(1);
	tParams=tParams.replace(/&?pg=[^&]*/,'');
	tParams+='&pg='+_pi;
	location.href='?'+tParams;
}

function __gotopg(p){
	var tParams = document.location.search.substr(1);
	tParams=tParams.replace(/&?pg=[^&]*/,'');
	tParams+='&pg='+p;
	location.href='?'+tParams;
}

function __pagelist(pindex,psize,rcount,listindex){
 var invalid="";
 if(typeof(listindex)=="undefined" ) listindex="";
 if(psize<=0) psize=20;
 var pcount=parseInt(rcount/psize)+((rcount%psize)>0?1:0);
 if(rcount<=0||pcount<=1) invalid=" disabled";
 document.write('Displaying '+rcount+' Accounts of '+pindex+'/'+pcount+'Pages ');
 if(pindex>1)
  document.write('<a href="javascript:__gotopg(1)">First Page</a> <a href="javascript:__gotopg('+(pindex-1)+')">Last</a> ');
 else
  document.write('<a>First Page</a> <a>Last</a> ');
 if(pindex<pcount)
  document.write('<a href="javascript:__gotopg('+(pindex+1)+')">Next</a> <a href="javascript:__gotopg('+pcount+')">End</a> ');
 else
  document.write('<a>Next</a> <a>End</a> ');
 document.write('Go to<input type="text" id="__i_pi'+listindex+'" value="" size="2" maxlength="5" style="width:30px"'+invalid+'/><input type="button" onclick="__gopg(document.all[\'__i_pi'+listindex+'\'],'+pcount+')" value="GO"'+invalid+'/>');
}

function __pagelist_en(pindex,psize,rcount){
 var invalid="";
 if(psize<=0) psize=20;
 var pcount=parseInt(rcount/psize)+((rcount%psize)>0?1:0);
 if(rcount<=0||pcount<=1) invalid=" disabled";
 document.write('Records:'+rcount+' Pages:'+pindex+'/'+pcount+' ');
 if(pindex>1)
  document.write('<a href="javascript:__gotopg(1)">Home</a> <a href="javascript:__gotopg('+(pindex-1)+')">Prev</a> ');
 else
  document.write('<a>Home</a> <a>Prev</a> ');
 if(pindex<pcount)
  document.write('<a href="javascript:__gotopg('+(pindex+1)+')">Last</a> <a href="javascript:__gotopg('+pcount+')">Next</a> ');
 else
  document.write('<a>Last</a> <a>Next</a> ');
 document.write('Goto<input type="text" id="__i_pi" value="" size="2" maxlength="5" style="width:30px"'+invalid+'/><input type="button" onclick="__gopg(document.getElementById(\'__i_pi\').value,'+pcount+')" value="GO"'+invalid+'/>');
}


