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