$j(function () {
	validateFindANurseryNearYouForm();
	$j('.animateSlideshow > ul').animateSlideshow({
		fadeInDuration: 450,
		fadeOutDuration: 350,
		transitionDelay: 6000
	});
});

function validateFindANurseryNearYouForm() {
	var form = $j('#panelFindANurseryNearYou form');
	var postcode = $j('#inputPostcode');

	// When the form is submitted...
	form.submit(function (e) {

		// Validate postcode.
		if (!validate(postcode, 'Please enter a postcode', hasSubstance(postcode))) return false;
		if (!validate(postcode, 'Please enter a valid UK postcode', isPostcode(postcode))) return false;
	});
}