//

function printPageNavigator(target, totalp, curno, pagetabs, dir) {
	try {
		var pgs = "pg=";		
		var exist = target.indexOf("?"); // ?sname
		if (exist > 0)
			pgs = '&' + pgs; // -1 this way too
		else
			pgs = '?' + pgs;
		/*trace("printPageNavigator", "target", target);
		trace("printPageNavigator", "exist", exist);
		trace("printPageNavigator", "pgs", pgs);
		*/
		
	// The box
		document.write("<select name='selectpage' onChange=\"document.open(this.value,'_self','');\">");
		
		var ths;
		for (var i = 1; i <= totalp; i++){
			document.write("<option value='" + target + pgs + i + "'");
			if (i == curno)
				document.write(" selected ");
			ths = ">第 " + i + "/" + totalp + " 页"
			if (pagetabs != null) {
				document.write(ths + " " + pagetabs[i-1] + "</option>");
			} else {
				document.write(ths + "</option>");
			}
		}	
		document.write("</select>");	
		
		var p1 = "<a href=\"" + target + pgs;
		var p2 = "\">";
		var p3 = "</a>&nbsp;&nbsp;";
		var blanks2 = "&nbsp;&nbsp;";
		var spanhd = "<span class='text_grey'>";
		
		var headt = "&nbsp;<span title='" + pagetabs[0] + "'><首页></span>";
		var endt = "<span title='" + pagetabs[totalp-1] + "'><末页></span>";
		var previoust = "<span title='" + pagetabs[curno-2] + "'><上页></span>";
		var nextt = "<span title='" + pagetabs[curno] + "'><下页></span>";
		
		document.write(blanks2);
		
		if (dir != null && dir != "")
			document.write("&nbsp;<a href=\"" + target + "&section=" + dir + p2 + "<目录>" + p3);
		
		if (curno != 1)
			document.write(p1 + "1" + p2 + headt + p3);
		else
			document.write(spanhd + "&nbsp;<首页></span>" + blanks2);
			
		if (curno > 2)
			document.write(p1 +  (curno-1).toString() + p2 + previoust + p3);
		else
			document.write(spanhd + "<上页></span>" + blanks2);

		var currt = "<span title='" + pagetabs[curno-1] + "'>" + curno + "</span>";
		document.write(blanks2 + currt + "&nbsp;" + blanks2);
		
		if (curno < totalp-1 )
			document.write(p1 + (curno+1).toString() + p2 + nextt + p3);
		else
			document.write(spanhd + "<下页></span>" + blanks2);
			
		if (curno != totalp)
			document.write(p1 +  totalp + p2 + endt + p3);
		else
			document.write(spanhd + "<末页></span>" + blanks2);	
		
	} catch(ex) {
	//	
	}

}
