<? global $lang;?>
<div id="search-form">
  <form method="POST" action="/wyszukiwarka">
    <label>Szukaj na stronie</label>
    <input type="text" name="search_txt" id="search_txt" />
    <button class="btn btn-primary">
      <i class="fa fa-search"></i>
    </button>
  </form>
</div>
<script type="text/javascript">
  $( document ).ready( function()
  {
    $( 'body' ).on( 'click', '#search-form .btn', function()
    {
      var search_txt = $( '#search_txt' ).val();
      search_txt = search_txt.trim();
      if ( search_txt.length < 3 )
      {
        $.prompt( 'Proszę wpisać co najmniej 3 znaki.', { 
          title: '<?= ucfirst( $lang['blad'] );?>',
          buttons: {
            '<?= $lang['zamknij'];?>': true
          }
        } );
        return false;
      }
      $( '#search-form form' ).submit();
    });
  });
</script>