///////////////////////////////////////////////////////////////////////////////
// Browsercheck v 1.0                                                        //
// DOM available?                                                            //
// Browserversion?                                                           //
// Netscape Version 4 or higher?                                             //
// Internet Explorer 4 or higher?                                            //
// Browser Version 4 available?                                              //
///////////////////////////////////////////////////////////////////////////////

isDom = (document.getElementById) ? true : false;
bV    = parseInt(navigator.appVersion);
NS4   = (document.layers) ? true : false;
IE4   = ((document.all)&&(bV>=4))?true:false;
ver4  = (NS4 || IE4) ? true : false;

///////////////////////////////////////////////////////////////////////////////
// Testdisplay Broswercheck                                                  //
///////////////////////////////////////////////////////////////////////////////

isExpanded = false;

function getIndex(el) {
	ind = null;
	for (i=0; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		if (whichEl.id == el) {
			ind = i;
			break;
		}
	}
	return ind;
}

function arrange() {
	nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
	for (i=firstInd+1; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		if (whichEl.visibility != "hide") {
			whichEl.pageY = nextY;
			nextY += whichEl.document.height;
		}
	}
}

function initIt()	{
    if(!isDom)	{
		if (NS4)	{
			for (i=0; i<document.layers.length; i++)	{
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Child") != -1 && i !=1) whichEl.visibility = "hide";
				else											whichEl.visibility = "show";
														}
				arrange();
					}
		else		{
			tempColl = document.all.tags("DIV");
			for (i=0; i<tempColl.length; i++)	{
				if (tempColl(i).className == "child" && i != 1) tempColl(i).style.display = "none";
				else											tempColl(i).style.display = "block";
												}
					}
				}
					}

function expandIt(el) {

	if(isDom)	{

		switchVisibility(el + "Child");

				}

	else		{

		if (!ver4) return;
		if (IE4) {expandIE(el)} else {expandNS(el)}

				}
}

function expandIE(el) {
	whichEl = eval(el + "Child");
	if (whichEl.style.display == "none") {
		whichEl.style.display = "block";
	}
	else {
		whichEl.style.display = "none";
	}
}

function expandNS(el) {
	whichEl = eval("document." + el + "Child");
	whichIm = eval("document." + el + "Parent.document.images['imEx']");
	if (whichEl.visibility == "hide") {
		whichEl.visibility = "show";
	}
	else {
		whichEl.visibility = "hide";
	}
	arrange();
}

function showAll() {
	for (i=firstInd; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		whichEl.visibility = "show";
	}
}

function expandAll(isBot) {
	newSrc = (isExpanded) ? "triDown.gif" : "triUp.gif";

	if (NS4) {
        document.images["imEx"].src = newSrc;
		for (i=firstInd; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id.indexOf("Parent") != -1) {
				whichEl.document.images["imEx"].src = newSrc;
			}
			if (whichEl.id.indexOf("Child") != -1) {
				whichEl.visibility = (isExpanded) ? "hide" : "show";
			}
		}

		arrange();
		if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
	}
	else {
		divColl = document.all.tags("DIV");
		for (i=0; i<divColl.length; i++) {
			if (divColl(i).className == "child") {
				divColl(i).style.display = (isExpanded) ? "none" : "block";
			}
		}
		imColl = document.images.item("imEx");
		for (i=0; i<imColl.length; i++) {
			imColl(i).src = newSrc;
		}
	}

	isExpanded = !isExpanded;
}

///////////////////////////////////////////////////////////////////////////////
// Function to switch visibility with DOM                                    //
///////////////////////////////////////////////////////////////////////////////


function switchVisibility(element)	{

	collapseAllDom();

    if(document.getElementById(element).style.visibility=="hidden" || document.getElementById(element).style.visibility=="")	{

    	document.getElementById(element).style.position = "relative";
	    document.getElementById(element).style.visibility = "visible";

																																}

	else																														{

		document.getElementById(element).style.visibility = "hidden";
	    document.getElementById(element).style.position = "absolute";

																																}
									}


///////////////////////////////////////////////////////////////////////////////
// Functions to Collaps all Menuitems without DOM                            //
///////////////////////////////////////////////////////////////////////////////

function collapsAll(isBot) {

	if(isDom)	{

		collapseAllDom();

				}
	else		{

		newSrc = (isExpanded) ? "triDown.gif" : "triUp.gif";

		if (NS4) {
			for (i=firstInd; i<document.layers.length; i++) {
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Parent") != -1) {
				}
				if (whichEl.id.indexOf("Child") != -1) {
					whichEl.visibility = "hide";
				}
			}

			arrange();
			if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
		}
		else {
			divColl = document.all.tags("DIV");
			for (i=0; i<divColl.length; i++) {
				if (divColl(i).className == "child") {
					divColl(i).style.display = "none";
				}
			}
		}

		isExpanded = !isExpanded;

				}
							}

///////////////////////////////////////////////////////////////////////////////
// Functions to Collaps all Menuitems with DOM                               //
///////////////////////////////////////////////////////////////////////////////


function collapseAllDom()	{

	var allChilds = document.getElementsByTagName("div");

    for (i=0; i<allChilds.length; i++)	{

    	if (allChilds[i].className == "child")	{

    		allChilds[i].style.visibility = "hidden";
    	    allChilds[i].style.position = "absolute";

    											}
										}

							}


///////////////////////////////////////////////////////////////////////////////
// writing stylesheets into document                                         //
///////////////////////////////////////////////////////////////////////////////


with (document) {

	write("<STYLE TYPE='text/css'>");

	if(isDom)	{

		write(".parent{visibility:visible;}");
		write(".child{position:absolute;visibility:hidden}");

				}

	else		{

		if (NS4)	{

			write(".parent {position:absolute; visibility:hidden}");
			write(".child {position:absolute; visibility:hidden}");
			write(".regular {position:absolute; visibility:hidden}")

					}
		else		{

			write(".child {display:none}")

					}

				}

	write("</STYLE>");

}

onload = initIt;

function show(id){
document.getElementById(id).style.display = "block";}
function hide(id){
document.getElementById(id).style.display = "none";}