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