
<?php 
$_helper = $this->helper('catalog/product_compare');
$_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null;
?>
<div class="block block-compare">
    <div class="block-title">
        <?php echo $this->__('Compare Products') ?>
            <?php if($_helper->getItemCount() > 0): ?> 
                <small><?php echo $this->__('(%d)', $_helper->getItemCount()) ?></small>
            <?php endif; ?>
        
    </div>
    <div class="block-content">
    <?php if($_helper->getItemCount() > 0): ?>
        <ol id="compare-items">
        <?php foreach($_items as $_index => $_item): ?>
            <li class="item">
                <input type="hidden" class="compare-item-id" value="<?php echo $_item->getId() ?>" />
                <a href="<?php echo $_helper->getRemoveUrl($_item) ?>" title="<?php echo $this->__('Remove This Item') ?>" class="btn-remove" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the compare products?') ?>');"></a>
                <a class="product-name" href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $prod_name= $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name'); ?></a>
            </li>
        <?php endforeach; ?>
        </ol>
        <script type="text/javascript">decorateList('compare-items')</script>
        <div class="ajax-checkout">
            <button type="button" title="<?php echo $this->__('Compare') ?>" class="button button-compare" onclick="popWin('<?php echo $_helper->getListUrl() ?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')"><span><?php echo $this->__('Compare') ?></span></button>
            <button class="button button-clear" onclick="if(confirm('Are you sure you would like to remove all products from your comparison')) setLocation('<?php echo $_helper->getClearListUrl(); ?>')"><span><?php echo $this->__('Clear') ?></span></button>
        </div><!--ajax-checkout-->
    <?php else: ?>
        <p class="empty"><?php echo $this->__('You have no items to compare.') ?></p>
    <?php endif; ?>
    </div><!--block-content-->
</div><!--block block-list block-compare-->
