$(document).ready(function(){

// This is for the navigation highlighting
	
jQuery('li.active').parent('ul').addClass('activeParent');
jQuery('li.active').parent('ul').parent('li').addClass('active');
jQuery('.dateStamp + p').addClass('introParagraph');	

jQuery('span.author').parent('li').addClass('author');

// This calls the lightbox as necessary 

//jQuery("a[@rel*=lightbox]").lightBox();

// This handles the pseudo-accordion on the gallery pages

$('#centralFocus h2').click(function() {
        $(this).next().toggle("slow");
        return false;
}).next().hide();
$('.firstToggle').toggle();

// This toggles the style switcher 

$('#styleHeader').click(function() {
        $(this).next().toggle("slow");
        return false;
})
$('#styleSwitcher ').toggle();
$('#brownSwatch').click(function() {
	$('#stylesheet').attr('href','/_css/version5/unified-brown.css');
	
	$.get("/includes/version5/colorChooser.php", { t: "brown" } );
	return false;
});
$('#whiteSwatch').click(function() {
	$('#stylesheet').attr('href','/_css/version5/unified-white.css');
	
	$.get("/includes/version5/colorChooser.php", { t: "white" } );
	return false;
});
	
// This creates the background letters

if( jQuery.browser.msie && (jQuery.browser.version <= 6)) {

} else {

	function setBackgroundLetter() {
		var first_paragraph = $('#content h1')[0];
		var first_paragraph = $('#content h1')[0];
		if ( !first_paragraph ) return false;
		var text = first_paragraph.firstChild.nodeValue;
		var first_letter = text.substr(0,1);
		var newClassname = 'class' + first_letter;

		jQuery('#content').addClass(newClassname);
	}

	setBackgroundLetter();

}

});