jQuery.noConflict();
(function($) {

	$('span.view-large').hide();
	myOp = 1;
	
	$(function() {
        var offset = $("#box").offset();
        var topPadding = 40;
        $(window).scroll(function() {
            if ($(window).scrollTop() > offset.top) {
                $("#box").stop().animate({
                    marginTop: $(window).scrollTop() - offset.top + topPadding
                },500);
            } else {
                $("#box").stop().animate({
                    marginTop: 0
                },500);
            };
        });
    });
	$(window).load(function(){
		$('#sort').masonry({ 
			columnWidth: 352,
			animate: true,
			itemSelector: '.box'
		}, 
		function() { $(this).css({

			});
		});
	});
	
	$(window).load(function(){
		$('#random-sort').masonry({ 
			columnWidth: 240,
			animate: true,
			itemSelector: '.random-box'
		}, 
		function() { $(this).css({

			});
		});
	});	
	
	// MouseOver Events
	$('.box').hover(function(){
		$('img', this).fadeTo("fast", 0.75).addClass('box-hover');
		$('span.view-large', this).fadeTo("fast", 1)},
	function(){
			$('img', this).fadeTo("fast", myOp).removeClass('box-hover');
			$('span.view-large', this).fadeTo("fast", 0)
	});
	
	// Colorbox
	$("a[rel='gallery']").colorbox({
		maxWidth: '85%',
		maxHeight: '85%'
	});
	
})(jQuery);
