$(document).ready( function() {
	
	// Set first and last classes for li tags in sidebar
	$("#sideNavWrapper ul li:first").addClass("first");
	$("#sideNavWrapper ul li:last").addClass("last");
	
	// Auto display QuickSMS plugin if form was submitted
	if($('#quickSMSConfirmation').text() != "") {
		$('#quickSMSContainer').show();
	}
		
	// Handle all external links with [rel=external] set - send to new window :-)
	$('A[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;	
	});
	
	// Make links from Sociable plugin open externally
	$('div.sociable ul li a').attr('rel','external nofollow').click( function() {
		window.open( $(this).attr('href') );
		return false;	
	});
	
	// Add nofollow and external to link love from cFormsII
	$('.linklove').attr('rel','external nofollow').click( function() {
		window.open( $(this).attr('href') );
		return false;	
	});
	
	// Add nofollow and external to links in popup
	$('body.popup a').attr('rel','external nofollow').click( function() {
		window.open( $(this).attr('href') );
		return false;	
	});
	
	// Determine current blog post and set link as current in sidenav
	//   iff the current artlicle is in the recent post list!
	$("#sideNavWrapper ul li:contains('" + $("#col1.isPost h1:first").html() + "')").addClass("current_page_item");
		
});
