function contactUs() {
	if (document.getElementById)
	{
		var f = document.getElementById('frmContactUs');
		var charCount = f.myMsg.value.length;
		var emailFilter = /^.+@.+\..{2,3}$/;
		var badChars = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;

		if (f.myName.value.length == 0) {
			alert("Please type your name");
			f.myName.focus();
			return false;
		}
		if ((f.myPhone.value.length == 0) && (f.myEmail.value.length == 0)) {
			alert('Please type either a phone number or an email address');
			f.myPhone.focus();
			return false;
		}
		else if ((f.myEmail.value.length > 0) && ((!emailFilter.test(f.myEmail.value)) || (f.myEmail.value.match(badChars)))) {
			alert("Please type a valid email address");
			f.myEmail.focus();
			return false;
		}
		else if (charCount > 2000) {
			alert("Your message is too long - it must be no longer than 2000 characters.\n\nYour comments are currently " + charCount + " characters in length.");
			f.myMsg.focus();
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}
}

function sendComments() {
	if (document.getElementById)
	{
		var f = document.getElementById('frmComments');
		var charCount = f.myComment.value.length;
		var monthSelect = f.stayedMonth;
		var monthValue = monthSelect.options[monthSelect.selectedIndex].value;
		
		if (f.myName.value.length == 0) {
			alert("Please enter your name or initials");
			f.myName.focus();
			return false;
		}
		else if (monthValue == "") {
			alert("Please select the month in which you stayed at Coombe Park");
			f.stayedMonth.focus();
			return false;
		}
		else if (f.stayedYear.value.length == 0) {
			alert("Please enter the year in which you stayed at Coombe Park");
			f.stayedYear.focus();
			return false;
		}
		else if ((charCount < 3) || (charCount > 500)) {
			alert("Please type comments of between 3 and 500 characters in length.\n\nYour current comments are " + charCount + " characters in length.");
			f.myComment.focus();
			return false;
		}
		else {
			return true;
		}
	}
	else {
		return true;
	}
}

function hideLayers() {
	if (document.layers) {
		document.layers[0].visibility = 'hide';
		document.layers[1].visibility = 'hide';
	}
}

function emptyDIVs() {
	if (document.all && !document.getElementById)
		var allDIVS = document.all.tags('div');
	else if ((document.getElementById) && (!document.layers))
		var allDIVS = document.getElementsByTagName('div');

	if (!document.layers) {
		var el, i = 0;
		while (el = allDIVS.item(i++)) {
			if ((typeof el.style != 'undefined') && (el.id != 'Navigation') && (el.id != 'MainContent')) {
				el.style.display = 'none';
				el.innerHTML = '';
			}
		}
	}
}
