$(document).ready(function() {
	
	load_animations();
	
	$('div#st_vertical').slideTabs({
		contentAnim: 'slideH',
		contentAnimTime: 600,
		contentEasing: 'easeInOutExpo',
		orientation: 'vertical',
		tabsAnimTime: 300,
		autoHeight: true
	});
	
	$('#shareme').sharrre({
	  share: {
		googlePlus: true,
		facebook: true,
		twitter: true
	  },
	  url: 'http://www.e-maginair.com',
	  enableTracking: true,
	  buttons: {
		googlePlus: {size: 'tall'},
		facebook: {layout: 'box_count'},
		twitter: {count: 'vertical'}
	  },
	  hover: function(api, options){
		$(api.element).find('.buttons').show();
	  },
	  hide: function(api, options){
		$(api.element).find('.buttons').hide();
	  }
	});
	
	/*********************
	quicksand
	*********************/		
	$clientsHolder = $('ul.portfolio');
	$clientsClone = $clientsHolder.clone(); 
 
	$('.filter_portfolio a').click(function(e) {
		e.preventDefault();
	 
		$filterClass = $(this).attr('class');
	 
		$('.filter_portfolio li').removeClass('active');
		$(this).parent().addClass('active');
	 
		if($filterClass == 'all'){
			$filters = $clientsClone.find('li');
		} else {
			$filters = $clientsClone.find('li[data-type~='+ $filterClass +']');
		}
	 
	   $clientsHolder.quicksand( $filters, {
			duration: 300,
			easing: 'easeInOutQuad'
		}, function(){
			 $("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',theme:'facebook', allow_resize: false});
			 	$('.zoom img').each(function() {
                $(this).hover(
                    function() {
                        $(this).stop().animate({ opacity: 0.5 }, 'slow');
                    },
                   function() {
                       $(this).stop().animate({ opacity: 1.0 }, 'slow');
                   })
     			});
				$('.portfolio_li.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});						
		});
		
	});
	
	$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',theme:'facebook',slideshow:5000});
	
	$('.portfolio_li.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});					
	});
	
	$('#featured').orbit({
		 animation: 'fade',
		 timer: true,
		 directionalNav: false,
		 captions: false
	});
	
	$("#onglet").tabs("#contenu_onglet > div", {effect: 'slide', history: true});

});
