function submitContactForm(block_code)
{
	var el = document.getElementById(block_code + '_form')
	
	if (validateContactForm(el, block_code))
	{
		el['smtd'].value = 'digidy78';
		el.submit();
	}
	
	return false;
}

function validateContactForm(el, block_code)
{
	var name = eval('el.' + block_code + '_name');
	if(name.value == '')
	{
		alert('Doplňte vaše jméno a příjmení.');
		name.focus();
		return false
	}

	var email = eval('el.' + block_code + '_email');
	if(!validateContactFormEmail(email))
	{
		alert('Doplňte váš email.');
		email.focus();
		return false
	}

	var message = eval('el.' + block_code + '_message');
	if(message.value == '')
	{
		alert('Doplňte zprávu.');
		message.focus();
		return false
	}
	
	return true
}

function validateContactFormEmail(theinput)
{
	s=theinput.value
	if(s.search)
	{
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\.)+[a-zA-Z]{2,4}$","gi"))>=0)
	}
	if(s.indexOf)
	{
		at_character=s.indexOf('@')
		if(at_character<=0 || at_character+4>s.length)
			return false
	}
	if(s.length<6)
		return false
	else
		return true
}

function checkEnterContactForm(e, code)
{
	var activeElement;
	
	if (typeof(e.target) != 'undefined')
		activeElement = e.target;
	else if(typeof(e.srcElement) != 'undefined')
		activeElement = e.srcElement;
	
	if(e && e.keyCode == 13 && activeElement.type != 'textarea')
	{
		submitContactForm(code)
		return false
	}
	else
		return true
}
