/*//---------------------------------------------*/
/*// Email Form Validation Function              */
/*//---------------------------------------------*/
/*//-------------------------------------------------------*/
/*// NEW EMAIL VALIDATION FUNCTION                         */
/*//-------------------------------------------------------*/

function CheckForm()
{
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	var why = "";
	
	if (document.contactus.firstname.value == "")
		why += "ERROR: Please enter a First Name.\n";

	if (document.contactus.lastname.value == "")
		why += "ERROR: Please enter a Last Name.\n";

	if(!(emailFilter.test(document.contactus.email.value)))
		why += "ERROR: Please enter proper email address.\n";
	
	if (document.contactus.email.value.match(illegalChars))
		why += "ERROR: Email address contains illegal characters.\n";
	
	if(document.contactus.comments.value == "")
		why += "ERROR: Please enter a brief comment or question.\n";

	if (why != "")
	{
		alert (why);
		return false;
	}

	return true;
}



/* POPUP WINDOW
USAGE:
<a href="word.html" onclick="return popup(this, 'word')">CRAVEN</a>
*/

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
