/**
* MULTICOL.js
* version 1.1
* Kotaro Imai : HOKYPOKY.(http://hokypoky.info)
* (c) Licensed GNU General Public License.
*/
if (typeof info == "undefined") { var info = {} } if (typeof info.hokypoky == "undefined") { info.hokypoky = {} } info.hokypoky.Multicol = new function() { jQuery.fn.extend({ multicol: function(a) { this.each(function() { var b = parseInt($(this).css("line-height")); var c = (a.colNum ? a.colNum : 2); var l = (a.colMargin ? a.colMargin : 10); var d = parseInt($(this).width()); var g = ($(this).width() - l * (c - 1)) / c - 0.1; $(this).find("> *:last").css({ marginBottom: 0 }).end().find("img").each(function() { var i = this.height % b; if (i != 0) { i = (i < b / 2 ? -i : b - i) } $(this).css({ marginBottom: i }) }).end().css({ width: g }).end(); var k = parseInt($(this).height()); var j = (parseInt(k) / parseInt(b)) % parseInt(c); if (j != 0) { k = k + b * (c - j) } $(this).css({ height: k + "px", overflow: "hidden" }).wrapInner("<div class='multicolInner'></div>").end(); var h = $(this).html(); $(this).css({ height: k / c + "px", width: d }).html("").end(); for (var f = 0; f < c; f++) { var e = $(h).css({ "float": f != (c - 1) ? "left" : "right", width: g, marginTop: -($(this).height() * f) + "px", marginRight: f != (c - 1) ? l + "px" : 0 + "px", overflow: "hidden" }); $(this).append(e) } }); return this } }) };