<?php

	//echo("starting at : "); echo(time()); echo("<br>");
	//-------------------------------------------------------------------
	include('../M0/session_start.php');

	//-------------------------------------------------------------------
	include("../M0/communs_en_tete_HTML.html") ;
	include('../M0/communs_en_tete_simple.html');
	include ("../M0/identify_sondes.php");

	//-------------------------------------------------------------------
	$return_path = "../graphiques_sites/graphiques_one_site.php" ;
	include('../M0/display_user_site_with_option.php');
	
	//-------------------------------------------------------------------
	if ( $_SESSION['SITE_ID'] != "00001_001" ) {

		if ( $NB_sondes >= 1 ) {
			include('./graphiques_one_site_a.php'); 
		} 
		else {
			include('./graphiques_one_site_b.php'); 
		}
	}

	//-------------------------------------------------------------------
	include('../M0/communs_bouton_retour_index_sites.html'); 

	//-------------------------------------------------------------------

?>

<script>

function graphique_one_site_change(){
    document.getElementById("graphique_one_site_form").requestSubmit();
}

function myFunction() {
	
	var x = document.getElementById("scheduled_status");
	var y = document.getElementById("echelle_temps");
	var aqcm_JOUR_TAMPON = document.getElementById("aqcm_JOUR_TAMPON");
	var aqcm_MOIS_TAMPON = document.getElementById("aqcm_MOIS_TAMPON");
	var aqcm_ANNEE_TAMPON = document.getElementById("aqcm_ANNEE_TAMPON");

	if ( x.checked ) {
		y.selectedIndex = 4;
		aqcm_JOUR_TAMPON.value  = <?php echo($avant_jour); ?>;
		aqcm_MOIS_TAMPON.value  = <?php echo($avant_mois); ?>;
		aqcm_ANNEE_TAMPON.value = <?php echo($avant_annee); ?>;
	} 
	else {
		y.selectedIndex = 1;
		aqcm_JOUR_TAMPON.value  = <?php echo($hier_jour); ?>;
		aqcm_MOIS_TAMPON.value  = <?php echo($hier_mois); ?>;
		aqcm_ANNEE_TAMPON.value = <?php echo($hier_annee); ?>;
	}
	document.getElementById("graphique_one_site_form").requestSubmit();
	
}

function myFunction_2() {
	
	var x = document.getElementById("scheduled_status");
	var y = document.getElementById("echelle_temps");
	var aqcm_JOUR_TAMPON = document.getElementById("aqcm_JOUR_TAMPON");
	var aqcm_MOIS_TAMPON = document.getElementById("aqcm_MOIS_TAMPON");
	var aqcm_ANNEE_TAMPON = document.getElementById("aqcm_ANNEE_TAMPON");

	if ( x.checked ) {
		if ( y.selectedIndex < 2 ) {
			y.selectedIndex = 4;
		}
		aqcm_JOUR_TAMPON.value = <?php echo($avant_jour); ?>;
		aqcm_MOIS_TAMPON.value = <?php echo($avant_mois); ?>;
		aqcm_ANNEE_TAMPON.value = <?php echo($avant_annee); ?>;
	}
	else {
		if ( y.selectedIndex <= 1 ) {
			aqcm_JOUR_TAMPON.value  = <?php echo($hier_jour); ?>;
			aqcm_MOIS_TAMPON.value  = <?php echo($hier_mois); ?>;
			aqcm_ANNEE_TAMPON.value = <?php echo($hier_annee); ?>;
		}
		else {
			aqcm_JOUR_TAMPON.value  = <?php echo($avant_jour); ?>;
			aqcm_MOIS_TAMPON.value  = <?php echo($avant_mois); ?>;
			aqcm_ANNEE_TAMPON.value = <?php echo($avant_annee); ?>;
		}
	}
	document.getElementById("graphique_one_site_form").requestSubmit();

	
}

</script>


    </body>
</html>