/* AUTEUR: Louyest Etienne */
/* DATE DE CREATION: 25/07/2006 */	
/* ****************************** */
function comtest(){//redirection sur autre page avec transfert données
inclang="Geen taal aangeduid";//si on met "var" => uniquement portée locale!
incmat="Geen materie aangeduid";
incniv="Geen niveau aangeduid";
lang="nl"; 
contcook=document.cookie; 			 
if (contcook.indexOf('langage=fr')!=-1){lang="fr"; inclang="Aucune langue cochée"; incmat="Aucune matière cochée";incniv="Aucun niveau coché";}
if (contcook.indexOf('langage=nl')!=-1){lang="nl"; inclang="Geen taal aangeduid"; incmat="Geen materie aangeduid";incniv="Geen niveau aangeduid";}
if (contcook.indexOf('langage=en')!=-1){lang="en"; inclang="No language selected"; incmat="No matter selected";incniv="No matter selected";}	
//test validité données formulaire (contrôle si une colonne est vide)
	//colonne niveau 
	testn=0;tniv=""; 
	var testidn=new Array("facile","difficile");
	for (x=0;x<2;x++){if (document.getElementById(testidn[x]).checked==true){testn=1;tniv=testidn[x]}}
	if (testn==0) {alert(incniv);}
	//colonne matière
	testm=0;tmat="";
	var testidm=new Array("d_oiseaux","d_plantes","d_insectes","d_champi","d_arbres","d_mammif","d_autres");	   
	for (x=0;x<7;x++){if (document.getElementById(testidm[x]).checked==true){testm=1;if(tniv=="difficile") {tmat=tmat+testidm[x]} else {tmat=tmat+testidm[x]+"_fac"}}}
	if (testm==0) {alert(incmat);} 
	//colonne langue 
	testl=0;tlan=""; 
	var testidl=new Array("fr","nl","en","la");
	for (x=0;x<4;x++){if (document.getElementById(testidl[x]).checked==true){testl=1;tlan=testidl[x]}}
	if (testl==0) {alert(inclang);}		
//renvoi vers adresse avec données nécessaires + inscription cookie "testfaune=ok" pour page suivante
adrsuiv="testfaun.php?"+"matiere="+tmat+"&lang="+tlan+"&niv="+tniv;
if (testm==1 && testl==1 && testn==1) {document.cookie="testfaune"+'='+'ok ';this.location.href=adrsuiv;}	
}//fin function comtest()

function checktestfaune(){//test si données complétées préalablement dans test.php
contcook=document.cookie;
if (contcook.indexOf('testfaune=ok')==-1){this.location.href='test.php';}
}//fin fct checktestcon

function testradiolat(){//test si click sur option "latin" (d'office difficile)  
document.getElementById("difficile").checked=true;
}//fin test radiolat()

function testradiofac(){//test si click sur option "facile" => langue ne peut pas être latin 
document.getElementById("la").checked=false;
lang="nl"; 
contcook=document.cookie; 			 
if (contcook.indexOf('langage=fr')!=-1){lang="fr"}
if (contcook.indexOf('langage=nl')!=-1){lang="nl"}
if (contcook.indexOf('langage=en')!=-1){lang="en"}	
//vérifie si fr, nl AND en sont vide et si oui, choisit la langue de la page. Si non, laisse la langue choisie (sf latin)
if (document.getElementById("fr").checked==false && document.getElementById("nl").checked==false && document.getElementById("en").checked==false) {document.getElementById(lang).checked=true;}
}//fin test radiofac()

