var docPath = "www.yellowblackdesign.com/sections/"; var sectionLoad = false; function pageload(hash) { if(hash) { if($.browser.msie) { hash=encodeURIComponent(hash); } moveMenuItem(hash); } else { console.log('no hash'); } } function moveMenuItem(hash) { sectionLoad = true; //move down all of the menu items that are up $('div#header div.menubar div.up').switchClass('up','down',500); $('div#header div.menubar div.up a.up').switchClass('up','down',500); $('a#' + hash).parent().switchClass('down','up',500); $('a#' + hash).parent().children('a.down').switchClass('down','up',500); loadSectionContent(hash); loadSectionHeader(hash); } function loadSectionContent(hash) { var httpPrefix = ""; if (location.protocol == 'https:') httpPrefix = "https://"; else httpPrefix = "http://"; var thePath = httpPrefix + "www.yellowblackdesign.com/sections/" + hash + '/index.php'; $("div#mainContent").slideUp("normal",function(){ $("div#mainContent").load(thePath,{postID:-1},function(){ $("div#mainContent").animate({opacity: 1.0}, 150).slideDown(); pageTracker._trackPageview("/#" + hash); }); }); return false; } function loadSectionHeader(hash) { var httpPrefix = ""; if (location.protocol == 'https:') httpPrefix = "https://"; else httpPrefix = "http://"; var thePath = httpPrefix + "www.yellowblackdesign.com/sections/" + hash + '/header.php'; $("div#headerContent").fadeOut("fast",function(){ $("div#headerContent").load(thePath,{postID:-1},function(){ $("div#headerContent").fadeIn(); }); }); return false; } $(document).ready(function() { //init history plugin $.historyInit(pageload); if (location.hash.length == 0 && !sectionLoad) { $.historyLoad('home'); } //attach an event to each menu div that's clicked $("a[rel='history']").click(function(){ var hash = this.href; hash = hash.replace(/^.*#/, ''); $.historyLoad(hash); return false; }); });