(function(a){a.fn.quicksand=function(f,b){var e={duration:750,easing:"swing",attribute:"data-id",adjustHeight:"auto",useScaling:true,enhancement:function(g){},selector:"> *",dx:0,dy:0};a.extend(e,b);if(a.browser.msie||(typeof(a.fn.scale)=="undefined")){e.useScaling=false}var c;if(typeof(arguments[1])=="function"){var c=arguments[1]}else{if(typeof(arguments[2]=="function")){var c=arguments[2]}}return this.each(function(u){var z;var x=[];var j=a(f).clone();var y=a(this);var h=a(this).css("height");var o;var k=false;var l=a(y).offset();var m=[];var w=a(this).find(e.selector);if(a.browser.msie&&a.browser.version.substr(0,1)<7){y.html("").append(j);return}var n=0;var r=function(){if(!n){n=1;$toDelete=y.find("> *");y.prepend(s.find("> *"));$toDelete.remove();if(k){y.css("height",o)}e.enhancement(y);if(typeof c=="function"){c.call(this)}}};var v=y.offsetParent();var t=v.offset();if(v.css("position")=="relative"){if(v.get(0).nodeName.toLowerCase()=="body"){}else{t.top+=(parseFloat(v.css("border-top-width"))||0);t.left+=(parseFloat(v.css("border-left-width"))||0)}}else{t.top-=(parseFloat(v.css("border-top-width"))||0);t.left-=(parseFloat(v.css("border-left-width"))||0);t.top-=(parseFloat(v.css("margin-top"))||0);t.left-=(parseFloat(v.css("margin-left"))||0)}if(isNaN(t.left)){t.left=0}if(isNaN(t.top)){t.top=0}t.left-=e.dx;t.top-=e.dy;y.css("height",a(this).height());w.each(function(A){m[A]=a(this).offset()});a(this).stop();var q=0;var p=0;w.each(function(A){a(this).stop();var B=a(this).get(0);if(B.style.position=="absolute"){q=-e.dx;p=-e.dy}else{q=e.dx;p=e.dy}B.style.position="absolute";B.style.margin="0";B.style.top=(m[A].top-parseFloat(B.style.marginTop)-t.top+p)+"px";B.style.left=(m[A].left-parseFloat(B.style.marginLeft)-t.left+q)+"px"});var s=a(y).clone();var g=s.get(0);g.innerHTML="";g.setAttribute("id","");g.style.height="auto";g.style.width=y.width()+"px";s.append(j);s.insertBefore(y);s.css("opacity",0);g.style.zIndex=-1;g.style.margin="0";g.style.position="absolute";g.style.top=l.top-t.top+"px";g.style.left=l.left-t.left+"px";if(e.adjustHeight==="dynamic"){y.animate({height:s.height()},e.duration,e.easing)}else{if(e.adjustHeight==="auto"){o=s.height();if(parseFloat(h)<parseFloat(o)){y.css("height",o)}else{k=true}}}w.each(function(A){var B=[];if(typeof(e.attribute)=="function"){z=e.attribute(a(this));j.each(function(){if(e.attribute(this)==z){B=a(this);return false}})}else{B=j.filter("["+e.attribute+"="+a(this).attr(e.attribute)+"]")}if(B.length){if(!e.useScaling){x.push({element:a(this),animation:{top:B.offset().top-t.top,left:B.offset().left-t.left,opacity:1}})}else{x.push({element:a(this),animation:{top:B.offset().top-t.top,left:B.offset().left-t.left,opacity:1,scale:"1.0"}})}}else{if(!e.useScaling){x.push({element:a(this),animation:{opacity:"0.0"}})}else{x.push({element:a(this),animation:{opacity:"0.0",scale:"0.0"}})}}});j.each(function(C){var B=[];var E=[];if(typeof(e.attribute)=="function"){z=e.attribute(a(this));w.each(function(){if(e.attribute(this)==z){B=a(this);return false}});j.each(function(){if(e.attribute(this)==z){E=a(this);return false}})}else{B=w.filter("["+e.attribute+"="+a(this).attr(e.attribute)+"]");E=j.filter("["+e.attribute+"="+a(this).attr(e.attribute)+"]")}var D;if(B.length===0){if(!e.useScaling){D={opacity:"1.0"}}else{D={opacity:"1.0",scale:"1.0"}}d=E.clone();var A=d.get(0);A.style.position="absolute";A.style.margin="0";A.style.top=E.offset().top-t.top+"px";A.style.left=E.offset().left-t.left+"px";d.css("opacity",0);if(e.useScaling){d.css("transform","scale(0.0)")}d.appendTo(y);x.push({element:a(d),animation:D})}});s.remove();e.enhancement(y);for(u=0;u<x.length;u++){x[u].element.animate(x[u].animation,e.duration,e.easing,r)}})}})(jQuery);
