/************************************************************************/
/*		RATING															*/
/************************************************************************/
//eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';5(1O.1t)(7($){5($.29.1x)1I{1m.23("1u",P,z)}1F(e){}$.p.4=7(j){5(3.K==0)l 3;5(E J[0]==\'1j\'){5(3.K>1){8 k=J;l 3.W(7(){$.p.4.H($(3),k)})};$.p.4[J[0]].H(3,$.1T(J).21(1)||[]);l 3};8 j=$.10({},$.p.4.18,j||{});3.1v(\'.9-4-1l\').n(\'9-4-1l\').W(7(){8 a=(3.1J||\'1K-4\').1L(/\\[|\\]+/g,"1S");8 b=$(3.1U||1m.1X);8 c=$(3);8 d=b.6(\'4\')||{y:0};8 e=d[a];8 f;5(e)f=e.6(\'4\');5(e&&f){f.y++}B{f=$.10({},j||{},($.1k?c.1k():($.1H?c.6():s))||{},{y:0,C:[],u:[]});f.t=d.y++;e=$(\'<1M 12="9-4-1Q"/>\');c.1R(e);e.n(\'4-T-13-S\');5(c.R(\'Q\'))f.m=z;e.1a(f.A=$(\'<O 12="4-A"><a 14="\'+f.A+\'">\'+f.15+\'</a></O>\').1d(7(){$(3).4(\'N\');$(3).n(\'9-4-M\')}).1b(7(){$(3).4(\'v\');$(3).D(\'9-4-M\')}).1h(7(){$(3).4(\'w\')}).6(\'4\',f))};8 g=$(\'<O 12="9-4 q-\'+f.t+\'"><a 14="\'+(3.14||3.1p)+\'">\'+3.1p+\'</a></O>\');e.1a(g);5(3.U)g.R(\'U\',3.U);5(3.17)g.n(3.17);5(f.1V)f.x=2;5(E f.x==\'19\'&&f.x>0){8 h=($.p.11?g.11():0)||f.1c;8 i=(f.y%f.x),V=1y.1z(h/f.x);g.11(V).1A(\'a\').1B({\'1C-1D\':\'-\'+(i*V)+\'1E\'})};5(f.m)g.n(\'9-4-1e\');B g.n(\'9-4-1G\').1d(7(){$(3).4(\'1f\');$(3).4(\'G\')}).1b(7(){$(3).4(\'v\');$(3).4(\'F\')}).1h(7(){$(3).4(\'w\')});5(3.L)f.o=g;c.1i();c.1N(7(){$(3).4(\'w\')});g.6(\'4.r\',c.6(\'4.9\',g));f.C[f.C.K]=g[0];f.u[f.u.K]=c[0];f.q=d[a]=e;f.1P=b;c.6(\'4\',f);e.6(\'4\',f);g.6(\'4\',f);b.6(\'4\',d)});$(\'.4-T-13-S\').4(\'v\').D(\'4-T-13-S\');l 3};$.10($.p.4,{G:7(){8 a=3.6(\'4\');5(!a)l 3;5(!a.G)l 3;8 b=$(3).6(\'4.r\')||$(3.Z==\'X\'?3:s);5(a.G)a.G.H(b[0],[b.I(),$(\'a\',b.6(\'4.9\'))[0]])},F:7(){8 a=3.6(\'4\');5(!a)l 3;5(!a.F)l 3;8 b=$(3).6(\'4.r\')||$(3.Z==\'X\'?3:s);5(a.F)a.F.H(b[0],[b.I(),$(\'a\',b.6(\'4.9\'))[0]])},1f:7(){8 a=3.6(\'4\');5(!a)l 3;5(a.m)l;3.4(\'N\');3.1n().1o().Y(\'.q-\'+a.t).n(\'9-4-M\')},N:7(){8 a=3.6(\'4\');5(!a)l 3;5(a.m)l;a.q.1W().Y(\'.q-\'+a.t).D(\'9-4-1q\').D(\'9-4-M\')},v:7(){8 a=3.6(\'4\');5(!a)l 3;3.4(\'N\');5(a.o){a.o.6(\'4.r\').R(\'L\',\'L\');a.o.1n().1o().Y(\'.q-\'+a.t).n(\'9-4-1q\')}B $(a.u).1r(\'L\');a.A[a.m||a.1Y?\'1i\':\'1Z\']();3.20()[a.m?\'n\':\'D\'](\'9-4-1e\')},w:7(a){8 b=3.6(\'4\');5(!b)l 3;5(b.m)l;b.o=s;5(E a!=\'1s\'){5(E a==\'19\')l $(b.C[a]).4(\'w\');5(E a==\'1j\')$.W(b.C,7(){5($(3).6(\'4.r\').I()==a)$(3).4(\'w\')})}B b.o=3[0].Z==\'X\'?3.6(\'4.9\'):(3.22(\'.q-\'+b.t)?3:s);3.6(\'4\',b);3.4(\'v\');8 c=$(b.o?b.o.6(\'4.r\'):s);5(b.1g)b.1g.H(c[0],[c.I(),$(\'a\',b.o)[0]])},m:7(a,b){8 c=3.6(\'4\');5(!c)l 3;c.m=a||a==1s?z:P;5(b)$(c.u).R("Q","Q");B $(c.u).1r("Q");3.6(\'4\',c);3.4(\'v\')},24:7(){3.4(\'m\',z,z)},25:7(){3.4(\'m\',P,P)}});$.p.4.18={A:\'26 27\',15:\'\',x:0,1c:16};$(7(){$(\'r[28=1w].9\').4()})})(1t);',62,134,'|||this|rating|if|data|function|var|star||||||||||||return|readOnly|addClass|current|fn|rater|input|null|serial|inputs|draw|select|split|count|true|cancel|else|stars|removeClass|typeof|blur|focus|apply|val|arguments|length|checked|hover|drain|div|false|disabled|attr|drawn|to|id|spw|each|INPUT|filter|tagName|extend|width|class|be|title|cancelValue||className|options|number|append|mouseout|starWidth|mouseover|readonly|fill|callback|click|hide|string|metadata|applied|document|prevAll|andSelf|value|on|removeAttr|undefined|jQuery|BackgroundImageCache|not|radio|msie|Math|floor|find|css|margin|left|px|catch|live|meta|try|name|unnamed|replace|span|change|window|context|control|before|_|makeArray|form|half|children|body|required|show|siblings|slice|is|execCommand|disable|enable|Cancel|Rating|type|browser'.split('|'),0,{}))

