        <link rel="stylesheet" href="Highcharts/nesw2/images/style.css" type="text/css">
	    <link type="text/css" href="css/jquery-ui-1.8.6.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery.min.js"></script>
        <script src="Highcharts/new2/amcharts/amcharts.js" type="text/javascript"></script>
        <script src="Highcharts/new2/amcharts/serial.js" type="text/javascript"></script>
		<script src="Highcharts/js/highcharts.js"></script>
		<script src="Highcharts/js/highcharts-more.js"></script>
        <script src="Highcharts/js/modules/exporting.js"></script>
        <script src="Highcharts/amcharts/gauge.js" type="text/javascript"></script>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>


		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
		<script type="text/javascript">
		jQuery(function($){
		$.datepicker.regional['vi'] = {
			closeText: 'Tutup',
			prevText: 'Sebelum',
			nextText: 'Sesudah',
			currentText: 'Sekarang',
			monthNames: ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
			'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'],
			monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun',
			'Jul', 'Ags', 'Sep', 'Okt', 'Nov', 'Des'],
			dayNames: ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jum&acute;at', 'Sabtu'],
			dayNamesShort: ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sbt'],
			dayNamesMin: ['Mg', 'Sn', 'Sl', 'Rb', 'Km', 'Jm', 'Sb' ],
			dateFormat: 'yy-mm-dd',
			firstDay: 0,
			isRTL: false,
			showMonthAfterYear: false,
			changeMonth: true,
			changeYear: true,
			yearSuffix: ''};
		$.datepicker.setDefaults($.datepicker.regional['vi']);
	  	$(function(){
				$('#tgls').datepicker({
					inline: true
				});
	    });
		$(function(){
				$('#tglf').datepicker({
					inline: true
				});
	    });
       });
</script>

<?php
session_start();
include "includes/map.php";
$sql_hjn="SELECT *
			FROM
			m_lokasi WHERE 1=1 AND status_lokasi=1 AND id_bbws=".$_SESSION['id_bbws']."";		
$sql_hjn.=" ORDER BY ReceivedDate DESC, id_tipe DESC";
$query_hjn=mysql_query($sql_hjn);

date_default_timezone_set('Asia/Jakarta');
$tanggal= mktime(0,0,0,date('m'),date('d'),date('Y'));
$hariini = date("Y-m-d", $tanggal);

