<?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
 */
?>
<div class="grid_12 white-box">
    <h1 style="margin:0"><?php echo $this->__('Catalog Advanced Search') ?></h1>
    <h3 class="legend"><?php echo $this->__('Search Settings') ?></h3>

    <div class="white-box-inner">
        <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
        <form action="<?php echo $this->getSearchPostUrl() ?>" method="get" id="form-validate">
            <div class="fieldset advanced-search">
                <ul class="form-list quad-list" id="advanced-search-list">
                    <?php $attrCount = 0; ?>
                    <?php foreach ($this->getSearchableAttributes() as $_attribute): ?>
                    <?php $_code = $_attribute->getAttributeCode() ?>
                    <li>
                        <label for="<?php echo $_code ?>"><?php echo $this->getAttributeLabel($_attribute) ?></label>
                        <?php switch($this->getAttributeInputType($_attribute)):
                            case 'number': ?>
                            <div class="input-range">
                                <input type="text" name="<?php echo $_code ?>[from]" value="<?php echo $this->htmlEscape($this->getAttributeValue($_attribute, 'from')) ?>" id="<?php echo $_code ?>" title="<?php echo $this->htmlEscape($this->getAttributeLabel($_attribute)) ?>" class="input-text validate-number" />
                                <span class="separator">-</span>
                                <input type="text" name="<?php echo $_code ?>[to]" value="<?php echo $this->htmlEscape($this->getAttributeValue($_attribute, 'to')) ?>" id="<?php echo $_code ?>_to" title="<?php echo $this->htmlEscape($this->getAttributeLabel($_attribute)) ?>" class="input-text validate-number" />
                            </div>
                            <?php break;
                            case 'price': ?>
                            <div class="input-range">
                                <input name="<?php echo $_code ?>[from]" value="<?php echo $this->htmlEscape($this->getAttributeValue($_attribute, 'from')) ?>" id="<?php echo $_code ?>" title="<?php echo $this->htmlEscape($this->getAttributeLabel($_attribute)) ?>"  class="input-text validate-number" type="text" />
                                <span class="separator">-</span>
                                <input name="<?php echo $_code ?>[to]" value="<?php echo $this->htmlEscape($this->getAttributeValue($_attribute, 'to')) ?>" id="<?php echo $_code ?>_to" title="<?php echo $this->htmlEscape($this->getAttributeLabel($_attribute)) ?>"  class="input-text validate-number" type="text" />
                                <small>(<?php echo $this->getCurrency($_attribute); ?>)</small>
                            </div>
                            <?php break;
                            case 'select': ?>
                                <div class="input-box">
                                    <?php echo $this->getAttributeSelectElement($_attribute) ?>
                                </div>
                            <?php break;
                            case 'yesno': ?>
                                <?php echo $this->getAttributeYesNoElement($_attribute) ?>
                            <?php break;
                            case 'date': ?>
                            <div class="input-range">
                                <?php echo $this->getDateInput($_attribute, 'from') ?>
                                <span class="separator">-</span>
                                <?php echo $this->getDateInput($_attribute, 'to') ?>
                            </div>
                            <?php break;
                            default: ?>
                            <div class="input-box">
                                <input type="text" name="<?php echo $_code ?>" id="<?php echo $_code ?>" value="<?php echo $this->htmlEscape($this->getAttributeValue($_attribute)) ?>" title="<?php echo $this->htmlEscape($this->getAttributeLabel($_attribute)) ?>"  class="input-text <?php echo $this->getAttributeValidationClass($_attribute) ?>" />
                            </div>
                        <?php endswitch; ?>
                    </li>
                        <?php $attrCount++; ?>
                    <?php endforeach; ?>
                </ul>
                <script type="text/javascript">decorateList('advanced-search-list')</script>
            </div>
            <div class="buttons-set">
                <button type="submit" title="<?php echo $this->__('Search Products') ?>" class="action-button"><span><?php echo $this->__('Search Products') ?></span></button>
            </div>
        </form>
        <script type="text/javascript">
        //<![CDATA[
            var dataForm = new VarienForm('form-validate', true);
        //]]>
        </script>
    </div>
</div>