    $(document).ready(function(){

        $("#contenttabs").tabs({ fx: { opacity: 'toggle' } });

        $("body#news #sectionmenu ul#nav-sub li:contains('News'), body#news #nav li#navabout-us ul.nav-sub li:contains('News')").addClass("here");
        $('ul#nav-sub.child-here li:first').removeClass("here");

        $('#contentbody h2:first,#contentsidebar h2:first').addClass("notopmargin");

        $('#contentsidebar dt:last').addClass("last");
        
        $('.roundcorners,#sectionmenu ul li.here')
            .prepend('<div class="tlcnr"></div>' + '<div class="trcnr"></div>')
            .append('<div class="blcnr"></div>' + '<div class="brcnr"></div>');   // this function adds a small 4px radius corner to a block on a white background

        $('#hero ul')
            .after('<div id="heronav">')
            .cycle({ 
                fx:    'scrollLeft', 
                timeout: 10000,
                pause: 1,
                pager:  '#heronav'
        });

        $("ul.sf-menu").superfish({
            delay:  500,
            animation: {opacity:'show',height:'show'},
            speed: 'fast',
            autoArrows:  false
        });

        // $("ul.sf-menu ul").find("li:last").addClass("lastitem");

        $("#nav ul.sf-menu li ul").each(function(){         // this function centres the drop-down menus under each of their top level nav bar items
            var pwidth = $(this).parent().width();          // get width of LI parent
            var cwidth = $(this).width();                   // get width of drop-down menu UL
            var marginleft = ((cwidth - pwidth) / 2);       // this is the value that the item needs to be negatively set on left margin
            $(this).css("margin-left",(0 - marginleft));    // set the new margin-left value directly onto the selector
        });
        
        $('#newsitems ul')
            .cycle({ 
                fx:    'scrollHorz', 
                timeout: 6000,
                next:  '#newsnext',
                prev:  '#newsprev', 
                pause: 1
        });
        
        $('#featuremulti ul')
            .cycle({ 
                timeout: 10000,
                next:  '#featurenext',
                prev:  '#featureprev', 
                pause: 1
        });
        
        $('#featurepartners .featurephoto').cycle({ 
            delay:  350, 
            speed:  400
        }); 

        // $("#pagetitle h1").each(function(){                 // this function puts the correct margin above the call to action based on height of page title
        //    var theight = $(this).height();                 // get height of title
        //    $("#calltoaction").css("padding-top",theight);  // apply the new padding-top value directly onto the selector
        //});
        
        $('#testimonialmorelink').mouseup(function(){
            $('#testimoniallink').click();
        });

        $("a[rel^='prettyPhoto']").prettyPhoto({
            animationSpeed: 'normal', /* fast/slow/normal */
            padding: 40, /* padding for each side of the picture */
            opacity: 0.35, /* Value betwee 0 and 1 */
            showTitle: true, /* true/false */
            allowresize: true, /* true/false */
            counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
            theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
            callback: function(){}
        });

	    $('dl.yearlyarchives').accordion({ 
	        header: 'dt',
	        collapsible: true, 
	        animated: false,
	        active: false
	    });
   	    
        $('dl.yearlyarchives').each(function(){         // get current year from accordion menu id and activate appropriate year in menu
            var listyear = $(this).attr('id');
            if (listyear != '') {
              $('dl.yearlyarchives').accordion('activate', 'dt#yearlist-' + listyear);
            } else {
			  $('dl.yearlyarchives').accordion('activate', 'dt:first');
			}
        });


	
    });
