var isvalid = true;

function validate(formname)
{
	testforblank(formname.fullname.value);
	testforemail(formname.email.value);

	if (isvalid == true)
	{
		return true;
	}
	else
	{
		alert('Please complete the form');
		isvalid = true;	// reset variable for next test
		return false;
	}

}

function testforblank(testvalue)
{
	// only run the test if other fields have been good so far
	if (isvalid == true)
	{
		if (testvalue == '') isvalid = false;
	}
}

function testforemail(testvalue)
{
	// only run the test if other fields have been good so far
	if (isvalid == true)
	{
		if (testvalue.indexOf('@') < 1) isvalid = false;
		if (testvalue.indexOf('.') == -1) isvalid = false;
	}
}
