function RVGTLine(a,c){this.elements=[];this.margin=a;this.rowHeight=c;this.maxHeight=0} RVGTLine.prototype={width:0,elementsWidth:0,firstThumbIndex:0,add:function(a,c){0===this.elements.length&&(this.firstThumbIndex=c);if(!a.data("w")){var d=a.width(),b=a.height();b>this.rowHeight&&(d=Math.round(d*this.rowHeight/b),b=this.rowHeight);a.data("w",d).data("h",b)}d={$elt:a,w:a.data("w"),h:a.data("h")};this.elements.push(d);d.h>this.maxHeight&&(this.maxHeight=d.h);this.width+=this.margin+d.w;this.elementsWidth+=d.w},clear:function(){this.elements.length&&(this.maxHeight=this.width=this.elementsWidth= 0,this.elements.length=0)}}; function RVGThumbs(a){this.opts=a;this.$thumbs=$("#thumbnails");if(0!=this.$thumbs.length){this.$thumbs.css("text-align","left");this.opts.extraRowHeight=0;1a>img",this.$thumbs),b=new RVGTLine(this.opts.hMargin,this.opts.rowHeight);a=c-1*b.elements.length&&(this.processLine(b,c),b.clear())}b.elements.length&&this.processLine(b,c,!0);this.prevLastLineFirstThumbIndex=b.firstThumbIndex},processLine:function(a,c,d){var b,e,f=a.maxHeight?a.maxHeight: a.elements[0].h;a.width/c>this.opts.resizeThreshold?(e=a.elementsWidth/(a.elementsWidth+c-a.width),b=f/(1+(e-1)*this.opts.resizeFactor),b=6*Math.round(b/6),be&&(b+=e)),bf&&(b=Math.round(b*f/h.h),e=f,g-=h.w-b,d&&(g=0));this.reposition(h.$elt,b,e,b-g,f)}},reposition:function(a,c,d,b,e){a.attr("width",c).attr("height",d);a.closest("li").css({width:b+"px",height:e+"px"});a.parent("a").css({left:Math.round((b-c)/2)+"px",top:Math.round((e-d)/2)+"px"})}};