// Image SlideShow

function slideShow(imgID, numOfImg, inTime, outTime, duration, current) {
	
	// check if current slide no. is set and within the range
	// if not, set its value to 1
	if (!current || current < 1 || current >= numOfImg) { current = 1; }
	
	// if fadeIn time is not set, set it to 1000
	if (!inTime) { inTime = 1000; }
	
	// if fadeIn time is not set, set it to 1000
	if (!outTime) { outTime = 1000; }
	
	// if fadeIn time is not set, set it to 2500
	if (!duration) { duration = 2500; }
	
	// not to change together
	var offset = 0;
	if (imgID == "project" && current == 1) { offset = 1000; }
	
	// fade in, stop for a while, fade out, then next one
	$("#"+imgID+current).delay(offset).fadeIn(inTime).delay(duration).fadeOut(outTime, function() { slideShow(imgID, numOfImg, inTime, outTime, duration, current+1) } );

}

$(function() {
	// images that you want to use the slideShow function
	slideShow("product", 4);
	slideShow("project", 4);
});
