/*
Based on script name: Simple Javascript Browser/OS detection
Authors: Harald Hope, Tapio Markula, Websites: http://techpatterns.com/
http://www.nic.fi/~tapio1/Teaching/index1.php3
Script Source URI: http://techpatterns.com/downloads/javascript_browser_detection.php
Version 2.0.1
*/
var d, ie, ff, n, nua;
d = document;
n = navigator;
nua = n.userAgent;
ff = ( nua.indexOf( 'Firefox' ) != -1 );
ie = ( d.all && !ff );

/*
  Simple tree menu (nn@rtfm.cz)
*/
function hideall() {
	id = document.getElementById('menu-vert-js');
	root = id.childNodes[ie ? 0 : 1];
	for (i = (ie ? 0 : 1); i < root.childNodes.length; i+=(ie ? 1 : 2)) {
		root.childNodes[i].firstChild.onclick = toggle;
		if (root.childNodes[i].firstChild.nextSibling) {
			sub = root.childNodes[i].firstChild.nextSibling.nextSibling;
			try {
				if (typeof sub == 'object') {
					if (typeof sub.style == 'object') {
						sub.style.display = 'none';
					}
				}
			} catch(e) { }
		}
	}
}

function toggle(e) {
	hideall();
	var ul = ie ?
		event.srcElement.nextSibling.nextSibling :
		e.target.nextSibling.nextSibling;
	style = ul.getAttribute('style');
	if (style && typeof(style) == 'object') {
		if (style.display == 'none') {
			style.display = 'block';
		} else {
			style.display = 'none';
		}
		return false;
	}
	if (style) {
		if (style.indexOf('block') > 0) {
			ul.setAttribute('style', 'display:none');
		} else {
			ul.setAttribute('style', 'display:block');
		}
	} else {
		ul.setAttribute('style', 'display:none');
	}
	return false;
}


function initmenu() {
	hideall();
}

onload=initmenu;

