(function()
{
    'use strict';

    var page = jQuery(document);

    page.on('contentloaded', function(event)
    {
        var block = jQuery(event.target);

        var openButton  = block.find('.button.open');
        var closeButton = block.find('.button.close');

        var params = {
            source: '.dialog.loader',
            modal: true
        };

        openButton.on('click', function(event)
        {
            page.trigger('dialog:open', params);
        });

        closeButton.on('click', function(event)
        {
            page.trigger('dialog:close');
        });
    });

}());
