function parseForm() {
	contactName = document.forms[0].elements["contactName"].value;
	strippedCN = stripCharsNotInBag(contactName, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
	if(strippedCN.length < 2) {
		document.getElementById('contactName').focus();
		alert("Please enter your full name\n(should be at least 2 letters)");
		return false;
	}
	emailAddress = document.forms[0].elements["emailAddress"].value;
	strippedEmailAddress = stripCharsNotInBag(emailAddress, "@.-_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
	if((emailAddress.indexOf("@") == -1)||(emailAddress.indexOf(".") == -1)||(emailAddress.length < 8)||(emailAddress.length != strippedEmailAddress.length)) {
		document.getElementById('emailAddress').focus();
		alert("Please enter a full, valid email address");
		return false;
	}
}

function stripCharsNotInBag(s, bag)

{   var i;
    var returnString = "";

    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) != -1) returnString += c;
    }

    return returnString;
}
