﻿$(document).ready(function() {
    $('a.lightbox').bind('click', function(event) {
        event.preventDefault();

        var iframe = $('<iframe id="lightbox" frameborder="0"></iframe>');

        if (window.pageDialogOpen) {
            $(iframe).bind('dialogopen', pageDialogOpen);
        }

        $(iframe)
            .attr('src', $(this).attr('href'))
            .dialog({
                height: parseInt($(this).attr('lightboxHeight')),
                width: parseInt($(this).attr('lightboxWidth')),
                title: $(this).attr('title'),
                resizable: false,
                draggable: false,
                modal: true,
                dialogClass: $(this).attr('dialogClass')
            });

        if ($(this).attr('noRefresh') != 'true') {
            $(iframe).bind('dialogclose', function(event, ui) {
                window.location.reload();
            });
        }

        if (window.dialogClose) {
            $(iframe).bind('dialogclose', pageDialogClose);    
        }
    });
});

