function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
		for(i=0; i < e.length ;i++){
			if(ok.indexOf(e.charAt(i))<0){ 
				return (false);
			}
		} 
		if (document.images) {
			re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
			re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			if (!e.match(re) && e.match(re_two)) {
				return (-1);		
			} 
		}
	}
function check_form(theform) {
	if(theform.firstname.value=='') {
		alert('Please enter your first name');
		theform.firstname.style.backgroundColor='yellow';
		theform.firstname.focus();
		return false;
	} else {
		if(theform.lastname.value=='') {
			alert('Please enter your last name');
			theform.lastname.style.backgroundColor='yellow';
			theform.lastname.focus();
			return false;
		} else {
			if(!check_email(theform.email.value)) {
				alert('Please enter your e-mail address');
				theform.email.style.backgroundColor='yellow';
				theform.email.focus();
				return false;
			} else {
				if(theform.storytitle.value==''){
					alert('Please tell us your story title');
					theform.storytitle.style.backgroundColor='yellow';
					theform.storytitle.focus();
					return false;
				} else {
					if(theform.thefile.value=='') {
						alert('Please browse for your word document or text file');
						theform.thefile.style.backgroundColor='yellow';
						theform.thefile.focus();
						return false;
					} else {
						if(theform.captchatext.value=='') {
							alert('Please enter the text you see in the image');
							theform.captchatext.style.backgroundColor='yellow';
							theform.captchatext.focus();
							return false;
						} else {
							if(!theform.accept.checked) {
								alert('Sorry. You must be over eighteen and agree to the terms and contitions to enter.');
								theform.accept.style.backgroundColor='yellow';
								theform.accept.focus();
								return false;
							} else {
								theform.doit.value='Please Wait...';
								theform.doit.disabled=true;
								return true;
							}
						}
					}
				}
			}
		}
	}
}

