//////////////////////
// Initialize document
////////////////////

var baseurl = "http://blog.boondoggle.eu";
//var baseurl = "";

$(document).ready(function() {
	
	// hide boxes
		$(".toggle").siblings(".boxInner").hide();
		$(".toggle").css("background","#000000 url(" + baseurl +"/img/icons/ico-arrow-right.gif) no-repeat 20px 5px");
	
	// display author pictures
		$(".author > a").each(function() {
			var author = $(this).text().replace(/ /g,'-'); // strip spaces
			var author = author.toLowerCase();
			var parent = this.parentNode;
			var parent = parent.parentNode;
			$(parent).css("background", "url(" + baseurl +"/img/general/authors/" + author + "-thumb.gif) no-repeat left 2em");
			$(this).attr("href", baseurl + "/" + author + ".html");
		});
	
	// statistics on top of the page
		//var numberOfFeedreaders = NumberOfReaders();
		//var mostActiveAuthor = MostActiveAuthor();
		var mostActiveCommenter = MostActiveCommenter();
		
		//$("#numberOfFeedreaders ~ span").html(numberOfFeedreaders);
		//$("#mostActiveAuthor ~ span").html(mostActiveAuthor);
		$("#mostActiveCommenter ~ span").html(mostActiveCommenter);
	
	// set the number of days running
		var birthDate = new Date(2005, 9, 3);
		var todaysDate = new Date();
		var millisecondsPerDay = 1000 * 60 * 60 * 24; // set the amount of milliseconds per day (easier to calculate with later on)
		var ageInDays = Math.round((todaysDate - birthDate)/millisecondsPerDay);
		$("#numberOfDaysRunning ~ span").html(ageInDays);

	// Top 5 Most Read
		//var top5PopularFeeds = Top5PopularFeeds();
		//$("#top5MostRead").html(top5PopularFeeds);
	
	// add Magic button
		$("<div id='toggle'></div>").prependTo("#wrapper");
});
