function slideshow(node, imageSrcs){
	if (imageSrcs.length == 0) return;
	var images = new Array();
	var curImage = 0;
	var alpha = 100;

	// constructor
	for (var i=0; i<imageSrcs.length; i++){
		images[i]=new Image();
		images[i].src = imageSrcs[i];
	}
	var topImage = appendDiv(node);
	var bottomImage = appendDiv(node);
	
	start();
	
	function appendDiv(node){	
		var div = $("<div>"); 			
		div.css("width", node.css("width"));
		div.css("height", node.css("height"));
		div.css("background", "transparent no-repeat center center");
		div.css("position", "absolute");
		div.css("top", "0px");
		div.css("left", "0px");
		node.append(div);
		return div;
	}
	
	function start(){
		if (images[curImage] && images[curImage].complete){
			bottomImage.hide();
			topImage.css("backgroundImage", "url("+images[curImage].src+")");
			topImage.hide().fadeIn(1000);
			if(images.length > 1) setTimeout(swapPicture, 4000);
		} else setTimeout(start, 500);
	}
			
	function swapPicture(){		
		var nextImage = curImage + 1;
		
		// if this is the last image loop
		if (nextImage>=images.length)
			nextImage=0;
		
		// if the next image has finished loading
		if (images[nextImage] && images[nextImage].complete){ 
			curImage = nextImage;
			bottomImage.css("backgroundImage", "url("+images[curImage].src+")");
			topImage.fadeOut(1000);
			bottomImage.fadeIn(1000, fadeComplete);
			setTimeout(swapPicture, 4000);
		
		// otherwise wait for it to finish
		} else setTimeout(swapPicture, 500);
	}
	
	function fadeComplete(){
		var temp = topImage;
		topImage = bottomImage;
		bottomImage = temp;
	}
}