<?php
/**
 * Avalanche for Magento 1.8+
 * Designed by Fast Division (http://fastdivision.com)
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://fastdivision.com/legal/license.txt
 *
 * @author     Fast Division
 * @version    1.5.0
 * @copyright  Copyright 2013 Fast Division
 * @license    http://fastdivision.com/legal/license.txt
 */
?>
<?php
    $_product = $this->getProduct();
    $_helper = $this->helper('catalog/output');
	$primaryPhotoDuplicate = (Mage::getStoreConfig('avalanche_config/avalanche_product_details/avalanche_duplicate_image') == 1) ? true : false;
?>

<div id="quickview-image-browser" class="<?php if(!$_product->isSaleable()) { echo "faded"; } ?>">
	<div id="product-image">
		<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
		    <?php
				$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" width="300" />';
		        echo $_helper->productAttribute($_product, $_img, 'image');
		    ?>
		<?php else: ?>
		    <?php
		        $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(300).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" width="300" />';
		        echo $_helper->productAttribute($_product, $_img, 'image');
		    ?>
		<?php endif; ?>
	</div>
	<?php if (count($this->getGalleryImages()) > 0): ?>
	<div id="product-image-strip" class="clearfix">
		<ul class="menu clearfix">
			<?php if($primaryPhotoDuplicate): ?>
			<li>
			    <?php
					// Add main image to product image strip
			        $_img = '<a href="' . $this->helper('catalog/image')->init($_product, 'image') . '" class="product-image-thumbnail" data-img="' . $this->helper('catalog/image')->init($_product, 'image') . '" title="' . $this->htmlEscape($this->getImageLabel()) . '"><img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(55).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" width="55" height="55" /></a>';
			        echo $_helper->productAttribute($_product, $_img, 'image');
			    ?>
			</li>
			<?php endif; ?>
		    <?php foreach ($this->getGalleryImages() as $_image): ?>
		        <li>
		            <a href="<?php echo $this->getGalleryUrl($_image) ?>" class="product-image-thumbnail" data-img="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(55); ?>" width="55" height="55" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>"></a>
		        </li>
		    <?php endforeach; ?>
		</ul>
	</div>
	<?php endif; ?>
</div><br>
