<?php

function p($page,$count_page,$link) {
if($page-1>=1) echo '<a class="knop" href="'.$link.'n='.($page-1).'" onclick="Page.Go(this.href); return false"><b>&#171;&#171;</b></a>';
else echo '<a class="knop" href="'.$link.'n='.($count_page).'" onclick="Page.Go(this.href); return false"><b>&#171;&#171;</b></a>';
}

function n($page,$count_page,$link)
{
if($page+1<=$count_page) echo '<a class="knop" href="'.$link.'n='.($page+1).'" onclick="Page.Go(this.href); return false"><b>&#187;&#187;</b></a>';
else echo '<a class="knop" href="'.$link.'n=1" onclick="Page.Go(this.href); return false"><b>&#187;&#187;</b></a>';
}

function navi($page, $pages, $link) {
	if ($pages > 1) {
	echo '<div class="navi">';
		for ($k = 1; $k <= $pages; $k++) {
			if ( $k == 1 or $k == $pages or 2 >= ($page - $k) and -2 <= ($page - $k) ) {

				if ($pages > 4 && $k == 1 && $page > 4) $write = ' <a href="'.$link.'p='.$k.'" onclick="Page.Go(this.href); return false">'.$k.'</a> <u>...</u> ';
				else if ($k == $page) {
					$write = ' <b>'.$k.'</b> ';
				} else {
					$write = ' <a href="'.$link.'p='.$k.'" onclick="Page.Go(this.href); return false">'.$k.'</a> ';
				}
				if ($pages > 4 && $k == $pages && $page < ($pages - 3)) $write = ' <u>...</u> '.$write;

				echo $write;
			}
		}
		echo '</div>';
	}
}

function navi_window($page, $pages, $link) {
	if ($pages > 1) {
		echo '<div class="panel"><center>';
		for ($k = 1; $k <= $pages; $k++) {
			if ( $k == 1 or $k == $pages or 2 >= ($page - $k) and -2 <= ($page - $k) ) {
				if ($k == $page) {
					$write = '<u>'.$k.'</u> ';
				} else {
					$write = '<a href="'.$link.'p='.$k.'" onclick="Window.Go(this.href); return false">'.$k.'</a> ';
				}
				echo $write;
			}
		}
		echo '</center>';
	}
}

?>