title: AJAX back button menu issue
body: <p>I'm developing web site using jquery $.ajax to load content of different pages that I have in content/ directory. I also use hashtags to activate back button, reload, etc.</p>
  
  <p>BUT. I have main menu with active items, and if I navigate between the pages in depth of the one main menu item, it is active. Then, I click one of the main menu items, for example, Contacts. So, the contacts menu item becomes active. And if I click browser back button, the active menu item won't change. </p>
  
  <p>So, is there any way to remember the state of active main menu item? Main menu is situated on container page.</p>
  
  <p>Thank you!</p>
  
  <pre><code>$(function(){
  
          $('.menu a')
              .bind('click',function(e) {
                  e.preventDefault();
                  $('#content').html('Извините, страница не существует или находится в разработке!');
                  $('.menu a').each(function() {$(this).removeClass('activelink');});
                  location.hash=$(this).attr('href').match(/(([a-z]*)\W)*/)[2];
  
                  $(this).addClass('activelink');
                  return false;
              });
  
          $('#content').on('click','a',function(e) {
              if (!($(this).hasClass('address') || $(this).hasClass('zoom'))){
              e.preventDefault();
              $('#content').html('Извините, страница не существует или находится в разработке!');
              location.hash=$(this).attr('href').match(/(([a-z]*)\W)*/)[2];
              return false;
              }
              else {
                  if ($(this).hasClass('address')) {
                  alert('Вы покидаете сайт The House Of Events. Возвращайтесь к нам еще!');
                  }
              }
          });
  
      function hashChange(){
          var page=location.hash.slice(1);
          if (page!=""){
              $.ajax({
                      type: "GET",
                      url: "content/" + page + ".html #sub-content",
                      success: function(data, status) {
                          $('#content').html(data);
                          },
                      error: function fail() {
                          $('#content').html('Error');
                          }
                  });
          }
      }
  
      if ("onhashchange" in window){
          $(window).on('hashchange',hashChange).trigger('hashchange');
      } else { 
          var lastHash='';
          setInterval(function(){
              if (lastHash!=location.hash)
                  hashChange();
              lastHash=location.hash;
          },100);
      }
  });
  </code></pre>