(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.centerVertically = function(h,v,alrt) {
	return this.each(function(i){
	var ah = $(this).eq(i).height();
	var aw = $(this).eq(i).width();
	var dh = $(document).height();
	var dw = $(document).width();
	
	if( h && dw > aw )
	{
		var mw = (dw - aw) / 2;
		$(this).eq(i).css('left', Math.floor(mw));
	}
	
	if( v && dh > ah )
	{
		var mh = (dh - ah) / 2;
		$(this).eq(i).css('top', Math.floor(mh));
		
		if(alrt)
		{
		alert(dh);
		alert(ah);
		alert(mh);
		} 
	}
	
	});
};
})(jQuery);
