// JavaScript Document

function IsEmpty(aTextField) {
if (aTextField)
{

   if ((aTextField.value.length==0) ||
   (aTextField.value==null) || (aTextField.value==0) || (aTextField.value=='')) {
      return true;
   }

   else { return false; }
}
   else { alert('A field does not exist');
			return false;}
}

function IsEmail(string) {
if (string.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/))
return true;
else
return false;
}

var lang="";
message = new Array();

message["ro"]="Va rugam sa completati toate campurile obligatorii respectiv sa aveti grija ca adresa de e-mail, in cazul in care ati introdus una, sa fie valida.";
message["en"]="Please fill-in all mandatory fields.";
message["de"]="Bitte füllen Sie die Pflichtfelder aus.";



function ValidateForm(lang)
{

var IsIncorrect = false;
var emailInvalid = false;

if (IsEmpty(document.form1.Nume) || IsEmpty(document.form1.Subiect) || IsEmpty(document.form1.Subiect) || IsEmpty(document.form1.Mesaj) || IsEmpty(document.form1.Oras) || (!IsEmail(document.form1.Email.value) && !IsEmpty(document.form1.Email)) ) {
	IsIncorrect = true;
}

	if (IsIncorrect == true)
	{
		alert (message[lang]);
		return false; 
	}


return true;
 
} 