//********************Global Variables, Objects, Layers
var strActive1st, strActive2nd, strActive3rd;
window.defaultStatus = 'Deutsches Kinderhilfswerk';
strActive1st = "";
strActive2nd = "";
strActive3rd = "";
mozilla = false;
if ((navigator.appName == "Netscape") &&  (parseInt(navigator.appVersion.substring(0,1)) >=5)) {
	mozilla = true;
}

function objNav( strTitle, strURL )
{
	this.title = strTitle;
	this.url = strURL;
}

//********************Support Functions
function isObject( strName )
{
	bolIsLayer = false;
	if( strName != "url" && strName != "title" ) bolIsLayer = true;
	return bolIsLayer;
}

function getObjectRefString( strName )
{
	strRef = "";
	if( document.layers )
	{
		strRef = "document.layers[ \"" + strName + "\" ]";
	}
	else
	{
		if( document.all )
		{
			strRef = "document.all." + strName + ".style";
		}
		else
		{
			if( document.getElementById( strName ) )
			{
				strRef = "document.getElementById( \"" + strName + "\" )";
				if( document.getElementById( strName ).style )
				{
					strRef += ".style";
				}
			}
			else
			{
				return false;
			}
		}
	}
	return strRef;
}

function LayerExists( strLayerName )
{
	bolExists = false;
	objLayer = getObjectRefString( strLayerName );
    if (!mozilla) {
        if( objLayer.indexOf( ".style" ) > 0 ) objLayer = objLayer.substring( 0, objLayer.indexOf( ".style" ) );
     }  
	if( eval( objLayer ) ) bolExists = true;
	return bolExists;
}

function ShowLayer( strLayerName )
{
	if( LayerExists( strLayerName ) )
	{
		objLayer = getObjectRefString( strLayerName );
		objLayer = eval( objLayer );
		objLayer.visibility = "visible";
	}
}

function HideLayer( strLayerName )
{
	if( LayerExists( strLayerName ) )
	{
		objLayer = getObjectRefString( strLayerName );
		objLayer = eval( objLayer );
		objLayer.visibility = "hidden";
	}
}

function MoveLayer( strLayerName, lngTop )
{
	if( LayerExists( strLayerName ) )
	{
		objLayer = getObjectRefString( strLayerName );
		if( objLayer.indexOf( "style" ) >= 0 )
		{
			lngTop += "px";
		}
		objLayer = eval( objLayer );
		objLayer.top = lngTop;
	}
}

function SetFont( strTextName, bolBold )
{
	if( LayerExists( strTextName ) )
	{
		objText = getObjectRefString( strTextName );
		objText = eval( objText );
		if( bolBold == true )
		{
			objText.fontWeight = "bold";
		}
		else
		{
			objText.fontWeight = "normal";
		}
	}
}

//********************Main Functions
function Over( lngLevel, lngPosition, strStatus )
{
	var intTop;
	lngTop = 15 + lngPosition * 14;
	ShowLayer( "hover" + lngLevel );
	MoveLayer( "hover" + lngLevel, lngTop );
	window.status = strStatus;
}

function Out( lngLevel )
{
	HideLayer( "hover" + lngLevel );
}

function Activate( lngLevel, lngPosition, strLayerName )
{
	var strTextName, lngTop;
	lngTop = 15 + lngPosition * 14;
	strTextName = "txt" + strLayerName;
	switch( lngLevel )
	{
		case 2:
			if( strActive3rd != "" )
			{
				SetFont( "txt" + strActive3rd, false );
			}
			strActive3rd = strLayerName;
			SetFont( strTextName, true );
			ShowLayer( "marker2" );
			MoveLayer( "marker2", lngTop );
			break;
		case 1:
			if( strActive3rd != "" )
			{
				SetFont( "txt" + strActive3rd, false );
			}
			if( strActive2nd != "" )
			{
				HideLayer( strActive2nd );
				HideLayer( "marker2" );
				SetFont( "txt" + strActive2nd, false );
			}
			strActive3rd = "";
			strActive2nd = strLayerName;
			ShowLayer( strLayerName );
			SetFont( strTextName, true );
			ShowLayer( "marker1" );
			MoveLayer( "marker1", lngTop );
			break;
		case 0:
			if( strActive3rd != "" )
			{
				SetFont( "txt" + strActive3rd, false );
			}
			if( strActive2nd != "" )
			{
				HideLayer( strActive2nd );
				HideLayer( "marker2" );
				SetFont( "txt" + strActive2nd, false );
			}
			if( strActive1st != "" )
			{
				HideLayer( strActive1st );
				HideLayer( "marker1" );
				SetFont( "txt" + strActive1st, false );
			}
			ShowLayer( strLayerName );
			strActive3rd = "";
			strActive2nd = "";
			strActive1st = strLayerName;
			SetFont( strTextName, true );
			ShowLayer( "marker0" );
			MoveLayer( "marker0", lngTop );
			break;
		case -1:
			if( strActive3rd != "" )
			{
				SetFont( "txt" + strActive3rd, false );
			}
			if( strActive2nd != "" )
			{
				HideLayer( strActive2nd );
				HideLayer( "marker2" );
				SetFont( "txt" + strActive2nd, false );
			}
			if( strActive1st != "" )
			{
				HideLayer( strActive1st );
				HideLayer( "marker1" );
				HideLayer( "marker0" );
				SetFont( "txt" + strActive1st, false );
			}
			strActive3rd = "";
			strActive2nd = "";
			strActive1st = "";
			break;
	}
}
