<?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 if($this->getCollection()->getSize()): ?>
    <?php if($this->getLastPageNum() > 1): ?>
        <div class="pager pager-bottom">
            <div class="pages clearfix">
                <div class="box">
                    <?php if(!$this->isFirstPage()): ?>
                        <a class="button prev" href="<?php echo $this->getPreviousPageUrl() ?>"><?php echo $this->__('Prev') ?></a>
                    <?php else: ?>
                        <a class="button disabled prev" href="<?php echo $this->getPreviousPageUrl() ?>"><?php echo $this->__('Prev') ?></a>
                    <?php endif;?>
                </div>
                <div class="box">
                    <a href="#pager-bottom" id="pager-button-bottom" class="button dropdown-button">
                        Page <?php echo $this->getCurrentPage() ?> of <?php echo count($this->getFramePages()) ?>
                        <select id="page-selector" class="button" onchange="setLocation(this.value)">
                            <?php if ($this->canShowFirst()): ?>
                                <option value="<?php echo $this->getFirstPageUrl() ?>"><?php echo $this->__('Page') ?> 1</option>
                            <?php endif;?>
                            <?php foreach ($this->getFramePages() as $_page): ?>
                                <option<?php if ($this->isPageCurrent($_page)): ?> selected="selected"<?php endif;?> value="<?php echo $this->getPageUrl($_page) ?>"><?php echo $this->__('Page') ?> <?php echo $_page ?> <?php echo $this->__('of') ?> <?php echo count($this->getFramePages()) ?></option>
                            <?php endforeach;?>
                            <?php if ($this->canShowLast()): ?>
                                <option value="<?php echo $this->getLastPageUrl() ?>"><?php echo $this->getLastPageNum() ?></option>
                            <?php endif;?>
                        </select>
                    </a>
                </div>
                <div class="box">
                    <?php if(!$this->isLastPage()): ?>
                        <a class="button next" href="<?php echo $this->getNextPageUrl() ?>"><?php echo $this->__('Next') ?></a>
                    <?php else: ?>
                        <a class="button disabled next" href="<?php echo $this->getNextPageUrl() ?>"><?php echo $this->__('Next') ?></a>
                    <?php endif;?>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <?php if($this->getLastPageNum() <= 1): ?>
        <div class="pager-empty">
            <p class="item-count"><?php echo $this->getTotalNum() ?> <?php echo $this->__('Item(s)') ?></p>
            <a href="#main" class="button small-button back-to-top"><?php echo $this->__('Back to Top') ?></a>
        </div>
    <?php endif; ?>
<?php endif ?>