/*
 * Supersubs v0.2b - jQuery plugin
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 */
;(function($j){$j.fn.supersubs=function(options){var opts=$j.extend({},$j.fn.supersubs.defaults,options);return this.each(function(){var $j$j=$j(this);var o=$j.meta?$j.extend({},opts,$j$j.data()):opts;var fontsize=$j('<li id="menu-fontsize">&#8212;</li>').css({'padding':0,'position':'absolute','top':'-999em','width':'auto'}).appendTo($j$j).width();$j('#menu-fontsize').remove();$jULs=$j$j.find('ul');$jULs.each(function(i){var $jul=$jULs.eq(i);var $jLIs=$jul.children();var $jAs=$jLIs.children('a');var liFloat=$jLIs.css('white-space','nowrap').css('float');var emWidth=$jul.add($jLIs).add($jAs).css({'float':'none','width':'auto'}).end().end()[0].clientWidth/fontsize;emWidth+=o.extraWidth;if(emWidth>o.maxWidth){emWidth=o.maxWidth}else if(emWidth<o.minWidth){emWidth=o.minWidth}emWidth+='em';$jul.css('width',emWidth);$jLIs.css({'float':liFloat,'width':'100%','white-space':'normal'}).each(function(){var $jchildUl=$j('>ul',this);var offsetDirection=$jchildUl.css('left')!==undefined?'left':'right';$jchildUl.css(offsetDirection,emWidth)})})})};$j.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0}})(jQuery);
