jQuery(document).ready(function() {	
	
		$('#news-list').masonry
		({
			itemSelector: '.box',
			isAnimated: true,
			animationOptions: 
				{
				duration: 0,
				easing: 'linear',
				queue: false
				}
		});

	// Language options
	$('#openLangs, #closeLangs').live('click',function (e) {
		$('#langs').toggle();
		e.preventDefault();
		$('html,body').scrollTop($('body').height());
	});

	// Body overflow fixing
	var headerHeight = $('#header').height();
	
	// Back to top
	$('.back-to-top').click(function (e) {
		e.preventDefault();
		$('html,body').animate({scrollTop: 0}, 500, 'easeOutQuint');
	});

	jQuery(".sub-menu").delegate("li", "mouseover mouseout", function(e) {
            if (e.type == 'mouseover') {
                    $(".sub-menu li").not(this).dequeue().animate({opacity: "0.3"}, 0);
            } else {
                    $(".sub-menu li").not(this).dequeue().animate({opacity: "1"}, 0);
            }
	});
	
	$('.img-th').click(function () {
		var path = $(this).children('img').attr('src').replace(/thumb_/, 'img_');
		$('.preview').children('img').attr('src', path);
	});

});
