//alert ('checaform.js');

function isEmail(string) {
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
else
	return false;
}	

function validaNews(){
	
	var nome = $('#nome');
	if (nome.val() == '' || nome.val()=='nome'){
		alert ("Por favor, preencha o seu nome");
		nome.focus();
		return false;
	}
	
	var email =$('#email');
	if (!isEmail(email.val())){
		alert ("Por favor, preencha o seu email corretamente");
		email.focus();
		return false;
	}
	
	return true;
	
}


function validaEnviaAmigo(formId){
	
	var postId = formId.split("_");
	postId = postId[1];
	
	var emailAmigo = $('#emailAmigo_'+postId);	
	if (!isEmail(emailAmigo.val())){
		alert ("Por favor, preencha o email corretamente");
		emailAmigo.focus();
		return false;
	}	

	return true;
	
}
