function checkWholeForm(theForm) {
    var why = "";
    why += checkEmail(theForm.email.value);
    why += checkLocation(theForm.location.value);
    why += checkAddress(theForm.address.value);
    why += checkCity(theForm.city.value);
    why += checkPostcode(theForm.postcode.value);
	why += checkType();
	why += checkDesc(theForm.description.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

//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 location
function checkLocation (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter the location.\n";
	}	
	return error;
}

//check address
function checkAddress (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter the first line of the address.\n";
	}	
	return error;
}

//check city
function checkCity (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter the city.\n";
	}	
	return error;
}

//check postcode
function checkPostcode (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter the postcode.\n";
	}	
	return error;
}

//check type
function checkType () {
	var error = "";
	if ( document.forms[0].type.selectedIndex == 0 ) {
        error = "Please enter the type of location.\n";
    }
	return error;
}


//check message
function checkDesc (strng) {
	var error = "";
	if (strng == "") {
		error = "Please enter a description.\n";
	}
	return error;
}
