
function chargeliste(tableau,liste) {
	liste.options.length=0;
	for (lst=0;lst<tableau.length;lst++) {
		var o=new Option(tableau[lst][0],liste.options.length);
		o.value=tableau[lst][1]; 
		liste.options[liste.options.length]=o;
		if (lst>0) {
		switch(liste.name) {
		case "s_moteurs":		liste[lst].style.background='#9FB48B'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_meta":		liste[lst].style.background='#9FB48B'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_annu":		liste[lst].style.background='#E6DD79'; liste[lst].style.color='#000000';
		break;
		case "s_thema":		liste[lst].style.background='#E6DD79'; liste[lst].style.color='#000000';
		break;
		case "s_carto":		liste[lst].style.background='#C8CCF0'; liste[lst].style.color='#000000';
		break;
		case "s_nature":		liste[lst].style.background='#D2B5C2'; liste[lst].style.color='#000000';
		break;
		case "s_ope":		liste[lst].style.background='#D2B5C2'; liste[lst].style.color='#000000';
		break;
		case "s_media":		liste[lst].style.background='#FFCCAA'; liste[lst].style.color='#000000';
		break;
		case "s_aide":		liste[lst].style.background='#262EB7'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_invis":		liste[lst].style.background='#FFFF99'; liste[lst].style.color='#000000';
		break;
		case "s_compare":		liste[lst].style.background='#C4E3A4'; liste[lst].style.color='#000000';
		break;
		case "s_biblio":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_dico":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_trad":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_dedie":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_metho":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_autres":		liste[lst].style.background='#5E88AA'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_kmot":		liste[lst].style.background='#CCFF9B'; liste[lst].style.color='#000000';
		break;
		case "s_kannu":		liste[lst].style.background='#66CCFF'; liste[lst].style.color='#FFFFFF';
		break;
		case "s_keduc":		liste[lst].style.background='#FFCC00'; liste[lst].style.color='#000000';
		break;
		}
		}

	}
}

function QueryString(param){

  var begin,end;
  if(self.location.search.length>1)
  {
    begin=self.location.search.indexOf(param)+param.length+1;
    end=begin+6; 
    if(end==(-1)) end=self.location.search.length;
    return(self.location.search.substring(begin,end));

}
  else if(self.location.hash.length>1)
  {
    begin=self.location.hash.indexOf(param)+param.length+1;
    end=self.location.hash.indexOf("&",begin);
    if(end==(-1)) end=self.location.hash.length;
    return(self.location.hash.substring(begin,end));
  }
  else return("");

}

function NewWindow(url,hauteur,largeur) {
	var winl = (screen.width - largeur) / 2;
	var wint = (screen.height - hauteur) / 2;
	date_t = new Date;
	time = date_t.getTime();
	winprops ='height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',toolbar=no,location=no,menuBar=no,scrollBars=no,status=no,resizable=no'
	win = window.open(url, time, winprops)
}

