//检查字符串是否为数值
function isNumber( str ){
 	if( str.length == 0 ) return false;
 	for( var loc=0; loc<str.length; loc++ )
 		if( (str.charAt(loc) < '0') || (str.charAt(loc) > '9') ) return false;
 	return true;	
}
 	
//删除字符串前后的空白
function trim(strText){ 
  while (strText.substring(0,1) == ' ') 
    strText = strText.substring(1, strText.length);
  while (strText.substring(strText.length-1,strText.length) == ' ')
    strText = strText.substring(0, strText.length-1);
  return strText;
} 

function openwin(url){
	newwin = window.open(url, "newwindow", "toolbar=no,location=no, status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=250");
}

//分页函数
function show_pages(u,p,c,n)//(url,pagenum,curpage,n) url 页数 当前页 分页单位
{
	n_p = Math.ceil(p/n);
	n_c = Math.ceil(c/n);
	document.writeln("Goto Page: ");
	if(n_p > 1)
		if(n_c > 1)
			document.writeln("<a href="+u+((n_c-2)*n+1)+">&lt;&lt;上"+n+"页</a> ");
	
	for(i=(n_c-1)*n+1;i<=Math.min((n_c-1)*n+n,p);i++)
		if(i==c)
			document.writeln("<b>"+i+"</b> ");
		else
			document.writeln("<a href="+u+i+">"+i+"</a> ");
			
	if(n_p > 1)
		if(n_c < n_p)
			document.writeln("<a href="+u+(n_c*n+1)+">下"+n+"页&gt;&gt;</a> ");
}


