function getElt(eltId) {
	var elt;
	if (document.getElementById) {
		elt = document.getElementById(eltId);
	} else if (document.all) {
		elt = document.all(eltId);
	}
	return elt;
}

function hover(obj){
	if(document.all){ // This block will be interpreted only by IE Browsers
		ulTags = obj.getElementsByTagName('ul');
		if(ulTags.length > 0){
			sousMenu = ulTags[0].style;
			if(sousMenu.display == 'none' || sousMenu.display == ''){
				// IE trick to hide the select tags of the page
				// because if not, it would ever be on top of every menu
				hideSelect(true);
				sousMenu.display = 'block';
			} else{
				hideSelect(false);
				sousMenu.display = 'none';
			}
		}
	}
}

function setHover( menuId ){
	if (getElt( menuId ) == null) {
		return false;
	}
	liTags = getElt( menuId ).getElementsByTagName('li');
	if (liTags == null) {
		return false;
	}
	liTagsNb = liTags.length;
	for(i=0; i < liTagsNb; i++){
		liTags[i].onmouseover = function(){
			hover(this);
		}
		liTags[i].onmouseout = function(){
			hover(this);
		}
	}
	return true;
}

// IE trick to hide the select tags of the page
// because if not, it would ever be on top of every menu
function hideSelect(flag) {
	var selectTags = document.getElementsByTagName('select');
	selectTagsNb = selectTags.length;
	for(j=0; j < selectTagsNb; j++){
		if (flag) {
			selectTags[j].style.visibility = 'hidden';
		} else {
			selectTags[j].style.visibility = 'visible';
		}
	}
}
// In HTML page 
// include the script
// <script type="text/javascript" src="/js/menus.js"></script>
// and then initialize the menu :
// <script type="text/javascript">window.onload = function() {setHover("menu");}</script>

