var agent = navigator.userAgent.toLowerCase();
var w3c = document.getElementById ? true : false;
var iex = (navigator.appName == 'Microsoft Internet Explorer') ? true : false;
function getStyle(nom){
	return w3c ? document.getElementById(nom).style : iex ? document.all[nom].style : false;
}
function getObj(nom){
	return w3c ? document.getElementById(nom) : iex ? document.all[nom] : false;
}
Menu = function(nom,left,top){
	this.name = nom;
	this.timer = null;
	this.obj = nom+'Object';
	eval(this.obj+'=this');
}
Menu.prototype.montrer = function(nomSubMenu){
	menuCourant = this.name;
	objMenuCourant = getStyle(this.name);
	objDysplayMenu = getObj(nomSubMenu);
	clearTimeout(this.timer);
	var windowWidth = iex ? document.body.clientWidth : window.innerWidth;
	var offset = Math.floor((windowWidth-770)/2);
	if(offset < 0){
		offset = 0;
	}
	var psoitionHaut = objDysplayMenu.offsetTop ? (objDysplayMenu.offsetTop + objDysplayMenu.offsetHeight + 1): 203;;
	var psoitionGauche = objDysplayMenu.offsetLeft;
	if (psoitionGauche == 0) {
	 if (objDysplayMenu.offsetParent.offsetParent.offsetLeft == 0) { // opera
	 	psoitionGauche = objDysplayMenu.offsetParent.offsetLeft;
		psoitionHaut = objDysplayMenu.offsetParent.offsetTop+objDysplayMenu.offsetParent.offsetHeight+6;
	 } else { //konqueror + ie
	 	psoitionGauche = objDysplayMenu.offsetParent.offsetLeft+offset;
		psoitionHaut = iex ? 205 : 218;
	 }
	}
	objMenuCourant.left = psoitionGauche+"px";
	objMenuCourant.top = psoitionHaut+"px";
	objMenuCourant.visibility = 'visible';
}
Menu.prototype.cacher = function(){
	this.timer = setTimeout(this.obj+'.cacheLe()',500);
}
Menu.prototype.cacheLe = function(){
	getStyle(this.name).visibility = 'hidden';
}
cacheLes = function(){
	if(menuCourant != null){
		Menus[menuCourant].cacheLe();
		menuCourant = null;
	}
}
creerMenu = function(nom,left){
	Menus[nom] = new Menu(nom);
}

Menus = new Object();
var menuCourant = null;
creerMenu('submenu1');
creerMenu('submenu2');
creerMenu('submenu3');
creerMenu('submenu4');
creerMenu('submenu5');
creerMenu('submenu6');

