function updateURL( URL, Name) { if (typeof history.pushState == 'function' ) { var stateObj = { foo: "bar" }; history.pushState( stateObj, "Obsidian - " + Name, URL); } } $("document").ready(function() { $(".folder").click(function() { $("#loading").show(); title = encodeURI($(this).children(".title").children("a").attr("href")); Name = $(this).children(".title").children("a").html(); $("body").load(title, function( response, status, xhr ) { if ( status == "error" ) { var msg = "Sorry but there was an error: "; $( "#error" ).html( msg + xhr.status + " " + xhr.statusText ); }}); updateURL(title, Name); }); $(".thumb").click(function() { title = encodeURI($(this).children("a").attr("href")); $("#lightbox").html(''); $("#viewer").fadeIn(); return false; }); $("#container").click(function() { $("#viewer").fadeOut(); }); $(".loading").hide(); });