var delay = 6000;
Event.observe(window, 'load', function(){
		setTimeout('changeImage();', delay);
});

function changeImage() {
	div = $('header');
	inner_img = $$('div#header img')[0];
	// first we set the background image of the .headerphoto div to the new image 0
	div.style.backgroundImage='url(http://michellespiano.com/images/rotators/' + rotators[0] + ')';
	// now fade out the image
	inner_img.fade();
	// change the image source
	inner_img.src = 'http://michellespiano.com/images/rotators/' + rotators[0];
	// and show it
	inner_img.show();
	// and change the background image to the next one to preload it
	div.style.backgroundImage='url(http://michellespiano.com/images/rotators/' + rotators[1] + ')';
	img = rotators.shift();
	rotators[rotators.length] = img;
	setTimeout('changeImage();', delay);
}

function makeRequest(form) {
	data = form.serialize();
	h = form.getHeight();
	form.style.height = h  + 'px';
	form.innerHTML = '&nbsp;&nbsp;Please wait...';
	new Ajax.Request('request.php', {
			parameters: data,
			method: 'get',
			onSuccess: function(transport) {
				form.innerHTML = transport.responseText;
			}
		}
	);
}
