/*#####################

La fonction dater(jjmm) transforme une date au format VEN 30 JAN facon calendrier
la fonction dater recoit en parametre un nombre a 4 chiffres comprenant 
 - le jour du mois (de 1 à 31) sur deux caractères 
 - le mois (de 1 à 12) sur deux caracteres

#######################*/

function dater(jjmm,aaaa){
var mois=jjmm.substring(2)-1; var jjj=""; var mmm=""; var jj=jjmm.substring(0,2); var d=new Date(aaaa,mois,jj);
switch(d.getDay()){ case 0:jjj="DIM";break;case 1:jjj="LUN";break;case 2:jjj="MAR";break;case 3:jjj="MER";break; case 4:jjj="JEU";break;case 5:jjj="VEN";break;case 6:jjj="SAM";break; };
switch(mois){ case 0:mmm="JAN";break;case 1:mmm="FEV";break;case 2:mmm="MAR";break;case 3:mmm="AVR";break; case 4:mmm="MAI";break;case 5:mmm="JUN";break;case 6:mmm="JUL";break;case 7:mmm="AOU";break; case 8:mmm="SEP";break;case 9:mmm="OCT";break;case 10:mmm="NOV";break;case 11:mmm="DEC";break; };
document.write("<td class='ddate'><div class='ddate1'>"+jjj+"</div><div class='ddate2'>"+jj+"</div><div class='ddate1'>"+mmm+"</div></td>");
}

function dateruk(z){ // z au format aaaa-mm-jj, jj jour du mois, jjj jour de la semaine, mois de 1 à 12, aaaa année
var mois=z.substring(5,2)-1; var jj=z.substring(8,2); var aaaa=z.substring(0,4); var jjj=""; var mmm=""; var d=new Date(aaaa,mois,jj);
switch(d.getDay()){ case 0:jjj="DIM";break;case 1:jjj="LUN";break;case 2:jjj="MAR";break;case 3:jjj="MER";break; case 4:jjj="JEU";break;case 5:jjj="VEN";break;case 6:jjj="SAM";break; };
switch(mois){ case 0:mmm="JAN";break;case 1:mmm="FEV";break;case 2:mmm="MAR";break;case 3:mmm="AVR";break; case 4:mmm="MAI";break;case 5:mmm="JUN";break;case 6:mmm="JUL";break;case 7:mmm="AOU";break; case 8:mmm="SEP";break;case 9:mmm="OCT";break;case 10:mmm="NOV";break;case 11:mmm="DEC";break; };
document.write("<td><div class='ddate1'>"+jjj+"</div><div class='ddate2'>"+jj+"</div><div class='ddate1'>"+mmm+"</div></td>");
}

/*#####################

La fonction veriformu() verifie la validité du mail pour la newsletter et initialise l'inscription/désinscription

#######################*/

function veriformu(formulaire){
	if(formulaire.email.value == ''){
		alert('Vous devez entrer une adresse email dans la case...');
	}else{
		var valid=0;
		var place = formulaire.email.value.indexOf("@",1);
		var point = formulaire.email.value.indexOf(".",place+3);
		if (!((place > -1)&&(formulaire.email.value.length >6)&&(point > 1))){
				valid=1;
				alert("Entrez une adresse e-mail valide!! (Ex : xxxxx@xxx.com)");
		}
		if(valid==0){
			formulaire.submit();
		}
	}
}
/*########################## VERIF MAIL #################*/

function verifmail(formulaire){
	var adresse=formulaire.email.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+3);
	if (!((place > -1)&&(adresse.length >6)&&(point > 1))){
		alert('Entrez une adresse e-mail valide!! (Ex : xxxxx@xxx.com)\n');
	}	
}

function popupopenold(id, pop_an){
	window.open("../programmation/popup_prog.php?id="+id+"&annee="+pop_an, "Groupe_Une","height=450, width=600, top=10, left=10, menubar=no, toolbar=no, location=no, status=no, scrollbars=yes");
}

function popupopen(id, pop_an){
	window.open("../programmation/popup_prog.php?id="+id+"&annee="+pop_an, "Groupe_Une","height=450, width=600, top=10, left=10, menubar=no, toolbar=no, location=no, status=no, scrollbars=yes");
}

function archivenews(){
	window.open("../news/archive.php", "Archive_News","height=300, width=450, top=10, left=10, menubar=no, toolbar=no, location=no, status=no, scrollbars=yes");
}

function jukebox(){
	window.open("../jukebox/jukebox.php", "JukeBox","height=380, width=360, top=0, left=10, menubar=no, toolbar=no, location=no, status=no, scrollbars=no");
}

function opendiapo(rub){
	//window.open('../photos/diaporama/diaporama.php?rub='+rub,'Diaporama','width=950,height=500,left=5,top=5,scrollbars=yes');
	window.open('http://www.annu.fr','Diaporama','width=950,height=500,left=5,top=5,scrollbars=yes');
}

function afficherdivprog2(d,max,istopo){
var min;
if(istopo==1){min=0;}else{min=1;}
	for(i=min; i<=max; i++){
	var s=String(d)+String(i);
		if(document.getElementById(s).style.display=='block'){
			document.getElementById(s).style.display='none';
		}else{
			document.getElementById(s).style.display='block'
		}
	}

	
}


function progzoom(img){

img.style.position=(img.style.position=="absolute")?"relative":"absolute";
img.style.height=(img.style.height=="auto")?"100px":"auto";
img.title=(img.title=="Cliquez pour agrandir")?"Cliquez pour diminuer":"Cliquez pour agrandir";




}

function afficherdivprog(d,max){
var min;
	for(i=0; i<=max; i++){
	var s=String(d)+String(i);
		if(document.getElementById(s).style.display=='block'){
			document.getElementById(s).style.display='none';
		}else{
			document.getElementById(s).style.display='block'
		}
	}

	
}


function checkergroup(chk){
var group=document.getElementsByName(chk.name);
var groupval="";
for(i=0; i<group.length; i++){
	if(group(i).id==chk.id){
		group(i).checked=true;
		groupval=group(i).value;
	}else{
		group(i).checked=false;
	}
}
document.getElementById('resultats2').innerHTML=groupval;
}