$(function() {
	$('.post-image-slider').each(function(){
		$('.' + $(this).find('ul').find('.current').find('a').attr('href') ).css({opacity: 1.0});
	});
	
	//$($('.post-image-slider  li.current').find('a').attr('href')).each(function(){ $(this).css({opacity: 1.0}); });
	$('.post-image-slider  li a').click(function(e)
	{
		e.preventDefault(); //Cancel the link behavior
		
		if($(this).parent('li').attr('class') != 'current'){
			// old picture
			var old_li = $(this).parent('li').parent('ul').find('.current');//$('.post-image-slider  li[class=current]');
			$( '.' + old_li.find('a').attr('href') ).animate({opacity: 0.0}, 1000);
			old_li.removeClass('current');
			
			// target picture
			$(this).parent('li').addClass('current');
			$('.' + $(this).attr('href')).animate({opacity:1.0}, 1000);
		}
	});
});
