	function validateAppForm(theForm) {
		if (theForm.club_name.value == "") {
			alert("cannot proceed without a club name supplied");
			theForm.club_name.focus();
			return false;
		}
		if (theForm.club_capt_name.value == "") {
			alert("cannot proceed without a Captain's name supplied");
			theForm.club_capt_name.focus();
			return false;
		}
		if (theForm.club_capt_phone1.value == "") {
			alert("cannot proceed without a Captain's phone number supplied");
			theForm.club_capt_phone1.focus();
			return false;
		}
		
		theForm.submit();
		return true;
	}

	function validateNewClubAppForm(theForm) {
		if (theForm.club_name.value == "") {
			alert("cannot proceed without a club name supplied");
			theForm.club_name.focus();
			return false;
		}

		theForm.submit();
		return true;
	}

	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
			return [curleft,curtop];
		}
	}

	function openPopWindowSize(url,desc,wdth,hght,item) {
		if (item) {
			var elem = document.getElementById("calevt" + item);
			var coords = Array();
			coords = findPos(elem);
			popwindow = window.open(url,desc,'width=' + wdth + ',height=' + hght + ',scrollbars=yes,resizable=yes');
			popwindow.moveTo(coords[0], coords[1]);
		}
		else {
			popwindow = window.open(url,desc,'width=' + wdth + ',height=' + hght + ',scrollbars=yes,resizable=yes');
			popwindow.moveTo(150, 300);
		}
	}

	function IsEmail(elem) {
		var field = elem.value;
		var regex = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i ;
		return regex.test(field);
	}

	function validateContactUsForm(theForm) {
		if ((theForm.fromaddress.value == "") || (! IsEmail(theForm.fromaddress))) {
			alert("You must supply a valid email address to proceed");
			theForm.fromaddress.focus();
			return false;
		}
		
		if (theForm.emailmsg.value == "") {
			alert("Please type a smalll message in the box");
			theForm.emailmsg.focus();
			return false;
		}
		
		theForm.submit();
		return true;
	}
