/*
take a ul and wrap every nth li in another ul
Gerrit Giliomee - www.azapi.co.za
*/
(function($) {
	$.fn.makerows = function(options){

	var opts = $.extend({}, $.fn.makerows.defaults, options);

	nr = $(this).find('li').length;
	str = '';

	for(i = 1; i <= nr; i+=opts.rows) {
		str += '<ul>';

		fstr = "li:nth-child("+i+")";
		for(ii = 1; ii < opts.rows; ii++) {
			fstr += ",li:nth-child("+(i+ii)+")";
		}

		$(this).find(fstr).each(function(){
			str += '<li>'+$(this).html()+'</li>';
		});
		str += '</ul>';
	}

	$(this).html(str);

	}

	$.fn.makerows.defaults = {
	rows: 4
	};

})(jQuery);