function openDialog() {
	$('#smallMap').hide(); // hide the flash map as it looks strange when the dialog is open
	$('#contactForm').modal({onClose: function (dialog) {
			$('#smallMap').show(); // restore the flash map on closing
			$.modal.close();
		}, close: false
	});
	$('#contactForm :text:first').focus();
	return(false);
}

function submitWithAjax(form) {
	var valid = true;
	// validate our form
	$('.validateme').each(function(i, o) {
		if($(o).val() == '') {
			$(o).css('background-color','#fbebeb');
			valid = false;
		} else {
			$(o).css('background-color','');
		}

	});

	if(!valid) {
		$('.error').show();
		return(false);
	} else {
		$('.error').hide();
	}

	// now submit using ajax
	$('#contactFormFields').load(form.action + '&nospam=1', $(form).serializeArray());
	$('#contactForm :input').hide();
	$('#contactFormFields').text('Your request has been sent, and will be read by our staff.<br> Thank you for taking the time to contact us.');
}
