var interval = 7000; // Zeit in ms zwischen Bildwechsel
var duration = 2000; // Dauer Fade in ms 

function randOrd(){
return (Math.round(Math.random())-0.5); } 
Images.sort(randOrd);


	/*$("#head_img img").load(function() {
		this.attr("src", Images[0]);
	});*/

$(function() {
	setInterval("changeImage()", interval);
	
	$(Images).each(function(Key, Image) {
		if (Key == 0)  {
			$("#head_img img:first").replaceWith("<img src='" + Image + "' style='position: absolute; top: 0px; left: 0px' />");
		}
		else {
			$("#head_img").append("<img src='" + Image + "' style='position: absolute; top: 0px; left: 0px; display: none' />");
		}
	});
});

var current = 1;
var pos = 0;

function changeImage() {
	if (current == Images.length)
		current = 0;
		
	$('#head_img').children(":nth(" + current + ")").hide().css("z-index", pos).fadeIn(duration);
		
	pos++;
	current++;
}

