<?php

	//-------------------------------------------------------------------
	include('../M0/session_start.php');

	//-------------------------------------------------------------------
	include("../M0/communs_en_tete_HTML.html") ;
	
	$back_link = "../M1/index_sites.php";
	include('../M0/communs_en_tete_home_back.html');
	
	include("../M0/identify_sondes.php");

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

		if ( $NB_sondes >= 1 ) {
			include('./one_site_consult_a.php'); 
		} 
		else {
			include('./one_site_consult_b.php'); 
		}
	}
	else {
		include('./one_site_consult_c.php'); 
	}

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

?>

    </body>
</html>

<script>

function graphique_one_site_change(){
    document.getElementById("one_site_consult_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 ( y.selectedIndex == 0 ){ 
		aqcm_JOUR_TAMPON.value = <?php echo($aujourdhui_jour); ?>;
		aqcm_MOIS_TAMPON.value = <?php echo($aujourdhui_mois); ?>;
		aqcm_ANNEE_TAMPON.value = <?php echo($aujourdhui_annee); ?>;
	} 
	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); ?>;
	} 
	if ( y.selectedIndex == 2 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_semaine_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_semaine_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_semaine_avant); ?>;
	} 
	if ( y.selectedIndex == 3 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_2_semaines_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_2_semaines_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_2_semaines_avant); ?>;
	} 
	if ( y.selectedIndex == 4 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 5 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_2_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_2_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_2_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 6 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_3_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_3_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_3_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 7 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_6_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_6_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_6_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 8 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_an_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_an_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_an_avant); ?>;
	} 

	if ( x.checked ) {
		y.selectedIndex = 4;
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_mois_avant); ?>;
	} 

	document.getElementById("one_site_consult_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 ( y.selectedIndex == 0 ){ 
		aqcm_JOUR_TAMPON.value = <?php echo($aujourdhui_jour); ?>;
		aqcm_MOIS_TAMPON.value = <?php echo($aujourdhui_mois); ?>;
		aqcm_ANNEE_TAMPON.value = <?php echo($aujourdhui_annee); ?>;
	} 
	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); ?>;
	} 
	if ( y.selectedIndex == 2 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_semaine_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_semaine_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_semaine_avant); ?>;
	} 
	if ( y.selectedIndex == 3 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_2_semaines_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_2_semaines_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_2_semaines_avant); ?>;
	} 
	if ( y.selectedIndex == 4 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 5 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_2_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_2_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_2_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 6 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_3_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_3_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_3_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 7 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_6_mois_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_6_mois_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_6_mois_avant); ?>;
	} 
	if ( y.selectedIndex == 8 ){ 
		aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_an_avant);  ?>;
		aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_an_avant);  ?>;
		aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_an_avant); ?>;
	} 

	if ( x.checked ) {
		if ( y.selectedIndex < 2 ) {
			y.selectedIndex = 4;
			aqcm_JOUR_TAMPON.value	= <?php echo($jour_1_mois_avant);  ?>;
			aqcm_MOIS_TAMPON.value	= <?php echo($mois_1_mois_avant);  ?>;
			aqcm_ANNEE_TAMPON.value	= <?php echo($annee_1_mois_avant); ?>;
		}
	}
	document.getElementById("one_site_consult_form").requestSubmit();
	
}

</script>

