$.fn.extend({
	ddFader: function(opt){
		if(!opt.images.length){ return; }
		
		var imageIndex = 0;
		
		$(this).find('*').remove();
		var canvas = $('<div />').css({
			width:opt.width+'px',
			height:opt.height+'px',
			position:'relative',
			overflow:'hidden'
		});
		var imgCss = {
			position:'absolute',
			left:'0px',
			top:'0px',
			'z-index':200
		};
		var top = $('<img />').css(imgCss);
		var bottom = $('<img />').css(imgCss);
		
		canvas.append(bottom);
		canvas.append(top);

		$(this).append(canvas);
		
		function loadNext(){
			top.attr('src', opt.images[imageIndex].url);
			imageIndex++;
			if(imageIndex==opt.images.length){ imageIndex = 0; }
			bottom.attr('src', opt.images[imageIndex].url);

			top.fadeOut('slow', function(){
				top.attr('src', bottom.attr('src'));
				top.show();
				top.click(function(){
					document.location.href = opt.images[imageIndex].linkURL;
				});
			});
		}
		top.attr('src', opt.images[0].url);
		top.click(function(){
			document.location.href = opt.images[0].linkURL;
		});
		setInterval(loadNext, opt.delay);
	}
});