﻿
$(document).ready(function () {

    $("body").append('<div id="sfxPopup">   <div id="sfxContentInner"></div></div>');

    $("a[href^='http'][href*='http://shelcat.org/sfxlcl3/menu?']")
        .addClass('sfxPopup')
        .each(function () {
            var anchor = $(this);
            anchor.attr('onclick', '');
            anchor.attr('target', '');
            anchor.removeClass('newWindow');

            anchor.attr('title', '');
            anchor.children('img').attr('alt', '');

            anchor.attr('href', '/SfxTransform.aspx?sfxUrl=' + encodeURIComponent(anchor.attr('href') + "&sfx.response_type=multi_obj_xml") + '&ajax=true&width=600&height=300');
            anchor.prettyPhoto({ deeplinking: false, keyboard_shortcuts: false, social_tools: '', theme: 'light_rounded', opacity: 0.60, changepicturecallback: function () {

                var height = $('.pp_inline').height();
                $('.pp_content').height(height + 50);

                if ($('#redirectUrl').length > 0) {
                    var redirectHref = $('#redirectUrl').attr('href');
                    if (redirectHref.length > 0) {
                        setTimeout("window.open('" + redirectHref + "', '_blank')", 3000);
                    }
                }
            }
            });
        });
});
