(function ($) {
$.fn.vAlign = function() {
    return this.each(function(i) {
        var h = $(this).height();
        var oh = $(this).outerHeight(true);
        var mt = (h + (oh - h)) / 2;
        $(this).css("margin-top", "-" + mt + "px");
        $(this).css("top", "50%");
        $(this).css("position", "absolute");
    });
};
$.fn.hAlign = function() {
    return this.each(function(i) {
        var h = $(this).width();
        var oh = $(this).outerWidth(true);
        var mt = (h + (oh - h)) / 2;
        $(this).css("margin-left", "-" + mt + "px");
        $(this).css("left", "50%");
        $(this).css("position", "absolute");
    });
};

})(jQuery);
