<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/colourp1/public_html/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records

  list($categoriesRecords, $categoriesMetaData) = getRecords(array(
    'tableName'   => 'categories',
	'orderBy'     => 'title',
  ));

  list($products_introductionRecords, $products_introductionMetaData) = getRecords(array(
    'tableName'   => 'products_introduction',
    'limit'       => '1',
  ));
  $products_introductionRecord = @$products_introductionRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$products_introductionRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

  list($slideshowRecords, $slideshowMetaData) = getRecords(array(
    'tableName'   => 'slideshow',
    'limit'       => '1',
  ));
  $slideshowRecord = @$slideshowRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$slideshowRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

?>
<!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>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE><?php echo $products_introductionRecord['title'] ?></TITLE>
<LINK HREF="styles.css" REL="stylesheet" TYPE="text/css">

 <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22970572-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
 </HEAD>

<BODY>
<TABLE WIDTH="1000" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
  <TR>
    <TD COLSPAN="7" CLASS="tdWhite"><?php require_once('_include-masthead.php'); ?></TD>
  </TR>
  <TR>
    <TD CLASS="titleLower" COLSPAN="7" ALIGN="LEFT" VALIGN="TOP"><?php 
  list($randomImageRecord, $randomImageMetaData) = getRecords(array( 
         'tableName'   =>  'slideshow', 
	 'limit'       =>  1, 
	 'allowSearch' => false, 
       )); 
   
  $images = array(); 
   
  if ($randomImageRecord) { 
    $images = $randomImageRecord[0]['images']; 
  } 
?>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!--  
  
var image = new Array();  
 
<?php $counter = 0; ?> 
<?php foreach ($images as $image): ?> 
  image[<?php echo $counter++; ?>] = '<?php echo $image['urlPath'];?>' ;  
<?php endforeach ?> 
  
var index = Math.floor(Math.random() * image.length);  
document.write('<style type="text/css"> td.titleLower { background-image: url('+ image[index] +') } </style>');  
//-->  
</SCRIPT><TABLE WIDTH="1000" HEIGHT="170" BORDER="0" CELLPADDING="0" CELLSPACING="0">
      <TR>
        <TD CLASS="tdLowerHeadlineCell"><H1><?php echo $products_introductionRecord['title'] ?></H1></TD>
      </TR>
    </TABLE></TD>
  </TR>
  <TR>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="176" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="499" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="20" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="245" HEIGHT="17"></TD>
    <TD CLASS="tdWhite"><IMG SRC="images/single-pixel.gif" WIDTH="17" HEIGHT="20"></TD>
  </TR>
  <TR>
    <TD CLASS="tdWhite">&nbsp;</TD>
    <TD CLASS="tdWhite"><?php require_once('_include-plants-nav.php'); ?></TD>
    <TD CLASS="tdWhite">&nbsp;</TD>
    <TD CLASS="tdWhite"><table width="499" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php echo $products_introductionRecord['content'] ?></td>
      </tr>
      <tr>
        <td><h2 class="h2Padded">Browse:</h2>
		<p><a href="plants-results.php"><strong>View all plants &raquo;</strong></a></p><hr />
          <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
          <table width="495" border="0" align="left" cellpadding="0" cellspacing="0">  
            <tr>  
              
              <?php foreach ($categoriesRecords as $record): ?>  
              <td width="50%">  
                <p><strong><a href="plantsSubcategory.php?main_category=<?php echo $record['num'] ?>"><?php echo $record['title'] ?></a></strong></p>   </td>  
       
   <?php $maxCols=2; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?>  
     <?php endforeach; ?>  
     
     </tr>  
            </table>          <!-- /STEP2: Display Records --></td>
      </tr>
      <tr>
        <td class="tdWhite"><hr /></td>
      </tr>
      <tr>
        <td class="tdWhite"><h2 class="h2Padded">Search:</h2></td>
      </tr>
      <tr>
        <td class="tdWhite">            <div align="left">
<form method="post" action="http://thecoachesloft.com/plants-results.php">
            <input name="content,subcategory,title,variety,common_name,latin_name,bloom_time2,attributes2,flower_colour,sun_exposure2,foliage_colour,plant_type2,category_keyword" type="text" class="inputFieldLarge" value="" />
            <div align="left">
              <input name="submit" type="submit" class="inputButton" value="Search" />
            </div>
        </form></div></td>
      </tr>
      
      
      
    </table></TD>
    <TD CLASS="tdWhite">&nbsp;</TD>
    <TD COLSPAN="2" CLASS="tdWhite"><?php require_once('_include-right-column.php'); ?></TD>
  </TR>
  
  <TR>
    <TD CLASS="tdWhite">&nbsp;</TD>
    <TD COLSPAN="5" CLASS="tdWhiteRuleTop"><?php require_once('_include-footer.php'); ?></TD>
    <TD CLASS="tdWhite">&nbsp;</TD>
  </TR>
</TABLE>
</BODY>
</HTML>