if($_POST['btncari']=="Search") {
	$tgls=$_POST['tgls'];
} else { 
	//$tgls = date('Y-m-d',strtotime('-1 day',strtotime($hariini))) ;
	$tgls = date('Y-m-d',strtotime($hariini)) ;
}
?>
<body onLoad="load()">
	<article class="module width_3_quarter">
			<header>
            <h3 class="tabs_involved" style="background-image:url(images/icons/siaga1.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">
            INFO DATA HIDROLOGI - <?php echo $tgls; ?></h3>
            </header>
			<div class="message_list">
				<div class="module_content">
                <div class="spacer" align="left">
                <form action="" method="post">
        <ul class="tabs">
        	<li><strong>PILIH TANGGAL :</strong> <input type="text" id="tgls" name="tgls" value="<?php echo date('Y-m-d',strtotime($tgls));?>" size="10" />
            	<input type="submit" id="btncari" name="btncari" value="Search" />	
            </li>
        </ul>
        </form>
                  <table border="1" width="100%" class="tablesorter" cellspacing="0">
                <thead>
                <tr>
                    <th width="24%" rowspan="2">NAMA LOKASI</th>
                    <th colspan="4">LEVEL SIAGA</th>
                    <th colspan="3">TELEMETRI</th>
                    <th colspan="3">MANUAL</th>
                    <!--th width="17%" rowspan="2" >STATUS</th-->
                </tr>
                <tr>
                    <th width="5%" >NML</th>
                    <th width="4%" >S-3</th>
                    <th width="4%" >S-2</th>
                    <th width="4%" >S-1</th>
                    <th width="7%" >07:00</th>
                    <th width="7%" >12:00</th>
                    <th width="7%" >17:00</th>
                    <th width="7%" >07:00</th>
                    <th width="7%" >12:00</th>
                    <th width="7%" >17:00</th>
                  </tr>
                </thead>
				<?php
				$i=0;
                while($rslide=mysql_fetch_array($query_hjn)){
                $i++;
				
				if($rslide['icon']=="siaga4" || $rslide['icon']=="normal"){ 
							$sts="style='background-color:#090; color:#FFF; padding-left:16px;'";
				} else if($rslide['icon']=="siaga3"){ 
							$sts="style='background-color:#00F; color:#FFF; padding-left:16px;'";
				} else if($rslide['icon']=="siaga2"){ 
							$sts="style='background-color:#FC0; color:#FFF; padding-left:16px;'";
				} else if($rslide['icon']=="siaga1"){ 
							$sts="style='background-color:#F00; color:#FFF; padding-left:16px;'";				
				} else if($rslide['icon']=="offline"){ 
							$sts="style='background-color:#F00; color:#FFF; padding-left:16px;'";				
				} 
					
					
					
				$sql06tele=mysql_fetch_array(mysql_query("SELECT DISTINCT Rain AS klWLevel, ReceivedDate,jam_value AS ReceivedTime,max(a.WLevel) AS WLevel, FORMAT(a.WLevel,1) AS klWLevel FROM ".$rslide['nama_lokasi']." AS a
INNER JOIN m_jam AS b ON DATE_FORMAT(b.jam_value,'%H:0') = DATE_FORMAT(a.ReceivedTime,'%H:0')
WHERE 1=1 AND a.WLevel!=0 AND ML!='50' AND a.WLevel>=1 AND a.ReceivedDate='".$tgls."' AND b.jam_value LIKE '07:00:00%'
GROUP BY ReceivedDate,jam_value"));
				$sql12tele=mysql_fetch_array(mysql_query("SELECT DISTINCT Rain AS klWLevel, ReceivedDate,jam_value AS ReceivedTime,max(a.WLevel) AS WLevel, FORMAT(a.WLevel,1) AS klWLevel FROM ".$rslide['nama_lokasi']." AS a
INNER JOIN m_jam AS b ON DATE_FORMAT(b.jam_value,'%H:0') = DATE_FORMAT(a.ReceivedTime,'%H:0')
WHERE 1=1 AND a.WLevel!=0 AND ML!='50' AND a.WLevel>=1 AND a.ReceivedDate='".$tgls."' AND b.jam_value LIKE '12:00:00%'
GROUP BY ReceivedDate,jam_value"));
				$sql18tele=mysql_fetch_array(mysql_query("SELECT DISTINCT Rain AS klWLevel, ReceivedDate,jam_value AS ReceivedTime,max(a.WLevel) AS WLevel, FORMAT(a.WLevel,1) AS klWLevel FROM ".$rslide['nama_lokasi']." AS a
INNER JOIN m_jam AS b ON DATE_FORMAT(b.jam_value,'%H:0') = DATE_FORMAT(a.ReceivedTime,'%H:0')
WHERE 1=1 AND a.WLevel!=0 AND ML!='50' AND a.WLevel>=1 AND a.ReceivedDate='".$tgls."' AND b.jam_value LIKE '17:00:00%'
GROUP BY ReceivedDate,jam_value"));
				
				$sql06m=mysql_fetch_array(mysql_query("SELECT FORMAT(WLevel,1) AS WLevel FROM ".$rslide['nama_lokasi']." 
WHERE 1=1 AND ML='50' AND ReceivedDate='".$tgls."' AND ReceivedTime LIKE '07:%'"));
				$sql12m=mysql_fetch_array(mysql_query("SELECT FORMAT(WLevel,1) AS WLevel FROM ".$rslide['nama_lokasi']." 
WHERE 1=1 AND ML='50' AND ReceivedDate='".$tgls."' AND ReceivedTime LIKE '12:%'"));
				$sql18m=mysql_fetch_array(mysql_query("SELECT FORMAT(WLevel,1) AS WLevel FROM ".$rslide['nama_lokasi']." 
WHERE 1=1 AND ML='50' AND ReceivedDate='".$tgls."' AND ReceivedTime LIKE '17:%'"));
				
				
				?>
				<tr>
                	<td style="background-color:#000; color:#FFF;"><?php echo $i.". ".strtoupper($rslide['nama_alat']);?></td>
                	<td style="background-color:#090; color:#FFF;"><?php echo number_format($rslide['siaga4'],0);?></td>
                	<td style="background-color:#00F; color:#FFF;"><?php echo number_format($rslide['siaga3'],0);?></td>
                	<td style="background-color:#FC0; color:#FFF;"><?php echo number_format($rslide['siaga2'],0);?></td>
                	<td style="background-color:#F00; color:#FFF;"><?php echo number_format($rslide['siaga1'],0);?></td>
                	<td align="right"><?php if($rslide['nama_lokasi']=="gunungcupu" || $rslide['nama_lokasi']=="bendmanganti"){ echo $sql06m['WLevel']; } else { echo $sql06tele['klWLevel']; }?></td>
                	<td align="right"><?php if($rslide['nama_lokasi']=="gunungcupu" || $rslide['nama_lokasi']=="bendmanganti"){ echo $sql12m['WLevel']; } else { echo $sql12tele['klWLevel']; }?></td>
                	<td align="right"><?php if($rslide['nama_lokasi']=="gunungcupu" || $rslide['nama_lokasi']=="bendmanganti"){ echo $sql18m['WLevel']; } else { echo $sql18tele['klWLevel']; }?></td>
                	<td align="right"><?php echo $sql06m['WLevel'];?></td>
                	<td align="right"><?php echo $sql12m['WLevel'];?></td>
                	<td align="right"><?php echo $sql18m['WLevel'];?></td>
                	<!--td <?php echo $sts;?> bgcolor="#000000"><?php echo strtoupper($rslide['icon']);?></td-->
				</tr>
                <?php
                }
                ?>
				</table>
				</div>
			</div>
			<!--footer>
				<form class="post_message">
					<input type="text" value="Message" onFocus="if(!this._haschanged){this.value=''};this._haschanged=true;">
					<input type="submit" class="btn_post_message" value=""/>
				</form>
			</footer-->
		</article>

		<article class="module width_quarter">
		<header>
		<h3 class="tabs_involved" style="background-image:url(images/icon_online.png); background-repeat:no-repeat; padding-left:20px; margin-left:5px;">PETA POS</h3>
		</header>
		<div class="tab_container">
				        <div id="map" style="width: 100%; height: 371px; background-color:aliceblue;">
				          <article class="module width_quarter_battray">
				            <!-- end of .tab_container -->
			              </article>
				          <!-- end of content manager article --> 
		</div>
		</div>
		<!-- end of .tab_container -->
		</article><!-- end of content manager article -->        
</body>