	
$(function(){
	$.fn.extend({
		
		// jQuery extension for vertically centering an element within another.
		// Authored by Brad Greenwald @ greenwaldweb.com
		verticalCenter: function() {
			
			// This plugin vertically centers an element based on the height of its' wrapper element.
			// It is recommended to set the wrapper element to display: block and overflow: hidden to create a consistent layout.
			// Also this script should be fired after the desired images are loaded. $(window).load(function(){}); works well for this.
 		
			
			// Usage:
			// $(".thumbnails img").verticalCenter();
			
			// Configuration API:
			// none yet
			
			return this.each(function(i) {
					var t = $(this),
					h1 = t.height(),
					h2 = t.parent().height(),
					diff = ( h1 < h2 ) ? Math.round( (h2 - h1) / 2 ) : -Math.round( ( h1 - h2 ) / 2);
					
					t.css({ 
							"margin" : diff + 'px auto 0'
					});
			});
		}
	});				
});

