(function(n){var t=1;n.fn.dropShadow=function(i){var r=n.extend({left:4,top:4,blur:2,opacity:.5,color:"black",swap:!1},i),u=n([]);return this.not(".dropShadow").each(function(){var o=n(this),s=[],h=r.blur<=0?0:r.blur,p=h==0?r.opacity:r.opacity/(h*8),y=r.swap?t:t+1,v=r.swap?t+1:t,c,a,f,e,l;for(c=this.id?this.id+"_dropShadow":"ds"+(1+Math.floor(9999*Math.random())),n.data(this,"shadowId",c),n.data(this,"shadowOptions",i),o.attr("shadowId",c).css("zIndex",y),o.css("position")!="absolute"&&o.css({position:"relative",zoom:1}),bgColor=o.css("backgroundColor"),bgColor=="rgba(0, 0, 0, 0)"&&(bgColor="transparent"),s[0]=bgColor!="transparent"||o.css("backgroundImage")!="none"||this.nodeName=="SELECT"||this.nodeName=="INPUT"||this.nodeName=="TEXTAREA"?n("<div></div>").css("background",r.color):o.clone().removeAttr("id").removeAttr("name").removeAttr("shadowId").css("color",r.color),s[0].addClass("dropShadow").css({height:o.outerHeight(),left:h,opacity:p,position:"absolute",top:h,width:o.outerWidth(),zIndex:v}),a=8*h+1,f=1;f<a;f++)s[f]=s[0].clone();f=1,e=h;while(e>0)s[f].css({left:e*2,top:0}),s[f+1].css({left:e*4,top:e*2}),s[f+2].css({left:e*2,top:e*4}),s[f+3].css({left:0,top:e*2}),s[f+4].css({left:e*3,top:e}),s[f+5].css({left:e*3,top:e*3}),s[f+6].css({left:e,top:e*3}),s[f+7].css({left:e,top:e}),f+=8,e--;for(l=n("<div></div>").attr("id",c).addClass("dropShadow").css({left:o.position().left+r.left-h,marginTop:o.css("marginTop"),marginRight:o.css("marginRight"),marginBottom:o.css("marginBottom"),marginLeft:o.css("marginLeft"),position:"absolute",top:o.position().top+r.top-h,zIndex:v}),f=0;f<a;f++)l.append(s[f]);o.after(l),u=u.add(l),n(window).resize(function(){try{l.css({left:o.position().left+r.left-h,top:o.position().top+r.top-h})}catch(n){}}),t+=2}),this.pushStack(u)},n.fn.redrawShadow=function(){return this.removeShadow(),this.each(function(){var t=n.data(this,"shadowOptions");n(this).dropShadow(t)})},n.fn.removeShadow=function(){return this.each(function(){var t=n(this).shadowId();n("div#"+t).remove()})},n.fn.shadowId=function(){return n.data(this[0],"shadowId")},n(function(){var t="<style type='text/css' media='print'>";t+=".dropShadow{visibility:hidden;}</style>",n("head").append(t)})})(jQuery);
