<?php
$title = $category->title;
$this->setLayout('member/layout.phtml');
?>
<?php if ($category->description) : ?>
<p><?php p($category->description) ?></p>
<?php endif; ?>
<?php if ($showSearch) : ?>
<div class="am-category-search-wrapper">
    <form action="" method="get" id="am-category-search">
        <div class="am-input-filter-wrapper">
            <div class="am-input-filter-inner-wrapper">
                <input class="am-input-filter"
                       type="text"
                       name="cq"
                       autocomplete="off"
                       value="<?php p($cq) ?>"
                       placeholder="<?php __e('Type Keyword and Press Enter…') ?>" />
                <div class="am-input-filter-empty">&nbsp;</div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    jQuery(function(){
        jQuery(document).on('keyup', '#am-category-search-q', function(event){
            if (event.keyCode === 13) {
                jQuery(this).closet('form').submit();
            }
        });
        jQuery(document).on('keyup change', '.am-input-filter', function(){
            jQuery('.am-input-filter-empty').toggle(jQuery(this).val().length !== 0);
        });
        jQuery('.am-input-filter').change();
        jQuery(document).on('focusin focusout', '.am-input-filter', function(){
            jQuery(this).closest('.am-input-filter-wrapper').toggleClass('am-input-filter-wrapper_focus');
        });
        jQuery('.am-input-filter-empty').click(function(){
            jQuery(this).closest('.am-input-filter-wrapper').find('.am-input-filter').val('');
            jQuery(this).closest('form').submit();
        });
    });
</script>
<?php endif; ?>
<?php foreach ($this->resources as $r) : ?>
<div class="am-block am-block-category-resource">
    <?php include $this->_script('resource/_' . $r->getAccessType() . '.phtml') ?>
</div>
<?php endforeach; ?>
<?php echo $paginator->render(); ?>