<?php include "components/preheader.php"; ?>
<?php
  if(array_key_exists('PassFail', $_GET))
    setcookie('LastFootballPassFail', $_GET['PassFail'], time() + (86400 * 30), "/");
?>

<!DOCTYPE HTML>
<head>
<?php include "components/sport_header.php"; ?>

<title>What Game Should I Watch - Football</title>
<meta name="description" content="We analyze sporting events to determine an objective rating of how enjoyable it is to watch">
<meta name="keywords" content="football baseball NFL MLB television TV DVR PVR VCR record rating">
<meta http-equiv="refresh" content="180">

<script>
var tiles=[];

function tileclick(elmnt) 
{
  highlightShadow = "none";
  originalShadow = "0px 0px 5px #000000";
  if(elmnt.getElementsByClassName("ranking")[0].style.visibility != "visible")
  {
    //elmnt.style.boxShadow = highlightShadow;
    elmnt.getElementsByClassName("ranking")[0].style.visibility = "visible";
    tiles.push(elmnt);
  }
  else
  {
    //elmnt.style.boxShadow = originalShadow;
    elmnt.getElementsByClassName("ranking")[0].style.visibility = "hidden";
    
    index = tiles.indexOf(elmnt);
    if(index >= 0)
      tiles.splice(index, 1);
  }
  
  tiles.sort(function(a, b) {return parseInt(b.getAttribute("data-value")) - parseInt(a.getAttribute("data-value"))});
  for (index = 0; index < tiles.length; ++index) 
  {
    tiles[index].getElementsByClassName("ranking")[0].innerHTML = "#" + (index+1).toString();
  }
}
</script>

<style>
  div.ranking
  {
    position: relative;
    left: 158px;
    top: -85px;
    font-size: 18px;
    font-family: Impact, Charcoal, sans-serif;
    color: blue;
    background-color: white;
    height: 24px;
    width: 35px;
    background-color: white;
    border-width: 1px;
    border: solid;
    border-radius: 8px;
    visibility: hidden;
    cursor: default;
  }
</style>

<!--[if lt IE 9]>
<script>
document.createElement('header');
document.createElement('nav');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('footer');
document.createElement('hgroup');
</script>
<![endif]-->

</head>

<body>
<?php include_once("components/analyticstracking.php") ?>

  <?php include "components/banner.php"; ?>

  <div class="Everything" id="Everything">
    <?php include "components/nav.php"; ?>

    <div class ="Content" style="height: auto;">

    <?php include "components/football_submenu.php"; ?>

<?php

define("QTY", 24);

$con=mysqli_connect("localhost","scosen_wgsiw","password","scosen_wgsiw");
// Check connection
if (mysqli_connect_errno())
{
  //Try one more time
  $con=mysqli_connect("localhost","scosen_wgsiw","password","scosen_wgsiw");
  if (mysqli_connect_errno())
  {
    exit("Failed to connect to MySQL: " . mysqli_connect_error());
  }
}

$where = "TRUE";
$from = "football";
$order = "KTime DESC";
$limit = $_GET['IDX'] . ", " . strval(QTY+1);
switch($_GET['Sort'])
{
  case 'TeamSchedule':
    $order = "KTime ASC";
    $limit = $_GET['IDX'] . ", " . strval(QTY);
    break;
  case 'Recent':
    $where .= " AND KTime <= DATE(DATE_ADD(NOW(), INTERVAL 20 HOUR))";
    break;
  case 'TopRated':
    $order = "Rating DESC";
    $where .= " AND Status >= 99 ";
    break;
}

if($_GET['Season'] != 'All')
{
  $where .= " AND Season = " . $_GET['Season'];
}

