﻿// Popular Categories
function GetPopularCategoriesMaxHeight(){
var maxHeight = 0;
$('#ulPopularCategories li').each(function(event){if(parseInt(maxHeight,10) < parseInt($(this).height(),10)){maxHeight = parseInt($(this).height(),10);}});
return maxHeight;}
 
function GetPopularCategoriesMaxHeightPerRow(){
var noOfLiPerRow = 5;var countLi  = 0;var totalRows = 0;
countLi = $('#ulPopularCategories > li').length;
totalRows = Math.ceil(countLi/noOfLiPerRow);
for(var index=0;index<totalRows;index++){   
 var maxHeight = 0;var startIndex =index * noOfLiPerRow ;var endIndex = startIndex + noOfLiPerRow ;
 $('#ulPopularCategories').find('li').slice(startIndex,endIndex).each(function(event){if(parseInt(maxHeight,10) < parseInt($(this).height(),10)){maxHeight = parseInt($(this).height(),10);}});
 $('#ulPopularCategories').find('li').slice(startIndex,endIndex).height(maxHeight);}}

 $(document).ready(function() { GetPopularCategoriesMaxHeightPerRow(); }); 
 
