var slabHashBangSub; $(document).ready( function(){ var hash; if(location.hash){ hash = location.hash; } else { hash = '#!homepage'; } setup_hashbang(); hashbang_page(hash); $(window).hashchange( function(){ hash = window.location.hash; $('#mainboxsub').fadeOut(300, function(){ setup_hashbang(); hashbang_page(hash); return false; }); }); }); function setup_hashbang(){ var hhref; var hqref; var htref; $('nav ul li a.hashnav, .mainimg a').each( function(){ hqref = $(this).prop('href'); htref = hqref.replace("index.php?page=","#!"); $(this).prop('href',htref) $(this).click( function(){ slabHashBangSub = 0; }) }); $('#menubox a,#prevNextSlideButtons a').each( function(){ hhref = $(this).prop('href'); hqref= hhref.replace(/#offset[0-9]*/gi,''); htref = hqref.replace("index.php?page=","#!"); $(this).prop('href',htref); $(this).click( function(){ slabHashBangSub = 1; $('#menubox a').removeClass('lit'); $(this).addClass('lit'); }); }); return true; } function hashbang_page(hash){ var hhqr = hash.split('!'); var hhqs = hhqr[1]; var hhparts = hhqs.split('&'); var hpage = hhparts[0]; var hpagep = hpage+'_page'; if(hhqs.match(/family/gi)!=null){ var famly = hhparts[1].split('='); var hfam = famly[1]+'_section'; hpage = famly[1]; } if(hpage != 'gallery'){ if(hpage != null){ $('body').removeClass(); $('body').addClass(hpagep); if(hfam) $('body').addClass(hfam); $('nav ul li a').removeClass('lit'); $('nav ul li'+hpage+'_nav a').addClass('lit'); } if(slabHashBangSub == 1){ $('#mainbox').html('
'); $('#mainbox').load('?page='+hhqs+'&najax=1 #mainboxsub', function(){ $('#mainboxsub').hide().fadeIn(300); setup_hashbang(); return false; }); } else { $('#main').html('
'); $('#main').load('?page='+hhqs+'&najax=1 #mainsub', function(){ $('#mainsub').hide().fadeIn(300); setup_hashbang(); return false; }); } } return false; }