function tafSubmit () {
	var formError = false;
	var email = document.getElementById('email').value;
	var femail = document.getElementById('femail').value;
	if(!email || !isValidEmail(email))
	{
		document.getElementById('emailError').style.display = 'block';
		formError = true;
	}
	else
	{
		document.getElementById('emailError').style.display = 'none';
	}
	if(!femail || !isValidEmail(femail))
	{
		document.getElementById('femailError').style.display = 'block';
		formError = true;
	}
	else
	{
		document.getElementById('femailError').style.display = 'none';
	}
	if ( !formError )
    {
        this.tafform.submit();
	}
}

function isValidEmail( str )
    {
        var at="@";
        var dot=".";
        var comma = ",";
        var lat=str.indexOf(at);
        var lstr=str.length;
        var ldot=str.indexOf(dot);

        // if they enter a comma, all bets are off cause this is not technically valid but we want to accept to allow for multiple emails
        if ( str.indexOf( comma ) > -1 )
        {
            return true;
        }

        if (str.indexOf(at)==-1)
        {
            return false;
        }

        if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
        {
            return false;
        }

        if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
        {
              return false;
        }

        if (str.indexOf(at,(lat+1))!=-1)
        {
              return false;
        }

        if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
        {
              return false;
        }

        if (str.indexOf(dot,(lat+2))==-1)
        {
              return false;
        }

        if (str.indexOf(" ")!=-1)
        {
              return false;
        }

        return true;
    }

