$(document).ready(function(){
    var $gal_container = $('#business-gallery-links');

    var $business_gallery = $gal_container.imagesLoaded(function(){
        $gal_container.masonry({
            // set itemSelector so .grid-sizer is not used in layout
            itemSelector: '.business-unit',
            // use element for option
            columnWidth: '.business-unit-sizer',
            gutter: 5,
            percentPosition: true,
            initLayout: true
        });
    });


    $gal_container.on('click', function (event) {
        event = event || window.event;
        var target = event.target || event.srcElement,
            link = target.src ? target.parentNode : target,
            options = {index: link, event: event},
            links = this.getElementsByTagName('a');
        blueimp.Gallery(links, options);
    });

});