// JavaScript Document 

//HANDDLE MENU OF NBRS -------------------------------------------------------------------------------------

<!--CHANGE CLASS WITH CONDITION-->
// Don't forget to define the active object (the Id of the 1st activated object) on top of the page!!!
//Call your objects NAME+NO+NBR
//Parameters: the id, the new class, and the regular class to change back the old activated item if needed.
function exchangeClass(object, newClass, oldClass, object_kind){
	info_object = object.id.split('NO');
	no_object = info_object[1];
	name_object = info_object[0];
	if(no_object != no_active){
		//when the object is activated, we must not change it's class on mouse over, or activate it again onClick
		if(oldClass){
			//If the 3rd parameter exist, we must change the class of the active object back to regular.
			document.getElementById(name_object+"NO"+no_active).className = oldClass;
			//Then we declare that the new active object will be the one we just clicked on
			old_active = no_active;
			no_active = no_object;
			if (object_kind){
				//Show and hide the kind of object wanted (div name...)
				document.getElementById(object_kind+old_active).style.visibility = "hidden";
				document.getElementById(object_kind+no_active).style.visibility = "visible";
			}
		}
		//We change the class even if there is no old item to desactivate cause the function can also change the mouse over/out
		object.className = newClass;	
	}
}
