// Equal height columns
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			 tallest = thisHeight;
		}
	});
	group.height(tallest);
}


//Align Center
(function ($) {
	// VERTICALLY ALIGN FUNCTION
	$.fn.vAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		var ph = $(this).parent().height();
		var mh = (ph - ah) / 2;
		$(this).css('padding-top', mh);
		$(this).css('padding-bottom', mh);
		});
	};
})(jQuery);

$(document).ready(function() {
	 if ($("div.productsWrap").length){
		 $(".productsWrap .price").vAlign();
		 equalHeight($(" .row1 .colorWrap"));
		 equalHeight($(" .row2 .colorWrap"));
		 equalHeight($(" .row3 .colorWrap"));
		 equalHeight($(" .row4 .colorWrap"));
		 equalHeight($(" .row5 .colorWrap"));	 	
		 equalHeight($(" .row6 .colorWrap"));
		 equalHeight($(" .row7 .colorWrap"));
		 equalHeight($(" .row8 .colorWrap"));
		 equalHeight($(" .row9 .colorWrap"));	 	 
		 equalHeight($(" .priceBox"));
		 equalHeight($(" .row1 .priceBox2"));	
		 equalHeight($(" .row2 .priceBox2"));	 	 
		 equalHeight($(" .row3 .priceBox2"));	 	  
		 equalHeight($(" .row4 .priceBox2"));	
		 equalHeight($(" .row5 .priceBox2"));	 	 
		 equalHeight($(" .row6 .priceBox2"));	
		 equalHeight($(" .row7 .priceBox2"));	
		 equalHeight($(" .row8 .priceBox2"));	 	 
		 equalHeight($(" .row9 .priceBox2"));		 	 
		 equalHeight($(" .row1 .descLink"));	
		 equalHeight($(" .row2 .descLink"));	 
		 equalHeight($(" .row3 .descLink"));	 
		 equalHeight($(" .row4 .descLink"));	 
		 equalHeight($(" .row5 .descLink"));
		 equalHeight($(" .row6 .descLink"));
		 equalHeight($(" .row7 .descLink"));
		 equalHeight($(" .row8 .descLink"));
		 equalHeight($(" .row9 .descLink")); 	 	 	 	 	 	  
		 equalHeight($(" .row1 .reducedBox"));	 	 	 	 	 
		 equalHeight($(" .row2 .reducedBox"));
		 equalHeight($(" .row3 .reducedBox"));
		 equalHeight($(" .row4 .reducedBox"));
		 equalHeight($(" .row5 .reducedBox"));
		 equalHeight($(" .row6 .reducedBox"));
		 equalHeight($(" .row7 .reducedBox"));
		 equalHeight($(" .row8 .reducedBox"));
		 equalHeight($(" .row9 .reducedBox"));	 	 	 
		 equalHeight($(" .row1 .bottom")); 
		 equalHeight($(" .row2 .bottom"));
		 equalHeight($(" .row3 .bottom")); 
		 equalHeight($(" .row4 .bottom")); 
		 equalHeight($(" .row5 .bottom")); 	
		 equalHeight($(" .row6 .bottom"));
		 equalHeight($(" .row7 .bottom")); 
		 equalHeight($(" .row8 .bottom")); 
		 equalHeight($(" .row9 .bottom"))	 
	 }
});
