// Array tousLayer() should be defined in main script before calling this
// tousLayer() is the list of layer labels concerned by rollover
//


	
function affiche()
{
	for(i in tousLayer)
	{
		alert(tousLayer[i]);
	}
}

function cacherSelectLayer(){
		for(i in layerSelect)
			eval(startLayerRef+layerSelect[i]+endLayerRef+styleSwitch+'.visibility=layerVis0');	
			$('#'+layerSelect[i]).css('visibility','hidden');
}

function cacherToutLayer()
{
		for (i in tousLayer)
		{
			eval(startLayerRef + tousLayer[i] + endLayerRef +styleSwitch+ '.visibility=layerVis0');
			$('#'+tousLayer[i]).css('visibility','hidden');
		}
}


function moveActiveLayer() {
	if (visibleLayer(activeLayer)) {
		hideLayer(activeLayer);
	}
	activeLayer='layer0';
}

function hideLayer(layerName){
		eval(startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility=layerVis0');
		$('#'+layerName).css('visibility','hidden');
}

function hideLayerExcept(layerNum){
	if (1==0)
	{	
		for (i in tousLayer)
		{
			if ('layer'+i != tousLayer[layerNum])
			{
				// eval(startLayerRef + tousLayer[i] + endLayerRef +styleSwitch+ '.visibility=layerVis0;');
				$('#'+tousLayer[i]).css('visibility','hidden');
			}
		}
	}
}

function hideLayerMenu(layerName){
		moveLayerY(activeLayer,-2000);
		activeLayer = 'layer0';
}

function hideLayerPos(layerName,key,layerLineName){
		// eval(startLayerRef + layerName + endLayerRef + styleSwitch + ".top='-2000'");
		$('#'+layerName).css('top','-2000px');
		moveLayerY(layerLineName,-2000);
}


function hideText(layerName)
{
		// eval(startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility=layerVis0;');
		$('#'+layerName).css('visibility','hidden');
}

function moveLayerX(layerName,x){
		// eval(startLayerRef + layerName + endLayerRef + styleSwitch + leftSwitch +"='" + x + "'");
		$('#'+layerName).css('left',x);

}

function moveLayerY(layerName,y){
		// eval(startLayerRef + layerName + endLayerRef + styleSwitch + topSwitch +"='" + y + "'");
		$('#'+layerName).css('top',y);
}

function onDelay(layerName) {
	timerDelay = setTimeout("hideLayerMenu('"+layerName+"');", 400)
}

function offDelay() {
	clearTimeout(timerDelay)
}

function showLayer(layerName){
		if (visibleLayer(activeLayer)) {
			hideLayer(activeLayer);
		}
		//eval(startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility=layerVis1;');
		$('#'+layerName).css('visibility','visible');
	activeLayer = layerName;
}

function showLayer2(layerName){
		// eval(startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility=layerVis1;');
		$('#'+layerName).css('visibility','visible');
}

function showLayerMenu(layerName,y){
		// y = y + topOffset;
		moveLayerY(activeLayer,-2000);
		//eval(startLayerRef + layerName + endLayerRef + styleSwitch + topSwitch + "='" + y + "'");
		$('#'+layerName).css('top',y);
		activeLayer = layerName;
}

function showLayerPos(layerName,y,key,layerLineName){
		//on(key);
		// y = y + topOffset;
		hideLayerPos(activeName,key,activeLine);
		// eval(startLayerRef + layerName + endLayerRef + styleSwitch + topSwitch + "='" + y + "'");
		$('#'+layerName).css('top',y);
		//moveLayerY(layerLineName,y+12);
		moveLayerY(layerLineName,y);
	activeName = layerName;
	activeLine = layerLineName;
}



function showText(layerName)
{
	$('#'+layerName).css('visibility','visible');
		//eval(startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility=layerVis1;');
}

function switchLayer(layerName)
{	
	if (visibleLayer(layerName)) {
		hideLayer(layerName);
	} else {	
		showLayer2(layerName);
	}
	
}

function visibleLayer(layerName){
		// eval( 'var isVisible = ' + startLayerRef + layerName + endLayerRef +styleSwitch+ '.visibility ;');
		var isVisible = $('#'+layerName).css('visibility');
		return (isVisible=='visible');
}
