
function GetGotoPageUrlString (nPageNumber,sUrlText)
{
	return "<a href='JavaScript:GotoPage(" + nPageNumber + ");' style='TEXT-DECORATION: none;' title='Go to page " + nPageNumber + "'>" + sUrlText + "</a>";
}


function WritePagination(mypage,maxpages)
{
	TEXT_M1 = "<img src=\"images/arrow-prev.gif\" border=0>";  // namesake: minus 1 = M1
	TEXT_P1 = "<img src=\"images/arrow-next.gif\" border=0>";  // namesake: plus  1 = P1
	PageSize = document.forms.frmAdmin.PageSize.value;
	
	if (maxpages > 1 && mypage <= maxpages)
	{
		document.write("<table align='center' border='0'>"); 
		document.write("<tr valign='center'><td align='center'>"); 
		var counterstart = mypage - 9; 
		if (mypage%10) counterstart = mypage - (mypage%10) + 1; 

 		var counterend = counterstart + 9; 
		if (counterend > maxpages) counterend = maxpages; 
 
		document.write("<font size=1 color='#AA0000'>Pages:</font> ");
		if ( counterstart > 1 ) 
		 { document.write("<font color='#777777'>[</font>" + "<span style='background-color: #FFFF99;'>" + GetGotoPageUrlString(1,"1") + "</span>" + "<font color='#777777'>]</font>" + "&nbsp; "); 
		   document.write("<font color='#777777'>[</font>" + "<span style='background-color: #FFFF99;'>" + GetGotoPageUrlString(counterstart - 1,eval( ((counterstart - PageSize)>1)?(counterstart - PageSize):1) + "-" + eval(counterstart - 1)) + "</span>" + "<font color='#777777'>]</font>" + "&nbsp;"); }
 
		if (mypage > counterstart ) document.write(GetGotoPageUrlString(mypage - 1,TEXT_M1) + "&nbsp;" );

		document.write( "<font color='#444444'><B>(</B></font>" );
				
		var pad="";
		var counter = counterstart;
		for(;counter<=counterend;counter++)
		{
			if (counter != mypage) 
			 {document.write("<span style='background-color: #FFFF99;'>" + "&nbsp;" + GetGotoPageUrlString(counter,pad + counter) + "</span>");}
			else
			 {document.write("<span style='background-color: #FFFF22; color:#AA0000; font-size:11'>&nbsp;" + pad + counter + "</span>");}
		}

		document.write( "<font color='#444444'><B>)</B></font>" );

		if (mypage < counterend ) document.write("&nbsp;" + GetGotoPageUrlString(mypage + 1,TEXT_P1) ); 

		if (counterend < maxpages) 
		 {document.write("&nbsp; " + "<font color='#777777'>[</font>" + "<span style='background-color: #FFFF99;'>" + GetGotoPageUrlString (counterend + 1,eval(counterend + 1) + "-" + eval( ((counterend + PageSize)<maxpages)?(counterend + PageSize):maxpages)) + "</span>" + "<font color='#777777'>]</font>" + "&nbsp;"); 
		  document.write("&nbsp; " + "<font color='#777777'>[</font>" + "<span style='background-color: #FFFF99;'>" + GetGotoPageUrlString(maxpages,maxpages ) + "</span>" + "<font color='#777777'>]</font>"); }
			
		document.write("</td></tr></table>");		
	}
}


function WritePaginationHeader(mypage,maxpages,recordCount)
{
	document.write("<table border='0' width='100%'><tr valign='center'><td align='left'>");
	document.write("<a href=edit.asp onClick=\"javascript: document.forms.editform.action.value = 'add';   document.forms.editform.pagenumber.value=" + mypage + "; document.forms.editform.submit(); return false;\" >" + TEXT_ADD_NEW + "</a>");
	document.write("</td><td align=right>");
	document.write(TEXT_DETAILS_FOUND + ": " + recordCount + "<br>" + TEXT_PAGE1 + mypage + " " + TEXT_PAGE2 + " " + maxpages);
	document.write("</td></tr></table>");
}

    var rowWithMouse = null;

    function gGetElementById(s) {
      var o = (document.getElementById ? document.getElementById(s) : document.all[s]);
      return o == null ? false : o;
    }

    function rowUpdateBg(row, myId) 
    {
        row.className = (row == rowWithMouse) ? 'rowselected' : ( (myId&1) ? '' : 'shade' );
    }

    function rowRollover(myId, isInRow) {
      // myId is our own integer id, not the DOM id
      // isInRow is 1 for onmouseover, 0 for onmouseout
      var row = document.getElementById('tr_' + myId);
      rowWithMouse = (isInRow) ? row : null;
      rowUpdateBg(row, myId);
    }

function DisplayHeader()
{

		document.write("</SELECT></td></tr></table></td></tr></table></td></tr></table>"); 
	
}