/*
the function applyDropShadows takes one argument - a css selector
that refers to the element(s) to which you want to apply drop shadows.

Call this function from each page that you wish to apply drop shadows
cssSelector = element as well as class or ID attributes
shadowStyle = different shadow styles that are available

window.onload = function(){
	applyDropShadows(cssSelector,shadowStyle);
	}
*/

function applyDropShadows(cssSelector,shadowStyle){
	
/*modify by kdani kisdani86@gmail.com*/
	function getelementbyclass_for_shadows(theClass) {
		var allPageTags=document.getElementsByTagName("img");
		//just images
		var j = 0;
		var returnarray = new Array(); 
		for (i=0; i<allPageTags.length; i++) {
	
			if (allPageTags[i].className==theClass) {
	
			returnarray[j] = allPageTags[i];
			j++;
		}
	}
	
	return returnarray;
	
}
/* modify end*/
	
	if(document.getElementsByTagName && document.createElement){
		// get all elements that match the specified css selector
	//console.log(cssSelector);
		var elements = getelementbyclass_for_shadows(cssSelector);
	
		//console.log(elements);
		// loops through the list of matching elements
		for(i=0;i<elements.length;i++){
		
			var element = elements[i];
		//	console.log(element);
			// create the wrapper divs
			var wrap1 = document.createElement('div');
			var wrap2 = document.createElement('div');
			var wrap3 = document.createElement('div');
			wrap1.className = shadowStyle;
			
			// duplicate the image to be shadowed
			var newElement = element.cloneNode(true);
			
			// nest the new image and wrapper divs
			wrap3.appendChild(newElement);
			wrap2.appendChild(wrap3);
			wrap1.appendChild(wrap2);
			var shadowedElement = wrap1;
			
			// replace the old image with the new div-wrapped version
		
			element.parentNode.replaceChild(shadowedElement,element);
			}
		}
	}


