var openedMenu=null;
var boldedCaller=null;

function openedOnLoad(menuIndex, itemIndex){
	var curCaller = document.getElementById('btn'+menuIndex);
	var curMenu = document.getElementById('menu'+menuIndex);
	curMenu.rows[itemIndex-1].style.fontWeight='bold';
	openMenu('menu'+menuIndex, curCaller);
}

function openMenu(menuToOpen, caller){
	var curMenu = document.getElementById(menuToOpen);
	if(curMenu != openedMenu){
		if(openedMenu != null){
			openedMenu.style.display='none';
			openedMenu.parentNode.style.backgroundColor='#01567F';
			boldedCaller.style.fontWeight='normal';
		}
		curMenu.style.display='inline';
		curMenu.parentNode.style.backgroundColor='#01567F';
		caller.style.fontWeight='bold';
		openedMenu=curMenu;
		boldedCaller=caller;
	}else{
		curMenu.style.display='none';
		curMenu.parentNode.style.backgroundColor='#01567F';
		caller.style.fontWeight='normal';
		openedMenu=null;
	}
}

function selfReload(v){
	if(window.location.href.indexOf(".php") > 0)
		pos=window.location.href.substring(0,window.location.href.indexOf(".php")+4);
	else
		pos=window.location.href + "index.php";
	window.location.href=pos+"?"+v;
}

var topSpan=null;
var imgPos;
function createTopSpan(){
	imgPos=document.getElementsByTagName('img')[0];
	imgPos.style.position='absolute';
	topSpan=document.createElement('span');
	topSpan.style.display='none';
	topSpan.className='topLabel';
	topSpan.style.left=(imgPos.offsetLeft+166)+'px';
	var bodyObj=document.getElementsByTagName('body')[0];
	bodyObj.appendChild(topSpan);
}
function displayFullLabel(fullLabel, callerObj){
	callerObj.onmouseout=hideFullLabel;
	if(topSpan==null)
		createTopSpan();
	topSpan.innerHTML=fullLabel;
	topSpan.style.display='block';
	topSpan.style.left=(imgPos.offsetLeft+166)+'px';
}
function hideFullLabel(){
	topSpan.style.display='none';
	topSpan.innerHTML='';
}

var lsvOpened=false;
var tdContent;
var lsvContent;
var curCaller=null;
function toggleLeSaviezVous(callerObj, isLSV){
	if(isLSV){
		document.getElementById('tabLine').className='leSavLine';
		var table=document.getElementById('leSaviezVousTable');
		var toClose=document.getElementById('incroyableTable');
		var txtOn='Le saviez-vous ?';
		var txtOff='Le savez-vous ?';
		toClose.txtOff='Incroyable...';
	}else{
		document.getElementById('tabLine').className='incrLine';
		var table=document.getElementById('incroyableTable');
		var toClose=document.getElementById('leSaviezVousTable');
		var txtOn='&nbsp;&nbsp;Mais vrai !&nbsp;&nbsp;';
		var txtOff='Incroyable...';
		toClose.txtOff='Le savez-vous ?';
	}
	tdContent=table.getElementsByTagName('p')[0];
	if(table.style.display=='inline'){
		table.style.display='none';
		callerObj.getElementsByTagName('strong')[0].innerHTML=txtOff;
		curCaller=null;
	}else{
		lsvContent=tdContent.innerHTML.substring(4);
		tdContent.innerHTML='';
		if(curCaller!=null)
			curCaller.getElementsByTagName('strong')[0].innerHTML=toClose.txtOff;
		callerObj.getElementsByTagName('strong')[0].innerHTML=txtOn;
		toClose.style.display='none';
		table.style.display='inline';
		refill(lsvContent.length, 1);
		curCaller=callerObj;
	}
}
function refill(baseIndex, curIndex){
	tdContent.innerHTML=lsvContent.substring(0, curIndex);
	curIndex=curIndex+40;
	if(curIndex<baseIndex)
		setTimeout("refill("+baseIndex+","+curIndex+")", 1);
	else
		tdContent.innerHTML='<br>'+lsvContent;
}