var news = {
    del: function(newsId, img)
    {
        if (confirm('Продолжить?')) {
            var ajax = new leto.ajax('/advice/ajaxadmin/delete/');
            ajax.onSuccess = function()
            {
                $(img).parent().parent().remove();
            }
            ajax.query({ id: newsId });
        }

        return false;
    }
}

$(document).ready(function(){
    $('div.news-item img').css('cursor', 'pointer').click(function(){

        if ('a' == $(this).parent().attr('tagName').toLowerCase() || $(this).hasClass('nobig')) {
            return true;
        }

        var w = $(this).width() * 2;
        var h = $(this).height() * 2;

        var docH = $(window).height();

        if (h > docH) {
            h = docH; var m = 0;
            w = w - (h - docH) / (h / w);
        } else {
            m = (docH - h) / 2;
        }

        $.blockUI({ message: '<div id="block" style="background: none;" onclick="$.unblockUI(); $(this).remove();" style="cursor: pointer;" title="Нажмите, чтобы закрыть"></div>', css: { top: m + 'px', backgroundColor: 'transparent', border: 0 } });
        $(this).clone().width(w).height(h).appendTo('#block');
    });
});
