<!--
bton = new Image();
btoff = new Image();
bton.src = "images/index_on.jpg";
btoff.src = "images/index.jpg";

// Ouverture d'une fenetre POPUP
function OuvrirFenetre(URL,LgX,LgY,Nom) {
	PosX = (screen.width) ? (screen.width-LgX)/2 : 0; 
	PosY = (screen.height) ? (screen.height-LgY)/2 : 0; 
	if ( !Nom ) Nom = "popup";
	msg=open("wait.html",Nom,"location=no,status=no,toolbar=no,directories=no,resizable=yes,menubar=no,scrollbars=yes,width="+LgX+",height="+LgY+",left="+PosX+",top="+PosY);
	msg.location.href=URL;
	msg.focus();
}

// Filtrage caractères non numériques
function Filtre() {
	a=window.event.keyCode;
	if ((a<48 || a>57) && a!=47) window.event.keyCode = 0;
}

// Appel d'un lexique
function Lexique(Indice) {
	var j=-1;
	var url="";
	for (var i=0;i<document.images.length;i++) {
	if ( document.images[i].name == "img" ) {
		j++;
		if ( j==Indice ) {
			document.images[i].src = bton.src;
		} else {
			document.images[i].src = btoff.src;
		}
	}}
	if ( Indice == -1 ) return;
	switch ( Indice) {
		case 0: <!-- Titre -->
			url="lexique.php?ret=Chp0&tbl=jeunes_titre&lib=TITRE&maxcl=1&maxlg=45&guillemet=true";
			break;
		case 1: <!-- Organismes -->
			url="lexique.php?ret=Chp1&tbl=jeunes_am&lib=ORGANISMES&maxcl=1&maxlg=45&guillemet=true";
			break;
		case 2: <!-- Auteurs -->
			url="lexique.php?ret=Chp2&tbl=jeunes_au&lib=AUTEURS";
			break;
		case 3: <!-- Pays/Régions -->
			url="lexique.php?ret=Chp3&tbl=jeunes_geo&lib=PAYS/REGIONS";
			break;
		case 4: <!-- Domaines -->
			url="lexique.php?ret=Chp4&tbl=jeunes_theme&lib=DOMAINES";
			break;
		case 5: <!-- Mots-clés -->
			url="lexique.php?ret=Chp5&tbl=jeunes_de&lib=MOTS-CLES";
			break;
		case 6: <!-- Public cible -->
			url="lexique.php?ret=Chp6&tbl=jeunes_public&lib=PUBLIC";
			break;
	}
	/* POSITIONS */
	var LgX = 800;
	var LgY = 200;
	var PosX = (screen.width) ? (screen.width-LgX)/2 : 0; 
	var PosY = (screen.height) ? (screen.height-LgY)/2 : 0; 
	msg=open("","Index","location=no,status=no,toolbar=no,directories=no,resizable=yes,menubar=no,scrollbars=yes,width="+LgX+",height="+LgY+",left="+PosX+",top="+PosY);
	msg.location.href=url;
	msg.focus();
}
// SELECTION
function EcrireCookie(nom, valeur) {
	var date=new Date;
	date.setMonth(date.getMonth()+6);
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : date;
	var path=(argc > 3) ? argv[3] : "/";
	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 CaseCocher(CLE,nom) {
	if ( liste.indexOf(","+CLE+",") != -1 ) {
		//document.write('<td id="TD'+CLE+'" class="tabon" width=10% valign=top align=center>');
		document.write('<input onClick="Cochage(\'select'+CLE+'\',\''+nom+'\');" type="checkbox" name="select'+CLE+'" value="'+CLE+'" checked>');
		document.getElementById("TR"+CLE).className="sel_on"; 
	} else {
		//document.write('<td id="TD'+CLE+'" class="taboff" width=10% valign=top align=center>');
		document.write('<input onClick="Cochage(\'select'+CLE+'\',\''+nom+'\');" type="checkbox" name="select'+CLE+'" value="'+CLE+'">');
		document.getElementById("TR"+CLE).className="sel_of"; 
	}
}
function Cochage(CTL,nom) {
	var chx = document.SELECT.elements[CTL].value;
	var flg = false;
	var i = liste.indexOf(","+chx+",");
	if ( document.SELECT.elements[CTL].checked ) {
		if ( i == -1 ) {
			liste = liste+chx+",";
			flg = true;
		}
		document.getElementById("TR"+chx).className="sel_on"; 
	} else {
		
		if ( i != -1 ) {
			if ( liste == ","+chx+"," ) {
				liste = ",";
			} else if ( i == 0 ) {
				liste = liste.substr(chx.length+1);
			} else {
				liste = liste.substr(0,i)+liste.substr(i+chx.length+1);
			}
			flg = true;
		}
		document.getElementById("TR"+chx).className="sel_of"; 
	}
	if ( flg ) EcrireCookie(nom,liste);
	var total = liste.replace(/[^,]/gi,"");
	total = eval(total.length - 1);
	document.getElementById("panierh").innerHTML=total;
	document.getElementById("panierb").innerHTML=total;
	modif=true;
}
// 
function CocherTout(nom) {
	for (var i = 0; i < document.SELECT.elements.length; i++) {
		if (document.SELECT.elements[i].type == 'checkbox') {
			if ( !document.SELECT.elements[i].checked ) {
				document.SELECT.elements[i].checked = true;
				Cochage(document.SELECT.elements[i].name,nom);
			}	
		}
	}
}
// 
function DecocherTout(nom) {
	for (var i = 0; i < document.SELECT.elements.length; i++) {
		if (document.SELECT.elements[i].type == 'checkbox') {
			if ( document.SELECT.elements[i].checked ) {
				document.SELECT.elements[i].checked = false;
				Cochage(document.SELECT.elements[i].name,nom);
			}	
		}
	}
}

// Formulaire POST
function OuvrirPost(URL,LgX,LgY,Total,Maxdoc) {
	PosX = (screen.width) ? (screen.width-LgX)/2 : 0; 
	PosY = (screen.height) ? (screen.height-LgY)/2 : 0; 
	if ( Total > Maxdoc) {
		if (!confirm("Seuls les "+Maxdoc+" premiers documents sur "+Total+" seront traités. Voulez vous continuer ?")) return;
	}
	document.traitement.action = URL;
	msg=window.open("wait.html","popup","location=no,status=no,toolbar=no,directories=no,resizable=yes,menubar=no,scrollbars=yes,height="+LgX+",width="+LgY+",left="+PosX+",top="+PosY);	
	document.traitement.target = "popup";
	document.traitement.submit();
	msg.focus();
}

// Fermeture fenêtre PANIER
function FermerPopup(FLG) {
	if ( FLG ) {
		if (self.opener.location.pathname=="/jeunes/index.php") {
			opener.location.reload(true); 
		} else {
			window.opener.document.grille.submit();
		}
	}
	self.close();
	//setTimeout("self.close()",200); 
}

function OuvrirFermer(id) {
	if ( document.getElementById('terme' + id).style.display  == 'none' ) {
		document.getElementById('terme' + id).style.display  = 'block';
	} else {
		document.getElementById('terme' + id).style.display  = 'none';
	}
}
//-->
