$(document).ready(function() {
  // show and hide event details
  $('.event-preview .details-link').click(function() {
    var parent = $(this).parents("div.event-preview");
    parent.next().toggle();
    return false;
  });
  
	$('#slideshow').after('<ul id="slideshow-nav"></ul>');
	$('#slideshow').cycle({
			fx: 'fade',
			speed: 3600,
			pager: '#slideshow-nav',
			timeout: 9600,
			
			pagerAnchorBuilder: function(idx, slide){
				return '<li><a href="#">'+ $(slide).attr('alt') +'</a></li>'
			}
	});
	
	$('a#audio-player-callout').click(function() {
		window.open("http://staging.centresource.com/anniemoses/audio-player/", "Annie Mpses Band Audio Player", "status=0, location=0, toolbar=0,resizable=0, height=325px, width=198px");
		
		return false;
	});
	
  $('ul.tweets').after('<a class="twitter-follow" href="http://twitter.com/AnnieMosesBand" target="_blank">Follow @AnnieMosesBand on Twitter</a>');	
	//$('ul.xoxo li.widget').prepend('<span class="sidebar-gradient-header">&nbsp;</span>');
	//$('ul.xoxo li.widget').append('<span class="sidebar-gradient-footer">&nbsp;</span>');
	//$('ul.xoxo li.widget').addClass('sidebar-container');
	$('#categories-list .sidebar-container-wrapper').hide();
	$('#categories-list span.sidebar-gradient-header').hide();
	$('#categories-list span.sidebar-gradient-footer').hide();
	$('#categories-list').css('padding-top', '4px')
	
	$('a.hide').hide();
	$('a.show').click(function() {
		$('#categories-list span.sidebar-gradient-header').show();
		$('#categories-list span.sidebar-gradient-footer').show();
		$('#categories-list').css('padding-top', '50px');
		$('#categories-list .sidebar-container-wrapper').slideDown(400, function() {
			$('a.show').fadeOut('fast', function() {
				$('a.hide').fadeIn('slow');
			});
			
		});
		;
	});
	$('a.hide').click(function() {
		$('#categories-list span.sidebar-gradient-header').fadeOut('fast');
		$('#categories-list span.sidebar-gradient-footer').fadeOut('fast');
		$('#categories-list').animate({'paddingTop': '4px'}, 300)
		$('#categories-list .sidebar-container-wrapper').slideUp(400, function() {
			$('a.hide').fadeOut('fast', function() {
				$('a.show').fadeIn('slow');
			});
			;
		});
		;
	});
});