function envoilien(source) {
var s="";
if (source.indexOf("images/go_moteurs.gif")>0) {s=document.forms['zefab'].s_moteurs.options[document.forms['zefab'].s_moteurs.selectedIndex].value;}
if (source.indexOf("images/go_meta.gif")>0) {s=document.forms['zefab'].s_meta.options[document.forms['zefab'].s_meta.selectedIndex].value;}
if (source.indexOf("images/go_annu.gif")>0) {s=document.forms['zefab'].s_annu.options[document.forms['zefab'].s_annu.selectedIndex].value;}
if (source.indexOf("images/go_thema.gif")>0) {s=document.forms['zefab'].s_thema.options[document.forms['zefab'].s_thema.selectedIndex].value;}
if (source.indexOf("images/go_carto.gif")>0) {s=document.forms['zefab'].s_carto.options[document.forms['zefab'].s_carto.selectedIndex].value;}
if (source.indexOf("images/go_nature.gif")>0) {s=document.forms['zefab'].s_nature.options[document.forms['zefab'].s_nature.selectedIndex].value;}
if (source.indexOf("images/go_ope.gif")>0) {s=document.forms['zefab'].s_ope.options[document.forms['zefab'].s_ope.selectedIndex].value;}
if (source.indexOf("images/go_media.gif")>0) {s=document.forms['zefab'].s_media.options[document.forms['zefab'].s_media.selectedIndex].value;}
if (source.indexOf("images/go_aide.gif")>0) {s=document.forms['zefab'].s_aide.options[document.forms['zefab'].s_aide.selectedIndex].value;}
if (source.indexOf("images/go_invis.gif")>0) {s=document.forms['zefab'].s_invis.options[document.forms['zefab'].s_invis.selectedIndex].value;}
if (source.indexOf("images/go_compare.gif")>0) {s=document.forms['zefab'].s_compare.options[document.forms['zefab'].s_compare.selectedIndex].value;}
if (source.indexOf("images/go_biblio.gif")>0) {s=document.forms['zefab'].s_biblio.options[document.forms['zefab'].s_biblio.selectedIndex].value;}
if (source.indexOf("images/go_dico.gif")>0) {s=document.forms['zefab'].s_dico.options[document.forms['zefab'].s_dico.selectedIndex].value;}
if (source.indexOf("images/go_trad.gif")>0) {s=document.forms['zefab'].s_trad.options[document.forms['zefab'].s_trad.selectedIndex].value;}
if (source.indexOf("images/go_dedie.gif")>0) {s=document.forms['zefab'].s_dedie.options[document.forms['zefab'].s_dedie.selectedIndex].value;}
if (source.indexOf("images/go_metho.gif")>0) {s=document.forms['zefab'].s_metho.options[document.forms['zefab'].s_metho.selectedIndex].value;}
if (source.indexOf("images/go_autres.gif")>0) {s=document.forms['zefab'].s_autres.options[document.forms['zefab'].s_autres.selectedIndex].value;}
if (s!="") {window.open(s,"_blank","width=screen.width*3/4,height=screen.height*3/4,toolbar=yes,location=yes,menuBar=yes,scrollBars=yes,status=yes,resizable=yes,directories=yes");} else {alert( E_NOCLESELECT);}

}

function envoilien2(source) {
var s="";
if (source.indexOf("images/F_go_kmot.gif")>0) {s=document.forms['zefab'].s_kmot.options[document.forms['zefab'].s_kmot.selectedIndex].value;}
if (source.indexOf("images/F_go_kannu.gif")>0) {s=document.forms['zefab'].s_kannu.options[document.forms['zefab'].s_kannu.selectedIndex].value;}
if (source.indexOf("images/F_go_keduc.gif")>0) {s=document.forms['zefab'].s_keduc.options[document.forms['zefab'].s_keduc.selectedIndex].value;}
if (s!="") {window.open(s,"_blank","width=screen.width*3/4,height=screen.height*3/4,toolbar=yes,location=yes,menuBar=yes,scrollBars=yes,status=yes,resizable=yes,directories=yes");} else {alert( E_NOCLESELECT);}
}

function selectfocus(liste) {

if (liste.selectedIndex==0) {
	document.images['11h'].src="images/11h.gif";
	document.images['12h'].src="images/12h.gif";
	document.images['13h'].src="images/13h.gif";
	document.images['15h'].src="images/15h.gif";
	document.images['16h'].src="images/16h.gif";
	document.images['17h'].src="images/17h.gif";
	document.images['18h1'].src="images/18h1.gif";
	document.images['18h2'].src="images/18h2.gif";
	document.images['20h'].src="images/20h.gif";
	document.images['21h'].src="images/21h.gif";
}

window.focus();
}

