function colorChoice(objet, id, type) { // objet est le tr, id est l'id de la box et type c'est "over" ou "out"
	var box=document.getElementById(id);
	if (box.checked)
		if (type=='out')
			objet.style.backgroundColor= "#ffcc99";
		else
			objet.style.backgroundColor="#dff0f8";
	else
		if (type=='out')
			objet.style.backgroundColor="white";
		else
			objet.style.backgroundColor="#dff0f8";
}
function changeChecked(id) {
	var box=document.getElementById(id);
	if (box.checked) {
		box.checked=false;
		}
	else {
		box.checked=true;
	}
}
function changeVisibility(id) {
	var tr = document.getElementById('tr' + id);
	tr.style.visibility="visible";
	var submit= document.getElementById('submit' + (id - 1));
	submit.style.visibility="hidden";
}
function changeSrc(type) {
	if (type == 1) {
		var image=document.getElementById('graphiqueAnnee');
		var year=document.getElementById('date').value;
		var stat=document.getElementById('stat').value;
		if (stat == 'visite')
			image.src="statistiques/visiteurMois.php?annee=" + year;
		else if (stat =='direct')
			image.src="statistiques/trafficdirect.php?annee=" + year;
		else if (stat =='page-visite')
			image.src="statistiques/pageParVisite.php?annee=" + year;
		else if (stat =='moteur')
			image.src="statistiques/moteur.php?annee=" + year;
		else if (stat =='page')
			image.src="statistiques/pagePlusVues.php?annee=" + year;
		else if (stat =='referent')
			image.src="statistiques/referent.php?annee=" + year;
		else if (stat =='distribution')
			image.src="statistiques/distribution.php?annee=" + year;
		else
			image.src="encours.jpg";
		}
	else {
		var image=document.getElementById('graphiqueMois');
		var year=document.getElementById('date2').value;
		var e = year.indexOf("e");
		var mois= year.substring(0,e);
		var year=year.substring(e +1);
		
		var stat=document.getElementById('stat2').value;
		if (stat =='moteur')
			image.src="statistiques/moteur.php?annee=" + year+ "&mois=" + mois;
		else if (stat =='page')
			image.src="statistiques/pagePlusVues.php?annee=" + year+ "&mois=" + mois;
		else if (stat =='referent')
			image.src="statistiques/referent.php?annee=" + year+ "&mois=" + mois;
		else if (stat =='country') {
			if (mois < 10)
				mois = "0" + mois;
			image.src="http://era-orleans.org/webstat/ctry_usage_" + year+ mois + ".png";
			}
		else if (stat =='distribution')
			image.src="statistiques/distribution.php?annee=" + year+ "&mois=" + mois;
		else
			image.src="encours.jpg";
	}
}

function submitForm() {
    document.getElementById("formInChi").submit();
}

function selectAll() {
    if (document.getElementById("selecter").checked) {
        i=1;
        while (i <= 100) {
            if (document.getElementById("case" + i) != null)
                document.getElementById("case" + i).checked=true;
            i++;
        }
    }
    else {
        i=1;
        while (i <= 100) {
            if (document.getElementById("case" + i) != null)
                document.getElementById("case" + i).checked=false;
            i++;
        }
    }
}
function soumissionForm() {
    document.getElementById("formulaire").submit();
}
function soumissionForm2() {
    document.getElementById("formulaire").action="index.php?admin=xmlLeeds&downloaded";
    document.getElementById("formulaire").submit();
}
