 // Sets the font size
function setFontSize(fontSize)
{
 $("span.fonts-box a.active").removeClass("active");
 $("a." + fontSize).addClass("active");

 // Loop through the alternate style sheets
 $("link[title]").each(function(i)
 {
 this.disabled = true;

 // If this is the matching style sheet
 if($(this).attr("title") == fontSize)
 {
 this.disabled = false;
 }
 });
}

$(document).ready(function()
{
 // If not in print mode
 if(!$(document).getUrlParam("print"))
 {
 var fontSize = $.cookie("font-size");

 // If the font size is not set default to medium
 if(!fontSize)
 {
 fontSize = "font-med";
 }

 setFontSize(fontSize);

 // When a fonts box links is clicked update the cookie and switch the style sheet
 $("span.fonts-box a").click(function(event)
 {
 // If this is not the already active size
 if(!$(this).hasClass("active"))
 {
 var newFontSize = $(this).attr("class");

 $.cookie("font-size", newFontSize);
 setFontSize(newFontSize);
 }

 event.preventDefault();
 });
 }
}); 
