|
//Note that unicode characters are not acceptable and extended characters must be escaped
var L_Page_text = "Page: ";
var L_GotoPrevPgDisabled_text="Go to previous page (disabled)"; //alt text for back arrow
var L_GotoPrevPg_text="Go to previous page"; //alt text for back arrow
var L_Next_text=" Next "; //Next
var L_GotoNextPg_text="Go to next page"; //alt text for forward arrow
var L_GotoNextPgDisabled_text="Go to next page (disabled)"; //alt text for forward arrow
var L_GotoPage_text="Go to page"; //Text in status bar when hovering over page number...Go to page X
// updated 03-03-2006
var g_strNamespace = "";
// GoTo URL
function goto(url)
{
window.location = url;
}
// ShowStatus
function S(obj)
{
D(obj.innerText);
}
// ClearStatus
function C()
{
D("");
}
// DocumentWrite
function DW(str)
{
document.write(str);
}
// EscapeAndAppendToUrl
function EA(strUrl, strName, strValue)
{
if (-1 == strUrl.indexOf('?'))
strUrl += '?';
else
strUrl += '&';
return strUrl + strName + '=' + escape(strValue);
}
// DocumentLocation
function DL(strUrl)
{
document.location = strUrl;
}
// DisplayInStatus
function D(str)
{
str = str.replace(/"/g, "''");
window.status = str;
setTimeout('window.status = "' + str + '";', 0);
setTimeout('window.status = "' + str + '";', 1);
}
function StrGetPagingBase()
{
// This is stupid - the string specified by document.location doesn't
// have a lengthed defined! To compensate, I make sure javascript
// generates a new string by appending an empty string to the end.
var strBase = document.location + "";
var cPeriodCount = 0;
var i;
for (var i = strBase.length - 1; i >= 0 && cPeriodCount < 2; i--)
{
var strCurrent = strBase.substr(i, 1);
if ("." == strCurrent)
cPeriodCount++;
}
if (2 != cPeriodCount)
return "";
return strBase.substring(0, i + 2);
}
function InsertPageAnchor(iPage, strText, strStatus)
{
if (strStatus == L_GotoPrevPg_text)
{
DW('<TD STYLE="font-weight:normal"><A STYLE="color:white" CLASS="OAnc" accesskey="," onmouseout="C()" onmouseover="D(\'' +
strStatus +
'\')" HREF="' +
StrGetPagingBase() +
iPage + '.xml">' +
strText +
'</A></TD>');
}
else if (strStatus == L_GotoNextPg_text)
{
DW('<TD STYLE="font-weight:normal"><A STYLE="color:white" CLASS="OAnc" accesskey="." onmouseout="C()" onmouseover="D(\'' +
strStatus +
'\')" HREF="' +
StrGetPagingBase() +
iPage + '.xml">' +
strText +
'</A></TD>');
}
else
{
DW('<TD STYLE="font-weight:normal"><A STYLE="color:white" CLASS="OAnc" onmouseout="C()" onmouseover="D(\'' +
strStatus +
'\')" HREF="' +
StrGetPagingBase() +
iPage + '.xml">' +
strText +
'</A></TD>');
}
}
function InsertPagingNumbers(startingResult, totalResults, resultsPerPage)
{
var currentPage = Math.floor(startingResult / resultsPerPage);
var totalPages = Math.ceil(totalResults / resultsPerPage);
var strBase = StrGetPagingBase();
DW('<td STYLE="font-weight:normal">');
DW(L_Page_text);
DW('</td>');
for (var i = 0; i < totalPages; i++)
{
if (currentPage == i)
{
DW('<td>');
DW(' <B>[' + (i + 1) + '] </B>');
DW('</td>');
}
else
{
DW('<td>');
InsertPageAnchor(i,
' ' + (i + 1) + ' ',
L_GotoPage_text + " " + (i + 1) );
DW('</td>');
}
}
DW('<td>');
DW(' ');
DW('</td>');
return;
}
function InsertPagingArrows(startingResult, totalResults, resultsPerPage)
{
var currentPage = Math.floor(startingResult / resultsPerPage);
var totalPages = Math.ceil(totalResults / resultsPerPage);
if (0 == currentPage)
{
DW('<td>');
DW('<IMG SRC="back2.gif" ALIGN="absmiddle" BORDER="0" ALT="' + L_GotoPrevPgDisabled_text + '">');
DW('</td>');
}
else
{
InsertPageAnchor(currentPage - 1,
'<IMG SRC="back.gif" ALIGN="absmiddle" BORDER="0" ALT="' + L_GotoPrevPg_text + '" />',
L_GotoPrevPg_text);
}
if (totalPages - 1 == currentPage)
{
DW('<td>');
DW('<SPAN CLASS="OLblDe" STYLE="font-weight:normal"> ' + L_Next_text + '</SPAN>');
DW('</td>');
DW('<td>');
DW('<IMG SRC="next2.gif" ALIGN="absmiddle" BORDER="0" ALT="' + L_GotoNextPgDisabled_text + '" />');
DW('</td>');
}
else
{
DW('<td>');
DW(' ');
DW('</td>');
InsertPageAnchor(currentPage + 1,
'<SPAN CLASS="OLblDe" STYLE="font-weight:normal">' + L_Next_text + '</SPAN>' + '<IMG SRC="next.gif" ALIGN="absmiddle" BORDER="0" ALT="' + L_GotoNextPg_text + '" STYLE="margin-left:3px" />',
L_GotoNextPg_text);
}
DW('<td>');
DW(' ');
DW('</td>');
return;
}
function SetNamespace(strNamespace)
{
g_strNamespace = strNamespace;
if (g_strNamespace.substr(g_strNamespace.length - 1) != '/')
g_strNamespace += '/';
}
// Removes any attempts at opening or closing a tag from a string.
function StrFixString(strString)
{
if (null == strString)
return null;
strString = strString.replace(/</g, "<");
return strString.replace(/>/g, ">");
}
function SzGetArgumentValue(strQueryName)
{
var reQuery = new RegExp("[\\?&]" + strQueryName + "=([^&]*)", "i");
if (!reQuery.test(location))
return null;
return reQuery.exec(location)[0].substring(strQueryName.length + 2);
}
function defined(obj)
{
return !(typeof(obj) == "undefined");
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.