        $(function(){


$('#main').masonry({
                columnWidth: 240, 
				easing: 'linear',
				duration: 'fast',
	});
			
			

/* Masonry filter effect */ 
 $('a.filter').click(function(){
  filterBoxes(this.id);
 })
   
 function filterBoxes(klass){
  if (klass == "all") { klass = "blog,web,identity,bits,unpublished" }
  $('#holder').find('.' + klass)
   .hide()
   .appendTo('#main')
   .fadeIn('200')
  $('#main').find('.box:not(.' + klass + ')')
   .fadeOut( '200', function(){
    $(this).appendTo('#holder') ;
   });
  setTimeout(function(){ $('#main').masonry() },500);
 }

 
 

	

 $('.expand').click(function () {
        if ($(this).is('.expanded')) {
            restoreBoxes();
        } else {
            var size = ($(this).attr('data-size')) ? $(this).attr('data-size').split(',') : defaultSize;
            $(this)
            // save original box size
            .data('size', [$(this).width(), $(this).height()]).animate({
                width: size[0],
                height: size[1]
            }, function () {
                // show hidden content when box has expanded completely
                $(this).find('.expandable').show('normal');
                $(this).find('.hideable').hide('normal');
                $('#main').masonry();
            });
            restoreBoxes();
            $(this).addClass('expanded');
        }

        function restoreBoxes() {
            var len = $('.expanded').length - 1;
            $('.expanded').each(function (i) {
                var box = $(this).data('size');
                $(this).find('.expandable').hide('normal');
                $(this).find('.hideable').show('normal');
                $(this).animate({
                    width: (box[0] || 100),
                    height: (box[1] || 'auto')
                }, function () {
                    if (i >= len) {
                        $('#main').masonry();
                    }
                }).removeClass('expanded');
            })
        }
    });





 
/* PrettyPhoto defaults */ 
$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			opacity: 0.80, /* Value between 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			
		});

/* Title wraps fade on hover - add fadecap in addition to (color)cap to the class to get a hover fade transition */
$('.box img:has(.fadecap)').hover(
    function() { $(this).find('.fadecap').fadeOut(); },
    function() { $(this).find('.fadecap').fadeIn(); }
);


 $('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});

            





})