		function getElementsByClass(searchClass,node,tag) {
			var classElements = new Array();
			if ( node == null )
				node = document;
			if ( tag == null )
				tag = '*';
			var els = node.getElementsByTagName(tag);
			var elsLen = els.length;
			var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
			for (i = 0, j = 0; i < elsLen; i++) {
				if ( pattern.test(els[i].className) ) {
					classElements[j] = els[i];
					j++;
				}
			}
			return classElements;
		}
		
		function getMargin(e){
			if(e.style.margin=="" || e.style.margin==null){
				var margin = new Array();
			
				if (document.all && !window.opera) {
					margin[0]=(e.currentStyle["marginTop"]!="auto") ? parseInt(e.currentStyle["marginTop"])+"px" : "auto";
					margin[1]=(e.currentStyle["marginRight"]!="auto") ? parseInt(e.currentStyle["marginRight"])+7+"px" : "7px";
					margin[2]=(e.currentStyle["marginBottom"]!="auto") ? parseInt(e.currentStyle["marginBottom"])+7+"px" : "7px";
					margin[3]=(e.currentStyle["marginLeft"]!="auto") ? parseInt(e.currentStyle["marginLeft"])+"px" : "auto";
				}else{
					margin[0]=parseInt(document.defaultView.getComputedStyle(e, null).getPropertyValue("margin-top"))+"px";
					margin[1]=parseInt(document.defaultView.getComputedStyle(e, null).getPropertyValue("margin-right"))+7+"px";
					margin[2]=parseInt(document.defaultView.getComputedStyle(e, null).getPropertyValue("margin-bottom"))+7+"px";
					margin[3]=parseInt(document.defaultView.getComputedStyle(e, null).getPropertyValue("margin-left"))+"px";
				}
				
				return margin[0]+" "+margin[1]+" "+margin[2]+" "+margin[3];
			}else{
				return e.style.margin;
			}
		}
		
		var Shadow = {
			defaultColor : "#000020",
			defaultOpacity: 0.4,
			
			add: function(element, options) {
				//Shadow.remove(element);
				
				doptions = { "color" : Shadow.defaultColor, "opacity" : Shadow.defaultOpacity }
				if (options) {
					for (var i in doptions) {
						if (!options[i]) {
							options[i] = doptions[i];
						}
					}
				} else {
					options = doptions;
				}
			
				try {
					var e = element;
					
					var d = document.createElement('div');
					d.style.position="relative";
					//alert(e.style.margin);
					/*Obtain elements width,height,margins*/
					d.style.width = (e.style.width!="") ? e.style.width : "auto";
					d.style.height = (e.style.height!="") ? e.style.height : "auto";
					d.style.margin = getMargin(e);
					d.style.textAlign = "left";
					/*Remove margin from element.  Margin will be reflected in wrapper*/
					e.style.margin = "0px";
					
					var shadow = document.createElement('div');
					shadow.style.position="absolute";
					shadow.style.left="7px";
					shadow.style.top="7px";
					/* IE6 cannot render empty elements with 100% height properly.*/
					var agt=navigator.userAgent.toLowerCase();
					if(agt.indexOf("msie")>0 && agt.indexOf("msie 7")==-1){
						shadow.className="elementshadow";
					}else{
						shadow.style.height="100%";
						shadow.style.width="100%";
					}
					if (document.all && !window.opera) {
						shadow.style.filter = "alpha(opacity="+(options['opacity']*100)+")";
					}else{
						shadow.style.opacity=options['opacity'];
					}
					shadow.style.backgroundColor=options['color'];
					
					e.parentNode.replaceChild(d, e);
					d.appendChild(shadow);
					d.appendChild(e);
				} catch (error) {
					alert(error);
			    }
			},
			
			remove : function(element) {
				if (element.className == "shadowed") {
					element.className = image.parentNode.className;
					element.parentNode.parentNode.replaceChild(image, image.parentNode);
				}
			}
		}

		function addShadows() {
			var sElements = getElementsByClass("shadow");
			for (i=0;i<sElements.length;i++) {
				var scolor = null;
				var sopacity = null;
				
				var classes = sElements[i].className.split(' ');
				for (j=0;j<classes.length;j++) {
					if (classes[j].indexOf("scolor") == 0) {
						var scolor = classes[j].substring(6);
					} else if (classes[j].indexOf("sopacity") == 0) {
						var sopacity = classes[j].substring(8)/100;
					}
				}
				
				Shadow.add(sElements[i], {color: scolor, opacity: sopacity});
			}
			if(document.all){document.styleSheets[0].addRule("div.elementshadow","height:expression(this.nextSibling.offsetHeight + 'px'); width:expression(this.nextSibling.offsetWidth + 'px');");}
		}
		
		//window.onload = function(){addShadows();}
