<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

include("config.php");

     $aktualni=mysql_query("SELECT devices.id,devices.name,sensors.active,icons.picture,devices.type,devices.building,devices.floor,devices.loc_x,devices.loc_y FROM devices,sensors,icons,buildings WHERE buildings.mapname='".$_GET['b']."' AND buildings.id=devices.building AND devices.floor=".$_GET['f']." AND icons.id=devices.icon AND devices.sensor=sensors.id AND sensors.active=1 ORDER BY devices.id");
     $poceta=mysql_num_rows($aktualni);
     for($i=0;$i<$poceta;$i++)
     {
     $aktdata=mysql_fetch_row($aktualni);
     $x=$aktdata[7]+$_GET['x']-9;
     $y=$aktdata[8]+$_GET['y']-9;
     $obsah.='<div onclick="location.href=\'detail.php?id='.$aktdata[0].'\'" class="device" id="dev'.$aktdata[0].'" style="position:absolute; top:'.$y.'px; left:'.$x.'px; width:18px; height:18px; background-image:url(\'icon/thumbnails/'.$aktdata[3].'\')"></div>'; 
     if (strlen($aktdata[4])>1)
     {$tt='<br/>('.$aktdata[4].')';} else {$tt='';}
     $obsah.='<div class="popupinfo" id="idev'.$aktdata[0].'"><strong>'.$aktdata[1].'</strong>'.$tt.'</div>';
     }
echo $obsah;     
?>