<style>
#pos_awlr_katulampa {
	/*height: 30px; width: 200px; margin-left: 656px; margin-top: -113px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left;
	background-color:#0CF;*/
	position: absolute;
  height: auto; width: auto; margin-left: 656px; margin-top: -113px;
  overflow: auto;
  background-color:#F90;
  color: #fff;
  text-align: left;
  /*line-height: 1.5em;*/
  font-size: 14px;
  border-radius: 0 0 5px 5px;
}
#pos_Cibinong {
	height: 30px; width: 200px; margin-left: 610px; margin-top: -118px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left;
}
#pos_Cikeas {
	height: 30px; width: 200px; margin-left: 700px; margin-top: -64px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left;
}
#pos_Depok {
	height: 30px; width: 200px; margin-left: 577px; margin-top: -212px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left;
}
#pos_Cileungsi {
	height: 30px; width: 200px; margin-left: 780px; margin-top: -40px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left;
}
#pos_BendungBekasi {
	height: 30px; width: 200px; margin-left: 846px; margin-top: -112px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_MTHaryono {
	height: 30px; width: 200px; margin-left: 518px; margin-top: -98px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_Manggarai {
	height: 30px; width: 200px; margin-left: 506px; margin-top: -67px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_bkb {
	height: 30px; width: 200px; margin-left: 539px; margin-top: -59px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_Sawangan {
	height: 30px; width: 200px; margin-left: 412px; margin-top: 156px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_tanahkusir {
	height: 30px; width: 200px; margin-left: 376px; margin-top: -113px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_kebunjeruk {
	height: 30px; width: 200px; margin-left: 350px; margin-top: -100px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_BatuBelah {
	height: 30px; width: 200px; margin-left: 321px; margin-top: 158px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_serpong {
	height: 30px; width: 200px; margin-left: 180px; margin-top: -150px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_PasarBaru {
	height: 30px; width: 200px; margin-left: 420px; margin-top: -250px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_awlr_bkt_1 {
	height: 30px; width: 200px; margin-left: 650px; margin-top: 17px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_awlr_bkt2 {
	height: 30px; width: 200px; margin-left: 681px; margin-top: -77px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
#pos_awlr_bkt3 {
	height: 30px; width: 200px; margin-left: 669px; margin-top: -106px; color:#F00; font-family:Tahoma, Geneva, sans-serif;	
	 text-align:left; border:#090 1px solid;
}
</style>
<img src="images/aliransungaijakarta.jpg" height="500px" />
<?php
include "config/conn.php";
date_default_timezone_set('Asia/Jakarta');
$tanggal= mktime(0,0,0,date('m'),date('d'),date('Y'));
$hariini = date("Y-m-d", $tanggal);
//------------------SQL ---------------------------------//

$sql="SELECT * FROM m_lokasi WHERE 1=1 AND id_tipe='PDA' AND id_bbws=1 AND status_lokasi=1
UNION
SELECT * FROM m_lokasi WHERE 1=1 AND nama_lokasi IN ('Sawangan','PasarBaru','Manggarai') AND id_bbws=1 AND status_lokasi=1 ORDER BY urutan_sungai ASC ";
              $query = mysql_query($sql);
			  $i=0;
			  date_default_timezone_set('Asia/Jakarta');
			  $tanggal= mktime(0,0,0,date('m'),date('d'),date('Y'));
			  $hariini = date("Y-m-d", $tanggal);
			  //$hariini=date('Y-m-d');
              while ($row_detdata=mysql_fetch_array($query)){
              $i++;
$sql1="SELECT ReceivedDate AS SamplingDate,ReceivedTime AS SamplingTime,WLevel, FORMAT(WLevel*100,0) AS klWLevel FROM ".$row_detdata['nama_lokasi']." WHERE 1=1 AND WLevel!=0 GROUP BY SamplingDate, SamplingTime ORDER BY SamplingDate DESC,SamplingTime DESC LIMIT 1";
$query1=mysql_query($sql1);
$row_detdata1=mysql_fetch_array($query1);

			  if($row_detdata['id_merk']=="RADIO") { $nilai=$row_detdata1['klWLevel']; } else {
						$nilai=number_format(str_replace(',','',$row_detdata1['WLevel']),0); }
  	  		  if(($row_detdata1['SamplingDate']==$hariini) && $nilai>=$row_detdata['siaga4'] && $nilai<$row_detdata['siaga3']) { 
					$sts='<img src="images/siaga1.png">'; 
				} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai>=$row_detdata['siaga3'] && $nilai<$row_detdata['siaga2']) { 
					$sts='<img src="images/siaga3.png">'; 
				} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai>=$row_detdata['siaga2'] && $nilai<$row_detdata['siaga1']) { 
					$sts='<img src="images/siaga2.png">'; 
				} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai>=$row_detdata['siaga1']) { 
				
				if($row_detdata['nama_lokasi']=="awlr_bkt_1" || $row_detdata['nama_lokasi']=="awlr_bkt2" || $row_detdata['nama_lokasi']=="awlr_bkt3" || $row_detdata['nama_lokasi']=="MTHaryono" || $row_detdata['nama_lokasi']=="BendungBekasi") {
						$sts='<font color="red">-</font>'; 
					} else { 
						$sts='<img src="images/siaga1.png">'; 
					}			
			} else if(($row_detdata['SamplingDate']==$hariini) && $nilai<$row_detdata['siaga4']  && $_SESSION['id_bbws']==1) { 
					$sts='<img src="images/siaga4.png">'; 
				} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai<$row_detdata['siaga4']) { 
					$sts='<img src="images/siaga4.png">'; 
				} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai<0) { 
					$sts='<img src="images/siaga4.png">'; 
		} else if(($row_detdata1['SamplingDate']==$hariini) && $nilai>=0 && $nilai<=$row_detdata['siaga4']) { 
					$sts='<img src="images/siaga4.png">'; 
				} else if($row_detdata1['SamplingDate']!=$hariini) {
					$sts='<img src="images/icon_offline.png">';
				}
?>
<div id="pos_<?php echo $row_detdata['nama_lokasi'];?>">
	<?php if($row_detdata['nama_lokasi']=='Manggarai' || $row_detdata['nama_lokasi']=='MTHaryono' || $row_detdata['nama_lokasi']=='Sawangan'  || $row_detdata['nama_lokasi']=='awlr_bkt_1'){?>
	<?php echo $row_detdata['nama_alat'];?> : <?php echo $row_detdata1['WLevel']/100;?>m <?php echo $sts;?>
	<?php  } else {?>
    <?php echo $sts;?> <?php echo $row_detdata['nama_alat'];?> : <?php echo $row_detdata1['WLevel']/100;?>m
    <?php }?>
</div>
<?php } ?>


<!--div class="pos_katulampa">
	<img src="images/sungaisiaga1.png"> Katulampa : 50 m
</div>
<div class="pos_cibinong">
	<img src="images/sungaisiaga1.png"> Cibinong:50 cm
</div>
<div class="pos_cikeas">
	<img src="images/sungaisiaga1.png">Cikeas:50 cm
</div>
<div class="pos_depok">
	<img src="images/sungaisiaga1.png">Depok:50 cm
</div>
<div class="pos_cileungsi">
	<img src="images/sungaisiaga1.png">Cileungsi:50 cm
</div>
<div class="pos_bdgbekasi">
	<img src="images/sungaisiaga1.png">Bdg.Bekasi:50 cm
</div>
<div class="pos_mtharyono">
	<img src="images/sungaisiaga1.png">MT.Haryono:50 cm
</div>
<div class="pos_manggarai">
	<img src="images/sungaisiaga1.png">Manggarai:50 cm
</div>
<div class="pos_bkb">
	<img src="images/sungaisiaga1.png">Banjir Kanal:50 cm
</div>

<!-- PESANGGARAHAN ->
<div class="pos_sawangan">
	Sawangan:50 cm <img src="images/sungaisiaga1.png">
</div>
<div class="pos_tanahkusir">
	Tanah Kusir:50 cm <img src="images/sungaisiaga1.png">
</div>
<div class="pos_kebunjeruk">
	Kebun Jeruk:50 cm <img src="images/sungaisiaga1.png">
</div>

<!--CISADANE->
<div class="pos_batubelah">
	Batubelah:50 cm <img src="images/sungaisiaga1.png">
</div>
<div class="pos_serpong">
	Serpong:50 cm <img src="images/sungaisiaga1.png">
</div>
<div class="pos_pasarbaru">
	Pasarbaru:50 cm <img src="images/sungaisiaga1.png">
</div-->