// jQuery basic
jQuery.noConflict();

// remove false-class
jQuery(document).ready(function(){
	jQuery('#primary').children('div').removeClass('false');
});

// Masonry Grid Setting
jQuery(function(){
    var 
        speed = 1000,   // animation speed
        $wall = jQuery('#primary')
    ;

    $wall.masonry({
        columnWidth: 240, 
        // only apply masonry layout to visible elements
        itemSelector: '.box:not(.invis)',
        animate: true,
        animationOptions: {
            duration: speed,
            queue: false
        }
    });

    jQuery('#filtering-nav span').click(function(){
        var colorClass = '.' + jQuery(this).attr('class');
		
		jQuery(this).parent().siblings().removeClass("active-filter");
		jQuery(this).parent().removeClass("inactive-filter").addClass("active-filter");
		
        if(colorClass=='.all') {
            // show all hidden boxes
            $wall.children('.invis')
                .toggleClass('invis').fadeIn(speed);
        } else {    
            // hide visible boxes 
            $wall.children().not(colorClass).not('.invis')
                .toggleClass('invis').fadeOut(speed);
            // show hidden boxes
            $wall.children(colorClass+'.invis')
                .toggleClass('invis').fadeIn(speed);
        }
        $wall.masonry();

        return false;
    });
});

// fade out sibbling in gallery
jQuery(document).ready(function(){
	// opacity fade on links
	jQuery('.box').hover(function() {
		jQuery(this).siblings('.box').not('.invis').stop().fadeTo(200,0.5);
	}, function() {
		jQuery(this).siblings('.box').not('.invis').stop().fadeTo(400,1);
	});
});

// fade out sibbling in gallery
jQuery(document).ready(function(){
	// opacity fade on links
	jQuery('.single-image').hover(function() {
		jQuery(this).siblings('.single-image').children('a').stop().fadeTo(200,0.5);
	}, function() {
		jQuery(this).siblings('.single-image').children('a').stop().fadeTo(400,1);
	});
});

// remove last bg-image of linklist
jQuery(function(){
	jQuery('.event-meta span:last-child').css("background-image", "url(none.jpg)");
	jQuery('.event-navigation li:last-child').css("background-image", "url(none.jpg)");
	jQuery('#meta-nav li:first-child').css("background-image", "url(none.jpg)");
});

//// special content
jQuery(document).ready(function() {
    jQuery('#special').stop().delay(3000).animate(
		{ top: 70 }, {
		    duration: 1500,
		    easing: 'easeOutElastic'
		}
	);
});

jQuery(document).ready(function() {
    jQuery('.specialClose').click(function(event) {
        jQuery("#special")
            .animate(
                { top: -200 }, {
                    duration: 700,
                    easing: 'easeInBack'
                });
		});
});

Shadowbox.init({
	overlayColor: "#fff",
	overlayOpacity: 0.7,
	viewportPadding: 5,
	counterType: "skip",
	continuous: true,
	slideshowDelay: 5
});
