/* Created by Martin Hintzmann 2008 martin [a] hintzmann.dk
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 *
 * Version: 0.2
 * Requires: jQuery 1.2+
 * http://plugins.jquery.com/project/textshadow
 *
 */
(function($) {
	$.fn.textShadow = function(xOffset, yOffset, blurRadius, shadowColor, shadowOpacity) {
		if (!$.browser.msie) return;
		return this.each(function(){
			$(this).textShadowRemove();
			if ($(this).css("position")=="static") {
				$(this).css({position:"relative"});
			}
			$(this).css({zIndex:"0"});

			var span=document.createElement("span");
			$(span).addClass("jQueryTextShadow");

			$(span).html($(this).html());
			$(this).append(span);
			
			$(span).css({
				position:	"absolute",
				zIndex:		"-1",	
				color:		shadowColor,
				left:			(-blurRadius+xOffset)+"px",
				top:			(-blurRadius+yOffset)+"px"
			});
			if (blurRadius != 0) {
				if (shadowOpacity != undefined) {
					$(span).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelradius="+blurRadius+", enabled='true', makeShadow='true', ShadowOpacity="+shadowOpacity+")");
				} else {
					$(span).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelradius="+blurRadius+", enabled='true')");
				}
			}				
	  });
	};

	$.fn.textShadowRemove = function() {
		return this.each(function() {
			$(this).children("span.jQueryTextShadow").remove();
		});
	};
})(jQuery);
