var _button1UpColor = "rgb(237, 237, 237)";
var _button1DownColor = "rgb(217, 217, 217)";
var _lable1UpColor = "rgb(186, 0, 0)";
var _lable1DownColor = "rgb(255, 255, 255)";
function setFrameUrl( aRoot, aURL, aAnchorName )
{
	if( aRoot.document.getElementById(aAnchorName) )
	{
	    //alert("hallo"+aRoot.document.getElementById(aAnchorName).style.paddingLeft);
		if( aRoot.document.getElementById(aAnchorName).style.paddingLeft > aRoot.document.getElementById(aAnchorName).style.paddingRight )
		{
			//---Roman
			var _button1UpImage = "url(../images/unselectedArrow.gif)";
			var _button1DownImage = "url(../images/selectedArrow.gif)";
		}
		else
		{
			//---Arabic
			var _button1UpImage = "url(../images/unselectedLeftArrow.gif)";
			var _button1DownImage = "url(../images/selectedLeftArrow.gif)";
		}
		//---Reset all other anchors if they are pushed
		for( var i = 0; i < aRoot.document.anchors.length; i++ )
		{
			aRoot.document.anchors[i].style.color = _lable1UpColor;
			aRoot.document.anchors[i].style.backgroundColor = _button1UpColor;
			if( aRoot.document.anchors[i].style.backgroundImage == _button1DownImage )
			{
				aRoot.document.anchors[i].style.backgroundImage = _button1UpImage;
			}
			else
			{
				//---Maybe not a anchor we are interested in
			}
		}
		aRoot.document.getElementById(aAnchorName).style.color = _lable1DownColor;
		aRoot.document.getElementById(aAnchorName).style.backgroundColor = _button1DownColor;
		aRoot.document.getElementById(aAnchorName).style.backgroundImage = _button1DownImage;
	}
	else
	{
	    //---We did not find the menu item
	}
	aRoot.parent.main.location.href = aURL;
}

function queryAndSetSelectedAnchor()
{
	var documentTitle = parent.main.document.title;
	if( document.getElementById(documentTitle) )
	{
		if( document.getElementById(documentTitle).style.paddingLeft > document.getElementById(documentTitle).style.paddingRight )
		{
			//---Roman
			var _button1UpImage = "url(../images/unselectedArrow.gif)";
			var _button1DownImage = "url(../images/selectedArrow.gif)";
		}
		else
		{
			//---Arabic
			var _button1UpImage = "url(../images/unselectedLeftArrow.gif)";
			var _button1DownImage = "url(../images/selectedLeftArrow.gif)";
		}
		document.getElementById(documentTitle).style.color = _lable1DownColor;
		document.getElementById(documentTitle).style.backgroundColor = _button1DownColor;
		document.getElementById(documentTitle).style.backgroundImage = _button1DownImage;
	}
	else
	{
	    //---We did not find the menu item
	}
}

var _buttonUpColor = "rgb(237, 237, 237)";
var _buttonDownColor = "rgb(255, 255, 255)";
var _lableUpColor = "rgb(0, 0, 0)";
var _lableDownColor = "rgb(0, 0, 0)";
/*var _lableDownColor = "rgb(186, 0, 0)";*/
function setSubFrameUrl( aURL, aAnchorName )
{
	if( parent.menu.document.getElementById(aAnchorName) )
	{
		//---Reset all other anchors if they are pushed
		for( var i = 0; i < parent.menu.document.anchors.length; i++ )
		{
		    parent.menu.document.anchors[i].style.backgroundColor = _buttonUpColor;
		    parent.menu.document.anchors[i].style.color = _lableUpColor;
		    parent.menu.document.anchors[i].style.borderBottomColor = "black";
		}
		parent.menu.document.getElementById(aAnchorName).style.backgroundColor = _buttonDownColor;
		parent.menu.document.getElementById(aAnchorName).style.color = _lableDownColor;
    	parent.menu.document.getElementById(aAnchorName).style.borderBottomColor = "white";
	}
	else
	{
	    //---We did not find the menu item
	}
	parent.main.location.href = aURL;
}
/*
	called by onLoad() in a subdocument or submenu to set the selected tab in a submenu.
	The one that is called later will win.
	This is necessary because of racing condition when one document is not loaded jet.
*/
function queryAndSetSelectedSubAnchor( aTitle )
{
	var documentTitle = aTitle;
	if( parent.main.document )
	{
		if( !aTitle )
		{
		    	//---Called from menu
			documentTitle = parent.main.document.title;
		}
		else
		{
		    //---Called from document
		}
		if( parent.menu.document.getElementById(documentTitle) )
		{
			parent.menu.document.getElementById(documentTitle).style.backgroundColor = _buttonDownColor;
			parent.menu.document.getElementById(documentTitle).style.color = _lableDownColor;
	    	parent.menu.document.getElementById(documentTitle).style.borderBottomColor = "white";
		}
		else
		{
		    //---We did not find the menu item
		}
	}
	else
	{
	    //---We do not have a document and therefor cannot work!
	    alert( "no valid main document!" );
	}
}

