/*******
	***	Link Fader by Cedric Dugas   ***
	*** Http://www.position-absolute.com ***
*****/

$(document).ready(function() {
	hoverOpacity.init()
});

hoverOpacity = {
	init : function(){
		$('div.linkFader').css({
			position:"relative",
			backgroundPosition:"0px 0px",
			cursor:"pointer"
		})   
		
		$('div.linkFader').each(function(){
			
			spanFader = document.createElement('span');
			myBG = $(this).css("background-image")
			
			$(this).append(spanFader);
		
			myBG = $(this).css("background-image")
			spanWidth =  $(this).css("width")
			spanHeight =  $(this).css("height")
				
			$(this).find("span").css({
				backgroundImage:myBG,
				backgroundPosition:"bottom right",
				position:"absolute",
				display:"block",
				cursor:"pointer",
				top:"0px",
				left:"0px",
				width:spanWidth,
				height:spanHeight,
				opacity:0,
				visibility:"visible",
				padding: "17px 112px 17px 112px", 
				'z-index' : '0'  //zindex added and neede for background img to fall behind div .summary elements
				
			})
		})
		$("div.linkFader").hover(function () {
			// console.log($(this).find("span:not(:animated)"));
			//$(this).find("span").stop();
			//$(this).find("span:not(:animated)").animate({opacity: 1}, 300);
		},
		function () {
			$(this).find("span").animate({opacity: 0},250)
		});
	}
}
