﻿/// <reference path="jquery.js" />

jQuery.fn.center = function () {
    this.css("position", "absolute");
    this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
    return this;
};

jQuery.fn.wrapBorder = function () {
    var windowUpPart = "<table>" +
                            "<tr>" +
                                "<td class='popup_upl'></td>" +
                                "<td class='popup_up'></td>" +
                                "<td class='popup_upr'></td>" +
                            "</tr>" +
                            "<tr>" +
                                "<td class='popup_l'></td>" +
                            "<td>";
    var windowDownPart = "</td>" +
                         "<td class='popup_r'></td>" +
                         "</tr>" +
                         "<tr>" +
                         "<td class='popup_bl'></td>" +
                         "<td class='popup_b'></td>" +
                         "<td class='popup_br'></td>" +
                         "</tr>" +
                         "</table>";
    this.before(windowUpPart);
    this.after(windowDownPart);

    return this;
};