var NS4 = navigator.appName.indexOf( "Netscape" ) != -1	//document.layers
var IE = document.all
var IE4 = navigator.appVersion.indexOf( "MSIE 4." ) != -1
var isMac = navigator.appVersion.indexOf( "Mac" ) != -1
var HP = navigator.userAgent.indexOf( "HP" ) != -1
var Sun = navigator.userAgent.indexOf( "Sun" ) != -1
var IE5 = navigator.appVersion.indexOf( "MSIE 5." ) != -1
var IE50 = navigator.appVersion.indexOf( "MSIE 5.0" ) != -1
var	NS6 = navigator.userAgent.indexOf( "Netscape6" ) != -1
var	NS7 = navigator.userAgent.indexOf( "Netscape/7" ) != -1
var useLayers = ( NS4 && ( HP || Sun ) && !NS7 )

var pageLoaded = false
var __targetSelf = true
var contenttable = false

var Atlas__RememberURL = true
var Atlas__URLCookieName = 'AtlasURLCookie'
	
function getLLTop( oTop ) 
{
	if ( oTop != top && !eval( 'oTop.parent.NotLivelinkFrame' ) )
	{
		oTop = getLLTop( oTop.parent ) 
	} 

	return oTop
} 

function isAtlasDisplayed()
{
	var llTop = getLLTop(self)

	return ( llTop.frames.length > 1 && eval( 'llTop.frames[0].Page__ATLAS' ) )
}

function executeAtlasFunction( atlasFunction ) 
{
	var args
	var i
	var s
	var bAtlas = false


	if ( isAtlasDisplayed() )
	{
		args = executeAtlasFunction.arguments
		s = ''

		for( i = 1; i < args.length; i++ )
		{
			if ( i > 1 ) s += ','

			s += 'args[' + i + ']'
		}

		eval( 'getLLTop(self).frames[0].' + atlasFunction + '(' + s + ')' )
		
		bAtlas = true
	}

	return bAtlas
}

function saveAtlasURL()
{
    if ( window.name == 'FrameTop' || window.name == 'TopFrame' || window.name == 'topFrame' || window.name == 'Header' )
        saveAtlasURL2( parent.location )
    else
        saveAtlasURL2( self.location )
}


function saveAtlasURL2( theURL )
{
	if ( Atlas__RememberURL )
	{
		document.cookie = Atlas__URLCookieName + '=' + escape( theURL )
	}
}

function openURL( theURL, theTarget )
{
    var     theTarget
    var     theParam = "width=600,height=400,resizable,toolbar" 
	var		targetSize
	var     targetInURL = 'OpenInNewWin='
	var     targetParam = 'NewWinParam='
	
    var     pos1 = theURL.indexOf( targetInURL )
    if ( pos1 > -1 )
    {
        pos1 = pos1 + targetInURL.length
        var pos2 = theURL.indexOf( '&', pos1 )
        if ( pos2 == -1 )
        {
            // end of string reached.
            theTarget = theURL.substring( pos1 )
        }
        else
        {
            theTarget = theURL.substring( pos1, pos2 )
        }
        
        var     pos3 = theURL.indexOf( targetParam )
        if ( pos3 > -1 )
        {
            pos3 = pos3 + targetParam.length
            var pos4 = theURL.indexOf( '&', pos3 )
            if ( pos4 == -1 )
            {
                // end of string reached.
                theParam = theURL.substring( pos3 )
            }
            else
            {
                theParam = theURL.substring( pos3, pos4 )
            }
        }
    }

	if ( NS4 || theTarget == "" )
	{
		if ( typeof(theTarget) == "string" )
			targetSize = theTarget.length
		else
			targetSize = theTarget.length()
		
		if ( targetSize != 0 )
		{
			var targetWindow = window.open( theURL, theTarget, theParam )
	            
			if ( targetWindow.focus )
			{
				targetWindow.focus()
			}
			
		}
		else if ( theURL.indexOf( 'func=ContentRH' ) > 0 )
		{
			getLLTop(self).location.href = theURL
		}
		else if ( __targetSelf )
	    {
			location.href = theURL
	    }
	    else
	    {
	    	parent.location.href = theURL
		}
	}
	else
	{
		var targetWindow = window.open( theURL, theTarget, theParam )
            
		if ( targetWindow.focus )
		{
			targetWindow.focus()
		}
	}
}

function getDate()
{
	var pos, pos1, pos2, pos3
	var todayDay, todayMonth, todayDayN, todayYear
	
	var nnow = new Date();
	var strDate = nnow.toString()

	pos1 = strDate.indexOf( ' ' )
	todayDay = strDate.substring( 0, pos1 )
	
	pos2 = strDate.indexOf( ' ', pos1 + 1 )
	todayMonth = strDate.substring( pos1 + 1, pos2 )
	
	pos3 = strDate.indexOf( ' ', pos2 + 1 )
	todayDayN = strDate.substring( pos2 + 1, pos3 )

	if ( NS7 )
	{
		var pos4
		pos4 = strDate.indexOf( ' ', pos3 + 1 )
		todayYear = strDate.substring( pos3 + 1, pos4 )
	}
	else
	{
		pos = strDate.lastIndexOf( ' ' )
		todayYear = strDate.substring( pos + 1 )
	}
	
	return( todayDay + ', ' + todayDayN + ' ' + todayMonth + ' ' + todayYear )

}