if($_GET['Team'] != 'All')
{
  $where .= " AND (FALSE ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCEast' || $_GET['Team'] == 'BUF')
    $where .= " OR Home = 'BUF' OR Away = 'BUF' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCEast' || $_GET['Team'] == 'MIA')
    $where .= " OR Home = 'MIA' OR Away = 'MIA' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCEast' || $_GET['Team'] == 'NE')
    $where .= " OR Home = 'NE' OR Away = 'NE' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCEast' || $_GET['Team'] == 'NYJ')
    $where .= " OR Home = 'NYJ' OR Away = 'NYJ' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCNorth' || $_GET['Team'] == 'BAL')
    $where .= " OR Home = 'BAL' OR Away = 'BAL' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCNorth' || $_GET['Team'] == 'CIN')
    $where .= " OR Home = 'CIN' OR Away = 'CIN' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCNorth' || $_GET['Team'] == 'CLE')
    $where .= " OR Home = 'CLE' OR Away = 'CLE' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCNorth' || $_GET['Team'] == 'PIT')
    $where .= " OR Home = 'PIT' OR Away = 'PIT' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCSouth' || $_GET['Team'] == 'HOU')
    $where .= " OR Home = 'HOU' OR Away = 'HOU' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCSouth' || $_GET['Team'] == 'JAC')
    $where .= " OR Home = 'JAC' OR Away = 'JAC' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCSouth' || $_GET['Team'] == 'IND')
    $where .= " OR Home = 'IND' OR Away = 'IND' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCSouth' || $_GET['Team'] == 'TEN')
    $where .= " OR Home = 'TEN' OR Away = 'TEN' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCWest' || $_GET['Team'] == 'DEN')
    $where .= " OR Home = 'DEN' OR Away = 'DEN' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCWest' || $_GET['Team'] == 'KC')
    $where .= " OR Home = 'KC' OR Away = 'KC' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCWest' || $_GET['Team'] == 'OAK')
    $where .= " OR Home = 'OAK' OR Away = 'OAK' ";
  if($_GET['Team'] == 'AFC' || $_GET['Team'] == 'AFCWest' || $_GET['Team'] == 'SD')
    $where .= " OR Home = 'SD' OR Away = 'SD' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCEast' || $_GET['Team'] == 'DAL')
    $where .= " OR Home = 'DAL' OR Away = 'DAL' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCEast' || $_GET['Team'] == 'NYG')
    $where .= " OR Home = 'NYG' OR Away = 'NYG' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCEast' || $_GET['Team'] == 'PHI')
    $where .= " OR Home = 'PHI' OR Away = 'PHI' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCEast' || $_GET['Team'] == 'WAS')
    $where .= " OR Home = 'WAS' OR Away = 'WAS' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCNorth' || $_GET['Team'] == 'CHI')
    $where .= " OR Home = 'CHI' OR Away = 'CHI' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCNorth' || $_GET['Team'] == 'DET')
    $where .= " OR Home = 'DET' OR Away = 'DET' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCNorth' || $_GET['Team'] == 'GB')
    $where .= " OR Home = 'GB' OR Away = 'GB' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCNorth' || $_GET['Team'] == 'MIN')
    $where .= " OR Home = 'MIN' OR Away = 'MIN' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCSouth' || $_GET['Team'] == 'ATL')
    $where .= " OR Home = 'ATL' OR Away = 'ATL' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCSouth' || $_GET['Team'] == 'CAR')
    $where .= " OR Home = 'CAR' OR Away = 'CAR' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCSouth' || $_GET['Team'] == 'NO')
    $where .= " OR Home = 'NO' OR Away = 'NO' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCSouth' || $_GET['Team'] == 'TB')
    $where .= " OR Home = 'TB' OR Away = 'TB' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCWest' || $_GET['Team'] == 'ARI')
    $where .= " OR Home = 'ARI' OR Away = 'ARI' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCWest' || $_GET['Team'] == 'SEA')
    $where .= " OR Home = 'SEA' OR Away = 'SEA' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCWest' || $_GET['Team'] == 'SF')
    $where .= " OR Home = 'SF' OR Away = 'SF' ";
  if($_GET['Team'] == 'NFC' || $_GET['Team'] == 'NFCWest' || $_GET['Team'] == 'STL')
    $where .= " OR Home = 'STL' OR Away = 'STL' ";
  
  $where .= ") ";
}

switch($_GET['MinRating'])
{
  case '05':
    $where .= " AND Rating >= 55 AND Status >= 99 ";
    break;
  case '10':
    $where .= " AND Rating >= 111 AND Status >= 99 ";
    break;
  case '15':
    $where .= " AND Rating >= 200 AND Status >= 99 ";
    break;
  case '20':
    $where .= " AND Rating >= 311 AND Status >= 99 ";
    break;
  case '25':
    $where .= " AND Rating >= 377 AND Status >= 99 ";
    break;
  case '30':
    $where .= " AND Rating >= 446 AND Status >= 99 ";
    break;
  case '35':
    $where .= " AND Rating >= 505 AND Status >= 99 ";
    break;
  case '40':
    $where .= " AND Rating >= 571 AND Status >= 99 ";
    break;
  case '45':
    $where .= " AND Rating >= 648 AND Status >= 99 ";
    break;
  case '50':
    $where .= " AND Rating >= 791 AND Status >= 99 ";
    break;
}


