<div class="navbar navbar-default navbar-fixed-top">
  <nav class="header-fixed1000">
    <div class="container-fluid">
      <a class="brand header-brand" href="<?php echo $wo['config']['site_url']; ?>">
        <img width="170" src="<?php echo $wo['config']['theme_url'];?>/img/logo.<?php echo $wo['config']['logo_extension'];?>" alt="<?php echo $wo['config']['siteName'];?> Logo"/>
      </a>
      <div>
        <ul class="nav navbar-nav">
          <li class="active navbar-home">
            <a href="<?php echo $wo['config']['site_url']; ?>" id="home-button" onclick="Wo_ChangeHomeButtonIcon();">
              <i class="fa fa-home"></i>
            </a>
          </li>
        </ul>
        <ul class="nav navbar-nav">
          <li class="dropdown search-container">
            <form class="navbar-form navbar-left col-lg-12 form-group" data-toggle="dropdown" role="button" id="navbar-searchbox" role="search">
              <div class="form-group inner-addon <?php echo Wo_RightToLeft('left-addon');?> ">
                <i class="glyphicon fa fa-search main-color progress-icon" data-icon="search"></i>
                <input type="text" class="form-control search-input" onkeyup="Wo_DetectSearchType(this.value)" placeholder="<?php echo $wo['lang']['search_header_label']; ?>" dir="auto" <?php if (Wo_IsLogged() === true) { echo 'onfocus="Wo_GetRecentSearchs()"';}?>>
              </div>
            </form>
            <ul class="dropdown-menu search-dropdown-container" style="margin-left:7px;" role="menu">
              <div class="search-dropdown-result"></div>
              <li>
                <span class="search-advanced-container">
                  <a href="<?php echo Wo_SeoLink('index.php?tab1=search');?>" class="search-advanced-link">
                    <?php echo $wo['lang']['advanced_search']; ?>
                  </a>
                </span>
              </li>
            </ul>
          </li>
        </ul>
        <?php
        if (Wo_IsLogged() === true) {
        echo Wo_LoadPage('header/loggedin-header');
        } else {
        echo Wo_LoadPage('header/main-header');
        }
        ?>
      </div>
    </div>
  </nav>
</div>
<script type="text/javascript">
var Searchcontainer = $('.search-container');
var SearchBox = $('.search-container .search-input');
var SearchResult = $('.search-dropdown-result');

function Wo_ChangeHomeButtonIcon() {
  $('.navbar-home #home-button').html('<i class="fa fa-circle-o-notch fa-spin"></i>');
}
  
function Wo_DetectSearchType(query) {
  var Hash = smokeTheHash(query);
  if (Hash) {
    $('.search-advanced-container').hide(200);
    Wo_SearchhashResult(query);
  } else {
    $('.search-advanced-container').fadeIn(200);
    Wo_SearchResult(query);
  }
}

function Wo_ClearSearches() {
  $('.clear-searches').html('<i class="fa fa-spinner fa-spin"></i>');
   $.get(Wo_Ajax_Requests_File(), {f: 'clearChat'}, function(data) {
        if (data.status == 200) {
           location.reload();
        }
   });
}

function Wo_GetRecentSearchs() {
  Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
  $.get(Wo_Ajax_Requests_File(), {f: 'search', s: 'recent'}, function(data) {
      if (data.status == 200) {
          if (data.html.length > 0) {
            SearchResult.html('<div class="recent"><div class="gray recent-searches <?php echo Wo_RightToLeft("pull-left");?>"><i class="fa fa-clock-o"></i> <?php echo $wo["lang"]["recent_searches"]?></div><div onclick="Wo_ClearSearches();" class="gray recent-searches clear-searches pointer <?php echo Wo_RightToLeft("pull-right");?>"><?php echo $wo["lang"]["clear"]?></div><div class="clear"></div></div>' + data.html);
          }
        }
      Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
  });
}
function Wo_SearchResult(query) {
    if (SearchBox.val() != '') {
      Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
      Searchcontainer.addClass('open');
      Searchcontainer.find('.search-advanced-link').attr('href','<?php echo Wo_SeoLink("index.php?tab1=search&query=")?>' + query);
      $.get(Wo_Ajax_Requests_File(), {f: 'search', s: 'normal', query: query}, function(data) {
        if (data.status == 200) {
          if (data.html.length == 0) {
            SearchResult.html('<span class="center-text">' + " <?php echo $wo['lang']['no_result']; ?>" + '<span>');
          } else {
            SearchResult.html(data.html);
          }
        }
        Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
      });
      $(document).click(function() {
        Searchcontainer.removeClass('open');
      });
    } else {
      Searchcontainer.removeClass('open');
    }
}


function Wo_SearchhashResult(query) {
    var Searchcontainer = $('.search-container');
    var SearchBox = $('.search-container .search-input');
    var SearchResult = $('.search-dropdown-result');
    if (SearchBox.val() != '') {
      Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
      Searchcontainer.addClass('open');
      Searchcontainer.find('.search-advanced-link').attr('href','<?php echo Wo_SeoLink("index.php?tab1=search&query=")?>' + query);
      $.get(Wo_Ajax_Requests_File(), {f: 'search', s: 'hash', query: query}, function(data) {
        if (data.status == 200) {
          if (data.html.length == 0) {
            SearchResult.html('<span class="center-text">' + " <?php echo $wo['lang']['no_result']; ?>" + '<span>');
          } else {
            SearchResult.html(data.html);
          }
        }
        Wo_progressIconLoader(Searchcontainer.find('.navbar-form'));
      });

      $(document).click(function() {
        Searchcontainer.removeClass('open');
      });
    } else {
      Searchcontainer.removeClass('open');
    }
}

function smokeTheHash(str) {
  var n = str.search("#");
  if(n != "-1"){
    return true;
  } else {
    return false;
  }
}
</script>