function head_background_rotate() {
	backgound_index++;
	if (typeof(backgound_images[backgound_index])=='undefined') {
		backgound_index= 0;
	}
	$('#head_background').fadeOut('slow', function() {
		$('#head_background').attr({'src':backgound_images[backgound_index]}).fadeIn('slow', function() {
			setTimeout(function() {
				head_background_rotate();
			}, 3000);
		});
	});
}

$(window).load(function() {
	//preload images...
	for (var i in backgound_images) {
		$(document.createElement('img')).attr({'src':backgound_images[i]})
										.css({'position':'absolute', 'top':'-1000px', 'left':'-1000px'})
										.appendTo('body');
	}
	//start rotating
	setTimeout(function() {
		head_background_rotate();
	}, 4000);
});
