function setupShadowBox()
{
	Shadowbox.setup();
}

jQuery(document).ready(function($)
{
	//use the img alt value as the anchor title value - titles cannot be added via contribute but alts can
	$('.galleryPage .accordion div a img').each(function(counter)
	{
		var _$this = $(this);
		
		var imgAlt = _$this.attr('alt');
		
		_$this.parent('a').attr('title',imgAlt);										 
	});
	
	setupShadowBox(); //init shadowbox()
	
	//add class of .last to the 6th gallery image so that client can update via Contribute without worrying about this
	$('.galleryPage .accordion div a img').parent().each(function(counter)
	{
		var myRemainder = counter % 6; //counter starts at zero
		
		if(myRemainder == 5)
		{
			$(this).addClass('last');
		}
	});
	
	//add class of .first to 1st gallery image so client doesn't need to
	$('.galleryPage .accordion div a img:eq(0)').parent().addClass('first');
	
	$("#main .accordion").accordion(
	{
		header: "h3",
		autoHeight: false //fixes showing scrollbars in ie6
	});
	
	$(".accordion h3 a").ajaxContent(function()
	{
		$("#sub .accordion").accordion(
		{
			header: "h4",
			autoHeight: false, //fixes showing scrollbars in ie6
			collapsible: true,
			active: false
		});								 
	});
	
	$("#sub .accordion").accordion(
	{
		header: "h4",
		autoHeight: false, //fixes showing scrollbars in ie6
		collapsible: true,
		active: false
	});
	
	//must remove this element in this fashion since IE confuses the css with another span
	//afaik there is not an accordion option to not create this element which would be ideal
	$('.accordion span.ui-icon').remove();
});

Shadowbox.init(
{
	skipSetup: true, //running setup manually so that ajaxed images can then be included
	path: "assets/js/"
});