/*
   Add a default clickhandler so we can use hrefs
 */
Backbone.View.prototype.defaultClickHandler = function( e ) {
  if ( e.metaKey || e.ctrlKey || e.altKey ) return;

  var routeTo = $(e.target).closest('a').attr('href');
  console.log("Navigating to "+ routeTo);

  if ( $(e.target).closest('li').hasClass('active') ) {
    Backbone.history.loadUrl( Backbone.history.fragment );
  } else {
    Backbone.history.navigate(routeTo, true);
  }

  e.preventDefault();

  return false;
};

/* HACK: this is needed because internal events did not seem to work*/
$("a[rel=backbone]").live("click",Backbone.View.prototype.defaultClickHandler);

/*
   Add a default clickhandler so we can use hrefs
 */
Backbone.View.prototype.defaultClickHandler = function( e ) {
  if ( e.metaKey || e.ctrlKey || e.altKey ) return;

  var routeTo = $(e.target).closest('a').attr('href');
  console.log("Navigating to "+ routeTo);

  if ( $(e.target).closest('li').hasClass('active') ) {
    Backbone.history.loadUrl( Backbone.history.fragment );
  } else {
    Backbone.history.navigate(routeTo, true);
  }

  e.preventDefault();

  return false;
};

/* HACK: this is needed because internal events did not seem to work*/
//$("a[rel=backbone]").live("click",Backbone.View.prototype.defaultClickHandler);

disable rel=backbone for now (testing on testserver to see if this is acceptable)