$(document).ready(function(){
	$('.listsort').ready(function(){
		
		arr = [];
		$('.listsort ul li').map(function(){
			arr.push( '<li>' + $(this).html() + '</li>' );
		});

		
		colA = arr.splice(0, Math.ceil( arr.length / 3)).reverse();
		colB = arr.splice(0, Math.ceil( arr.length / 2)).reverse();
		colC = arr.reverse();
		
		output = '';
		while (colA.length > 0) {
			if (colA.length) output += colA.pop();
			if (colB.length) output += colB.pop();
			if (colC.length) output += colC.pop();
		}
			
		$('.listsort ul').html(output);

	});
	$('.listsortb').ready(function(){
		
		arr = [];
		$('.listsortb ul li').map(function(){
			arr.push( '<li>' + $(this).html() + '</li>' );
		});

		
		colA = arr.splice(0, Math.ceil( arr.length / 3)).reverse();
		colB = arr.splice(0, Math.ceil( arr.length / 2)).reverse();
		colC = arr.reverse();
		
		output = '';
		while (colA.length > 0) {
			if (colA.length) output += colA.pop();
			if (colB.length) output += colB.pop();
			if (colC.length) output += colC.pop();
		}
			
		$('.listsortb ul').html(output);

	});
});


if (jQuery) {
        $('.sub-menu').ready(function(){
                $('.sub-menu').parent().addClass('sub_menu_bg');
        });
}
