$(document).ready(function(){
	$('.photolinkshistoricalexamples a').lightBox();
	$('.photolinkshistoricalgal a').lightBox();

	$('.nicetable tbody tr:odd').addClass('altrow');
	
	$('.msgGood:visible').each(coolReveal);
	$('.msgError:visible').each(coolReveal);
	
	sCurrentFontSize = $.cookie('bfl_fontsize');
	if (sCurrentFontSize == '' || sCurrentFontSize == null)
	{
		$('#normal').addClass('fontsizeron');
	}
	else
	{
		$('#' + sCurrentFontSize).addClass('fontsizeron');
		$('body').removeClass();
		if (sCurrentFontSize != 'normal')
		{
			$('body').addClass(sCurrentFontSize);
		}
	}
	
	$('a.fontsizer').click(function(){
		sId = $(this).attr('id');
		$('body').removeClass();
		if (sId != 'normal')
		{
			$('body').addClass(sId);
		}
		
		$('.fontsizer').removeClass('fontsizeron');
		$(this).addClass('fontsizeron');
		
		$.cookie('bfl_fontsize', sId);
	});	
});

function coolReveal()
{
    $(this).hide();
    $(this).slideDown('slow'); 
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
