function submitNewsletter(){
	mail = document.newsletter.newsletter.value;
	if((mail.length > 0) && (mail.indexOf('@') != -1)){
		location.href = 'newsletter.php?mail=' + mail;
	} else {
		alert('The e-mail address is blank or is not a valid e-mail address!');
	}
}

function submit1Newsletter(){
	mail = document.newsletter.newsletter.value;
	if((mail.length > 0) && (mail.indexOf('@') != -1)){
		return true;
	} else {
		alert('The e-mail address is blank or is not a valid e-mail address!');
		return false;
	}
}


//function to check valid email address
function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

   // search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) 
   {
	  alert('O adresa de mail valid este necesara.\nVa rog introduceti o adresa valida.');
	  return false;
	} 
	return true; 
}

function checkForm(){
	obj = document.contact;
		if(obj.name.value.length < 5){
			alert('Campul '+ obj.name.name + ' este obligatoriu si trebuie sa fie mai lung de 5 caractere !');
			return false;
		}
		if(obj.email.value.length < 5){
			alert('Campul '+ obj.email.name + ' este obligatoriu si trebuie sa fie mai lung de 5 caractere !');
			return false;
		}
		if(obj.phone.value.length < 5){
			alert('Campul '+ obj.phone.name + ' este obligatoriu si trebuie sa fie mai lung de 5 caractere !');
			return false;
		}
		if(obj.request.value.length < 5){
			alert('Campul '+ obj.request.name + ' este obligatoriu si trebuie sa fie mai lung de 5 caractere !');
			return false;
		}
		return true;
}
function sendForm(){
	if (checkForm()){
		document.contact.submit();
	}
}


