(function($){var smash=window.smash||{};smash.viewingOptions=(function(){var textSizes=[80,90,100,110,120],styleSheets=["link#normal-styles","link#contrast-styles"],currentTextSize;var init=function(){currentTextSize=2;if(typeof $.cookie("textSize")=="string"){currentTextSize=parseInt($.cookie("textSize"));sizeText(currentTextSize)}if(typeof $.cookie("styleSheet")=="string"){chooseStyleSheet(parseInt($.cookie("styleSheet")))}hideViewingOptions(0);$("#voMainLink span").wrapInner('<a href="#" id="voMainLinkAnchor"></a>');$("#voMainLink:hover").css("cursor","pointer");$("#voMainLinkAnchor").click(function(ev){toggleViewingOptions(300);ev.preventDefault()});$("#voFonts1 a").click(function(ev){sizeText(0);ev.preventDefault()});$("#voFonts2 a").click(function(ev){sizeText(1);ev.preventDefault()});$("#voFonts3 a").click(function(ev){sizeText(2);ev.preventDefault()});$("#voFonts4 a").click(function(ev){sizeText(3);ev.preventDefault()});$("#voFonts5 a").click(function(ev){sizeText(4);ev.preventDefault()});$("#voNormalColours").click(function(ev){chooseStyleSheet(0);ev.preventDefault()});$("#voContrastColours").click(function(ev){chooseStyleSheet(1);ev.preventDefault()})};var toggleViewingOptions=function(duration){$("#voOptions").slideToggle(duration)};var showViewingOptions=function(duration){$("#voOptions").slideDown(duration)};var hideViewingOptions=function(duration){$("#voOptions").slideUp(duration)};var sizeText=function(size){currentTextSize=size;$.cookie("textSize",currentTextSize,{expires:365,path:"/"});$(".voFonts li").each(function(){$(this).removeClass("current");if($(this)[0].id.indexOf((currentTextSize+1).toString())!==-1){$(this).addClass("current")}});setTextSize()};var setTextSize=function(){$(document.body).css("font-size",textSizes[currentTextSize]+"%")};var chooseStyleSheet=function(index){$.cookie("styleSheet",index,{expires:365,path:"/"});$.each(styleSheets,function(){$(this.toString())[0].disabled=true});$(styleSheets[index])[0].disabled=false};return{init:init}}());smash.navHighlight=(function(){var currentURI,currentSection;var excludedPrimaries=["category"];var navigationQuery="#main-navigation li";var init=function(){currentURI=window.location.href;currentSection=getSection(currentURI);if(smash.currentCategory&&typeof smash.currentCategory==="string"){currentSection=smash.currentCategory}highlightCurrentSection()};var getSection=function(uri){var trimmed=uri.replace(/^https?:\/\/[\w\.\-]+/,"").replace(/^\//,"").replace(/\/$/,"");var sections=trimmed.split("/");if(sections.length){if($.inArray(sections[0],excludedPrimaries)>0&&sections.length>1){return sections[1]}else{return sections[0]}}else{return""}};var highlightCurrentSection=function(){$(navigationQuery).each(function(){if(currentSection==getSection($(this).find("a").attr("href"))){$(this).addClass("current");return false}})};return{init:init}}());$(smash.viewingOptions.init);$(smash.navHighlight.init);window.smash=smash}($));