<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="category-products">
<div class="new-arrow1"><h2><?php echo $this->__('New Products') ?></h2></div>


<div id="secondary-slider2" class="flexslider carousel">
<div class="flex-viewport" style="overflow: hidden; position: relative;">
<div class="slides" style="width: 2400%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px); margin-left: 0px;">

<?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_products->getItems() as $_product): ?>
        <?php if ($i++%$_columnCount==0): ?>

        <?php endif ?>
        <ul class="home-grid" style="margin-right: 14px; width: 295px; float: left; display: block; padding: 0px;">
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
                <a id="fancybox358" class="fancybox quick-view" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('Details');?></a>                   
                  <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image') ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
                  <div class="productgrid-area">
                  <h2 class="product-name">
                  <a  href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php //echo $this->htmlEscape($_product->getName()) ?>
                     <?php $prod_name = $this->htmlEscape($_product->getName()) ; 
                        if(strlen($prod_name) > 30) {echo substr($prod_name,0,30)."...";}else {echo $prod_name;}?></a></h2>
                  <?php  //if($_product->getRatingSummary()): ?>
                    <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                  <?php  //endif;  ?>
                  
                  <?php echo $this->getPriceHtml($_product, true, '-new') ?>
                  <div class="actions">
                  <?php if($_product->isSaleable()): ?>
                      <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart ajx-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                  <?php else: ?>
                      <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                  <?php endif; ?> 
                  <ul class="add-to-links">  
                  <li>                                           
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                        <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to wishlist') ?>"></a>
                    <?php endif; ?>     
                    </li>
                    <li>                             
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                        <a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"></a>
                    <?php endif; ?>
                    </li>                             
                  </ul> <!--add-to-links-->
                  </div><!--actions-->
                  </div><!--productgrid-area-->            
            </li>
        </ul>
        <?php if ($i%$_columnCount==0 || $i==count($_products)): ?>

        <?php endif ?>
    <?php endforeach; ?>
</div> <!--slides-->
</div> <!--flex-viewport-->
</div> <!--#secondary-slider1-->
</div> <!--category-products-->
<script type="text/javascript">
j$('#secondary-slider2').flexslider({
   selector: ".slides > ul",
    animation: "slide",
    animationLoop: false,
    itemWidth:295,
    itemMargin:18,
    minItems: 1,
    maxItems: 3,
    move:1,
    controlNav: false,
    slideshowSpeed: 7000,          
    animationSpeed: 1000,
    slideshow: false,
    start: function(slider){
      j$('div').removeClass('loading');
    }
       });
</script>
<?php endif; ?>
