function isValidEmail (email)
{
	return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
}

function before_submit_letter()
{
	var aForm = document.getElementById('inversly_connection_form');
	
	var contact = aForm['contact'].value;
	var email = aForm['email'].value;
	var message = aForm['email'].message;
	
	if (contact == "")
	{
		event.returnValue = false;
		alert ('Введите Ваше имя.');
	}
	else if (email == "")
	{
		event.returnValue = false;
		alert ('Введите E-mail.');
	}
	else if (isValidEmail(email)==false)
	{
		
		event.returnValue = false;
		alert ('E-mail неправильный.');
	}
	else if (message == "")
	{
		
		event.returnValue = false;
		alert ('Введите текст сообщения.');
	}
}
