setBrowser();

function hideID(objectID) {
	setIdProperty(objectID, 'display', 'none');
	}
function showID(objectID) {
	setIdProperty(objectID, 'display', 'block');
	}
function printFiche() {
	for (j=0; j<=nPictures; j++ ) {
		tmpName = ImageName + j;
		setIdProperty(tmpName, 'display', 'inline');
		showID("prod-caracteristiques");
		showID("prod-equipement");
		}
	print();
		setFicheTo("caracteritiques");
	}

var tableNavGlobale = new Array(20);
// Menus comprenant un sous-menu
tableNavGlobale [0] = new Array(2);
tableNavGlobale [0][0] = "lnkNavigation";
tableNavGlobale [0][1] = function (){ hideAllMenu(); afficheMenu(this.href); swapBG(this.id); };
tableNavGlobale [1] = new Array(2);
tableNavGlobale [1][0] = "lnkProduction";
tableNavGlobale [1][1] = function (){ hideAllMenu(); afficheMenu(this.href); swapBG(this.id); };
tableNavGlobale [2] = new Array(2);
tableNavGlobale [2][0] = "lnkConception";
tableNavGlobale [2][1] = function (){ hideAllMenu(); afficheMenu(this.href); swapBG(this.id); };
tableNavGlobale [3] = new Array(2);
tableNavGlobale [3][0] = "lnkDistribution";
tableNavGlobale [3][1] = function (){ hideAllMenu(); afficheMenu(this.href); swapBG(this.id); };

// Menus ne comprenant pas un sous-menu
tableNavGlobale [4] = new Array(2);
tableNavGlobale [4][0] = "lnkInvitation";
tableNavGlobale [4][1] = function (){ hideAllMenu(); };

tableNavGlobale [5] = new Array(2);
tableNavGlobale [5][0] = "lnkAdmiration";
tableNavGlobale [5][1] = function (){ hideAllMenu(); };

tableNavGlobale [6] = new Array(2);
tableNavGlobale [6][0] = "lnkContact";
tableNavGlobale [6][1] = function (){ hideAllMenu(); };

// Menu Niveau 2
tableNavGlobale [7] = new Array(2);
tableNavGlobale [7][0] = "lnkOpen";
tableNavGlobale [7][1] = function (){afficheMenu(this.href);};
tableNavGlobale [8] = new Array(2);
tableNavGlobale [8][0] = "lnkWa";
tableNavGlobale [8][1] = function (){afficheMenu(this.href);};
tableNavGlobale [9] = new Array(2);
tableNavGlobale [9][0] = "lnkPros";
tableNavGlobale [9][1] = function (){afficheMenu(this.href);};
tableNavGlobale [10] = new Array(2);
tableNavGlobale [10][0] = "lnkDistributeurs";
tableNavGlobale [10][1] = null;

// Menu Niveau 3
// Groupe 1

tableNavGlobale [11] = new Array(2);
tableNavGlobale [11][0] = "lnkP1";
tableNavGlobale [11][1] = function (){showPictureHome('img1',6, this.id);};
tableNavGlobale [12] = new Array(2);
tableNavGlobale [12][0] = "lnkP2";
tableNavGlobale [12][1] = function (){showPictureHome('img2',6, this.id);};
tableNavGlobale [13] = new Array(2);
tableNavGlobale [13][0] = "lnkP3";
tableNavGlobale [13][1] = function (){showPictureHome('img3',6, this.id);};
tableNavGlobale [14] = new Array(2);
tableNavGlobale [14][0] = "lnkP4";
tableNavGlobale [14][1] = function (){showPictureHome('img4',6, this.id);};
tableNavGlobale [15] = new Array(2);
tableNavGlobale [15][0] = "lnkP5";
tableNavGlobale [15][1] = function (){showPictureHome('img5',6, this.id);};
tableNavGlobale [16] = new Array(2);
tableNavGlobale [16][0] = "lnkP6";
tableNavGlobale [16][1] = function (){showPictureHome('img6',6, this.id);};

// Groupe 2
tableNavGlobale [17] = new Array(2);
tableNavGlobale [17][0] = "lnkP8";
tableNavGlobale [17][1] = function (){showPictureHome('img8',4, this.id);};
tableNavGlobale [18] = new Array(2);
tableNavGlobale [18][0] = "lnkP9";
tableNavGlobale [18][1] = function (){showPictureHome('img9',4, this.id);};
tableNavGlobale [19] = new Array(2);
tableNavGlobale [19][0] = "lnkP10";
tableNavGlobale [19][1] = function (){showPictureHome('img10',4, this.id);};
tableNavGlobale [20] = new Array(2);
tableNavGlobale [20][0] = "lnkP11";
tableNavGlobale [20][1] = function (){showPictureHome('img11',4, this.id);};


