$.fn.prettyComments=function(a){a=jQuery.extend({animate:false,animationSpeed:"fast",maxHeight:500,alreadyAnimated:false,init:true},a);$("body").append('<div id="comment_hidden"></div>');var b=function(a){$("#comment_hidden").css({position:"absolute",top:-1e4,left:-1e4,width:$(a).width(),"min-height":$(a).height(),"font-family":$(a).css("font-family"),"font-size":$(a).css("font-size"),"line-height":$(a).css("line-height")});if($.browser.msie&&parseFloat($.browser.version)<7){$("#comment_hidden").css("height",$(a).height())}};var c=function(b){theValue=$(b).attr("value")||"";theValue=theValue.replace(/\n/g,"<br />");$("#comment_hidden").html(theValue+"<br />");if(!a.init){if($("#comment_hidden").height()>$(b).height()){if($("#comment_hidden").height()>a.maxHeight){$(b).css("overflow-y","scroll")}else{$(b).css("overflow-y","hidden");d(b)}}else if($("#comment_hidden").height()<$(b).height()){if($("#comment_hidden").height()>a.maxHeight){$(b).css("overflow-y","scroll")}else{$(b).css("overflow-y","hidden");e(b)}}}};var d=function(b){if(a.animate&&!a.alreadyAnimated){a.alreadyAnimated=true;$(b).animate({height:$("#comment_hidden").height()},a.animationSpeed,function(){a.alreadyAnimated=false})}else if(!a.animate&&!a.alreadyAnimated){$(b).height($("#comment_hidden").height())}};var e=function(b){if(a.animate&&!a.alreadyAnimated){a.alreadyAnimated=true;$(b).animate({height:$("#comment_hidden").height()},a.animationSpeed,function(){a.alreadyAnimated=false})}else{$(b).height($("#comment_hidden").height())}};$(this).each(function(){$(this).css({overflow:"hidden"}).bind("keyup",function(){c($(this))});b(this);c($(this));if($("#comment_hidden").height()>a.maxHeight){$(this).css({"overflow-y":"scroll",height:a.maxHeight})}else{$(this).height($("#comment_hidden").height())}a.init=false})}
