function Validate(val) {
	var re = /[a-zA-Z0-9 ]/;
	if (!re.test(val)) {
		//alert("value invalid!");
		return false;
	} else {
		return true;
	}
}

function checkFeedback(theForm) {
	errors = "";
	if (theForm.name.value == "" || !Validate(theForm.name.value)) {
		errors += "Your name is invalid.\n";
	}
	if (theForm.comment.value == "") {
		errors += "Your comment is invalid.\n";
	}
	
	if (errors != "") {
		alert("Details you've supplied are invalid:\n\n" + errors + "\nPlease check your details and try again.");
		return false;
	} else {
		return true;
	}
}


function checkMoodBoosters(theForm) {
	
	errors = "";
	if (theForm.name.value == "" || !Validate(theForm.name.value)) {
		errors += "Your name is invalid.\n";
	}
	if (theForm.email.value == "") {
		errors += "Your email address is invalid.\n";
	}
	if (theForm.number.value == "") {
		errors += "Your telephone number is invalid.\n";
	}
	if (theForm.remain_anonymous.options[theForm.remain_anonymous.selectedIndex].value == "") {
		errors += "Your email address is invalid.\n";
	}
	if (theForm.remain_anonymous.options[theForm.remain_anonymous.selectedIndex].value == "Yes" && theForm.pseudonym.value == "") {
		errors += "Your pseudonym is invalid.\n";
	}
	if (theForm.about_yourself.value == "") {
		errors += "Tell us a little bit about yourself.\n";
	}
	if (theForm.mood_boosters.value == "") {
		errors += "You haven't supplied a mood booster!\n";
	}
	
	if (errors != "") {
		alert("Details you've supplied are invalid:\n\n" + errors + "\nPlease check your details and try again.");
		return false;
	} else {
		alert("Thanks!");
		return true;
	}
}

function checkMusicTrackEntry(theForm) {
	
	errors = "";
	if (theForm.yourName.value == "" || !Validate(theForm.yourName.value)) {
		errors += "your name is invalid.\n";
	}
	if (theForm.yourEmail.value == "" || !Validate(theForm.yourEmail.value)) {
		errors += "email address is invalid.\n";
	}
	if (theForm.theArtist.value == "" || !Validate(theForm.theArtist.value)) {
		errors += "artist is invalid.\n";
	}
	if (theForm.theTrack.value == "" || !Validate(theForm.theTrack.value)) {
		errors += "artist's track is invalid.\n";
	}
	

	if (errors != "") {
		alert("Details you've supplied are invalid:\n\n" + errors + "\nPlease check your details and try again.");
		return false;
	} else {
		alert("Thanks!");
		return true;
	}
}

function checkRealStory(theForm) {
	
	errors = "";
	if (theForm.name.value == "" || !Validate(theForm.name.value)) {
		errors += "your name is invalid.\n";
	}
	if (theForm.email.value == "" || !Validate(theForm.email.value)) {
		errors += "email address is invalid.\n";
	}
	if (theForm.number.value == "" || !Validate(theForm.number.value)) {
		errors += "telephone number is invalid.\n";
	}
	if (theForm.town_county.value == "" || !Validate(theForm.town_county.value)) {
		errors += "town/county is invalid.\n";
	}
	if (theForm.remain_anonymous.value == "" || !Validate(theForm.remain_anonymous.value)) {
		errors += "haven't indicated if you prefer to remain anonymous.\n";
	}
	if (theForm.pseudonym.value == "" || !Validate(theForm.pseudonym.value)) {
		errors += "pseudonym is invalid.\n";
	}
	if (theForm.prepared_talk.value == "" || !Validate(theForm.prepared_talk.value)) {
		errors += "haven't indicated if you are prepared to talk on radio.\n";
	}
	if (theForm.story.value == "" || !Validate(theForm.story.value)) {
		errors += "story is invalid.\n";
	}
	
	if (errors != "") {
		alert("Details you've supplied are invalid:\n\n" + errors + "\nPlease check your details and try again.");
		return false;
	} else {
		alert("Thanks!");
		return true;
	}
}


function checkEmailSub(theForm) {
	
	errors = "";
	
	// subscribe
	if (theForm.subscribe[0].checked == true) {
		if (theForm.name.value == "" || !Validate(theForm.name.value)) {
			errors += "your name is invalid.\n";
		}
	}

	if (theForm.email.value == "" || !Validate(theForm.email.value)) {
		errors += "email address is invalid.\n";
	}
	
	if (errors != "") {
		alert("Details you've supplied are invalid:\n\n" + errors + "\nPlease check your details and try again.");
		return false;
	} else {
		alert("Thanks!");
		return true;
	}
}