function agrandir(photo){
document.write("<html><body BACKGROUND='fondpage.jpg'>")
document.write("<DIV ALIGN=center>")
document.write("<img src="+photo+" border=1>")
document.write("<form><input type='button' onClick='window.history.go(-1)' value='");
setcomment("c_retpp");
document.write("'></form>");
document.write("</DIV></body></html>")
}//fin fonction agrandir
function dernaj(){
setcomment("c_dernaj");
derniere=datlast_o;
if (datlast_p>derniere){derniere=datlast_p};  
if (datlast_plantes_inc>derniere){derniere=datlast_plantes_inc};
if (datlast_i>derniere){derniere=datlast_i};
if (datlast_insectes_inc>derniere){derniere=datlast_insectes_inc};
if (datlast_c>derniere){derniere=datlast_c};
if (datlast_champi_inc>derniere){derniere=datlast_champi_inc};
if (datlast_m>derniere){derniere=datlast_m};
if (datlast_ar>derniere){derniere=datlast_ar};//arbres 
if (datlast_a>derniere){derniere=datlast_a};//autres 
if (datlast_fe>derniere){derniere=datlast_fe};//fonds d'écran
if (datlast_li>derniere){derniere=datlast_li};//liens
if (datlast_phyto>derniere){derniere=datlast_phyto};//phyto

document.write(derniere.substring(6,8)+"-"+derniere.substring(4,6)+"-"+derniere.substring(0,4));
}//fin fct dernaj			 
function affich(photo){	  
document.write("<IMG SRC='fe_"+photo+"_petit.jpg' BORDER=1 HEIGHT=130 alt='");
setcomment("c_agrandir");
document.write("' OnClick=agrandir2('"+photo+"')>");
}//fin fct affich
function agrandir2(photo){
document.write("<html><LINK rel='STYLESHEET' HREF='index_style.css' TYPE='text/css'><body>")
document.write("<DIV ALIGN=center>")
document.write("<img src='fe_"+photo+".jpg' width=80% border=1><br>")
document.write("<form><input type='button' onClick='window.history.go(-1)' value='");
setcomment("c_retpp");
document.write("'></form></DIV>");
document.write("</body></html>")
}//fin fonction agrandir2
function agrandir3(photo){
document.write("<html>\n<LINK rel='STYLESHEET' HREF='index_style.css' TYPE='text/css'>\n<body>\n")
document.write("<DIV ALIGN=center>\n")
document.write("<img src='"+photo+".jpg' border=1><br>\n")
document.write("<form><input type='button' onClick='window.history.go(-1)' value='");
setcomment("c_retpp");
document.write("'></form></DIV>\n");
document.write("</body>\n</html>")
}//fin fonction agrandir3
function copyr(){
var np1 = "© Etienne Louyest";
document.write("<a href='faune_contact.php'>");
document.write(np1+'</a>');
}//fin fct copyr
function crcont(){
alphab="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
suite="";
al1=(Math.round((20-1)*Math.random()+1));
al2=(Math.round((20-1)*Math.random()+1));while (al2==al1){al2=(Math.round((20-1)*Math.random()+1))}
al3=(Math.round((20-1)*Math.random()+1));while (al3==al1 || al3==al2){al3=(Math.round((20-1)*Math.random()+1))}
al4=(Math.round((20-1)*Math.random()+1));while (al4==al1 || al4==al2 || al4==al3){al4=(Math.round((20-1)*Math.random()+1))}
for (x=1;x<20;x++){
alea=(Math.round((alphab.length-1)*Math.random()+1));
aleal=alphab.charAt(alea);
if (x==al1 || x==al2 || x==al3 || x==al4) {document.write("<font color='#ff0000'>"+aleal+"</font> ");suite=suite+aleal;} else {document.write(aleal+" ");}
}//fin for 
}//fin fct crcont  
function checkctl(){	
alertfaute="Fouten met de ingetoetsde letters...";
if (lang=="fr") {alertfaute="Faute(s) dans l'introduction des lettres..."}
if (lang=="en") {alertfaute="Faults in the introduction of the letters..."}
if (document.test.ctl.value!=suite){alert(alertfaute);document.test.ctl.value="";} else {ecrform();}
}//fin fct checkctl	
function ecrform(){
//écriture cookie test
document.cookie="testcon"+'='+'ok ';
this.location.href='faune_contact2.php';
}//fin ecrform	   
function checktestcon(){
contcook=document.cookie;
if (contcook.indexOf('testcon=ok')==-1){this.location.href='faune_contact.php';}
}//fin fct checktestcon
function contact(){	
document.write('&nbsp;&nbsp;&nbsp;<a href="faune_contact.php">');
document.write('<img src="acc_contact.jpg" border="1" height="50" alt="');
setcomment("c_contact");
document.write('"></a>');
}//fin fct contact
function drapeau(){	
lang="nl"; 
contcook=document.cookie; 			 
if (contcook.indexOf('langage=fr')!=-1){lang="fr"}
if (contcook.indexOf('langage=nl')!=-1){lang="nl"}
if (contcook.indexOf('langage=en')!=-1){lang="en"}	
document.write("<div style='text-align: right'>");
if (lang!="nl") {document.write("&nbsp;<img src='acc_drapeau_nl.jpg' alt='Nederlands' border='1' width='20' onClick=langnl()>");}
if (lang!="fr") {document.write("&nbsp;<img src='acc_drapeau_fr.jpg' alt='Français' border='1' width='20' onClick=langfr()>");}
if (lang!="en") {document.write("&nbsp;<img src='acc_drapeau_en.jpg' alt='English' border='1' width='20' onClick=langen()>");}
document.write("<br></div>");
}//fin fct drapeau	 
function draplat(){	
document.write("<div style='text-align: right'>");
ljeu="latoff"; 
contcook=document.cookie; 
if (contcook.indexOf('latin=off')!=-1){ljeu="latoff"}
if (contcook.indexOf('latin=on')!=-1){ljeu="laton"}  
if (ljeu=="latoff") {document.write("<img src='acc_drapeau_lat_on.jpg' alt='Latin on - Latijns on - Latin on' border='1' width='20' onClick=langlaton()>");}
if (ljeu=="laton") {document.write("<img src='acc_drapeau_lat_off.jpg' alt='Latin off - Latijns off - Latin off' border='1' width='20' onClick=langlatoff()>");}
document.write("<br></div>");
}// fin fct draplat
function langlaton(){  
document.cookie="latin"+'='+'on ';	   
window.location.reload();
}//fin fct langlaton
function langlatoff(){  
document.cookie="latin"+'='+'off '; 
window.location.reload();
}//fin fct langlatoff
function langnl(){	
document.cookie="langage"+'='+'nl ';
window.location.reload();
}//fin fct langnl
function langfr(){	
document.cookie="langage"+'='+'fr ';
window.location.reload();
}//fin fct langfr
function langen(){	
document.cookie="langage"+'='+'en ';
window.location.reload();
}//fin fct langen
function star(x){
if (x!=0){
	for (y=1;y<=x;y++){	
	document.write("<img src='acc_star.jpg' border='0' height='20' alt='STAR'>")
	}//fin for
}//fin if
else {document.write("<img src='acc_star0.jpg' border='0' height='20' alt='STAR'>")
}//fin else
}//fin fct star
function drapl(l){
ll="Taal = Nederlands";
if(l=="fr"){ll="Langue = Français";}
if(l=="en"){ll="Language = English";}
document.write("&nbsp;<img src='acc_drapeau_"+l+".jpg' alt='"+ll+"' border='1' width='20'>&nbsp;");
}//fin fct drapl
function favori(){
nav=navigator.appName.substring(0,3);
ver=navigator.appVersion.substring(0,1);
if (nav=="Mic" && ver>=4){
url_site="http://www.louyeti.be/";
titre_site="F&F E.Louyest";
window.external.AddFavorite(url_site,titre_site);
}//fin if nav
else {
alert('Press CTRL+D to add this adres at yours favorites');
}//fin else
}//fin fct favori 
//*******************************
function chkcook(){//vérification existence cookie
ccoo=document.cookie; //mise du cookie ../louyeti dans la variable ccoo
//vérification du contenu du cookie
if (ccoo.indexOf('phytosuiv')==-1){
//création date expiration cookie soit aujourd'hui + 1 mois
dateExp=new Date();
mois=dateExp.getMonth();
if (mois>11){mois=mois-12;annee=date.Exp.getFullYear();annee=annee+1;dateExp.setMonth(annee)}
mois=mois + 1;dateExp.setMonth(mois);
dateExp=dateExp.toGMTString();
//création du cookie
document.cookie="avertok"+'='+'phytosuiv'+';expires='+ dateExp +';'; 
this.location.href='phyto_avert.htm';
}//fin if
}//fin fct chkcook	 
function phytosuiv(){
this.location.href='phyto.php';
}//fin fct phytosuiv  
//********* comptage entités ***************
function n_inc_insectes(){
nbr=0;
while (insectes_inc[nbr]!="*"){
nbr=nbr+1;
}// fin while
nbr=nbr/4;
document.write(" ("+nbr+")");
}//fin function	 
function n_inc_plantes(){
nbr=0;
while (plantes_inc[nbr]!="*"){
nbr=nbr+1;
}// fin while
nbr=nbr/4;
document.write(" ("+nbr+")");
}//fin function
function n_inc_champi(){
nbr=0;
while (champi_inc[nbr]!="*"){
nbr=nbr+1;
}// fin while
nbr=nbr/4;
document.write(" ("+nbr+")");
}//fin function	
function n_phyto(){
nbr=0;
while (phyto[nbr]!="*"){
nbr=nbr+1;
}// fin while
nbr=nbr/22;
document.write(" ("+nbr+")");
}//fin function
function aff_logo(){
document.write("<IMG SRC='troglodyte.png' BORDER=0 WIDTH=200>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='index_"+lang+".php'><IMG SRC='");setcomment("c_logo");
document.write(".png' BORDER=0 height=100 ALT='");setcomment("c_faune");
document.write("'></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
}//fin fct aff_logo
function aff_logo_i(){
document.write("<IMG SRC='troglodyte.png' BORDER=0 WIDTH=200>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='index.htm'><IMG SRC='");setcomment("c_logo");
document.write(".png' BORDER=0 height=100 ALT='");setcomment("c_faune");
document.write("'></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
}//fin fct aff_logo_i
function pageprec(){
history.back();
}//fin fct pageprec

