function m3Columnize(uls, num_columns) {
	
	$(uls).each(function(){	
		var num_lis		= $(this).find("li").length;
		var num_rows    = Math.ceil( num_lis / num_columns);			
		var col_tmp     = 1;
		var col_height  = 0;
		var max_height  = 0;
		
		if ( num_lis < num_columns) {
			return;
		}
		/*
		var cols = array();
		cols[0] = 0;
		for( var i = 0; i < num_columns; i++ ) {
			if( i == 0 )
				continue;
			
			cols[i] = num_rows * i + 1;
		}
		*/
		$(this).find("li").each(function(iterator){
			var col_current = Math.ceil((iterator+1)/num_rows);
			
			$(this).addClass("col_" + col_current);
			
			if ((iterator+1) % num_rows == 1) {
				$(this).addClass("first_row");
			}
			
			$(this).addClass("col_" + col_current);	
			
			if (col_current > col_tmp) {
				col_tmp = col_current;
				$(this).css("margin-top", -(col_height));
				
				if (col_height > max_height) {
					max_height = col_height;
				}
				
				col_height = 0;
			}
			
			col_height += $(this).outerHeight();
		});
		
		$(this).css("height", max_height);
	});
}

function m3SmoothScroll(anchor, duration) {
	$(anchor).click(function(e) {
		e.preventDefault();
		$.scrollTo("#" + this.href.split("#")[1], duration);
	});
}

function m3Log(message) {
	if (window.console && window.console.log) {
		window.console.log(message);
	}
}
