$(document).ready(function() {
    
    slideshows();
    nav_access();
    news_lightbox();
    
});


/* Slideshows with jQuery Cycle
----------------------------------------------------------- */
function slideshows() {
    $('ul.slideshow').cycle({
        fx: 'scrollLeft',
        easing: 'easeOutQuad',
        speed: 800,
        timeout: 7500,
        pause: 1,
        pager: 'ul.services', 
        pagerAnchorBuilder: function(idx, slide) { 
            // return selector string for existing anchor 
            return 'ul.controls li:eq(' + idx + ') a'; 
        } 
        
    });
}


/* Adds a class of 'focus' to focused skip links
----------------------------------------------------------- */
function nav_access() {

    $('ul#nav_access li a').focus(function(){
    	$(this).addClass('focus');
    });
    $('ul#nav_access li a').blur(function(){
    	$(this).removeClass('focus');
    });

}

/* Opens news items in a lightbox
----------------------------------------------------------- */
function news_lightbox() {
    $('#news p.read_more a').colorbox({
        inline: true,
        href: function() { return '#' + $(this).attr('rel'); },
        width: '500px',
        height: '60%',
        opacity: 0.7
    });
}

