(function($){

	/*$.fn.equaliseHeights = function(){
		var maxHeight = 0;
		$(this).each(function(){
			var $t = $(this).css('height','').find('.inner').css('height','').end();
			var h = $t.outerHeight(true);
			$t.data('height', h);
			maxHeight = h>maxHeight?h:maxHeight;
		});
		
		return $(this).each(function(){
			var $t = $(this);
			var dH = maxHeight - $t.data('height');
			var $c = $($t.find('.inner').andSelf().filter('.inner')[0]);
			var h;
			if($c.size() === 1){
				h = $c.height();
				$c.height(h + dH);
			}
			else{
				h = $t.height();
				$t.height(h + dH);
			}
		});
	};*/
	
	$.fn.equaliseWidths = function(){
		var maxWidth = 0;
		$(this).each(function(){
			var $t = $(this);
			var h = $t.outerWidth(true);
			$t.data('height', h);
			maxWidth = h>maxWidth?h:maxWidth;
		});
		
		return $(this).each(function(){
			var $t = $(this);
			var dH = maxWidth - $t.data('height');
			var $c = $($t.children('[class=inner]'));
			var h;
			if($c.size() === 1){
				h = $c.width();
				$c.width(h + dH);
			}
			else{
				h = $t.width();
				$t.width(h + dH);
			}
		});
	};
	
	$.fn.expand = function(){
		var $t = $(this);
		var h = $t.outerHeight();
		var dH = 0;		
		$t.children().each(function(){
			var $c = $(this);			
			var tmpH = $c.outerHeight(true);
			var top = $c.position().top;
			dH = tmpH+top>h+dH?tmpH+top-h:dH;			
		});
		return $t.height(h+dH);
	};

})(jQuery);

