<?php

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

	//-------------------------------------------------------------------
	$return_path = "./one_sonde_consult_2.php" ;
	include('../M0/display_user_site_with_option.php'); 

	//-------------------------------------------------------------------
	if ( $_SESSION['SITE_ID'] != "00001_001" ) {
		
		if ( $NB_sondes >= 1 ) {
			include('./one_sonde_consult_4_a.php'); 
		} 
		else {
			include('./one_sonde_consult_4_b.php'); 
		}

	}
	else {
		
	}

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

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

?>


<script>
function one_sonde_consult_2_change(){
    document.getElementById("one_sonde_consult_2_form").requestSubmit();
}
</script>

<script>
function myFunction() {
	
	var x = document.getElementById("scheduled_status");
	var y = document.getElementById("echelle_temps");
	var z = document.getElementById("presence");
	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;
		z.selectedIndex = 0;
		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;
		z.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("one_sonde_consult_2_form").requestSubmit();

}

function myFunction_1() {
	
	var x = document.getElementById("scheduled_status");
	var y = document.getElementById("echelle_temps");
	var z = document.getElementById("presence");
	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 ) {
		
		z.selectedIndex = 0;
		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 > 3 ){ 
			z.selectedIndex = 0;
			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 {
			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("one_sonde_consult_2_form").requestSubmit();

}

function myFunction_2() {
	
	var x = document.getElementById("scheduled_status");
	var y = document.getElementById("echelle_temps");
	var z = document.getElementById("presence");
	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 ) {
		
		z.selectedIndex = 0;
		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 > 3 ){ 
			z.selectedIndex = 0;
			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 {
			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("one_sonde_consult_2_form").requestSubmit();

}

</script>

</body>
</html>	
