var recentHash = "";
  
function pollHash() {
	if (window.location.hash==recentHash) {
		return; // Nothing's changed since last polled.
	}
	
	recentHash = window.location.hash;

	$(recentHash + "-link").click();
}


$(function() {
				
	// $('.page:not(.noLoad)').each(function() {
	// 	$(this).load('pages/' + $(this).attr('id') + '.html', {}, function() {
	// 		
	// 		// Add in curves at top and bottom
	// 		$(this).prepend('<div class="pageTop"></div>').append('<div class="pageBottom"></div>');
	// 		
	// 		// Convert all H1 heading tags to images
	// 		$(this).find('h1.arrowHeading').each(function() {
	// 			$(this).replaceWith('<img class="arrowHeading" src="fonts/fontwriter.php?text=' + escape($(this).text()) + '" alt="' + $(this).text().replace(/"/g, "&quot;") + '"/>');
	// 		});
	// 	});
	// });
	
	setInterval(pollHash, 500);
	
	$('.page').each(function() {
		
		// Add in curves at top and bottom
		$(this).prepend('<div class="pageTop"></div>').append('<div class="pageBottom"></div>');
		
		// Convert all H1 heading tags to images
		$(this).find('h1.arrowHeading').each(function() {
			$(this).replaceWith('<img class="arrowHeading" src="fonts/fontwriter.php?text=' + escape($(this).text()) + '" alt="' + $(this).text().replace(/"/g, "&quot;") + '"/>');
		});
	});
	
	$('#pageWrapper').scrollable({
		size: 1,
		speed: 800,
		clickable: false
	}).navigator({
		navi: '#menu',
		naviItem: 'a',
		activeClass: 'current'
	});	
	
	$('#menu a').click(function() {
		window.location.hash = $(this).parent().attr('id');
	});
    
    $("li.diyBlogArchiveYear").live('click', function(){
        $(this).next("ul.diyBlogArchiveMonths").slideToggle();
    });
    
    $("li.diyBlogArchiveMonth").live('click', function(){
        $(this).next(" ul.diyBlogArchiveTitles").slideToggle();
    });
    
    //popUpProperties($('#homeObject').contents().find('h1'));
});
