function loadFrame(name)
{
	var s = location.search;

	if ((s != null) && (s.length > 0))
		s = s.substring(1, s.length);
	if (s == "noframe") return;

	if (top == self)
	{
		if ((name != null) && (name.length > 0))
			top.location.href = '/index.html?' + name;
		else
			top.location.href = '/index.html';
	}
	showLink(name);
}

function showLink()
{
	Elemente=new Array();
	collection = parent.frames.navigation.document.getElementsByTagName('a');
  	for (i = 0; i < collection.length; i++)
  	{
    		if (collection[i].href == document.URL)
    		{
    	 		 aktCell=collection[i].parentNode;
    	 		 collection[i].className="active";
    	 	} else
    	 	{
    	 		collection[i].className="passive";
    	 	}
  	}
  	collection = parent.frames.navigation.document.getElementsByTagName('td');
  	index=indexOf(aktCell, collection);
  	aktLevel=aktCell.getAttribute('level');
  	for (i=index-1; i >= 0; i--)
  	{
  		if (collection[i].getAttribute('level')<aktLevel)
  		{
  			if (collection[i+1].parentNode.style.display == 'none')
  			{
  				Elemente.push(collection[i]);
  			}
  			aktLevel=collection[i].getAttribute('level');
  		}
  	}
  	while (Elemente.length>0)
  	{
  		item=Elemente.pop();
  		toggle(item);
  	}
  	delete(Elemente);
}

function test(item)
{
	window.alert(item);
}

function checkLocation()
{
	var url = location.search;
	if ((url != null) && (url.length > 0))
		url = url.substring(1, url.length);
	if ((url != null) && (url.length > 0))
		main.location.href=url;
}

function checkLocationNoFrame()
{
	var url = location.search;
	if ((url != null) && (url.length > 0))
		url = url.substring(1, url.length);
	if ((url != null) && (url.length > 0))
		window.navigate(url + "?noframe");
}

function navigateTo()
{
	var url = document.Content.NavigateTo.value;
	if (url.length > 0)
		parent.frames.main.navigate(url);
}

function indexOf(item, collection)
{
  for (i = 0; i < collection.length; i++)
  {
    if (collection[i] == item)
      return i;
  }
  return -1;
}

function toggle(item)
{
  level = eval(item.getAttribute('level',0));

  collection = parent.frames.navigation.document.getElementsByTagName('td');
  index = indexOf(item, collection);

  for (i = index + 1; i < collection.length; i++)
  {
    childrow = collection[i].parentNode;
    child = collection[i];
    atr = child.getAttribute('level');
    if (atr == null)
      return;
    childlevel = eval(atr);
    if (childlevel <= level)
      return;

    if (childrow.style.display == '')
    {
        childrow.style.display = 'none';
    }
    else if (childlevel <= level + 1)
	{
        childrow.style.display = '';
    }
  }

}

function collapseAll(collection, level)
{
  for (i = 0; i < collection.length; i++)
  {
    childrow = collection[i].parentNode;
    child = collection[i];
    childlevel = eval(child.getAttribute('level'));

    if (childlevel > level)
      childrow.style.display = 'none';
   }
}

function initswitch()
{
	a = document.body.childNodes[0];
	a.style.display = 'none';
}

function doswitch()
{
	a = document.body.childNodes[0];
	if (a.style.display == '')
		a.style.display = 'none';
	else
		a.style.display = '';

	a = document.body.childNodes[1];
	if (a.style.display == '')
		a.style.display = 'none';
	else
		a.style.display = '';
}
