var timerID = null;
var timerOn = false;
var timecount = 20;
var path="/medias/fr-CA/header_menu_";

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function rollover(id,isout){
	if (isout!==1){ document.getElementById(id).src=path+id+"_on.gif";}
	else{ for (i=1; i<5; i++){ document.getElementById('b'+i).src=path+'b'+i+'_off.gif'; }}
}

function startTime() {
	if (timerOn == false) { timerID=setTimeout("rollover('',1)", timecount); }
	timerOn = true;
}
 
function stopTime(imageid) { 
if (timerOn) { 
	rollover('',1);
	clearTimeout(timerID); 
	timerID = null; 
	timerOn = false; } 
}

function ouvrirFenetre (url,fixe){
	if (fixe==0){params="width=578,height=450,menubar,scrollbars,resizable";}
	else if (fixe==2){ params="width=790,height=525,menubar,scrollbars,resizable,toolbar,status,location,directories"; }
	else {params="width=591,height=512"}
	window.open(url,'',params);
}

function valid() {
	if(document.frmRecherche.Query.value=="") {
		window.alert("Veuillez entrer un mot-clé à rechercher");
		return false; }
	return true;
}

// -- code pour tooltips -- //

function switchTip(obj,type,id,toggle) {
	var tip = document.getElementById('t'+obj).style;
	var lnk = document.getElementById('l'+obj);
	if (type ==1) { 
		if (tip.display == "none") {
			if (previous) { hideTip(previous); }
			tip.display = '';
			if (id){ lnk.href = "#"+id; }
			lnk.style.fontWeight = 'bold';
			previous = obj; } 
		else { if (toggle == true) { lnk.href = "#c"; hideTip(obj); } }
	} else { hideTip(obj); }
}

function hideTip(obj) {
	document.getElementById('t'+obj).style.display = 'none';
	document.getElementById('l'+obj).style.fontWeight = 'normal';
}

function collapseAll(objs,state) {
	var affVision = false;
	var i;
	var strUrl = window.location.href;
	var intPosition = strUrl.indexOf('#');
	if (intPosition !== -1) {
		intActif = (strUrl.slice(intPosition+1))-1;
		if (!isNaN(intActif)){
			affVision = true;
			previous = objs[intActif];
			var objs1 = objs.slice(0,intActif);
			var objs2 = objs.slice(intActif+1);
			objs = objs1.concat(objs2);
			document.getElementById('l'+previous).style.fontWeight = 'bold'; } }
	if (state) { if (affVision == true) { showVisionneuse(1); } else { showVisionneuse(0); } }
	for (i=0;i<objs.length;i++ ) { switchTip(objs[i],0) }
}
