var iPrevious = 1;
var iNext = 2;
function GotoPage(intIndex, strBaseDivID)
{
	if (!strBaseDivID || strBaseDivID == "")
	{
		strBaseDivID = "divPage";
	}
	
	if (intIndex > 1)
	{
		iPrevious = intIndex-1;
	}
	else
	{
		iPrevious = 1;
	}
	
	if (intIndex < iLast)
	{
		iNext = intIndex+1;
	}
	else
	{
		iNext = iLast;
	}
	
	for (var iDivIndex = 1; iDivIndex <= iLast; iDivIndex++)
	{
		if (document.getElementById(strBaseDivID + iDivIndex))
		{
			document.getElementById(strBaseDivID + iDivIndex).style.display = "none";
		}
	}

	if (document.getElementById(strBaseDivID + intIndex))
	{
		document.getElementById(strBaseDivID + intIndex).style.display = "block";
	}	
}

function LoadBottomPageNavigation(strTopPageID, strBottomPageID)
{
	var objTopPageRow = document.getElementById("cellTopPage");
	var objBottomPageRow = document.getElementById("cellBottomPage");
	
	if (objTopPageRow && objBottomPageRow)
	{
		objBottomPageRow.innerHTML = objTopPageRow.innerHTML;
	}
}

function LoadPageNavigation(strSourcePageID, strDestinationPageID)
{
	var objSourcePageRow = document.getElementById(strSourcePageID);
	var objDestinationPageRow = document.getElementById(strDestinationPageID);
	
	if (objSourcePageRow && objDestinationPageRow)
	{
		objDestinationPageRow.innerHTML = objSourcePageRow.innerHTML;
	}
}

function SetRange(intIndex, strRangeSpanID, intRecordCount)
{
	if (document.getElementById(strRangeSpanID))
	{
		var intStartIndex = 20 * (intIndex - 1) + 1;
		var intEndIndex = 20 * intIndex;
		if (intEndIndex > intRecordCount)
		{
			intEndIndex = intRecordCount;
		}
		document.getElementById(strRangeSpanID).innerHTML = intStartIndex + "-" + intEndIndex;
	}	
}

