/*
 * jQuery WidowFix Plugin
 * http://matthewlein.com/widowfix/
 * Copyright (c) 2010 Matthew Lein
 * Version: 1.3 (10/25/2010)
 * Dual licensed under the MIT and GPL licenses
 * Requires: jQuery v1.4 or later
 */

(function(a){jQuery.fn.widowFix=function(d){var c={letterLimit:null,prevLimit:null,linkFix:false};var b=a.extend(c,d);return this.each(function(){var i=a(this),m;if(b.linkFix){var h=i.find("a:last");h.wrap("<var>");var e=a("var").html();m=h.contents()[0];h.contents().unwrap()}var f=a(this).html().split(" ");var k=f.pop();function j(){if(k===""){k=f.pop();j()}}j();var l=f[f.length-1];if(b.linkFix){if(b.letterLimit!==null&&m.length>=b.letterLimit){i.find("var").each(function(){a(this).contents().replaceWith(e);a(this).contents().unwrap()});return}else{if(b.prevLimit!==null&&l.length>=b.prevLimit){i.find("var").each(function(){a(this).contents().replaceWith(e);a(this).contents().unwrap()});return}}}else{if(b.letterLimit!==null&&k.length>=b.letterLimit){return}else{if(b.prevLimit!==null&&l.length>=b.prevLimit){return}}}var g=f.join(" ")+"&nbsp;"+k;i.html(g);if(b.linkFix){i.find("var").each(function(){a(this).contents().replaceWith(e);a(this).contents().unwrap()})}})}})(jQuery);
