// Gestion du menu dynamique
// Author : yanhl	Date : 19/11/2001
// Location : Frame de gauche

// Pour tests
if (!gfxDirectory) {
var gfxDirectory = 'inrs/gfx/';
}
var imgExtension = '.gif';

function menuAtom(name, link, imageURL, imageName){
	this.name = name;				// Nom du menu (Texte affiché pour les menu textes, Alt des images sinon)
	this.link = link;				// Lien vers lequel pointe l'entrée du menu
	this.state = false;				// Etat on/off
	this.cover = false;				// Couverture du magazine (oui/non)
//	this.coverHeight = 0;			// > hauteur de l'image
	this.description = '';
	if (arguments.length > 2) {
		this.imageURL = imageURL;	// Si le menu est en image, URL du fichier

		if (arguments.length > 3) this.imageName = imageName;
		else this.imageName = imageURL; // Nom de l'image -> pour les rolls

		this.imgNormal = new Image();
		this.imgNormal.src = gfxDirectory + this.imageName + imgExtension;
		this.imgOver = new Image();
		this.imgOver.src = 	gfxDirectory + this.imageName + "_over" + imgExtension;
		this.imgOn = new Image();
		this.imgOn.src = 	gfxDirectory + this.imageName + "_on" + imgExtension;

	}
	this.under = new Array();		// Les fils
}
menuAtom.prototype.addDescription = function(desc) {
	this.description = desc;
}
menuAtom.prototype.addCover = function(height) {
	this.cover = true;
	this.coverHeight = height;
}


var menuOpened = -1;
function menuClose(nextOpened) {
	if (menuOpened >= 0) {
		globalMenu.under[menuOpened].state = !globalMenu.under[menuOpened].state;
	}
	menuOpened = nextOpened;
}

function selectMenu(which) {
	with (which) {
		state = !state;
	}
}
