$(document).ready(function() { function cachePath(path) { return path.replace(/ /g, "_").replace(/\//g, "-"); } function imagePath(image, path, size, square) { var suffix; if (square) suffix = size.toString() + "s"; else suffix = size.toString(); return "cache/" + cachePath(path + "/" + image + "_" + suffix + ".jpg"); } function loadAlbum(path) { $.ajax({ type: "GET", url: "cache/" + path + ".json", success: function(album) { $("#debug").html("

" + album.path + "

"); $("#debug").append("

Photos

"); for (var i = 0; i < album.photos.length; ++i) $("#debug").append(""); if (album.albums.length) $("#debug").append("

Sub-albums

"); for (var i = 0; i < album.albums.length; ++i) { var link = $("
  • " + album.albums[i].path + "
  • "); $("#debug").append(link); } } }); } $(window).hashchange(function() { var cache = location.hash.substring(1); if (!cache.length) cache = cachePath("New York Summer 2009"); //root loadAlbum(cache); }); $(window).hashchange(); });