//******************************************************************
// Name of the file: extension.js
// Function: Index file.
// Author: hina000@hotmail.com
// Last Modification date: 03/26/2003
//******************************************************************

//checkEmail() validates the contactus.php
function checkEmail(myForm)
{
	var strValue = myForm.to2.value;
    var nameValue = myForm.name.value;
    var commentValue = myForm.comments.value;

    if (nameValue.length > 35 )
    {
    	alert("Name field can't have greater than 35 characters");        
        return(false);
    }
    if (nameValue.length == 0)
    {
		alert("Please enter your name");
		return(false);
	}
    if (commentValue.length > 2000 )
    {
    	alert("Comments can't have greater than 2000 characters");
        return(false);
    }
	if (commentValue.length == 0)
	{
		alert("Please enter comments");
		return(false);
	}
	//checks the email format
	if(/^\w+([\.]?\w+)*@\w+([\.]?\w+)*(\.\w{2,3})+$/.test(myForm.to2.value))
    {
    	if (strValue.length > 100)
        {
        	alert("Email field can't have greater than 100 characters");
            return(false);
 
        }
        	return (true);
	}                        
    	else
    	{
    		alert("Your email should be in this format: user@domain.com ");
            return (false);
        }
}


