$(window).load(checkSize);
$(function(){checkSize()});

function checkSize(){

	//find max height of galleryItems and force them all to this size to maintain grid layout

	var maxSize = 0;

	$('div.galleryItem', 'ol.galleryResults').height('auto').each(
		function(){
			var height = $(this).outerHeight();

			
			if(height > maxSize){
				maxSize = height;
			}
		}
	).css('min-height',(maxSize + 10));

	// remove right border from every 3rd li (remove end border)
	$('li:nth-child(3n) div.galleryItem', 'ol.galleryResults').css('border', 0);

}