jQuery( function($) {
	$('a.nc').live('click', function() {
		return false;
	});
	
	$('#slideshow').each( function() {
		$s = this;
		$('.next, .prev').click( function() {
			var $next, $cur = $('li.active', $s);
			if( $(this).hasClass('next') ) {
				if( $cur.next().length > 0 ) {
					$next = $cur.next();
				}else {
					$next = $cur.parent().children().first();
				}
			}else {
				if( $cur.prev().length > 0 ) {
					$next = $cur.prev();
				}else {
					$next = $cur.parent().children().last();
				}
			}
			
			$next.addClass('active').siblings().removeClass('active');
			$('.image', $next).fadeTo(10, .3, function(){
				$(this).fadeTo(2000, 1);
			});
			
			$('.title', $next).css({
				left: 900,
				opacity: 0
			}).animate({
				left: 135,
				opacity: 1
			}, 1000, 'easeOutBack');
			
			$('.info', $next).css({
				top: 500,
				opacity: 0
			}).animate({
				top: 150,
				opacity: 1
			}, 1000, 'easeOutBack');
		});
	});
	
	setInterval( function(){
		$cur = $("#from-blog .active");
		if( $cur.next().length > 0 ) {
			$next = $cur.next();
		}else {
			$next = $cur.parent().children().first();
		}
		
		$cur.fadeOut('slow', function() {
			$(this).removeClass('active');
			$next.addClass('active').hide().fadeIn('slow');
		});		
		
	}, 4000);
});
