/** * jQuery VGrid v0.1.2 - variable grid layout plugin * * Terms of Use - jQuery VGrid * under the MIT (http://www.opensource.org/licenses/mit-license.php) License. * * Copyright 2009 xlune.com All rights reserved. * (http://blog.xlune.com/2009/09/jqueryvgrid.html) */ (function(H){function B(P){var O=P.data("_vgchild");var N=P.width();var R=[[0,N,0]];var Q=0;O.each(function(U){var T=H(this);var S=M(T);var V=F(R,S[0]);R=J(R,V,S);Q=Math.max(Q,V[1]+S[1]);T.data("_vgleft",V[0]);T.data("_vgtop",V[1])});P.data("_vgwrapheight",Q);G(P)}function F(R,Q){var S=R.concat([]).sort(I);var N=S[S.length-1][2];for(var P=0,O=S.length;P=N){break}if(S[P][1]-S[P][0]>=Q){return[S[P][0],S[P][2]]}}return[0,N]}function J(R,N,Q){var S=R.concat([]).sort(I);var T=[N[0],N[0]+Q[0],N[1]+Q[1]];for(var P=0,O=S.length;PN[0])||O[2]>N[2])?1:-1}function D(O,N){return(O[0]>N[0])?1:-1}function E(R,N){var S=R.concat([N]).sort(D);var O=[];for(var Q=0,P=S.length;Q0&&O[O.length-1][1]==S[Q][0]&&O[O.length-1][2]==S[Q][2]){O[O.length-1][1]=S[Q][1]}else{O.push(S[Q])}}return O}function C(O,N){if(O[0]>=N[0]&&O[0]=N[0]&&O[1]=N[0]&&O[0] *"));N.data("_vgdefchild",N.data("_vgchild"));N.css({"position":"relative","width":"auto"});N.data("_vgchild").css("position","absolute");B(N);L(N.data("_vgchild"));if(N.data("_vgopt").fadeIn){var Q=(typeof (N.data("_vgopt").fadeIn)=="object")?N.data("_vgopt").fadeIn:{time:N.data("_vgopt").fadeIn};N.data("_vgchild").each(function(S){var R=H(this);R.css("display","none");setTimeout(function(){R.fadeIn(Q.time||250)},S*(Q.delay||0))})}H(window).resize(function(R){A(N)});return N},vgrefresh:function(R,P,N,O){var Q=H(this);if(Q.data("_vgchild")){Q.data("_vgchild",Q.find("> *"));Q.data("_vgchild").css("position","absolute");B(Q);P=typeof (P)=="number"?P:Q.data("_vgopt").time||500;N=typeof (N)=="number"?N:Q.data("_vgopt").delay||0;K(Q.data("_vgchild"),R||Q.data("_vgopt").easeing||"linear",P,N);if(typeof (O)=="function"){setTimeout(O,Q.data("_vgchild").length*N+P)}}return Q},vgsort:function(O,R,P,N){var Q=H(this);if(Q.data("_vgchild")){Q.data("_vgchild",Q.data("_vgchild").sort(O));B(Q);K(Q.data("_vgchild"),R||Q.data("_vgopt").easeing||"linear",typeof (P)=="number"?P:Q.data("_vgopt").time||500,typeof (N)=="number"?N:Q.data("_vgopt").delay||0)}return Q}})})(jQuery);