function resizeImage(obj, limitWidth, limitHeight) {
    limitWidth = limitWidth || 120;
    limitHeight = limitHeight || 120;

    if (obj.width > limitWidth) {
        obj.style.width = limitWidth + 'px';
        obj.style.height =  (limitWidth * obj.height / obj.width) + 'px';
    }

    if (obj.height > limitHeight) {
        obj.style.height = limitHeight + 'px';
        obj.style.width =  (limitHeight * obj.width / obj.height) + 'px';
    }

    obj.style.visibility = 'visible';
}

if (top == self) {(function ($) {$(function () {
    $('<div id="dialog" style="display: none; position: relative;">'
            + '<iframe src="about:blank" frameborder="0" style="height: 100%; width: 100%;" />'
            + '<div class="bg-loading" style="height: 100%; left: 0; position: absolute; top: 0; width: 100%;"></div>'
            + '</div>').dialog({
        autoOpen: false,
        bgiframe: true,
        close: function (event, ui) {
            $("iframe", this).attr("src", "about:blank");
        },
        height: 140,
        modal: true,
        open: function (event, ui) {
            $(".bg-loading", this).show();
        },
        resizable: false
    }).find("iframe").bind("load", function () {/*readystatechange DOMContentLoaded*/
        if (!this.document || this.document.readyState == "complete") {
            $(this).parent().find(".bg-loading").hide();
        }
        return true;
    });

    $("a.pop-dialog").click(function () {
        $("#dialog iframe").attr("src", this.href);
        $("#dialog").dialog("option", "title", $(this).attr("dialog_title"))
           .dialog("option", "height", parseInt($(this).attr("dialog_height")))
           .dialog("option", "width", parseInt($(this).attr("dialog_width")))
           .dialog("open");
        return false;
    });

    $("table.hover tr").hover(function () {
        $(this).addClass("hover");
    }, function () {
        $(this).removeClass("hover");
    })

    $(".tabs").tabs();

    return true;
});})(jQuery);}