jQuery.fn.extend({
	multicol: function(cfg) {
		this.each(function() {
			var div   = null;
			var cols  = (cfg.colNum    ? cfg.colNum    :  2);
			var marg  = (cfg.colMargin ? cfg.colMargin : 10);
			var items = [];
			var count = 0;
			var ipc   = 0;
			var width = $(this).width();
			var wc    = Math.floor( (width-(marg*(cols-1))) /cols);
			for(var i=0; i<this.children.length; i++) items[i] = this.children[i]; 
			count = items.length;
			ipc   = Math.ceil(count/cols);
			$(this).empty();
			for(var col=0; col<cols; col++) {
				div = document.createElement("div");
				ul  = document.createElement("ul");
				$(ul).addClass("tipo2").css({ margin: "0px 0px 0px 15px" });
				$(div).attr("id", "mc"+col).css({
					float: "left",
					position: "relative",
					width: wc+"px",
					paddingRight: (col==cols-1 ? 0 : marg)
				});
				for(var i=col*ipc; i<Math.min(count, ipc+(col*ipc)); i++) {
					ul.appendChild(items[i]);
				}
				div.appendChild(ul);
				this.appendChild(div);
			}
			div = document.createElement("div");
			$(div).addClass("clear");
			this.appendChild(div);
		});
	}, unicol: function() {
		this.each(function() {
			var jThis = $(this);
			var li = [];
			jThis.find("ul li").each(function (a, b) {
				li.push(b);
			});
			jThis.empty();
			for(k in li) { jThis.append(li[k]); }
		});
	}
});
