/////////////////////////////
//
//Date Function for HTML pages.
//
	function getDateInfo() {
		var currentDate = new Date();
		var daysOfWeek = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
		var monthsOfYear = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		with (currentDate){
			var thisDate = daysOfWeek[getDay()] + ", " + getDate() + " " + monthsOfYear[getMonth()] + " " + getFullYear();
		}
		return (thisDate);
	}

///////////////////////////
//
//Menu functions.
//
	function show_sub_menu(MenuNo, NumMenus) {
		clearTimeout(ST);
		with (document) {
			if (document.layers) {
				for (var i=1; i<NumMenus+1; ++i) {
 					if (i==MenuNo) {
 						eval("p" + i + ".visibility='show'");
 					} else {
						eval("p" + i + ".visibility='hide'");
					}
 				}
 			}
 			if (document.all) {
				for (var i=1; i<NumMenus+1; ++i) {
					if (i==MenuNo) {
						eval("p" + i + ".style.visibility='visible'");
 					} else {
 						eval("p" + i + ".style.visibility='hidden'");
 					}
 				}
 			}
 		}
	}

	function hide_sub_menu(MenuNo) {
		var hide = "hide_it("+MenuNo+")";
		ST=setTimeout(hide, 1000);
	}
	
	function hide_it(MenuNo) {
		with (document) {
			if (document.layers) {
 				eval("p" + MenuNo + ".visibility='hide'");
 			}
 			if (document.all) {
 				eval("p" + MenuNo + ".style.visibility='hidden'");
			}
 		}
	}
/////////////////////////////
//
//Member login check script.
//
	function LoginVal(theForm) {
		with (theForm){
			if (Email.value.length < 3) {
				alert("Please Enter Your Email Address.");
				Email.focus();
				return (false);
			}
			if (pw.value.length < 2) {
				alert("Please Enter Your Password.");
				pw.focus();
				return (false);
			}
		}
	}

/////////////////////////////
//
//Member registration script.
//
	function regVal(theForm) {
		with (theForm){
			if (Name.value.length < 3) {
				alert("Please Enter Your Name.");
				Name.focus();
				return (false);
			}
			if (Address.value.length < 5) {
				alert("Please Enter Your Address.");
				Address.focus();
				return (false);
			}
			if (Country.value.length < 2) {
				alert("Please Enter Your Country.");
				Country.focus();
				return (false);
			}
			if (HomePhone.value.length < 6) {
				alert("Please Enter Your Home Telephone Number.");
				HomePhone.focus();
				return (false);
			}
			var emailAddress=Email.value;
			var emailAddressLen=emailAddress.length;
			var atCharacter=emailAddress.indexOf("@");
			var dotCharacter=emailAddress.indexOf(".");
			if (emailAddressLen < 9 || atCharacter < 2) {
				alert("Please Enter a Valid Email Address.");
				Email.focus();
				return (false);
			}
		}
		if(confirm("Submit this form?")) {
			return (true);
		}
		else {
			return(false);
		}
	}

/////////////////////////////
//
//Member produce contact details popup.
//
	function viewDetails(memNum){
		detailsWin=window.open("dirdetails.php?id="+memNum, "details", "menubar=yes,scrollbars=yes,toolbar=no,status=no,location=no,directories=no,width=650,height=550");
		window.detailsWin.focus();
	}

/////////////////////////////
//
//Print contact details popup.
//
	function printPage(){
		if (ieVersion > 4.99){
			window.print();
		} else {
			alert("Sorry the version of Internet Explorer you are using cannot use this print method\n\nPlease use your right mouse button to click the page and select print from the resultant menu diplayed.");
		}
	}

/////////////////////////////
//
//Sign Up.
//
	function signUp(z){
		if (z==0) {
			if(confirm("Please confirm that you wish to sign up for this event.\n\r\n\rIf you click the 'OK' button you will be automatically added to the list of participating members.\n\rIf you do not wish to sign up right now then please click the 'Cancel' button.")) {
				return (true);
			}
			else {
				return(false);
			}	
		} else {
			if(confirm("Please confirm that you wish remove yourself from the signed up list for this event.\n\r\n\rIf you click the 'OK' button you will be automatically removed to the list of participating members.\n\rIf you do not wish do this right now then please click the 'Cancel' button.")) {
				return (true);
			}
			else {
				return(false);
			}	
		}
	}

/////////////////////////////
//
//Members for sale script.
//
	function saleVal(theForm) {
		with (theForm){
			if (Name.value.length < 3) {
				alert("Please Enter Your Name.");
				Name.focus();
				return (false);
			}
			if (Phone.value.length < 6) {
				alert("Please Enter a Contact Telephone Number.");
				Phone.focus();
				return (false);
			}
			var emailAddress=Email.value;
			var emailAddressLen=emailAddress.length;
			var atCharacter=emailAddress.indexOf("@");
			var dotCharacter=emailAddress.indexOf(".");
			if (emailAddressLen < 9 || atCharacter < 2) {
				alert("Please Enter a Valid Email Address.");
				Email.focus();
				return (false);
			}
			if (Item.value=="i.e. Set of Ping Irons" || Item.value=="" || Item.value==" ") {
				Item.value="";
				alert("Please Enter Item Name or Title.");
				Item.focus();
				return (false);
			}
		}
		if(confirm("Submit this form?")) {
			return (true);
		}
		else {
			return(false);
		}
	}

/////////////////////////////
//
//Set Delete, Edit or Add.
//
	function ForSaleDelEdit(theForm, actionToTake){
		with (theForm){
			if (actionToTake=="edit") {
				action = "forsaleadminedit.php";
				return (true);
			}
			if (actionToTake=="del") {
				if(confirm("Please confirm that you wish to delete this notice.")) {
					AddDelEdit.value = "Delete Notice";
					return(true);
				}
			}
		}
		return(false);	
	}

