<form name="one_site_consult_form" id="one_site_consult_form" method="post" action="./one_site_consult.php">
	
	<input type="hidden" id="aqcm_JOUR_TAMPON"  name="aqcm_JOUR_TAMPON"  value="" />
	<input type="hidden" id="aqcm_MOIS_TAMPON"  name="aqcm_MOIS_TAMPON"  value="" />
	<input type="hidden" id="aqcm_ANNEE_TAMPON" name="aqcm_ANNEE_TAMPON" value="" />
	
	<table align="center" width="<?php echo $tables_width ; ?>"  border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	
		<tr align="center">
		
			<td>

				</br>
				<table>
				
					<tr>
						<td align="right" width="37%">
							<label class="txtField_B">
								début de la période :
							</label>
						</td>
						<td align="left">
						
						<?php
						
							//-----------------------------------------------------------------------------
							if ( isset( $_POST['aqcm_JOUR_TAMPON'] ) && ( $_POST['aqcm_JOUR_TAMPON'] != '' ) ) 
								$_SESSION['aqcm_JOUR'] = $_POST['aqcm_JOUR_TAMPON'] ;
							if ( isset( $_POST['aqcm_MOIS_TAMPON'] ) && ( $_POST['aqcm_MOIS_TAMPON'] != '' ) ) 
								$_SESSION['aqcm_MOIS']  = $_POST['aqcm_MOIS_TAMPON'] ;
							if ( isset( $_POST['aqcm_ANNEE_TAMPON'] ) && ( $_POST['aqcm_ANNEE_TAMPON'] != '' ) ) 
								$_SESSION['aqcm_ANNEE'] = $_POST['aqcm_ANNEE_TAMPON'] ;
							
							//-----------------------------------------------------------------------------
							include("../M0/sonde_site_consult.php");

							//-----------------------------------------------------------------------------
							$debut_periode  			= mktime(0, 0, 0, intval($_SESSION['aqcm_MOIS'])  , intval($_SESSION['aqcm_JOUR']), intval($_SESSION['aqcm_ANNEE']) );
							
							$annee_debut_periode 	= date("Y", $debut_periode);
							$mois_debut_periode 	= date("m", $debut_periode);
							$jour_debut_periode 	= date("d", $debut_periode);
							
							$date_debut_periode		= date_create($annee_debut_periode."-".$mois_debut_periode."-".$jour_debut_periode);
							$is_bissextile			= ( date_format($date_debut_periode, 'L') == "1" ) ? true : false ;

							$lundis_string 				= [];
							$lundis_value 				= [];
							$timestamp_first_monday 	= strtotime('first monday of ' . $_SESSION['aqcm_ANNEE'] . '-' . $_SESSION['aqcm_MOIS'] ) ;
							$timestamp_last_monday  	= strtotime('last monday of '  . $_SESSION['aqcm_ANNEE'] . '-' . $_SESSION['aqcm_MOIS'] ) ;
							$last_lundi_value 			= intval( date("d", $timestamp_last_monday) ) ;
							
							$i = 0 ;
							$lundis_value[$i]  = intval( date("d", $timestamp_first_monday) ) ;
							$lundis_string[$i] = str_pad($lundis_value[$i] , 2 , "0" , STR_PAD_LEFT);
							
							while ( ( $lundis_value[$i] + 7 ) <= $last_lundi_value ) {
								$lundis_value[$i+1]		= $lundis_value[$i] + 7 ;
								$lundis_string[$i+1]	= str_pad($lundis_value[$i+1] , 2 , "0" , STR_PAD_LEFT);
								$i++;
							}

							//-----------------------------------------------------------------------------
							echo('<select name="aqcm_JOUR" id="aqcm_JOUR" onChange="graphique_one_site_change()" size="1" class="txtField_A" style="width:75px;" >');
							
							if ( ( $_SESSION['aqcm_T_SCALE'] == "1 jour" ) or ( $_SESSION['aqcm_T_SCALE'] == "2 jours" ) ) {
								include ("../M0/selection_jour_0.php");
							}
							else {
								for ($i = 0; $i < sizeof($lundis_string); $i++) {
									echo( '<option ' ) ;
									if ( $_SESSION['aqcm_JOUR'] == $lundis_string[$i] ) echo( "selected " ) ;
									echo( '>' ) ;
									echo( $lundis_string[$i] ) ;
									echo( '</option>' ) ;
								}
							}
							
							echo('</select>');
							
							//-----------------------------------------------------------------------------
							echo('<select id="aqcm_MOIS" name="aqcm_MOIS" onChange="graphique_one_site_change()" size="1" class="txtField_A" style="width:75px;" >');
							include ("../M0/selection_mois_0.php");
							echo('</select>');

							//-----------------------------------------------------------------------------
							echo('<select id="aqcm_ANNEE" name="aqcm_ANNEE" onChange="graphique_one_site_change()" size="1" class="txtField_A" style="width:80px;" >');
							include ("../M0/selection_annee_0.php");
							echo('</select>');
							
							//-----------------------------------------------------------------------------

						?>
						</td>
					</tr>
					
					<tr>
						<td align="right">
							<label class="txtField_B">
								durée de la période :
							</label>
						</td>
						<td align="left">
						<select id="echelle_temps" name="echelle_temps" size="1" class="txtField_A" style="width:237px;" onChange="myFunction_2()" > 
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "1 jour" ) echo("selected");  ?> >1 jour </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "2 jours" ) echo("selected");  ?> >2 jours </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "1 semaine" ) echo("selected");  ?> >1 semaine </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "2 semaines" ) echo("selected");  ?> >2 semaines </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "1 mois" ) echo("selected");  ?> >1 mois </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "2 mois" ) echo("selected");  ?> >2 mois </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "3 mois" ) echo("selected");  ?> >3 mois </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "6 mois" ) echo("selected");  ?> >6 mois </option>
						  <option <?php if ( $_SESSION['aqcm_T_SCALE'] == "1 an" ) echo("selected");  ?> >1 an </option>
						</select>
						</td>
					</tr>

				</table>

				<?php
				
					if ( 
							( $_SESSION['SITE_ID'] != "05130_131" ) && 
							( $_SESSION['SITE_ID'] != "05130_132" ) && 
							( $_SESSION['SITE_ID'] != "05130_133" ) ) {
								
						include("./one_site_consult_a_1.php");
						
					}
					
				?>

				<p>
				<table align="center" width="98%">

					<tr>
						<td align="center" style="text-align: center;" >
							<input type="submit" class="button_A" name="lancer"  value="afficher les mesures" formtarget="_blank" formaction="./one_site_consult_execute.php" >
						</td>
					</tr>

				</table>
				</p>

			</td>
		</tr>
			
	</table>

</form>

	