function colorfocus(liste) {
	if (liste.name!="s_moteurs") document.forms['zefab'].s_moteurs[0].selected=true;
	if (liste.name!="s_meta") document.forms['zefab'].s_meta[0].selected=true;
	if (liste.name!="s_thema") document.forms['zefab'].s_thema[0].selected=true;
	if (liste.name!="s_annu") document.forms['zefab'].s_annu[0].selected=true;
	if (liste.name!="s_carto") document.forms['zefab'].s_carto[0].selected=true;
	if (liste.name!="s_invis") document.forms['zefab'].s_invis[0].selected=true;
	if (liste.name!="s_compare") document.forms['zefab'].s_compare[0].selected=true;
	if (liste.name!="s_biblio") document.forms['zefab'].s_biblio[0].selected=true;
	if (liste.name!="s_dico") document.forms['zefab'].s_dico[0].selected=true;
	if (liste.name!="s_trad") document.forms['zefab'].s_trad[0].selected=true;
	if (liste.name!="s_dedie") document.forms['zefab'].s_dedie[0].selected=true;
	if (liste.name!="s_metho") document.forms['zefab'].s_metho[0].selected=true;
	if (liste.name!="s_autres") document.forms['zefab'].s_autres[0].selected=true;	
	if (liste.name!="s_media") document.forms['zefab'].s_media[0].selected=true;		
	if (liste.name!="s_ope") document.forms['zefab'].s_ope[0].selected=true;		
	if (liste.name!="s_nature") document.forms['zefab'].s_nature[0].selected=true;		
	if (liste.name!="s_aide") document.forms['zefab'].s_aide[0].selected=true;		

	document.images['11h'].src="images/11h.gif";
	document.images['12h'].src="images/12h.gif";
	document.images['13h'].src="images/13h.gif";
	document.images['15h'].src="images/15h.gif";
	document.images['16h'].src="images/16h.gif";
	document.images['17h'].src="images/17h.gif";
	document.images['18h1'].src="images/18h1.gif";
	document.images['18h2'].src="images/18h2.gif";
	document.images['20h'].src="images/20h.gif";
	document.images['21h'].src="images/21h.gif";
	switch(liste.name) {
	case "s_moteurs":		document.images['go'].src="images/go_moteurs.gif"; document.images['11h'].src="images/C11h.gif";
	break;
	case "s_meta":		document.images['go'].src="images/go_meta.gif"; document.images['11h'].src="images/C11h.gif";
	break;
	case "s_annu":		document.images['go'].src="images/go_annu.gif"; document.images['21h'].src="images/C21h.gif";
	break;
	case "s_thema":		document.images['go'].src="images/go_thema.gif"; document.images['21h'].src="images/C21h.gif";
	break;
	case "s_carto":		document.images['go'].src="images/go_carto.gif"; document.images['20h'].src="images/C20h.gif";
	break;
	case "s_nature":		document.images['go'].src="images/go_nature.gif"; document.images['11h'].src="images/C12h1.gif"; document.images['12h'].src="images/C12h2.gif";
	break;
	case "s_ope":		document.images['go'].src="images/go_ope.gif"; document.images['11h'].src="images/C12h1.gif"; document.images['12h'].src="images/C12h2.gif";
	break;
	case "s_media":		document.images['go'].src="images/go_media.gif"; document.images['13h'].src="images/C13h.gif";
	break;
	case "s_aide":		document.images['go'].src="images/go_aide.gif"; document.images['15h'].src="images/C15h.gif";
	break;
	case "s_invis":		document.images['go'].src="images/go_invis.gif"; document.images['16h'].src="images/C16h.gif"; 
	break;
	case "s_compare":		document.images['go'].src="images/go_compare.gif"; document.images['17h'].src="images/C17h.gif"; 
	break;
	case "s_biblio":		document.images['go'].src="images/go_biblio.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	case "s_dico":		document.images['go'].src="images/go_dico.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	case "s_trad":		document.images['go'].src="images/go_trad.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	case "s_dedie":		document.images['go'].src="images/go_dedie.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	case "s_metho":		document.images['go'].src="images/go_metho.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	case "s_autres":		document.images['go'].src="images/go_autres.gif"; document.images['18h1'].src="images/C18h1.gif"; document.images['18h2'].src="images/C18h2.gif";
	break;
	}	

		
}

