function navAnchor( funcName, pageNo, anchorText )
{
	return "<a href='javascript:" + funcName + "(" + pageNo + ")'>" + anchorText + "</a>";
}

function pageNav( funcName, pageNum, pageSize, total )
{
	if( total < 1 )
		return "";

	var ret = "";
	var PAGEBLOCK=10;
	var totalPages = Math.floor((total-1)/pageSize) + 1;

	var firstPage = Math.floor((pageNum-1)/PAGEBLOCK) * PAGEBLOCK + 1;
	if( firstPage <= 0 ) // ?
		firstPage = 1;

	var lastPage = firstPage-1 + PAGEBLOCK;
	if( lastPage > totalPages )
		lastPage = totalPages;

	if( firstPage > PAGEBLOCK )
	{
		ret += navAnchor(funcName, 1, "<<처음</a>") + "&nbsp;\n";
		ret += navAnchor(funcName, firstPage-1, "<이전") + "&nbsp;|&nbsp;\n";
	}

	for( i=firstPage; i<=lastPage; i++ )
	{
		if( pageNum == i )
			ret += "<b>" + i + "</b>&nbsp;\n";
		else
			ret += navAnchor(funcName, i, "[" + i + "]") + "&nbsp;\n";
	}

	if( lastPage < totalPages )
	{
		ret += "&nbsp;|&nbsp;" + navAnchor(funcName, lastPage+1, "다음>") + "\n";
		ret += "&nbsp;" + navAnchor(funcName, totalPages, "끝>>") + "\n";
	}

	return ret;
}

function gotoPage(num)
{
	document.srch_frm.method = 'POST';
	document.srch_frm.page.value = num;
	document.srch_frm.submit();
}

