
function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function checkform(contact)
{
    var tfld = trim(contact.email.value);                        
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	
    if (contact.name.value == '')
    {
        alert('Please enter your Name.');
		contact.name.style.background = '#CCFFFF';
        contact.name.focus();
        return false;
    }
    else if (contact.email.value == '' || !emailFilter.test(tfld) || contact.email.value.match(illegalChars))
    {
        alert('Please enter a valid Email Address.');
		contact.email.style.background = '#CCFFFF';
        contact.email.focus();
        return false;
    }
    else if (contact.comment.value == '')
    {
        alert('Please enter your comments or questions.');
		contact.comment.style.background = '#CCFFFF';
        contact.comment.focus();
        return false;
    }								
    else
    {
        return true;
    }
}