// Groupe des sous-menus
var tableMenus = new Array(4);
tableMenus[0] = 'navigation';
tableMenus[1] = 'production';
tableMenus[2] = 'conception';
tableMenus[3] = 'distribution';

// Attribue une fonction à un ID
function attachMouseOver(elementId, action) {
	tempID = getObjectById(elementId);
	tempID.onmouseover =  action;
}
function createDynamicMenu(menuArray) {	
	for (i=0; i<menuArray.length; i++ ) {
		attachMouseOver(menuArray[i][0], menuArray[i][1]);
	}
}
function afficheMenu(hrefElement) {
	var myStringArray = hrefElement.split('#');			// Récuperation de la valeur de “href” de l’element appelant
	setIdProperty(myStringArray[1], 'display', 'block');	// suppression du "#" pour récuperer l’ID du div à afficher
}
function swapBG(selectorID) {
	setIdProperty(selectorID,'backgroundPosition', '0 25px');
	}
function hideAllMenu() {
	for (i=0; i<tableMenus.length; i++) {
		setIdProperty(tableMenus[i], 'display', 'none');
	}
	for (j=0; j<6; j++) {
		setIdProperty(tableNavGlobale [j][0], 'backgroundPosition', '0 0');
	}
}

/* Affiche la sélection de menu de l’utilisateur selon la page dans laquelle il se situe */
function restoreToDefault(menu, selectorA, selectorB) {
	hideAllMenu();
	swapBG(selectorA);

	if (getObjectById(selectorB) != null) {
		setIdProperty(selectorB, 'backgroundColor', '#999');
		setIdProperty(selectorB, 'backgroundImage', 'url(none)');
		setIdProperty(selectorB, 'color', 'white');
	}
	if (menu != null){
		showID(menu);
	}
	}

/* ******************************** */
/* Page navigation sélection d’images*/
var isPageNavigation = false;
function showPictureHome(pictureID, nPictureToHide, selector) {
if (isPageNavigation == true){
	if (nPictureToHide == 6) {
			for (i=1; i<=nPictureToHide; i++) {
			tmpPict = "img" + i;
			hideID(tmpPict);
			setIdProperty("lnkP"+i, "backgroundColor", "#ccc");
			setIdProperty("lnkP"+i, "color", "black");
		}
	} else {
			for (i=8; i<=11; i++) {
			tmpPict = "img" + i;
			hideID(tmpPict);
			setIdProperty("lnkP"+i, "backgroundColor", "#ccc");
			setIdProperty("lnkP"+i, "color", "black");
		}
	}
	showID(pictureID);
	setIdProperty(selector, "backgroundColor", "black");
	setIdProperty(selector, "color", "white");
}
var toto = 0;
}

/* ******************************** */
/* Page produit */
function setFicheTo(fiche) {
	if (fiche=="caracteritiques") {
		showID("prod-caracteristiques");
		setIdProperty("prod-nav-lnkCaracteristiques", "backgroundColor", "#999");
		setIdProperty("prod-nav-lnkCaracteristiques", "color", "white");

		hideID("prod-equipement");
		setIdProperty("prod-nav-lnkEquipements", "backgroundColor", "#ccc");
		setIdProperty("prod-nav-lnkEquipements", "color", "#333");
		}
	if (fiche=="equipements") {
		showID("prod-equipement");
		setIdProperty("prod-nav-lnkEquipements", "backgroundColor", "#999");
		setIdProperty("prod-nav-lnkEquipements", "color", "white");

		hideID("prod-caracteristiques");
		setIdProperty("prod-nav-lnkCaracteristiques", "backgroundColor", "#ccc");
		setIdProperty("prod-nav-lnkCaracteristiques", "color", "#333");
		}
}


/* Sélection d’images */
nPictures = null;
ImageName = "prod-image";

function createTable() {
	prodImageTable = new Array(nPictures);
	if (nPictures > 0) {
		for (i=0; i<=nPictures; i++) {
			prodImageTable[i] = new Array(2);
			prodImageTable[i][0] = "lnkprod-image" + i;
			prodImageTable[i][1] = function () {manegeImages(this.id.substr(13,this.id.length-10));};
			}
	}
}

/* Affiche l’image "pictToShow" */
function manegeImages(pictToShow){
	for (j=0; j<=nPictures; j++ ) {
		tmpName = ImageName + j;
		hideID(tmpName);
		}
		showID(ImageName + pictToShow);
	}