$query = "SELECT * FROM " . $from ." WHERE " . $where . " ORDER BY " . $order . " LIMIT " . $limit;

//print $query . "<br/>";

$result = mysqli_query($con, $query);

$now = new DateTime("now", new DateTimeZone("America/New_York"));
$newdate = clone $now;
$newdate->modify('-36 hours');
$today = new DateTime($now->format('n/j/Y') . " 0:00", new DateTimeZone("America/New_York"));
$yesterday = clone $today;
$yesterday->modify('-24 hours');
$tomorrow = clone $today;
$tomorrow->modify('+24 hours');
$oneweek = clone $today;
$oneweek->modify('-1 week');
$sixmonths = clone $today;
$sixmonths->modify('-6 months');

define("ASE", "<img src=\"images/AltSmallEmpty.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("ASF", "<img src=\"images/AltSmallFull.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("ALE", "<img src=\"images/AltLargeEmpty.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("AL2", "<img src=\"images/AltLarge25.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("AL5", "<img src=\"images/AltLarge50.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("AL7", "<img src=\"images/AltLarge75.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("ALF", "<img src=\"images/AltLargeFull.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("SE", "<img src=\"images/SmallEmpty.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("SF", "<img src=\"images/SmallFull.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("LE", "<img src=\"images/LargeEmpty.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("L2", "<img src=\"images/Large25.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("L5", "<img src=\"images/Large50.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("L7", "<img src=\"images/Large75.png\" alt=\"\" style=\"vertical-align: middle;\">");
define("LF", "<img src=\"images/LargeFull.png\" alt=\"\" style=\"vertical-align: middle;\">");

$pfCutoff = 0;
switch($_GET['PassFail'])
{
  case '10':
    $pfCutoff = 111;
    break;
  case '15':
    $pfCutoff = 200;
    break;
  case '20':
    $pfCutoff = 311;
    break;
  case '25':
    $pfCutoff = 377;
    break;
  case '30':
    $pfCutoff = 446;
    break;
  case '35':
    $pfCutoff = 505;
    break;
  case '40':
    $pfCutoff = 571;
    break;
}

$num = 0;
$more = false;

$rows = array();
while($row = mysqli_fetch_array($result))
{
  array_push($rows, $row);

  $num++;  
  if($num >= QTY)
  {
    $more = true;
    break;
  }
}

$id = 0;
foreach($rows as $row)
{
  $id++;
  $kickoff = new DateTime($row['KTime'], new DateTimeZone("America/New_York"));

  $time = $kickoff->format('g:i D n/j');

  if($kickoff >= $tomorrow)
  {
    $time = $kickoff->format('g:i D n/j');
  }
  elseif($kickoff >= $today)
  {
    $time = $kickoff->format('g:i') . ' Today';
  }
  elseif($kickoff >= $yesterday)
  {
    $time = $kickoff->format('g:i') . ' Yesterday';
  }
  elseif($kickoff >= $oneweek)
  {
    $time = $kickoff->format('g:i l');
  }
  elseif($kickoff < $sixmonths)
  {
    $time = $kickoff->format('g:i D n/j/Y');
  }

  //print $row['Away'] . ' at ' . $row['Home'] . ' ' . $time . ' ' . $row['Rating'] . '<br/>';
  
  $status = '';
  if($newdate < $kickoff && $row['Status'] == 99)
  {
    $status = '&emsp;&emsp;<span style="color:red;font-weight:bold;">NEW</span>';
  }
  elseif($row['Status'] < 99 && $kickoff < $today)
  {
    $status = '&emsp;&emsp;<span style="color:red;font-weight:bold;">Error</span>';
  }
  elseif($row['Status'] == 0)
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Future</span>';
  }
  elseif($row['Status'] == 1)
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Calculating...</span>';
  }
  elseif($row['Status'] == 2)
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Q1 Projection</span>';
  }
  elseif($row['Status'] == 3)
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Q2 Projection</span>';
  }
  elseif($row['Status'] >= 4 && $row['Status'] < 99)
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Q3 Projection</span>';
  }
  elseif($row['Type'] == 'PRE')
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Preseason</span>';
  }
  elseif($row['Type'] == 'POST')
  {
    $status = '&emsp;&emsp;<span style="color:gray;font-style:italic;">Postseason</span>';
  }
  	
  if($row['Type'] == 'PRE')
    print "<div class=\"pretile\"";
  else if($row['Type'] == 'POST')
    print "<div class=\"posttile\"";
  else
    print "<div class=\"tile\"";
  
  if(intval($row['Status']) >= 99)
    print " id=\"tile" . strval($id) . "\" onclick=\"tileclick(this)\" data-value=\"" . $row['Rating'] . "\"";

  print ">";
    


  print "<p class=\"tile_title\">" . "<span style=\"float: left;\">". $time . "</span><span style=\"float: right;\">" . $status . "</span>" . "</p><hr>";
  print "<p class=\"tile_content\">" . $row['Away'] . " at " . $row['Home'] . "</p>";