function colorfocus2(liste) {
	if (liste.name!="s_kmot") document.forms['zefab'].s_kmot[0].selected=true;
	if (liste.name!="s_kannu") document.forms['zefab'].s_kannu[0].selected=true;
	if (liste.name!="s_keduc") document.forms['zefab'].s_keduc[0].selected=true;

	document.images['F_k12h'].src="images/F_k12h.gif";
	document.images['F_k15h'].src="images/F_k15h.gif";
	document.images['F_k18h'].src="images/F_k18h.gif";
	switch(liste.name) {
	case "s_kmot":		document.images['go'].src="images/F_go_kmot.gif"; document.images['F_k12h'].src="images/F_Ck12h.gif";
	break;
	case "s_kannu":		document.images['go'].src="images/F_go_kannu.gif"; document.images['F_k15h'].src="images/F_Ck15h.gif";
	break;
	case "s_keduc":		document.images['go'].src="images/F_go_keduc.gif"; document.images['F_k18h'].src="images/F_Ck18h.gif";
	break;
	}	

		
}

function EcrireCookie(nom, valeur)
{
   var argv=EcrireCookie.arguments;
   var argc=EcrireCookie.arguments.length;
   var expires=(argc > 2) ? argv[2] : null;
   var path=(argc > 3) ? argv[3] : null;
   var domain=(argc > 4) ? argv[4] : null;
   var secure=(argc > 5) ? argv[5] : false;
   document.cookie=nom+"="+escape(valeur)+
      ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
      ((path==null) ? "" : ("; path="+path))+
      ((domain==null) ? "" : ("; domain="+domain))+
      ((secure==true) ? "; secure" : "");
}
function getCookieVal(offset)
{
   var endstr=document.cookie.indexOf (";", offset);
   if (endstr==-1) endstr=document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom)
{
   var arg=nom+"=";
   var alen=arg.length;
   var clen=document.cookie.length;
   var i=0;
   while (i<clen)
   {
      var j=i+alen;
      if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
      i=document.cookie.indexOf(" ",i)+1;
      if (i==0) break;
   }
   return null;
}

function gofav(favori){
var lien =LireCookie(favori);
if (lien!=null) {
window.open(lien,"_blank","width=screen.width*3/4,height=screen.height*3/4,toolbar=yes,location=yes,menuBar=yes,scrollBars=yes,status=yes,resizable=yes,directories=yes");
}
else {
alert(E_LIENUNDEF);
}
}

function initfav(favori) {
date=new Date;
date.setMonth(date.getMonth()+12);
if (LireCookie(favori)==null) {lien=prompt(L_LIEN,'http://');} else {lien=prompt(L_LIEN,LireCookie(favori));}
if ((lien=="")||(lien=="http://")) {alert(E_LIENNOK);}
else {EcrireCookie(favori, lien, date);}
}

function charge_cat(onglet,categorie,liste) {
var j=0;
var k=liste.length;
var cat="";
var liste_onglet=new Array(); 
switch(onglet) {
	case "1":		liste_onglet=liste_onglet1;
	break;
	case "2":		liste_onglet=liste_onglet2;
	break;
	case "3":		liste_onglet=liste_onglet3;
	break;
	case "4":		liste_onglet=liste_onglet4;
	break;
	case "5":		liste_onglet=liste_onglet5;
	break;
	case "6":		liste_onglet=liste_onglet6;
	break;
}
if (typeof(liste_onglet)!="undefined") {
	for (i=0;i<liste_onglet.length;i++) {
		cat=liste_onglet[i][0];
		if (cat.substr(3,cat.length)==categorie) { 
			liste[k]=new Array(liste_onglet[i][0],"");			
			j=i+1;
			while (j<liste_onglet.length){
				if (liste_onglet[j][0].substr(0,3)!="---"){			
					k=k+1;
					liste[k]=new Array(liste_onglet[j][0],liste_onglet[j][1]);
				} else {return;}
				j=j+1;
			}
		}
	if (j==liste_onglet.length) {break;}
	}		
} 
}


function getVar (nomVariable)
{
	var infos = location.href.substring(location.href.indexOf("?")+1, location.href.length)+"&"
	if (infos.indexOf("#")!=-1)
		infos = infos.substring(0,infos.indexOf("#"))+"&"
	var variable=0
	{
		nomVariable = nomVariable + "="
		var taille = nomVariable.length
		if (infos.indexOf(nomVariable)!=-1)
			variable = infos.substring(infos.indexOf(nomVariable)+taille,infos.length).substring(0,infos.substring(infos.indexOf(nomVariable)+taille,infos.length).indexOf("&"))
	}
	return variable
}


