function checkWholeForm(theForm) {
    var why = "";
    why += checkName(theForm.name.value);
    why += checkEmail(theForm.email.value);
    why += checkTel(theForm.tel.value);
	why += checkDay();
	why += checkMonth();
	why += checkYear();
	why += checkMessage(theForm.message.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}


//check name
function checkName (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter your name.\n";
	}	
	return error;
}

//check email
function checkEmail (strng) {
	var error = "";
	var emailFilter=/^[^@]+@[^@.]+\.[^@]*\w\w$/;
	if (!(emailFilter.test(strng))) { 
		   error = "Please enter a valid email address.\n";
	}
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (strng.match(illegalChars)) {
	   error = "The email address contains illegal characters.\n";
	}
	return error;
}

//check phone
function checkTel (strng) {
	var error = "";
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	//strip out acceptable non-numeric characters
	if (isNaN(parseInt(stripped))) {
	   error = "Please enter a valid phone number.\n";
	}
	return error;
}

//check day
function checkDay () {
	var error = "";
	if ( document.forms[0].day.selectedIndex == 0 ) {
        error = "Please enter the day of your wedding.\n";
    }
	return error;
}

//check month
function checkMonth () {
	var error = "";
	if ( document.forms[0].month.selectedIndex == 0 ) {
        error = "Please enter the month of your wedding.\n";
    }
	return error;
}

//check year
function checkYear () {
	var error = "";
	if ( document.forms[0].year.selectedIndex == 0 ) {
        error = "Please enter the year of your wedding.\n";
    }
	return error;
}


//check message
function checkMessage (strng) {
	var error = "";
	if (strng == "") {
		error = "Please type a message.\n";
	}
	return error;
}