var catID = '1000';
function GotoPage(curPage)
{
	var nIndex = 1;
	var nLastPage = parseInt(nTotal / (nRow * nCol)) + 1;
	oDiv = document.getElementById('Index');
	var sHTML = '';
	for(var row = 0 ; row < nRow ;row++)
	{
		sHTML += '<table><tr>';
		for(var col = 0 ; col < nCol; col++)
		{
			nIndex = ((curPage-1)*nRow*nCol + row * nCol + col + 1);
			if (nIndex <= nTotal)
				sHTML += '<td class="thumbcell"><a href="photo.html?catID=' + catID + '&id='+ nIndex+'"><img src="' + photoPath + 'photos/thumb'+nIndex+'.jpg" alt="µã»÷¿´´óÍ¼ Click to see big picture. No. '+nIndex+'" /></a></td>';
			else
				sHTML += '<td class="thumbcell"></td>';
			
		}
		sHTML += '<tr>';
	}
	sHTML += '</table>';
	//oTbl.innerHTML=sHTML;
	oDiv.innerHTML = sHTML;
	document.getElementById('PageID').value = curPage;
	document.getElementById('txtPage').innerHTML = 'Page: ' + curPage;
	if(curPage==1)
		document.getElementById('divPrev').style.display = 'none';
	else
		document.getElementById('divPrev').style.display = 'block';
	if(curPage==nLastPage)
		document.getElementById('divNext').style.display = 'none';
	else
		document.getElementById('divNext').style.display = 'block';
	document.getElementById('txtPage').innerText = 'Page: ' + curPage + '  of  ' + nLastPage ;
}


function InitPage(curPage)
{
	SetHeaderText();

	var anything = getArgV('PageID');
	//	alert(anything);
	if (anything == '-1')
	{
		anything = '1';
	}
	curPage = parseInt(anything);
	GotoPage(curPage);
}
function MovePage(direction)
{
    DoMyLookup(document.location.href);
	var id = parseInt(document.getElementById('PageID').value) + direction;
	GotoPage(id)
	
}