<?php
include("inserts/_insertSiteWideNutsCode.php");
?>   
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "/var/www/forrest.id.au/public_html/nutsDemo/lib/viewer_functions.php";

  list($j_product_catalogueRecords, $j_product_catalogueMetaData) = getRecords(array(
    'tableName'   => 'j_product_catalogue',
  ));

?>
  <?php
    require_once "/var/www/forrest.id.au/public_html/nutsDemo/lib/viewer_functions.php";

    // get favorite record nums
    $tableOrTag        = mysql_escape('j_product_catalogue');  // update this with your table or tag name
    $currentUserNum    = mysql_escape( @$CURRENT_USER['num'] );
    $favoriteNumsQuery = "SELECT recordNum FROM {$TABLE_PREFIX}_website_favorites WHERE tableOrTag = '$tableOrTag' AND createdByUserNum = '$currentUserNum'";

    // load matching records
    list($favoriteRecords, $favoriteMetaData) = getRecords(array(
      'tableName'     => 'j_product_catalogue', // update this with your table or tag name
      'perPage'       => '10',
      'where'         => " num IN ($favoriteNumsQuery) ",
      'loadCreatedBy' => false,
      'allowSearch'   => false,
    ));
  ?>

<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "/var/www/forrest.id.au/public_html/nutsDemo/lib/viewer_functions.php";

  list($j_product_categoriesRecords, $selectedCategory) = getCategories(array(
    'tableName'           => 'j_product_categories',
    'selectedCategoryNum' => '',         // defaults to getNumberFromEndOfUrl()
    'categoryFormat'      => 'onelevel',  // showall, onelevel, twolevel
  ));

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
  <!-- favorites -->
  <script type="text/javascript" src="/nutsDemo/plugins/websiteFavorites/websiteFavorites.js"></script>
  <script type="text/javascript" src="/nutsDemo/3rdParty/jquery/jquery1.3.2.js"></script>
  <script type="text/javascript">jQuery.noConflict();</script>
  <?php $GLOBALS['WSF_SCRIPTS_LOADED'] = true; ?>
  <!-- /favorites -->

<!-- Page Meta Data -->
    <title>Nuts'n'Bolts | Catalogue</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="keywords" content=""> <!--Insert Section Code -->
    <meta name="description" content=""> <!--Insert Section Code -->

    <meta name="robots" CONTENT="NOINDEX, NOFOLLOW"> <!--INDEX / NOINDEX  |  FOLLOW / NOFOLLOW -->
    

<!-- CSS Links -->
    <?php
    include("inserts/_insertSiteWideCss.php");
    ?>   

<!-- Java Links etc -->
    <?php
    include("inserts/_insertSiteWideCode.php");
    ?>   

</head>

<body>
    <?php
    include("inserts/_insertOldBrowserAlert.php");
    ?>   
    <?php
    include("inserts/_insertLoginSlider.php");
    ?>   

<div id="pagewidth" >

    <?php
    include("inserts/_insertHeader.php");
    ?>   

    <?php
    include("inserts/_insertNavigation.php");
    ?>   

    <div id="wrapper" class="clearfix" > 
        <div id="maincolContent" >
        <div id="breadbcrumb"></div>
        <h1>Catalogue</h1>
                <?php foreach ($j_product_catalogueRecords as $record): ?>
                <div id="teaser-wrap">
                <div class="teaser">
                   <?php foreach ($record['images'] as $upload): ?><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><?php endforeach ?>
                   <h3><?php echo $record['title'] ?></h3>
                   <?php echo $record['summary'] ?>
                   <a href="<?php echo $record['_link'] ?>">Read More...</a>

                    <!--Add Favourite -->                   
                      <?php
                        $tableOrTag = 'j_product_catalogue';       // Update with your section's table name
                        $recordNum  = $record['num'];  // Update this with current record number
                      ?>
                    
                      <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'add'); ?>"
                           style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'add'); ?>">
                        <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'addAndReload'); ?>">Add Favorite</a>
                      </div>
                    
                      <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'remove'); ?>"
                           style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'remove'); ?>">
                        <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'removeAndReload'); ?>">Remove Favorite</a>
                      </div>
                    <!--Add Favourite -->                   
                   
                   
                </div>
               </div>
                <?php endforeach ?>
            
                <?php if (!$j_product_catalogueRecords): ?>
                  No records were found!<br/><br/>
                <?php endif ?>
        </div>
        
        <div id="leftcol" >
		  <?php if (!@$errorsAndAlerts) { $errorsAndAlerts = alert(); } ?>
		  <?php if (@$errorsAndAlerts): ?>
            <div id="alertBox">
              <?php echo $errorsAndAlerts; ?>
            </div>
          <?php endif ?>
        <div id="sectionPanelHighlight">
        
			<?php foreach ($a_text_snippetsRecords as $record): ?> 
            <?php if ($record['title'] == 'Catalogue'): ?><?php echo $record['content'] ?><?php endif ?> 
            <?php endforeach; ?>        
 

              <?php foreach ($j_product_categoriesRecords as $categoryRecord): ?>
                <?php echo $categoryRecord['_listItemStart'] ?>
            
                <?php if ($categoryRecord['_isSelected']): ?>
                  <b><a href="catalogue.php?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a></b>
                <?php else: ?>
                  <a href="catalogue.php?category=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a>
                <?php endif; ?>
            
                <?php echo $categoryRecord['_listItemEnd'] ?>
              <?php endforeach; ?>

        </div>
        <div id="sectionPanel">
        <h3>Your Cart</h3>
		  <?php foreach ($favoriteRecords as $record): ?>
            <?php
              $tableOrTag = 'j_product_catalogue';          // Update with your section's table name
              $recordNum  = $record['num'];  // Update this with current record number
            ?>
        
            <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'remove'); ?>"
                 style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'remove'); ?>">
              <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a> -
              <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'removeAndReload'); ?>">Remove</a>
            </div>
          <?php endforeach; ?>
        
          <?php if (!$favoriteRecords): ?>
             Empty.
          <?php endif; ?>
        </div>

       </div>
    </div>

	<?php
    include("inserts/_insertFooter.php");
    ?>    

</div>
	<script type="text/javascript" charset="utf-8">
    $('.teaser').hover(function() {
          // over
    
        $(this).children('img').stop().animate({
            left : '-150px'
        }, 500);
    
    }, 
    
    function() {
      // out	
    
        $(this).children('img').stop().animate({
            left : '0'
        }, 500);
    
    });
    </script>

    <?php
    include("inserts/_insertGoogleCode.php");
    ?>   
</body>

</html>