// Estevan Skate v2 JavaScript Document

/*******************************************************************\
|																	|
|																	|
|																	|
|																	|
\*******************************************************************/
function checkForm()
{
	if (document.contact.subject.value.length == 0)
	{
		alert( "You must enter a subject." );
		document.contact.subject.focus();
		return false;
	}
	else if (document.contact.name.value.length == 0)
	{
		alert( "You must enter a name." );
		document.contact.name.focus();
		return false;
	}
	else if( !checkEmail( document.contact.email.value ) )
	{
		alert( "You must enter a valid email.\n( ex. skater@estevanskate.com )" );
		document.contact.email.focus();
		return false;
	}
	else if (document.contact.message.value.length == 0)
	{
		alert( "You must enter a message." );
		document.contact.message.focus();
		return false;
	}
	else
	{
		return true;
	}
}

/*******************************************************************\
|																	|
|																	|
|																	|
|																	|
\*******************************************************************/
function checkEmail( email )
{
	var rexp = /^[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9}$/;

	return rexp.test( email );
}