').insertAfter($(ulSelector, this)); // LOOP TO BUILD COLUMNS for(var i = 0; i < columnNum; i++) { // KEEP FROM ADDING EMPTY UL'S TO THE DOM if(i < liNum) { // IF liNum / columnNum REMAINDER IS BETWEEN .0 AND .5 AND THIS IS THE FIRST LOOP ITERATION // WE'LL ADD 1 TO THE END RANGE SO THAT THE EXTRA LINK GOES INTO THE FIRST COLUMN if((liNum / columnNum) % 1 > 0.0 && (liNum / columnNum) % 1 < 0.5 && i == 0) { endRange = Math.round(liNum / columnNum) + 1; } // IF liNum / columnNum REMAINDER IS .5 AND THIS LOOP ITERATION IS NOT THE LAST ITERATION // WE'LL SUBTRACT 1 FROM THE END RANGE SO THAT WE DON'T HAVE AN EXTRA LINK WHERE IT DOESN'T BELONG else if((liNum / columnNum) % 1 == 0.5 && i >= (columnNum / i)) { endRange = Math.round(liNum / columnNum) - 1; } // NOTHING SPECIAL HERE - DIVIDE NORMALLY FOR THIS LOOP ITERATION else { endRange = Math.round(liNum / columnNum) } // ADD THE COLUMN UL $(".gb-custom-columns", this).append('