if($row['Status'] < 1)
  {
  echo ASF . ASF . ALF . ASF . ASF;
  }
elseif($row['Status'] < 99)
  {
  if($pfCutoff > 0)
    {
    if($row['Rating'] < $pfCutoff)
      {
      echo ASE . ASE . ALE . ASE . ASE;		//Fail
      }
    else
      {
      echo ASF . ASF . ALF . ASF . ASF;		//Pass
      }
    }
  elseif($row['Rating'] < 37)
    {
    echo ALE . ASE . ASE . ASE . ASE;  // 0 Stars
    }
  elseif($row['Rating'] < 55)
    {
    echo AL2 . ASE . ASE . ASE . ASE;  // 1/4 Stars
    }
  elseif($row['Rating'] < 86)
    {
    echo AL5 . ASE . ASE . ASE . ASE;  // 1/2 Stars
    }
  elseif($row['Rating'] < 111)
    {
    echo AL7 . ASE . ASE . ASE . ASE;  // 3/4 Stars
    }
  elseif($row['Rating'] < 150)
    {
    echo ALF . ASE . ASE . ASE . ASE;  // 1 Stars
    }
  elseif($row['Rating'] < 200)
    {
    echo ASF . AL2 . ASE . ASE . ASE;  // 1 1/4 Stars
    }
  elseif($row['Rating'] < 263)
    {
    echo ASF . AL5 . ASE . ASE . ASE;  // 1 1/2 Stars
    }
  elseif($row['Rating'] < 311)
    {
    echo ASF . AL7 . ASE . ASE . ASE;  // 1 /3/4 Stars
    }
  elseif($row['Rating'] < 347)
    {
    echo ASF . ALF . ASE . ASE . ASE;  // 2 Stars
    }
  elseif($row['Rating'] < 377)
    {
    echo ASF . ASF . AL2 . ASE . ASE;  // 2 1/4 Stars
    }
  elseif($row['Rating'] < 408)
    {
    echo ASF . ASF . AL5 . ASE . ASE;  // 2 1/2 Stars
    }
  elseif($row['Rating'] < 446)
    {
    echo ASF . ASF . AL7 . ASE . ASE;  // 2 3/4 Stars
    }
  elseif($row['Rating'] < 478)
    {
    echo ASF . ASF . ALF . ASE . ASE;  // 3 Stars
    }
  elseif($row['Rating'] < 505)
    {
    echo ASF . ASF . ASF . AL2 . ASE;  // 3 1/4 Stars
    }
  elseif($row['Rating'] < 534)
    {
    echo ASF . ASF . ASF . AL5 . ASE;  // 3 1/2 Stars
    }
  elseif($row['Rating'] < 571)
    {
    echo ASF . ASF . ASF . AL7 . ASE;  // 3 3/4 Stars
    }
  elseif($row['Rating'] < 607)
    {
    echo ASF . ASF . ASF . ALF . ASE;  // 4 Stars
    }
  elseif($row['Rating'] < 648)
    {
    echo ASF . ASF . ASF . ASF . AL2;  // 4 1/4 Stars
    }
  elseif($row['Rating'] < 699)
    {
    echo ASF . ASF . ASF . ASF . AL5;  // 4 1/2 Stars
    }
  elseif($row['Rating'] < 791)
    {
    echo ASF . ASF . ASF . ASF . AL7;  // 4 3/4 Stars
    }
  else
    {
    echo ASF . ASF . ASF . ASF . ALF;  // 5 Stars
    }
  }
