var aPreloadImages  = new Array();
function init()
{
preloadImages();
setCurrentTab();
if ( typeof bPageInit != 'undefined' && bPageInit )
pageInit();
}
function tabOn( sTabName )
{
var oTab        = document.images['tab_' +sTabName];
var sImagePath  = oTab.src.substr( 0, oTab.src.lastIndexOf('/') );
oTab.src        = sImagePath+ '/tab_' +sTabName+ '_over.gif';
}
function tabOut( sTabName )
{
var oTab        = document.images['tab_' +sTabName];
var sImagePath  = oTab.src.substr( 0, oTab.src.lastIndexOf('/') );
oTab.src        = sImagePath+ '/tab_' +sTabName+ '.gif';
}
function preloadImages()
{
for ( var iImg = 0; iImg < aPreloadImages.length; iImg++ )
{
var oNewImage   = new Image();
oNewImage.src   = aPreloadImages[iImg];
}
}
function addPreloadImages( sImageSrc )
{
for ( var iArg = 0; iArg < arguments.length; iArg++ )
aPreloadImages[aPreloadImages.length]   = sImageSrc;
}
function setCurrentTab()
{
if ( is_ie5up )
{
if ( typeof sThisTabName == 'undefined' )
return false;
var aDocLinks           = document.getElementsByTagName( 'A' );
var oCurrentTabImage    = document.images[ 'tab_' +sThisTabName ];
var oCurrentTabLink     = oCurrentTabImage.parentNode;
var sCurrentTabLink     = oCurrentTabLink.href;
var sCurrentTabSrc      = oCurrentTabImage.src;
var sImagePath          = sCurrentTabSrc.substr( 0, sCurrentTabSrc.lastIndexOf('/') );
oCurrentTabImage.src    = sImagePath+ '/tab_' +sThisTabName+ '_on.gif';
var oDuplicateImage     = document.createElement( 'IMG' );
oDuplicateImage.src     = oCurrentTabImage.src;
oDuplicateImage.width   = oCurrentTabImage.width;
oDuplicateImage.height  = oCurrentTabImage.height;
oDuplicateImage.alt     = oCurrentTabImage.alt;
oDuplicateImage.border  = oCurrentTabImage.border;
var oDuplicateLink  = document.createElement( 'A' );
oDuplicateLink.href = sCurrentTabLink;
var oTabTD  = oCurrentTabLink.parentNode;
removeAllChildren( oTabTD );
oDuplicateLink.appendChild( oDuplicateImage );
oTabTD.appendChild( oDuplicateLink );
}
}
function removeAllChildren( oSrcNode )
{
while ( oSrcNode.hasChildNodes() )
oSrcNode.removeChild( oSrcNode.childNodes[0] );
}
function popupArticle( iArticleID, iWidth, iHeight )
{
var iScreenWidth    = screen.width;
var iScreenHeight   = screen.height;
var iLeft           = (iScreenWidth/2) - (iWidth/2);
var iTop            = (iScreenHeight/2) - (iHeight/2);
window.open( 'popup.jsp?articleid=' +iArticleID, 'articlepopup', 'width=' +iWidth+ ',height=' +iHeight+ ',left=' +iLeft+ ',top=' +iTop+ ',toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=yes' );
}
function popupImage( sImageURL, iImgWidth, iImgHeight )
{
var iScreenWidth    = screen.width;
var iScreenHeight   = screen.height;
var iWidth          = iImgWidth + 50;
var iHeight         = iImgHeight + 100;
var sScrollbars     = 'no';
if ( iWidth > (iScreenWidth - 100) )
{
sScrollbars = 'yes';
iWidth      = (iScreenWidth - 100);
}
if ( iHeight > (iScreenHeight - 100) )
{
sScrollbars = 'yes';
iHeight  = (iScreenHeight - 100);
}
var iLeft           = (iScreenWidth/2) - (iWidth/2);
var iTop            = (iScreenHeight/2) - (iHeight/2);
window.open( 'popupimage.jsp?imageurl=' +sImageURL+ '&imagewidth=' +iImgWidth+ '&imageheight=' +iImgHeight, 'articlepopup', 'width=' +iWidth+ ',height=' +iHeight+ ',left=' +iLeft+ ',top=' +iTop+ ',toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=' +sScrollbars );
}
function showHide( sID, bInline )
{
var oElement    = document.getElementById( sID );
if( bInline )
{
oElement.style.display  = (oElement.style.display == 'none') ? 'inline' : 'none';
}
else
{
oElement.style.display  = (oElement.style.display == 'none') ? 'block' : 'none';
}
}
function showID( sID, bInline )
{
var oElement;
if ( document.getElementById )
{
oElement    = document.getElementById( sID );
}
else
{
oElement    = document.all[sID];
}
oElement.style.display  = (bInline) ? 'inline' : 'block';
}
function hideID( sID )
{
var oElement;
if ( document.getElementById )
{
oElement    = document.getElementById( sID );
}
else
{
oElement    = document.all[sID];
}
oElement.style.display  = 'none';
}
function setCookie( sName, sValue )
{
document.cookie = sName + '=' + escape(sValue);
}
function getCookie( sName )
{
var cookieVar       = document.cookie;
var cookieName      = sName + "=";
var cookieLength    = cookieVar.length;
var cookieBegin     = 0;
while ( cookieBegin < cookieLength )
{
var valueLength = cookieBegin + cookieName.length;
if ( cookieVar.substring(cookieBegin, valueLength) == cookieName )
{
var valueEnd    = cookieVar.indexOf( ';', valueLength );
if ( valueEnd == -1 )
valueEnd = cookieLength;
return unescape( cookieVar.substring(valueLength, valueEnd) );
}
cookieBegin = cookieVar.indexOf( ' ', cookieBegin ) + 1;
if (cookieBegin == 0)
break;
}
return null;
}
function deleteCookie( sName )
{
document.cookie = sName + '=deleted; expires=Fri, 31 Dec 1999 23:59:59 GMT;';
}
function printTodaysDate()
{
var oToday      = new Date();
var aMonthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
var sTodaysDate = oToday.getDate() + ' ' + aMonthNames[ oToday.getMonth() ] + ', ' + oToday.getYear();
document.write( sTodaysDate );
}
