/* ----- ----- ----- Free software Foundation - Affero Licence ----- ----- -----

menu.js - Menu
    Copyright (C) 2008  Thibault Garcia (thibault.garcia@revaweb.com)

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

----- ----- ----- Free software Foundation - Affero Licence ----- ----- ----- */

/* ----- ----- menuInit ----- -----
Initialise le menu
id       : Id de la zone qui ouvre le menu. Doit englober le menu
corps_id : Id du menu. Doit être contenu dans la zone qui l'ouvre
*/
function menuInit(id,corps_id){
	var corps=document.getElementById(corps_id);
	var item=document.getElementById(id);

	var menuDiv=document.createElement('div');
	menuDiv.style.filter='alpha(opacity=100)';
	menuDiv.style.opacity=1;
	menuDiv.style.cssFloat='none';
	menuDiv.style.position='relative';
	menuDiv.style.display='none';
	menuDiv.style.width='auto';
	menuDiv.style.height=0;
	menuDiv.style.margin='0';
	menuDiv.style.padding='0';
	menuDiv.style.border='0';

	corps.menuDiv=menuDiv;
	corps.parentNode.replaceChild(menuDiv,corps);
	menuDiv.appendChild(corps);

	item.style.position='relative';

	var menuId=eventId(menuDiv);
	eventAddAfter(item,'onmouseover','document.getElementById("'+menuId+'").style.display=\'block\'');
	eventAddAfter(item,'onmouseout','document.getElementById("'+menuId+'").style.display=\'none\'');
}

