var MsgErr = "";

//===========================================
// Menu avec calques des familles

function TheCalques( name, srcOn , srcOff , calque , keep) {
	this.name    = name;
	this.srcOn   = srcOn;
	this.srcOff  = srcOff;
	this.calque  = new MakeRefObj( calque );
	this.keep	 = keep;
	this.actif   = false;
	this.TimeInd = false;
	this.StopShow = false;
}

// MenuCalque Object
var allCalques = new Array();

EventTrt |= 2;			// Traitement Som
EventAll |= EventMove	// Gestion du mouseMove

//===========================================

var ChoixOn = -1;
var ChoixIn = false;
var LoadSomFam = false;

function ShowChoix( ind , Mode ) {
  var x;
    if (ind != -1) {
		if ((x=MM_findObj( allCalques[ind].name )) != null) {
			if (Mode) x.src = allCalques[ind].srcOn;
			else x.src = allCalques[ind].srcOff;
		}
		if ( ! Mode ) allCalques[ind].actif = Mode;
		allCalques[ind].calque.SetVisible( Mode );
	}
}

function SwapImage( num ) {
  var ind;
	if (LoadSomFam) {
	    ind = num - 1;
		allCalques[ind].actif = false;
		if (ChoixOn != -1) {
			if (allCalques[ChoixOn].TimeInd) {
				clearTimeout( allCalques[ChoixOn].TimeInd );
				allCalques[ChoixOn].TimeInd = null;
			}
			if (ChoixOn != ind) ShowChoix( ChoixOn , false );
		}
		if ( ! allCalques[num-1].StopShow) {
			ChoixOn = ind;	
			ShowChoix( ind , true );
		}
	}
}

function SwapImgRestore( num ) {
	if (LoadSomFam) {
		if (! allCalques[num-1].keep) {
			allCalques[num-1].actif = true;
			if (allCalques[num-1].TimeInd) clearTimeout( allCalques[ChoixOn].TimeInd );
			allCalques[num-1].TimeInd = setTimeout( "ShowChoix(" + (num - 1) + "," + false + ")",500);
		}
		allCalques[num-1].StopShow = false;
	}
}

function SwapStop( num ) {
	if (LoadSomFam) {
		if (! allCalques[num-1].StopShow) {
			ShowChoix( num-1 , false );
			allCalques[num-1].StopShow = true;
			ChoixOn = -1;
		}
		else {
			ShowChoix( num-1 , true );
			allCalques[num-1].StopShow = false;
			ChoixOn = num-1;
		}
	}
}
