﻿function editGalleryItem(id, button) {
    var form = $('.gallery_editor_form');
    form.prodialog('open');

    form.children('input').last().val(id)

    form.prodialog('loadDialogData');
}

function openGalleryEditorForm(id) {
    var form = $('.gallery_editor_form');
    form.children('input').last().val('-1')
    form.prodialog('open');
    form.prodialog('loadDialogData');


}

function initColorBox(selector, currentFormatString) {
    $(selector).colorbox({
        maxHeight: '90%',
        maxWidth: '90%',
        current: currentFormatString,
        title: function() {

            var retval = '';
            var $this = $(this);
            var title = $this.attr('title');
            var description = $('img', $this).attr('data-description');
            if (title.length > 0)
                retval += '<strong>' + title + '</strong>';

            if (description && description.length > 0)
                retval += '<p>' + description + '</p>';

            if (retval.length > 0) {
                retval = '<div>' + retval + '</div>';
            }

            return retval;
        }
    });
}
