var wait=2000; //set timeout, in miliseconds
var duration=100; //set duration of fading in and fading out while changing pictures
var picturescount=8; //set count of the pictures that are changing; pictures has to be in folder /images/ and have to have names 1.jpg, 2.jpg,... 99.jpg



var next=5;
var id="1";
function changeImage(id,next){
	$("#f"+id).append("<img class=\"f"+id+"new\" src=\"intro/intro_images/"+next+".jpg\" />");
	$(".f"+id+"new").hide();
	$(".f"+id+"old").fadeOut(duration, function(){
		$(".f"+id+"old").remove();
		old="f"+id+"old";
		neww="f"+id+"new";
		$(".f"+id+"new").addClass(old);
		$(".f"+id+"old").removeClass(neww);
	});
	
	$(".f"+id+"new").fadeIn(duration);
	}

function changing(){
	changeImage(id, next);
	if(next==picturescount){next=1;}
	else{next=next+1;}
	
	if(id=="1"){id="4";}
	else if(id=="2"){id="3";}
	else if(id=="3"){id="1";}
	else if(id=="4"){id="2";}
}

$(document).ready(function(){ 
	setInterval("changing()", wait);
	});
