function close_viewer() {
  setTimeout("remove_viewer()", 1000);
  
  window.location.hash = "";
}


function remove_viewer() {
  $("#viewer").remove();
}

function open_viewer(url) {
  if ($("#viewer").length == 0) {
    $('<div id="viewer"></div>').appendTo($("body"));
  }
  
  $("#viewer").load(url);//.css("display", "block");
  
  if (_gat) {
    var pageTracker = _gat._getTracker("UA-16758340-1");
    pageTracker._trackPageview(url);
  }
}

$("body.categories.view #content .project a").live("click", function() {
  href = $(this).attr("href");
  
  hash = href.split("/");
  hash = hash.slice(2, hash.length);
  window.location.hash = hash.join("/");
  
  open_viewer(href);
  
  return false;
});
