(function ($) {
    //
    // Based on code from http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
    $.fn.valign = function() {
        return this.each(function(i){
            var ah = $(this).height();
            var ph = $(this).parent().height();
            var mh = (ph - ah) / 2;
            //
            // Because these elements are floated, their position must be set as
            // relative and their top must be adjusted.
            $(this).css({top: mh, position: 'relative'});
        });
    };
})(jQuery);