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

function changeImage() {
	// first we set the background image of the .headerphoto div to the new image 0
	$('rotator').style.backgroundImage='url(' + rotators[0] + ')';
	// now fade out the image
	$('rotatorimg').fade();
	// change the image source
	$('rotatorimg').src = rotators[0];
	// and show it
	$('rotatorimg').show();
	// and change the background image to the next one to preload it
	$('rotator').style.backgroundImage='url(' + rotators[1] + ')';
	img = rotators.shift();
	rotators[rotators.length] = img;
	setTimeout('changeImage();', delay);
}
function makeRequest(form) {
	if (!$('customer').value || !$('email').value) {
		alert('Name and email are both required!');
	} else {
		data = form.serialize();
		h = form.getHeight();
		form.style.height = h  + 'px';
		form.innerHTML = '<h2>Please wait...</h2>';
		new Ajax.Request('request.php', {
				parameters: data,
				method: 'get',
				onSuccess: function(transport) {
					form.innerHTML = transport.responseText;
				}
			}
		);
	}
}

function showImg(img) {
	$('mdm-img').src = imgs + 'medium-' + img;
	$$('a.lb').each(function(s) {
		s.href=imgs + img;
	});
}
