var browser = new Browser();

// Global variable for tracking the currently active item.
var activeItem = null;
var activeSubItem = null;

// Capture mouse clicks on the page so any active item can be
// deactivated.
if (browser.isIE)
  document.onmousedown = pageMousedown;
if (browser.isNS)
  document.addEventListener("mousedown", pageMousedown, true);


// Determine browser and version.
function Browser() {
  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}



function pageMousedown(event) {
  	var el;

  	// Find the element that was clicked on.
  	if (browser.isIE){
    	el = window.event.srcElement;
	}
  	if (browser.isNS){
    	el = (event.target.className ? event.target : event.target.parentNode);
	}
  	// If the element clicked on was not a menu item or item, close the
  	// active menu.
	if (el && el.className != 'submenuitem')
		montre();
	return;
}

//-----------------------------------------------------------------------

function montre(id) {
	var d=null;
	
	if(id != null){
		d = document.getElementById(id);
	}
	
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('s' + i)) {document.getElementById('s' + i).style.display='none';}
	}
	
	if (d != null){
		d.style.display='block';
	}
	return;
	
}