$(document).ready(function(){

	/************************************************************************/
	/*		PROGRESSBAR														*/
	/************************************************************************/
	(function($){$.extend({progressBar:new function(){this.defaults={increment:2,speed:15,showText:true,width:120,boxImage:'/gfx/progressbar/progressbar.gif',barImage:'/gfx/progressbar/progressbg_green.gif',height:12};this.construct=function(arg1,arg2){var argpercentage=null;var argconfig=null;if(arg1!=null){if(!isNaN(arg1)){argpercentage=arg1;if(arg2!=null){argconfig=arg2;}}else{argconfig=arg1;}}
	return this.each(function(child){var pb=this;if(argpercentage!=null&&this.bar!=null&&this.config!=null){this.config.tpercentage=argpercentage;if(argconfig!=null)
	pb.config=$.extend(this.config,argconfig);}else{var $this=$(this);var config=$.extend({},$.progressBar.defaults,argconfig);var percentage=argpercentage;if(argpercentage==null)
	var percentage=$this.html().replace("%","");$this.html("");var bar=document.createElement('img');var text=document.createElement('span');bar.id=this.id+"_percentImage";text.id=this.id+"_percentText";bar.src=config.boxImage;bar.width=config.width;var $bar=$(bar);var $text=$(text);this.bar=$bar;this.ntext=$text;this.config=config;this.config.cpercentage=0;this.config.tpercentage=percentage;$bar.css("width",config.width+"px");$bar.css("height",config.height+"px");$bar.css("background-image","url("+config.barImage+")");$bar.css("padding","0");$bar.css("margin","0");$this.append($bar);$this.append($text);bar.alt=this.tpercentage;bar.title=this.tpercentage;}
	var t=setInterval(function(){var config=pb.config;var cpercentage=parseInt(config.cpercentage);var tpercentage=parseInt(config.tpercentage);var increment=parseInt(config.increment);var bar=pb.bar;var text=pb.ntext;var pixels=config.width/100;bar.css("background-position",(((config.width*-1))+(cpercentage*pixels))+'px 50%');if(config.showText)
	text.html(" "+Math.round(cpercentage)+"%");if(cpercentage>tpercentage){if(cpercentage-increment<tpercentage){pb.config.cpercentage=0+tpercentage}else{pb.config.cpercentage-=increment;}}
	else if(pb.config.cpercentage<pb.config.tpercentage){if(cpercentage+increment>tpercentage){pb.config.cpercentage=tpercentage}else{pb.config.cpercentage+=increment;}}
	else{clearInterval(t);}},pb.config.speed);});};}});$.fn.extend({progressBar:$.progressBar.construct});})(jQuery);

	/************************************************************************/
	/*		JGROWL															*/
	/************************************************************************/
	(function($){$.jGrowl=function(m,o){if($("#jGrowl").size()==0){$("<div id=\"jGrowl\"></div>").addClass($.jGrowl.defaults.position).appendTo("body");}
	$("#jGrowl").jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var _6=arguments;return this.each(function(){var _7=this;if($(this).data("jGrowl.instance")==undefined){$(this).data("jGrowl.instance",new $.fn.jGrowl());$(this).data("jGrowl.instance").startup(this);}
	if($.isFunction($(this).data("jGrowl.instance")[m])){$(this).data("jGrowl.instance")[m].apply($(this).data("jGrowl.instance"),$.makeArray(_6).slice(1));}else{$(this).data("jGrowl.instance").notification(m,o);}});}};$.extend($.fn.jGrowl.prototype,{defaults:{header:"",sticky:false,position:"top-right",glue:"after",theme:"default",corners:"10px",check:500,life:3000,speed:"normal",easing:"swing",closer:true,closerTemplate:"<div>[ close all ]</div>",log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},element:null,interval:null,notification:function(_17,o){var _19=this;var o=$.extend({},this.defaults,o);o.log.apply(this.element,[this.element,_17,o]);var _1a=$("<div class=\"jGrowl-notification\"><div class=\"close\">&times;</div><div class=\"header\">"+o.header+"</div><div class=\"message\">"+_17+"</div></div>").data("jGrowl",o).addClass(o.theme).children("div.close").bind("click.jGrowl",function(){$(this).unbind("click.jGrowl").parent().trigger("jGrowl.beforeClose").animate(o.animateClose,o.speed,o.easing,function(){$(this).trigger("jGrowl.close").remove();});}).parent();(o.glue=="after")?$("div.jGrowl-notification:last",this.element).after(_1a):$("div.jGrowl-notification:first",this.element).before(_1a);$(_1a).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind("jGrowl.beforeOpen",function(){o.beforeOpen.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.open",function(){o.open.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.beforeClose",function(){o.beforeClose.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.close",function(){o.close.apply(_19.element,[_19.element,_17,o]);}).trigger("jGrowl.beforeOpen").animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger("jGrowl.open");if($.fn.corner!=undefined){$(_1a).corner(o.corners);}
	if($("div.jGrowl-notification:parent",this.element).size()>1&&$("div.jGrowl-closer",this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass("jGrowl-closer").addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children("div.close").trigger("click.jGrowl");if($.isFunction(_19.defaults.closer)){_19.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});}},update:function(){$(this.element).find("div.jGrowl-notification:parent").each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).children("div.close").trigger("click.jGrowl");}});if($(this.element).find("div.jGrowl-notification:parent").size()<2){$(this.element).find("div.jGrowl-closer").animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});}},startup:function(e){this.element=$(e).addClass("jGrowl").append("<div class=\"jGrowl-notification\"></div>");this.interval=setInterval(function(){jQuery(e).data("jGrowl.instance").update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7){$(this.element).addClass("ie6");}},shutdown:function(){$(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);
	
	//HIGHLIGHTE INPUT ON FOCUS
	$('input[type="text"], input[type="password"], input[type="file"], textarea').focus(function() {
		$(this).addClass("on-focus");
	});
	$('input[type="text"], input[type="password"], input[type="file"], textarea').blur(function() {
		$(this).removeClass("on-focus");
	});
	
	//Switching between languages
	//Creating a cookie and stores the value. Includes.jsp pick it up and sets the session Locale
	$("a.language_link").click(function(){
		//Fetching language code
		var v_lang = this.id.replace('lang_', '');
		
		//Fetching current URL, removing hash character
		var v_url = window.location.href.replace(/\#.*/,'');
		
		//Creating language code cooking
		createCookie('dt_language',v_lang,34);
		
		//Reloading current page
		window.location = v_url;
	});
	
	$("#concertFilteringLink").click(function () {
		$("#concertFilteringBox").slideToggle("slow",function(){
			if( $("#concertFilteringLink").is('.downArrow') ) {
				$("#concertFilteringLink").removeClass('downArrow');
				$("#concertFilteringLink").addClass('upArrow');
	        }
	        else {
	        	$("#concertFilteringLink").removeClass('upArrow');
	        	$("#concertFilteringLink").addClass('downArrow');
	        }
			resizeIframe();
	    });
		return false;
	});
	
	$('#toggleIconDescriptions').toggle(function() {
		$("#iconsDescription").show();
		$("#iconsDescription").dropShadow({left: 1, top: 1, blur: 1, opacity:0.3, color: "#000", swap: false});
		$("#toggleIconDescriptions").removeClass('triangle-down-icon');
		$("#toggleIconDescriptions").addClass('triangle-up-icon');
	}, function() {
		$("#iconsDescription").hide();
		$("#iconsDescription").removeShadow();
		$("#toggleIconDescriptions").addClass('triangle-down-icon');
		$("#toggleIconDescriptions").removeClass('triangle-up-icon');
	});
	
	$('#toggleListSort').toggle(function() {
		$("#listSort").show();
		$("#listSort").dropShadow({left: 1, top: 1, blur: 1, opacity:0.3, color: "#000", swap: false});
		$("#toggleListSort").removeClass('triangle-down-icon');
		$("#toggleListSort").addClass('triangle-up-icon');
	}, function() {
		$("#listSort").hide();
		$("#listSort").removeShadow();
		$("#toggleListSort").addClass('triangle-down-icon');
		$("#toggleListSort").removeClass('triangle-up-icon');
	});

	
	$("#openAll").click(function () {
		$(".hiddenSongList").show();
		$(".linkShow").hide();
		$(".linkHide").show();
		resizeIframe();
	});
	
	$("#closeAll").click(function () {
		$(".hiddenSongList").hide();
		$(".linkShow").show();
		$(".linkHide").hide();
		resizeIframe();
	});
		
	$(".songRow").hover(function() {
		$(this).addClass('songrow-hover');
	}, function() {
		$(this).removeClass('songrow-hover');
	});
		
	$(function(){
		$('.auto-submit-star').rating({
			callback: function(value, link){
				rateArtist(value);
			}
		});
	});

	$(function(){
		$('.removeArtistToFollow').hover(
			function () {
				$(this).append($('<span class="small-text">&nbsp;(Jeg vil ikke lenger f&oslash;lge denne artisten)</span>'));
			}, 
			function () {
				$(this).find('span:last').remove();
			}
		);
	});
	
	//Thickbox
	$(".thickbox_dt").click(function () {
		window.parent.tb_show(this.title, this.href, this.rel);
		return false;
	});
	
	//Language select
	$(".countrySelect").change(function () {
		XT.doAjaxAction('showFylkeAndKommune', this, {'countryId':$(".countrySelect").val()});
	});
	
	//Accordion
	$("#topListContainer").accordion({ 
		active: 0,
		autoHeight: false,
		collapsible:true,
		change: function(event, ui) { resizeIframe(); }		
	});

	//Drop shadow
	
	
});



/************************************************************************/
/*		DROP SHADOW														*/
/************************************************************************/
/*
VERSION: Drop Shadow jQuery Plugin 1.6  12-13-2007

REQUIRES: jquery.js (1.2.6 or later)

SYNTAX: $(selector).dropShadow(options);  // Creates new drop shadows
				$(selector).redrawShadow();       // Redraws shadows on elements
				$(selector).removeShadow();       // Removes shadows from elements
				$(selector).shadowId();           // Returns an existing shadow's ID

OPTIONS:

	left    : integer (default = 4)
	top     : integer (default = 4)
	blur    : integer (default = 2)
	opacity : decimal (default = 0.5)
	color   : string (default = "black")
	swap    : boolean (default = false)

The left and top parameters specify the distance and direction, in	pixels, to
offset the shadow. Zero values position the shadow directly behind the element.
Positive values shift the shadow to the right and down, while negative values 
shift the shadow to the left and up.

The blur parameter specifies the spread, or dispersion, of the shadow. Zero 
produces a sharp shadow, one or two produces a normal shadow, and	three or four
produces a softer shadow. Higher values increase the processing load.

The opacity parameter	should be a decimal value, usually less than one. You can
use a value	higher than one in special situations, e.g. with extreme blurring. 

Color is specified in the usual manner, with a color name or hex value. The
color parameter	does not apply with transparent images.

The swap parameter reverses the stacking order of the original and the shadow.
This can be used for special effects, like an embossed or engraved look.

EXPLANATION:

This jQuery plug-in adds soft drop shadows behind page elements. It is only
intended for adding a few drop shadows to mostly stationary objects, like a
page heading, a photo, or content containers.

The shadows it creates are not bound to the original elements, so they won't
move or change size automatically if the original elements change. A window
resize event listener is assigned, which should re-align the shadows in many
cases, but if the elements otherwise move or resize you will have to handle
those events manually. Shadows can be redrawn with the redrawShadow() method
or removed with the removeShadow() method. The redrawShadow() method uses the
same options used to create the original shadow. If you want to change the
options, you should remove the shadow first and then create a new shadow.

The dropShadow method returns a jQuery collection of the new shadow(s). If
further manipulation is required, you can store it in a variable like this:

	var myShadow = $("#myElement").dropShadow();

You can also read the ID of the shadow from the original element at a later
time. To get a shadow's ID, either read the shadowId attribute of the
original element or call the shadowId() method. For example:

	var myShadowId = $("#myElement").attr("shadowId");  or
	var myShadowId = $("#myElement").shadowId();

If the original element does not already have an ID assigned, a random ID will
be generated for the shadow. However, if the original does have an ID, the 
shadow's ID will be the original ID and "_dropShadow". For example, if the
element's ID is "myElement", the shadow's ID would be "myElement_dropShadow".

If you have a long piece of text and the user resizes the	window so that the
text wraps or unwraps, the shape of the text changes and the words are no
longer in the same positions. In that case, you can either preset the height
and width, so that it becomes a fixed box, or you can shadow each word
separately, like this:

	<h1><span>Your</span> <span>Page</span> <span>Title</span></h1>

	$("h1 span").dropShadow();

The dropShadow method attempts to determine whether the selected elements have
transparent backgrounds. If you want to shadow the content inside an element,
like text or a transparent image, it must not have a background-color or
background-image style. If the element has a solid background it will create a
rectangular	shadow around the outside box.

The shadow elements are positioned absolutely one layer below the original 
element, which is positioned relatively (unless it's already absolute).

*** All shadows have the "dropShadow" class, for selecting with CSS or jQuery.

ISSUES:

	1)	Limited styling of shadowed elements by ID. Because IDs must be unique,
			and the shadows have their own ID, styles applied by ID won't transfer
			to the shadows. Instead, style elements by class or use inline styles.
	2)	Sometimes shadows don't align properly. Elements may need to be wrapped
			in container elements, margins or floats changed, etc. or you may just 
			have to tweak the left and top offsets to get them to align. For example,
			with draggable objects, you have to wrap them inside two divs. Make the 
			outer div draggable and set the inner div's position to relative. Then 
			you can create a shadow on the element inside the inner div.
	3)	If the user changes font sizes it will throw the shadows off. Browsers 
			do not expose an event for font size changes. The only known way to 
			detect a user font size change is to embed an invisible text element and
			then continuously poll for changes in size.
	4)	Safari support is shaky, and may require even more tweaks/wrappers, etc.
	
	The bottom line is that this is a gimick effect, not PFM, and if you push it
	too hard or expect it to work in every possible situation on every browser,
	you will be disappointed. Use it sparingly, and don't use it for anything 
	critical. Otherwise, have fun with it!
			
AUTHOR: Larry Stevens (McLars@eyebulb.com) This work is in the public domain,
				and it is not supported in any way. Use it at your own risk.
*/


(function($){

var dropShadowZindex = 1;  //z-index counter

$.fn.dropShadow = function(options)
{
	// Default options
	var opt = $.extend({
		left: 4,
		top: 4,
		blur: 2,
		opacity: .5,
		color: "black",
		swap: false
		}, options);
	var jShadows = $([]);  //empty jQuery collection
	
	// Loop through original elements
	this.not(".dropShadow").each(function()
	{
		var jthis = $(this);
		var shadows = [];
		var blur = (opt.blur <= 0) ? 0 : opt.blur;
		var opacity = (blur == 0) ? opt.opacity : opt.opacity / (blur * 8);
		var zOriginal = (opt.swap) ? dropShadowZindex : dropShadowZindex + 1;
		var zShadow = (opt.swap) ? dropShadowZindex + 1 : dropShadowZindex;
		
		// Create ID for shadow
		var shadowId;
		if (this.id) {
			shadowId = this.id + "_dropShadow";
		}
		else {
			shadowId = "ds" + (1 + Math.floor(9999 * Math.random()));
		}

		// Modify original element
		$.data(this, "shadowId", shadowId); //store id in expando
		$.data(this, "shadowOptions", options); //store options in expando
		jthis
			.attr("shadowId", shadowId)
			.css("zIndex", zOriginal);
		if (jthis.css("position") != "absolute") {
			jthis.css({
				position: "relative",
				zoom: 1 //for IE layout
			});
		}

		// Create first shadow layer
		bgColor = jthis.css("backgroundColor");
		if (bgColor == "rgba(0, 0, 0, 0)") bgColor = "transparent";  //Safari
		if (bgColor != "transparent" || jthis.css("backgroundImage") != "none" 
				|| this.nodeName == "SELECT" 
				|| this.nodeName == "INPUT"
				|| this.nodeName == "TEXTAREA") {		
			shadows[0] = $("<div></div>")
				.css("background", opt.color);								
		}
		else {
			shadows[0] = jthis
				.clone()
				.removeAttr("id")
				.removeAttr("name")
				.removeAttr("shadowId")
				.css("color", opt.color);
		}
		shadows[0]
			.addClass("dropShadow")
			.css({
				height: jthis.outerHeight(),
				left: blur,
				opacity: opacity,
				position: "absolute",
				top: blur,
				width: jthis.outerWidth(),
				zIndex: zShadow
			});
			
		// Create other shadow layers
		var layers = (8 * blur) + 1;
		for (i = 1; i < layers; i++) {
			shadows[i] = shadows[0].clone();
		}

		// Position layers
		var i = 1;			
		var j = blur;
		while (j > 0) {
			shadows[i].css({left: j * 2, top: 0});           //top
			shadows[i + 1].css({left: j * 4, top: j * 2});   //right
			shadows[i + 2].css({left: j * 2, top: j * 4});   //bottom
			shadows[i + 3].css({left: 0, top: j * 2});       //left
			shadows[i + 4].css({left: j * 3, top: j});       //top-right
			shadows[i + 5].css({left: j * 3, top: j * 3});   //bottom-right
			shadows[i + 6].css({left: j, top: j * 3});       //bottom-left
			shadows[i + 7].css({left: j, top: j});           //top-left
			i += 8;
			j--;
		}

		// Create container
		var divShadow = $("<div></div>")
			.attr("id", shadowId) 
			.addClass("dropShadow")
			.css({
				left: jthis.position().left + opt.left - blur,
				marginTop: jthis.css("marginTop"),
				marginRight: jthis.css("marginRight"),
				marginBottom: jthis.css("marginBottom"),
				marginLeft: jthis.css("marginLeft"),
				position: "absolute",
				top: jthis.position().top + opt.top - blur,
				zIndex: zShadow
			});

		// Add layers to container	
		for (i = 0; i < layers; i++) {
			divShadow.append(shadows[i]);
		}
		
		// Add container to DOM
		jthis.after(divShadow);

		// Add shadow to return set
		jShadows = jShadows.add(divShadow);

		// Re-align shadow on window resize
		$(window).resize(function()
		{
			try {
				divShadow.css({
					left: jthis.position().left + opt.left - blur,
					top: jthis.position().top + opt.top - blur
				});
			}
			catch(e){}
		});
		
		// Increment z-index counter
		dropShadowZindex += 2;

	});  //end each
	
	return this.pushStack(jShadows);
};


$.fn.redrawShadow = function()
{
	// Remove existing shadows
	this.removeShadow();
	
	// Draw new shadows
	return this.each(function()
	{
		var shadowOptions = $.data(this, "shadowOptions");
		$(this).dropShadow(shadowOptions);
	});
};


$.fn.removeShadow = function()
{
	return this.each(function()
	{
		var shadowId = $(this).shadowId();
		$("div#" + shadowId).remove();
	});
};


$.fn.shadowId = function()
{
	return $.data(this[0], "shadowId");
};


$(function()  
{
	// Suppress printing of shadows
	var noPrint = "<style type='text/css' media='print'>";
	noPrint += ".dropShadow{visibility:hidden;}</style>";
	$("head").append(noPrint);
});

})(jQuery);

