var isAutoRefreshPage = false;
 
// ----------------------------------------------------------------------------
// BodyOnLoad is associated with the body tag in the template
// for pages that need additional BodyOnLoad functionality use a different document head
// ----------------------------------------------------------------------------
function BodyOnLoad()
{
	setWebTrendsContent();
	toggleGoldIndexButton('goldIndexButtonDiv');
}
// ----------------------------------------------------------------------------
// Used for WebTrends
// ----------------------------------------------------------------------------
function setWebTrendsContent()
{
    // assign document title to WebTrends tag
    var docTitle = document.title;
    if( docTitle != null && docTitle != '' ) {
        docTitle = docTitle.replace('Briefing.com: ','');
        docTitle = docTitle.replace(/ /g, '');
        if( document.getElementById('WT.pi') ) {
            var productName = document.getElementById('WT.pi').content;
            document.getElementById('WT.pi').content = productName+'-'+docTitle;
        }
    }
}
// ------------------------------------------------------------------------
// if user has access to Gold product, display Gold button link.
// ------------------------------------------------------------------------
function toggleGoldIndexButton(id)
{
	if (checkCookieForGoldAccess())
	    if( document.getElementById(id) )
    		document.getElementById(id).style.display='block';
}
// ------------------------------------------------------------------------
// returns true if user has access cookie set to GOLD or ADMIN
// ------------------------------------------------------------------------
function checkCookieForGoldAccess()
{
	var product = 'default';
	var cookiePos = document.cookie.indexOf('LiaHua=');
	
	if (cookiePos != -1)
	{
		var endOfCookiePos = document.cookie.length;
		if (document.cookie.indexOf(";", cookiePos) != -1 && document.cookie.indexOf(";", cookiePos) <= endOfCookiePos)
			endOfCookiePos = document.cookie.indexOf(";", cookiePos);
		var product = document.cookie.substring(cookiePos + 7, endOfCookiePos);
	}
	return (product.toUpperCase()=='GOLD' || product.toUpperCase()=='ADMIN');
}
