/*
Wincantores Music Society
Written by Ian Collier, of lidd Consulting on behalf of Atonic Limited
This work copyright lidd Consulting/Atonic Limited
Please do not copy or modified this work without seeking the express permission of
the copyright holders beforehand.
Thank you

menu script
*/

// heading
document.write('<table class="heading">');
	document.write('<tr>');
		document.write('<td class="ends">');
				document.write('<p style="text-align : center;">Founded<br />1970</p>');
			document.write('</td>	');		
			document.write('<td class="middle">');
				document.write('<img src="./images/logo.png" alt="Wincantores Music Society" title="Wincantores Music Society" />');
			document.write('</td>');
			document.write('<td class="ends">');
				document.write('<p style="text-align : center;">Based in<br />Shaftesbury<br />Dorset</p>');
			document.write('</td>');						
		document.write('</tr>');	
document.write('</table>');

// menu
document.write('<div class="centered" style="width : 100%;background-color : #2164d9;">');
	document.write('<p style="text-align : center;">');
	// home page page
	document.write('<a href="index.html" style="color : #ffffff;">Home page</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// new members page
	document.write('<a href="newmembers.html" style="color : #ffffff;">New members</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// concerts page
	document.write('<a href="concerts.html" style="color : #ffffff;">Concerts for you</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// events page
	document.write('<a href="events.html" style="color : #ffffff;">Events</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// events page
	document.write('<a href="christmas.html" style="color : #ffffff;">Christmas</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// about page
	document.write('<a href="about.html" style="color : #ffffff;">About</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
	// contact page	
	document.write('<a href="contactus.asp" style="color : #ffffff;">Contact us</a>');
	document.write('</p>');
document.write('</div>');

// function to check the form values
function validateform() {
	// reference the document's contact form
	var pageform=document.frmcontact;
	// make regular expressions for testing input
	// name
	var regexpname=/^[a-z][a-z -']*[a-z]$/i
	// email
	var regexpemail=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/i;
	// check the name	
	if(regexpname.test(pageform.txtname.value)==false) {
		// post warning message
		document.getElementById("msg").innerHTML="<br /><span class=\"warning\">Please enter your name</span>";
		// reset name to blank
		pageform.txtname.value="";
	}
	else {
		// check the email address
		if(regexpemail.test(pageform.txtemail.value)==false) {
			// post warning message
			document.getElementById("msg").innerHTML="<br /><span class=\"warning\">Please enter a valid email address</span>";
			// reset name to blank
			pageform.txtemail.value="";
		}
		else {	
			// set textbox
			pageform.txtsubmitting.value="1";
			// we have what we need, process the form
			pageform.submit();
		}
	}
}	