// JavaScript Document
function validateUnsubscribe() {
	var email = document.forms["formUnsubscribe"].emailUnsubscribe.value;
	if(email == "") {
		alert("E-Mail obrigatório.");
		return false;
	}
	else {
		var regex = /\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/gi;
		if (email.match(regex))
			return true;
		else {
			alert("E-Mail inválido.");
			return false;
		}
	}
}

function validateSubscribe() {

	var email = document.forms["formNotes"].emailComm.value;
	var nome = document.forms["formNotes"].nameComm.value;
	
	var name=  document.forms["formNotes"].nameComm.value.length;
	var email  =document.forms["formNotes"].emailComm.value.length;
	var comment= document.forms["formNotes"].comment.value.length;
	var tot = name+email+comment;
	var maluco = document.getElementById('email').value = ((tot) % 3)+tot;
	
	if(email == "" || nome == "") {
		alert("Nome e E-Mail obrigatórios.");
		if(nome=="") document.forms["formNotes"].nameComm.focus();
		else document.forms["formNotes"].emailComm.focus();
		
		return false;
	}
	else {
		var regex = /\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/gi;
		if (email.match(regex)){
			return true;
		}
		else {
			alert("E-Mail inválido.");
			document.forms["formNotes"].emailComm.focus();
			return false;
		}
	}
}

function recomment(parent,html)
{
	if ((parent != ""))
	{
		html="<input type=\"hidden\" name=\"parentPid\" value=\""+parent+"\">"+html;
		html+="<BR>" + "<a href=\"#ancora_conteudo\" onClick=\"recomment('','&nbsp;');\">Clique caso queira comentar o conteúdo, e não mais o comentário</a>" + "<BR><BR><BR>";
		//location.hash="#ancora_conteudo";
	}
	document.getElementById("parent").innerHTML=html;
}

function open_pop (el) {
	var w = window.open(el.getAttribute('href'), '','status=yes,scrollbars=yes,resizable=yes', 'width=780,height=600');
	return !w;
}