/**
 * Code for bookmarkeable ajax urls including back button support
 * this will catch the hashchange (#bla) and convert it into a url which
 * will be loaded with an jquery ajax call
 */
$(document).ready(function() {

  $(window).bind('hashchange', function(e) {
    var url = $.param.fragment();

    // temp solution to prevent calling ajax urls 
    // when there's no bookmarkeable ajax url
    // this check should be done serverside while generating this js code
    if(url && url.length > 0 && $(location).attr('pathname').substring(10,1) == 'ranglijst')
    {
      url = $(location).attr('pathname') + '/' + url;

      // Load external content via AJAX
      $('#ajaxtarget').load(url, function(){ });
    }
  });
  $(window).trigger('hashchange');
});
