<?php
	//引入语言包
	$bar_langpackage=new publiclp;
	
	$page_up=$bar_langpackage->pu_page_u;
	$page_down=$bar_langpackage->pu_page_d;
	$curPstyle='';
function page_show($mod,$page_num,$page_total){
	if($mod==0){
		pagesbar($page_num,$page_total,'page');
	}
}

function page_show_parameter($mod,$page_num,$page_total,$page){
	if($mod==0){
		pagesbar($page_num,$page_total,$page);
	}
}
//分页显示函数

function pagesbar($page_num,$page_total,$page){
	
	global $page_up;
	global $page_down;
	
	$get_para=getUrlPara();
	$para_arr=explode('&'.$page.'',$get_para);
	$get_para=$para_arr[0];
	
	if(empty($page_num)){ $page_num=1; }
	if($page_num>1){
		$prePageUrl=$get_para.'&'.$page.'='.($page_num-1);
	}else{
		$prePageUrl='javascript:void(0);" style="color:#838383';		 
	}

	if($page_total>$page_num){
		$nextPageUrl=$get_para.'&'.$page.'='.($page_num+1);
	}else{
		$nextPageUrl='javascript:void(0);" style="color:#838383';
	}
	?>

	<div class="pages_bar">
	<a href="<?php echo $prePageUrl;?>" style="margin-left:3px;right:3px">
	<?php echo $page_up;?></a>

	<?php
	if($page_total>10){
		
		if($page_num<=5){
			for($i=1;$i<=10;$i++){
				if($page_num==$i){
						$curPstyle=' style="font-weight:bold;text-decoration:underline"';
				}else{
						$curPstyle='';
				}
				echo '<a href="'.$get_para.'&'.$page.'='.$i.'" style="margin-left:1px;right:1px"'.$curPstyle.'>&nbsp;'.$i.'&nbsp;</a>';
			}
		}

		if($page_num>=6&&$page_num+5<$page_total){
			
				for($b=$page_num-4;$b<$page_num;$b++){
						echo '<a href="'.$get_para.'&'.$page.'='.$b.'" style="margin-left:1px;right:1px"'.$curPstyle.'>&nbsp;'.$b.'&nbsp;</a>';
				}
								
				echo '<a href="'.$get_para.'&'.$page.'='.$page_num.'" style="margin-left:1px;right:1px;font-weight:bold;text-decoration:underline">&nbsp;'.$page_num.'&nbsp;</a>';
					
				for($h=$page_num+1;$h <= $page_num+5 ;$h++){
						echo '<a href="'.$get_para.'&'.$page.'='.$h.'" style="margin-left:1px;right:1px"'.$curPstyle.'>&nbsp;'.$h.'&nbsp;</a>';
				}
		}
		
		if($page_num+5>=$page_total){
				for($i=$page_total-10;$i<=$page_total;$i++){
					if($page_num==$i){
						$curPstyle=' style="font-weight:bold;text-decoration:underline"';
					}else{
						$curPstyle='';
					}
					echo '<a href="'.$get_para.'&'.$page.'='.$i.'" style="margin-left:1px;right:1px"'.$curPstyle.'>&nbsp;'.$i.'&nbsp;</a>';
				}
		}
			
	}else{
		for($i=1;$i<=$page_total;$i++){
			if($page_num==$i){
				$curPstyle=' style="font-weight:bold;text-decoration:underline"';
			}else{
				$curPstyle='';
			}
			echo '<a href="'.$get_para.'&'.$page.'='.$i.'" style="margin-left:1px;right:1px"'.$curPstyle.'>&nbsp;'.$i.'&nbsp;</a>';
		}
	}
	?>
	<a href="<?php echo $nextPageUrl;?>" style="margin-left:3px;right3px">
	<?php echo $page_down;?></a>
	</div>
<?php
}
?>