<?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) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/* @var $this Mage_Wishlist_Block_Customer_Wishlist */
?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
    <div class="my-wishlist">
        <div class="page-title title-buttons">
            <h1><?php echo $this->getTitle(); ?></h1>
        </div>
        <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

        <form id="wishlist-view-form" action="<?php echo $this->getUrl('*/*/update', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>" method="post">
            <?php echo $this->getChildHtml('top'); ?>
            <fieldset>
                <?php if ($this->hasWishlistItems()): ?>
                    <?php echo $this->getBlockHtml('formkey');?>
                    <?php $this->getChild('items')->setItems($this->getWishlistItems()); ?>
                    <?php echo $this->getChildHtml('items');?>
                <?php else: ?>
                    <p class="wishlist-empty"><?php echo $this->__('You have no items in your wishlist.') ?></p>
                <?php endif ?>
                <div class="buttons-set">
                    <?php echo $this->getChild('control_buttons')->toHtml();?>
                </div>
            </fieldset>
        </form>

        <script type="text/javascript">
        //<![CDATA[
        var wishlistForm = new Validation($('wishlist-view-form'));
        function addAllWItemsToCart() {
            var url = '<?php echo $this->getUrl('*/*/allcart', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>';
            var separator = (url.indexOf('?') >= 0) ? '&' : '?';
            $$('#wishlist-view-form .qty').each(
                function (input, index) {
                    url += separator + input.name + '=' + encodeURIComponent(input.value);
                    separator = '&';
                }
            );
            setLocation(url);
        }
        //]]>
        </script>
    </div>
    <?php echo $this->getChildHtml('bottom'); ?>
<?php endif ?>
