
jQuery(document).ready(function($){

// onAfter function hides or shows next and previous links as needed
function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    $('#prev')[index == 0 ? 'hide' : 'show']();
    $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
}

$('div.gallery')
.after('<div class="gallerynav">')
.cycle({ 
    fx:     'scrollHorz',  
    speed:  '1000', 
    timeout: 0, 
    prev:    '#prev',
    next:    '#next',
    after:   onAfter,
    pager:  '.gallerynav'
    }); 
    
/* Thumbnail grid hover dropdowns */

$("div.workblock p").hide(); 
	
$("div.workblock").hover(
	function () {
	if ($.browser.msie) $("p", this).show();
	$("p", this).animate({ height: 'show' }, 'fast');
    }, 
    function () {
    if ($.browser.msie) $("p", this).hide();
    $("p", this).animate({ height: 'hide' }, 'fast');
    }); 
    
$("ul#nav").accordion();
 
}); 



