/* ------------------------------------------------------------------------------------------ */
/* jQuery Masonry */
/* ------------------------------------------------------------------------------------------ */
$(window).load(function(){
	
	var $container = $('ul#article_category');
	$container.imagesLoaded(function(){
	  $container.masonry({
		itemSelector : '.masonry',
	    resizeable: true,
	    saveOptions: true
	  });
	});
	
	
});
/* ------------------------------------------------------------------------------------------ */
/* jQuery Mottie-Equalizer: https://github.com/Mottie/Equalizer */
/* ------------------------------------------------------------------------------------------ */

$(function() {

  $('div#body div#portfolio ul > li').equalizer();
  
});

/* ------------------------------------------------------------------------------------------ */
/* jQuery Tiptip: http://code.drewwilson.com/entry/tiptip-jquery-plugin */
/* ------------------------------------------------------------------------------------------ */
$(function(){
	$("form#form_contatti fieldset div.form_row label").tipTip({
		delay: 100,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "I campi contrassegnati da un asterisco sono obbligatori"
	});
	
	$("div.portfolio_single div.portfolio_header div.portfolio_single_ribbon").tipTip({
		delay: 100,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: "E' possibile acquistare l'elaborato seguendo il link all'interno di questa pagina"
	});
	$("div#wrapper div#mainmenu_wrapper div#menu_social ul li a").tipTip({
		delay: 100,
		fadeIn: 200,
		fadeOut: 200,
		attribute: "title",
		edgeOffset: 0, 
		defaultPosition: "top",
		content: ""
	});
		
});	



/* ------------------------------------------------------------------------------------------ */
/* jQuery Nivoslider */
/* ------------------------------------------------------------------------------------------ */
$(window).load(function() {
	$('#slide').nivoSlider({
        effect: 'random', // Specify sets like: 'fold,fade,sliceDown'
        slices: 15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 500, // Slide transition speed
        pauseTime: 6000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: false, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
/* ------------------------------------------------------------------------------------------ */
/* jQuery Fancybox */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {

	$("div.gallery a").attr('rel', 'gallery').fancybox({
		'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none'
	});		

	$("div.wp-caption a").attr('rel', 'gallery').fancybox({
		'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none'
	});		
	
	$("div.portfolio_header a.portfolio_single_thumb").fancybox({
		'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none'
	});		
	

	
	$("a#contacts_link").fancybox({
		'titlePosition'		: 'inside',
		'width'				: '600px',
		'height'			: '400px',	
		'autoScale'			: false,							
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'	
	});	
			
});
/* ------------------------------------------------------------------------------------------ */
/* Jquery Hover */
/* ------------------------------------------------------------------------------------------ */
jQuery(document).ready(function() {				
	wp_gallery();
	wp_attachment_img();
	blog_thumb();
	portfolio_thumb();
	portfolio_sidebar_thumb();
	portfolio_single_thumb();
	bottom_banner_thumb();
});
function wp_gallery() {
jQuery('div.gallery a img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.2);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}	
function wp_attachment_img() {
jQuery('div.wp-caption a img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.4);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function blog_thumb() {
jQuery('ul#article_category li div.article_blog div.article_blog_header a img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.1);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function portfolio_thumb() {
jQuery('div#portfolio ul li a.portfolio_thumb img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.1);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function portfolio_sidebar_thumb() {
jQuery('div#sidebar ul.posts li img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.1);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function portfolio_single_thumb() {
jQuery('div.portfolio_header a.portfolio_single_thumb img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.1);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function article_blog_thumb() {
jQuery('ul#article_category li div.article_blog div.article_blog_header a img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.2);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
function bottom_banner_thumb() {
jQuery('div#bottom_banners ul li div.banner_content_wrapper div.banner_header a img').hover(function(){
		jQuery(this).stop().fadeTo(500, 0.2);
	}, function() {
		jQuery(this).stop().fadeTo(500, 1);
	});
}
/* ------------------------------------------------------------------------------------------ */
/* jQuery SmoothScroll | Version 11-03-14 */
/* ------------------------------------------------------------------------------------------ */
$(document).ready(function() {
   
    $('a[href=#wrapper]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
    $('a[href=#body]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
});


