var fadingOut = 0;
var fadingIn = 0;
var timer;

function setPhoto() {		
	clearTimeout(timer);
	
	var found = false;
	var changed = false;
	var current = '';
	var next = '';
    $(".homeFoto").each(function() {
		if(!changed){
			if(found){
				changed = true;
				next = this;
			}
			if ( $(this).is(':visible') ) {
				found = true;
				current = this;
			}
		}
		
	});
	
	if(!changed){
		next = $(".homeFoto:first");
	}	
	
	$(current).fadeOut(function(){$(next).fadeIn()});
	
	setTimeout( "setPhoto()", 5000 );	
}