else
  {
  if($pfCutoff > 0)
    {
    if($row['Rating'] < $pfCutoff)
      {
      echo SE . SE . LE . SE . SE;		//Fail
      }
    else
      {
      echo SF . SF . LF . SF . SF;		//Pass
      }
    }
  elseif($row['Rating'] < 37)
    {
    echo LE . SE . SE . SE . SE;  // 0 Stars
    }
  elseif($row['Rating'] < 55)
    {
    echo L2 . SE . SE . SE . SE;  // 1/4 Stars
    }
  elseif($row['Rating'] < 86)
    {
    echo L5 . SE . SE . SE . SE;  // 1/2 Stars
    }
  elseif($row['Rating'] < 111)
    {
    echo L7 . SE . SE . SE . SE;  // 3/4 Stars
    }
  elseif($row['Rating'] < 150)
    {
    echo LF . SE . SE . SE . SE;  // 1 Stars
    }
  elseif($row['Rating'] < 200)
    {
    echo SF . L2 . SE . SE . SE;  // 1 1/4 Stars
    }
  elseif($row['Rating'] < 263)
    {
    echo SF . L5 . SE . SE . SE;  // 1 1/2 Stars
    }
  elseif($row['Rating'] < 311)
    {
    echo SF . L7 . SE . SE . SE;  // 1 3/4 Stars
    }
  elseif($row['Rating'] < 347)
    {
    echo SF . LF . SE . SE . SE;  // 2 Stars
    }
  elseif($row['Rating'] < 377)
    {
    echo SF . SF . L2 . SE . SE;  // 2 1/4 Stars
    }
  elseif($row['Rating'] < 408)
    {
    echo SF . SF . L5 . SE . SE;  // 2 1/2 Stars
    }
  elseif($row['Rating'] < 446)
    {
    echo SF . SF . L7 . SE . SE;  // 2 3/4 Stars
    }
  elseif($row['Rating'] < 478)
    {
    echo SF . SF . LF . SE . SE;  // 3 Stars
    }
  elseif($row['Rating'] < 505)
    {
    echo SF . SF . SF . L2 . SE;  // 3 1/4 Stars
    }
  elseif($row['Rating'] < 534)
    {
    echo SF . SF . SF . L5 . SE;  // 3 1/2 Stars
    }
  elseif($row['Rating'] < 571)
    {
    echo SF . SF . SF . L7 . SE;  // 3 3/4 Stars
    }
  elseif($row['Rating'] < 607)
    {
    echo SF . SF . SF . LF . SE;  // 4 Stars
    }
  elseif($row['Rating'] < 648)
    {
    echo SF . SF . SF . SF . L2;  // 4 1/4 Stars
    }
  elseif($row['Rating'] < 699)
    {
    echo SF . SF . SF . SF . L5;  // 4 1/2 Stars
    }
  elseif($row['Rating'] < 791)
    {
    echo SF . SF . SF . SF . L7;  // 4 3/4 Stars
    }
  else
    {
    echo SF . SF . SF . SF . LF;  // 5 Stars
    }
  }




print "<div class=\"ranking\">";
print "</div>";



  print "</div>";
}
mysqli_free_result($result);

while($num < QTY)
{
  $num++;
  print "<div class=\"blanktile\"></div>";
}

echo "<div style=\"clear:both\"/>";













$idx = intval($_GET['IDX']);
echo "<div style=\"text-align:center;\">";

//$query2 = strstr("SELECT COUNT(ID)" . substr($query, 8), " LIMIT", true);
//$result = mysqli_query($con, $query2);
//$row = mysqli_fetch_array($result);
//$count = $row[0];

if($idx > 0)
  echo "<a id=\"prev\" href=\"" . GenerateURL('IDX', strval(max($idx - QTY, 0))) . "\"  style=\"text-decoration: none;\">
          <img src=\"images/PrevButton.png\" style=\"margin: 20px;\" 
               onmousedown=\"this.src='images/PrevButtonPressed.png'\" 
               onmouseup=\"this.src='images/PrevButton.png'\"></img>
        </a> ";
else
  echo "<img id=\"prev\" src=\"images/PrevButtonHollow.png\" style=\"margin: 20px;\"></img>";

if($more)
  echo "<a id=\"next\" href=\"" . GenerateURL('IDX', strval($idx + QTY)) . "\" style=\"text-decoration: none;\">
          <img src=\"images/NextButton.png\" style=\"margin: 20px;\" 
               onmousedown=\"this.src='images/NextButtonPressed.png'\" 
               onmouseup=\"this.src='images/NextButton.png'\"></img>
        </a>";
else
  echo "<img id=\"next\" src=\"images/NextButtonHollow.png\" style=\"margin: 20px;\"></img>";



echo "</div>";















mysqli_free_result($result);
mysqli_close($con);  

?>


    </div>
  </div>
</div>

<?php include "components/footer.php"; ?>
    
</body>