<?php
/* @@var $this Mage_Core_Block_Template */
/* @@var $catalogSearchHelper Mage_Catalogsearch_Helper_Data */
$catalogSearchHelper =  $this->helper('catalogsearch');
?>

<form id="search_mini_form" class="@classNames form-inline" name="search" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
    <div class="@containerInner">
        @if (showButton && joinButton) {
            <div class="input-group">
        }
        @if (buttonPosition === 'right') {
            @include("input")
        }
        @if (showButton) {
            <span class="input-group-btn">
                <input type="submit" class="@button.classNames" onclick="document.search.submit()" value="@_searchBtnText">
            </span>
        }
        @if (buttonPosition === 'left') {

            @include("input")
        }

        @if (icon.passive.picture.fileName) {
            <img class="@(icon.classNames)-picture" src="@icon.passive.picture" data-hovered="@icon.hovered.picture">
        }

        @if (showButton && joinButton) {
            </div>
        }
        <div id="search_autocomplete" class="search-autocomplete"></div>
        <script type="text/javascript">
            //<![CDATA[
            var searchForm = new Varien.searchForm('search_mini_form', 'search', '');
            searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');
            //]]>
        </script>
    </div>
</form>
