//settings
var tweenTimeout = 10000;
var tweenDuration = 2000;
var imageCount;
var selectedImage = 0;
var interval;

$(document).ready(function(){
	imageCount = $(".header_image").length;
	
	//tween the images
	interval = setInterval('tweenImages()',tweenTimeout);
});

function tweenImages(){
	//animate the current image out
	$(".header_image").eq(selectedImage).animate({'opacity':0},tweenDuration);
	
	//reset the selected image
	if(++selectedImage >= imageCount) selectedImage = 0;
	
	//animate the next image in
	$(".header_image").eq(selectedImage).css({'opacity':0}).show().animate({'opacity':1},tweenDuration);
}
