// JavaScript Document
function set(myName,myWord)
{
	if(myWord == null)
	{
		myWord = "";
	}
	
	myForm = myName.value;
	
	if(myForm == myWord || myForm == "Please, write your name" || myForm == "Please, write your email" || myForm == "Please, write your phone" || myForm == "Please, write a comment" || myForm == 'comment:')
	{
		myName.value = "";
	} else if(myForm == "")
	{
		myName.value = myWord;
	}
}
function sendForm(_form)
{
	error = 0;
	if (!(/^[A-Za-z0-9_ ]{3,100}$/.test(document.getElementById('fName').value)))
	{
		document.getElementById('fName').value = "Please, write your name";
		error++;
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('fEmail').value)))
	{
		document.getElementById('fEmail').value = "Please, write your email";
		error++;
	}
	if (!(/^[0-9-.() ]{2,15}$/.test(document.getElementById('fPhone').value)))
	{
		document.getElementById('fPhone').value = "Please, write your phone";
		error++;
	}
	if (document.getElementById('fComment').value.length < 10 || document.getElementById('fComment').value == 'Please, write a comment')
	{
		document.getElementById('fComment').value = "Please, write a comment";
		error++;
	}
	if (document.getElementById('fCode').value.length != 4)
	{
		alert("You must enter the four-character code beside it, to send the message.");
		error++;
	}
	if(error == 0)
	{
		document.getElementById(_form).submit();
	}
}
function clearForm(_form)
{
	document.getElementById(_form).reset();
	//document.getElementsByName('comment').value = "comment:";
}
