<meta http-equiv="refresh" content="180">
<h3>LiveFlight Tracker <?php echo $acarsdata->flightnum?></h3>

 
 
 
 
<div class="mapcenter" align="center">
<div id="routemap" style="width: 100%; height: 520px;"></div>
</div>

<script type="text/javascript">
var options = {
	zoom: 6,
	autozoom: true,
	center: new google.maps.LatLng(<?php echo $acarsdata->lat?>, <?php echo $acarsdata->lng?>),
	mapTypeId: google.maps.MapTypeId.ROADMAP,
}
var map = new google.maps.Map(document.getElementById("routemap"), options);

</script>







<h3>Flight Info <?php echo $acarsdata->flightnum?></h3>


<table width="100%" border="0" cellspacing="2px" cellpadding="2px"><tr>
           <td style="background:#e1e1e1; font-weight:bold; font-weight:bold" width="20%">Flight:</td><td style="background:#f2eeee" width="25%">
<?php echo $acarsdata->flightnum; ?></td>
<td style="background:#e1e1e1; font-weight:bold" width="20%">
PIC:</td><td style="background:#f2eeee" width="35%">
<?php echo $acarsdata->pilotname; ?></td></tr>
<tr>
<td style="background:#e1e1e1; font-weight:bold">
Departure:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->depicao; ?></td>
<td style="background:#e1e1e1; font-weight:bold">
Arrival:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->arricao; ?></td>
</tr>
<tr>
<td style="background:#e1e1e1; font-weight:bold">
 Registration:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->aircraft; ?></td>
</tr>
<tr>
<td style="background:#e1e1e1; font-weight:bold">
Current Alt:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->alt; ?> FT</td>
<td style="background:#e1e1e1; font-weight:bold">
GS:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->gs; ?> KT</td></tr>
<tr>
<td style="background:#e1e1e1; font-weight:bold">
Last Info:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->lastupdate; ?></td></tr>
<tr>
<td style="background:#e1e1e1; font-weight:bold">
Distance:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->distremain; ?> NM</td>
<td style="background:#e1e1e1; font-weight:bold">
Status:</td>
<td style="background:#f2eeee">
<?php echo $acarsdata->phasedetail; ?></td></tr>
</table>












<h3>ACARS Info <?php echo $acarsdata->flightnum?></h3>

 <table width="100%" cellspacing="0" style="font-size:10px">
 <tr>
 <td>Pilot</td>
 <td>Flight</td>
 <td>Time</td>
 <td>ALT</td>
 <td>GS</td>
 <td>Latitude</td>
 <td>Longitude</td>
 </tr>
 
 <?php 

 foreach($posreports as $thepositions)
 { 
 ?>
 <tr>
 <td><?php $pilotdetail = PilotData::getPilotData($thepositions->pilotid);
$pilotid = PilotData::getPilotCode($pilotdetail->code, $pilotdetail->pilotid);
 echo $pilotid; ?></td>
 <td><?php echo $thepositions->flightnum; ?></td>
 <td><?php echo $thepositions->positiontime; ?></td>
 <td><?php echo $thepositions->altitude; ?></td>
 <td><?php echo $thepositions->groundspeed; ?></td>
 <td><?php echo $thepositions->latitude; ?></td>
 <td><?php echo $thepositions->longitude; ?></td>
 </tr>
 <?php
 }
 ?>
 </table>













<script type="text/javascript">
var iconBase = '<?php echo SITE_URL?>/lib/images/inair/';



var pointer_position = new google.maps.LatLng(<?php echo $acarsdata->lat?>, <?php echo $acarsdata->lng?>);


var image = new google.maps.MarkerImage(iconBase + <?php echo $acarsdata->heading;?> + '.png',
        new google.maps.Size(65, 124),
        new google.maps.Point(0,0),
        new google.maps.Point(15, 15)
    );


var point_position = new google.maps.Marker({
	position: pointer_position,
	map: map,
	icon: image,
	title: "<?php echo $acarsdata->flightnum;?>",
});

google.maps.event.addListener(point_position, 'click', function() {
	infowindow_position.open(map,point_position);
});

</script>



<?php
echo "<script>";
echo "var DrivePath = [";
foreach($posreports as $path)
{
echo "new google.maps.LatLng(".$path->latitude.", ".$path->longitude."),";

  } 
  echo "];";
  ?>


  var PathStyle = new google.maps.Polyline({
    path: DrivePath,
    strokeColor: "#FF0000",
    strokeOpacity: 0.8,
    strokeWeight: 4
  });

  PathStyle.setMap(map);
  </script>
  
  
  
  
  
  
 <?php
$arricao = TrackFlightData::searchAirportICAO($acarsdata->arricao);
echo "<script>";
echo "var DestPath = [";
echo "new google.maps.LatLng(".$acarsdata->lat.", ".$acarsdata->lng."),";
echo "new google.maps.LatLng(".$arricao->lat.", ".$arricao->lng."),";
  echo "];";
  ?>


  var PathStyle = new google.maps.Polyline({
    path: DestPath,
    strokeColor: "#FF8000",
    strokeOpacity: 1.0,
    strokeWeight: 2
  });

  PathStyle.setMap(map);
  </script>
  
  

  