<?php require_once('Connections/conn_newland.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_rs_tourDetail = 5;
$pageNum_rs_tourDetail = 0;
if (isset($_GET['pageNum_rs_tourDetail'])) {
  $pageNum_rs_tourDetail = $_GET['pageNum_rs_tourDetail'];
}
$startRow_rs_tourDetail = $pageNum_rs_tourDetail * $maxRows_rs_tourDetail;

mysql_select_db($database_conn_newland, $conn_newland);
$query_rs_tourDetail = "SELECT * FROM tbl_tours INNER JOIN tbl_country ON tbl_country.countryID=tbl_tours.country ORDER BY tbl_country.countryName ";
$query_limit_rs_tourDetail = sprintf("%s LIMIT %d, %d", $query_rs_tourDetail, $startRow_rs_tourDetail, $maxRows_rs_tourDetail);
$rs_tourDetail = mysql_query($query_limit_rs_tourDetail, $conn_newland) or die(mysql_error());
$row_rs_tourDetail = mysql_fetch_assoc($rs_tourDetail);

if (isset($_GET['totalRows_rs_tourDetail'])) {
  $totalRows_rs_tourDetail = $_GET['totalRows_rs_tourDetail'];
} else {
  $all_rs_tourDetail = mysql_query($query_rs_tourDetail);
  $totalRows_rs_tourDetail = mysql_num_rows($all_rs_tourDetail);
}
$totalPages_rs_tourDetail = ceil($totalRows_rs_tourDetail/$maxRows_rs_tourDetail)-1;

$queryString_rs_tourDetail = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_rs_tourDetail") == false && 
        stristr($param, "totalRows_rs_tourDetail") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_rs_tourDetail = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_rs_tourDetail = sprintf("&totalRows_rs_tourDetail=%d%s", $totalRows_rs_tourDetail, $queryString_rs_tourDetail);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Newland Tours: Opisy wyjazdów</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<link href="css/newland.css" rel="stylesheet" type="text/css" /></head>

<body>
<a href="#top"><img src="images/spacer.gif" alt="Skip to main page content" width="1" height="1" border="0" align="left" /></a>
<table width="750" border="0" cellpadding="3" cellspacing="0">
 <tr>
  <td><img src="images/banner_left.gif" width="451" height="68" alt="Newland Tours Banner, Left." /></td>
  <td width="280"><img src="images/banner_right.jpg" width="276" height="68" alt="Newland Tour Banner, Right." /></td>
 </tr>
 <tr>
  <td><img src="images/navbar.gif" name="navbar" width="450" height="20" border="0" usemap="#navbarMap" alt="Navigation Bar." /></td>
  <td><img name="copyright_bar" src="images/copyright_bar.gif" width="272" height="20" border="0" alt="Copyright 2006 Newland Tours." /></td>
 </tr>
 <tr>
  <td colspan="2">	
	<h1><br />
	  <a name="top" id="top"></a>Opisy wyjazdów</h1>
    <p><a href="tours.php">Znajdź wyjazd</a>: Opisy wyjazdów</p>
    <?php do { ?>
      <hr />
      <h2><img src="<?php echo $row_rs_tourDetail['tour_imageURL']; ?>" alt="<?php echo $row_rs_tourDetail['tour_imageALT']; ?>" align="right" /></h2>
      <h2><?php echo $row_rs_tourDetail['countryName']; ?>: <?php echo $row_rs_tourDetail['tourName']; ?></h2>
      <p><span class="author"> Opis wyjazdu</span>:<?php echo $row_rs_tourDetail['tour_description']; ?></p>
      <p><strong> Ilość noclegów</strong>:<?php echo $row_rs_tourDetail['numNights']; ?></p>
      <p><strong> Ilość posiłków w ciągu dnia:</strong><?php echo $row_rs_tourDetail['meals_per_day']; ?></p>
      <p><strong> Czy potrzebujesz przygotowania kondycyjnego</strong>:<?php echo $row_rs_tourDetail['exerciseReqd']; ?></p>
      <table width="60%" border="1" cellspacing="0" cellpadding="3">
          <tr>
            <td><strong>Plan podróży</strong>:</td>
            <td><?php echo $row_rs_tourDetail['itinerary']; ?></td>
          </tr>
              </table>
      <p><strong>Dowiedz się więcej o państwie <a href="profiles_detail.php?countryID=<?php echo $row_rs_tourDetail['countryID']; ?>"><?php echo $row_rs_tourDetail['countryName']; ?></a></strong></p>
      <p> Sprawdź cenę wyjazdu używając <a href="tourprice.php?tourID=<?php echo $row_rs_tourDetail['tourID']; ?>">kalkulatora ceny wyjazdu</a></p>
      <?php } while ($row_rs_tourDetail = mysql_fetch_assoc($rs_tourDetail)); ?><p>
    
    <table width="50%" border="0" align="center" bgcolor="#dddddd">
      <tr>
        <td width="23%" align="center"><?php if ($pageNum_rs_tourDetail > 0) { // Show if not first page ?>
              <a href="<?php printf("%s?pageNum_rs_tourDetail=%d%s", $currentPage, 0, $queryString_rs_tourDetail); ?>">Pierwszy</a>
              <?php } // Show if not first page ?>
        </td>
        <td width="31%" align="center"><?php if ($pageNum_rs_tourDetail > 0) { // Show if not first page ?>
              <a href="<?php printf("%s?pageNum_rs_tourDetail=%d%s", $currentPage, max(0, $pageNum_rs_tourDetail - 1), $queryString_rs_tourDetail); ?>">Poprzedni</a>
              <?php } // Show if not first page ?>
        </td>
        <td width="23%" align="center"><?php if ($pageNum_rs_tourDetail < $totalPages_rs_tourDetail) { // Show if not last page ?>
              <a href="<?php printf("%s?pageNum_rs_tourDetail=%d%s", $currentPage, min($totalPages_rs_tourDetail, $pageNum_rs_tourDetail + 1), $queryString_rs_tourDetail); ?>">Następny</a>
              <?php } // Show if not last page ?>
        </td>
        <td width="23%" align="center"><?php if ($pageNum_rs_tourDetail < $totalPages_rs_tourDetail) { // Show if not last page ?>
              <a href="<?php printf("%s?pageNum_rs_tourDetail=%d%s", $currentPage, $totalPages_rs_tourDetail, $queryString_rs_tourDetail); ?>">Ostatni</a>
              <?php } // Show if not last page ?>
        </td>
      </tr>
    </table>
    </p>
<p>Wszystkie zdjęcia &copy; PhotoDisc</p>
    <p><a href="tours.php">Znajdź wyjazd</a>: Opisy wyjazdów </p>    </td>
 </tr>
</table>

<br />


<map name="navbarMap" id="navbarMap">
 <area shape="rect" coords="1,0,62,20" href="index.php" alt="Home" />
 <area shape="rect" coords="71,0,117,20" href="about.php" alt="About" />
 <area shape="rect" coords="129,0,196,20" href="tours.php" alt="Find Tours" />
 <area shape="rect" coords="209,0,311,20" href="profiles.php" alt="Country Profiles" />
 <area shape="rect" coords="327,0,434,20" href="contact.php" alt="Contact An Agent" />
</map>
</body>
</html>
<?php
mysql_free_result($rs_tourDetail);
?>