/*
	SolidShadow v1.2.0 - jQuery SolidShadow
	Copyright (c) 2010 Justin Shearer
	
	Dual licensed under the MIT and GPL licenses:
	http://www.opensource.org/licenses/mit-license.php
	http://www.gnu.org/licenses/gpl.html

	EXAMPLE:
	$('span').solidShadow('inline','#fff','black','left',5);
	This will set the text color to white and give a 5px black text shadow to the bottom left of the element.

	OPTIONS:
	inlineBlock: "inline" or "block" (default = "inline")
	Choose if you are adding a shadow to a block element or text element.
	
	foreground: string (default = "#fff")
	Choose the foreground color using any css color value.
	 
	background: string (default = "#000")
	Choose the background color using any css color value.
	
	leftRight: "left" or "right" (default = "left")
	Choose if the shadow will be on the left or the right of the element. 
	
	length: integer (default = 10)
	Choose the length of the shadow in pixels.
	*note: the longer the shadow the slower the performance.
	
	topBottom: "top" or "bottom" (default = "bottom")
	Choose to have the shadow appear to the top or bottom of the element.
 */
(function($){
$.fn.solidShadow = function(inlineBlock,foreground,background,leftRight,length,topBottom){
	if(leftRight=='right'){leftRight='left'}else{leftRight='right';}
	if(topBottom=="top"){topBottom="-";}else{topBottom=""}
	if(length==null){length=10;}
	if(foreground==null){foreground="#fff";}
	if(background==null){background="#000";}
	$(this).each(function(){
		var text=$(this).html();
		if(inlineBlock=='block'){
			$(this).empty();
			var w=$(this).width();
			var h=$(this).height();
			if($(this).css('position')!='absolute'){
				$(this).css('position','relative');
			}
			$(this).append("<div style='position:absolute;left:0px;top:0px;z-index:"+(length+1)+";background-color:"+foreground+";width:"+w+"px;height:"+h+"px;'>"+text+"</div>");
			for(i=1;i<=length;i++){
				$(this).append("<div style='position:absolute;"+leftRight+":"+i+"px;top:"+topBottom+i+"px;z-index:"+(length-i)+";background-color:"+background+";width:"+w+"px;height:"+h+"px;'></div>");
			}
		}
		else{
			$(this).empty();
			$(this).append("<span class='reference' style='display:inline-block;position:relative;'>"+text+"</span>");
			$(this).children('.reference').append("<span class='top' style='position:absolute;left:0px;top:0px;z-index:"+(length+1)+";color:"+foreground+"'>"+text+"</span>");
			for(i=1;i<=length;i++){
				$(this).children('.reference').append("<span style='display:inline-block;position:absolute;width:100%;"+leftRight+":"+i+"px;top:"+topBottom+i+"px;z-index:"+(length-i)+";color:"+background+"'>"+text+"</span>");
			}
		}
	})
	};
})(jQuery);
