$(function(){
	
	$('#fader').cycle({
		fx:		'fade',
		sync:	0,
	});
	
	$('#rotator').cycle({
		fx:		'fade'
	});
	
	$('.gallery').css({
		'width': '1030px',
		'left' : '0px',
		'position' : 'relative'
	});

	$('.clients .entry p').after('<div class="controls group"><span class="prev disabled">Previous</span><span class="next">Next</span></div>');

	$('.controls .next').click(function(){
		if ( $(this).hasClass('disabled') ) {
			$.noop;
		}
		else {
			$(this).addClass('disabled');
			$('.controls .prev').removeClass('disabled');
			$('.gallery').animate({
				left: '-=412px'
			}, 1000);
		}
	});


	$('.controls .prev').click(function(){
		if ( $(this).hasClass('disabled') ) {
			$.noop;
		}
		else {
			$(this).addClass('disabled');
			$('.controls .next').removeClass('disabled');
			$('.gallery').animate({
				left: '+=412px'
			}, 1000);
		}
	});
	
	$(".linaker-card").hover(function() {

		var $this = $(this);
		var $img = $this.find('.photo');
		var $details = $this.find('.details');
				
		$this.css({ 'z-index' : '100' });

		if (!$this.hasClass('animated')) {

			$img
				.dequeue()
				.stop()
				.animate({

					marginTop: '-76px',
					marginLeft: '-77px',
					top: '50%',
					left: '50%',
					width: '154px',
					height: '152px'

				}, 50, function() {

					$details
						.show()
						.animate({

							paddingLeft: '174px'

						}, 50);

				});
		}

	}, function(){

		var $this = $(this);
		var $img = $this.find('.photo');
		var $details = $this.find('.details');
		
		$this.css({ 'z-index' : '50' });

		$this.addClass('animated');

		$details
			.dequeue()
			.animate({
				
				paddingLeft: '0px'

			}, 100, function(){

				$details.hide();

				$img
					.animate({

						marginTop: '0',
						marginLeft: '0',
						top: '0%',
						left: '0%',
						width: '104px',
						height: '102px'

					}, 200, function() {

						$this.removeClass('animated').dequeue();					

					})

				$this.css({ 'z-index' : '0' });

			});
	});
	
});
