<?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     default_iphone
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/* @var $this Mage_Catalog_Block_Product_Compare_List */
?>
<div class="page-head button-level">
    <h3><?php echo $this->__('Compare Products') ?></h3>
    <a href="#" class="link-print right" onclick="print();"><?php echo $this->__('Print This Page') ?></a>
</div>
<?php $_total=$this->getItems()->getSize() ?>
<?php if($_total): ?>
<div class="compare-products">
    <table cellspacing="0" class="data-table box-table catalog-listing" id="product_comparison">
<?php if ($_total>2): ?>
        <tbody class="remove-buttons">
            <tr>
                <?php $_i=0 ?>
                <?php foreach($this->getItems() as $_item): ?>
                <?php if($_i++%10==0): ?>
                <td>&nbsp;</td>
                <?php endif; ?>
                <td><a href="#" onclick="setLocation('<?php echo $this->getRemoveUrl($_item) ?>');window.opener.location.reload();"><img src="<?php echo $this->getSkinUrl('images/chart_remove.gif') ?>" alt="<?php echo $this->__('Remove Product') ?>" /></a></td>
                <?php endforeach; ?>
            </tr>
        </tbody>
<?php endif ?>
        <tbody>
            <tr class="first">
            <?php $_i=0 ?>
            <?php foreach($this->getItems() as $_item): ?>
                <?php if($_i++%10==0): ?>
                    <td class="label">&nbsp;</td>
                <?php endif; ?>
                <td>
                    <a href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->stripTags($_item->getName(), null, true) ?>" /></a>
                    <h5><a href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></h5>
                    <?php echo $this->helper('review/product')->getSummaryHtml($_item, 'short') ?>
                    <?php echo $this->getPriceHtml($_item, false, '-compare-list-top') ?>
                    <?php if($_item->isSaleable()): ?>
                    <button class="form-button" onclick="setPLocation('<?php echo $this->getAddToCartUrl($_item) ?>', true)"><span><?php echo $this->__('Add to Cart') ?></span></button><br/>
                    <?php else: ?>
                    <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
                    <?php endif; ?>
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                    <a href="#" onclick="setPLocation('<?php echo $this->getAddToWishlistUrl($_item) ?>', true)" class="link-cart"><small><?php echo $this->__('Add to Wishlist') ?></small></a>
                    <?php endif; ?>
                </td>
            <?php endforeach; ?>
            </tr>
        </tbody>
        <tbody>
        <?php foreach ($this->getAttributes() as $_attribute): ?>
            <tr>
                <?php $_i=0 ?>
                <?php foreach($this->getItems() as $_item): ?>
                <?php if($_i++%10==0): ?>
                <td class="label"><?php echo $_attribute->getStoreLabel() ?></td>
                <?php endif; ?>
                <td>
                    <?php switch ($_attribute->getAttributeCode()) {
                        case "price": ?>
                            <?php echo $this->getPriceHtml($_item, false, '-compare-list-' . $_attribute->getCode()) ?>
                            <?php break;
                        case "small_image": ?>
                            <img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" />
                            <?php break;
                        default: ?>
                            <?php echo $_helper->productAttribute($_item, $this->getProductAttributeValue($_item, $_attribute), $_attribute->getCode()) ?>
                            <?php break;
                    } ?>
                </td>
                <?php endforeach; ?>
            </tr>
        <?php endforeach; ?>
        </tbody>
        <tbody class="attribute-cart">
                <tr>
                <?php $_i=0 ?>
                <?php foreach($this->getItems() as $_item): ?>
                <?php if($_i++%10==0): ?>
                 <td class="label">&nbsp;</td>
                <?php endif; ?>
                <td>
                    <?php echo $this->getPriceHtml($_item, false, '-compare-list-bottom') ?>
                    <?php if($_item->isSaleable()): ?>
                    <button class="form-button" onclick="setPLocation('<?php echo $this->getAddToCartUrl($_item) ?>', true)"><span><?php echo $this->__('Add to Cart') ?></span></button><br/>
                    <?php else: ?>
                    <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
                    <?php endif; ?>
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                    <a href="#" onclick="setPLocation('<?php echo $this->getAddToWishlistUrl($_item) ?>', true)" class="link-cart"><small><?php echo $this->__('Add to Wishlist') ?></small></a>
                    <?php endif; ?>
                </td>
                <?php endforeach; ?>
            </tr>
        </tbody>
    </table>
    <div class="button-set">
        <button class="form-button" onclick="window.close();window.opener.focus();"><span><?php echo $this->__('Close Window') ?></span></button>
    </div>
</div>
<script type="text/javascript">
    decorateTable('product_comparison');
</script>
<?php else: ?>
<script type="text/javascript">
    window.close();
</script>
<?php endif; ?>
