function validateFriend() {
	
	var answered = false;
	var multiAnswer = 0;
	
	//customer information
	if (document.SurveyForm.emailto.value == ''){
		alert('Please enter the TO email address.');
		document.SurveyForm.emailto.focus();
		return false;
		}
		
	if (document.SurveyForm.emailto.value != ''){
		if (checkEmail(document.SurveyForm.emailto)){
		alert('The TO email address you entered is invalid.');
		document.SurveyForm.emailto.focus();
		return false;
		}
	}
	
	if (document.SurveyForm.emailfrom.value == ''){
		alert('Please enter the FROM email address.');
		document.SurveyForm.emailto.focus();
		return false;
		}
		
	if (document.SurveyForm.emailfrom.value != ''){
		if (checkEmail(document.SurveyForm.emailfrom)){
		alert('The FROM email address you entered is invalid.');
		document.SurveyForm.emailfrom.focus();
		return false;
		}
	}
	if (document.SurveyForm.namefrom.value == ''){
		alert('Please enter your Name.');
		document.SurveyForm.namefrom.focus();
		return false;
		}
}

function validateBasic2() {
	
	var answered = false;
	var multiAnswer = 0;
	
	//customer information
		if (document.SurveyForm.firstname.value == ''){
		alert('Please enter your First Name.');
		document.SurveyForm.firstname.focus();
		return false;
		}

		if (document.SurveyForm.lastname.value == ''){
		alert('Please enter your Last Name.');
		document.SurveyForm.lastname.focus();
		return false;
		}
		
		if (document.SurveyForm.email.value == ''){
		alert('Please enter your email Address.');
		document.SurveyForm.email.focus();
		return false;
		}
	if (document.SurveyForm.email.value != ''){
		if (checkEmail(document.SurveyForm.email)){
		alert('The Email Address you entered is invalid.');
		document.SurveyForm.email.focus();
		return false;
		}
	}	
	
	//question 1
	answered = false;
	for (i = 0; i < 2; i++){
		if (document.SurveyForm.guest[i].checked == true){
			answered = true;
		}
	}
	if (answered == false){
		alert ('You have not told us if you are bringing a guest.');
		return false;
	}


	if (document.SurveyForm.guest[0].checked == true) {
		if (document.SurveyForm.guestname.value == '') {
			document.SurveyForm.guestname.focus();
			alert("You selected that you are brining a guest - please enter their name.");
			return false;
		}
	}
	
}

function checkAlpha(field) {
	string = field.value;
	var Chars = "0123456789";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1){
			return true;          
       }
    }
    return false;
} 

function checkEmail(field) {
	string = field.value;
 	if (string.indexOf(' ')==-1 
      	&& 0<string.indexOf('@')
      	&& string.indexOf('@')+1 < string.length){
			return false;
	}
 	return true;
}
