﻿(function ($) {
	// VERTICALLY AND HORIZONTALY ALIGN FUNCTION
	$.fn.vhAlign = function () {
		return this.each(function (i) {
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = Math.ceil((ph - ah) / 2);
			var av = $(this).width();
			var pv = $(this).parent().width();
			var mv = Math.ceil((pv - av) / 2);
			$(this).css('margin-top', mh);
			$(this).css('margin-left', mv);
		});
	};
})(jQuery);
