﻿function verify_form_sendmail(form_sendmail) {
	if(form_sendmail.yourname_sendmail.value.length < 3) {
		alert("Preencha o campo 'Seu nome' corretamente."); this.document.form_sendmail.yourname_sendmail.focus(); return false; }
	if((form_sendmail.youremail_sendmail.value.length < 2) || (form_sendmail.youremail_sendmail.value.indexOf("@") == -1)) {
		alert("Seu e-mail inválido."); this.document.form_sendmail.youremail_sendmail.focus(); return false; }
	if((form_sendmail.addressee_sendmail.value.length < 2) || (form_sendmail.addressee_sendmail.value.indexOf("@") == -1)) {
		alert("E-mail destinatário inválido."); this.document.form_sendmail.addressee_sendmail.focus(); return false; }
}
function verify_form_indicate(form_sendmail) {
	if(form_sendmail.yourname_sendmail.value.length < 3) {
		alert("Preencha o campo 'Seu nome' corretamente."); this.document.form_sendmail.yourname_sendmail.focus(); return false; }
	if((form_sendmail.indicate_email.value.length < 2) || (form_sendmail.indicate_email.value.indexOf("@") == -1)) {
		alert("Seu e-mail inválido."); this.document.form_sendmail.indicate_email.focus(); return false; }
	if((form_sendmail.indicate_your_friend.value.length < 2) || (form_sendmail.indicate_your_friend.value.indexOf("@") == -1)) {
		alert("E-mail destinatário inválido."); this.document.form_sendmail.indicate_your_friend.focus(); return false; }
}
function verify_form_search(form_search) {
	if(form_search.search.value.length < 3) {
		alert("Preencha o campo 'Busca' corretamente."); this.document.form_search.search.focus(); return false; }
}
function verifica_form_cadnews(cadnews) {
	if (document.cadnews.flagPfPj[0].checked==true) {
 		if (cadnews.contactus_name.value.length < 5){
	 		alert("Favor preencher campo 'Nome Completo'."); cadnews.contactus_name.focus(); return false;}	
	}
	if (document.cadnews.flagPfPj[1].checked==true) {
 		if (cadnews.contactus_company.value.length < 3){
	 		alert("Favor preencher campo 'Razão Social'."); cadnews.contactus_company.focus(); return false;}
		if (cadnews.contactus_companycontact.value.length < 3){
	 		alert("Favor preencher campo 'Nome de Contato'."); cadnews.contactus_companycontact.focus(); return false;}
	}
	if((cadnews.contactus_email.value.length < 2) || (cadnews.contactus_email.value.indexOf("@") == -1) || (cadnews.contactus_email.value.indexOf(".") == -1)) {
		alert("E-mail inválido."); cadnews.contactus_email.focus(); return false; }
}

function bloqueia(cadnews)
	{
	if (document.cadnews.flagPfPj[0].checked==true)
		{
		//Dados Pessoa Física
		document.all.contactus_name.style.background="#ffffff";
		document.cadnews.contactus_name.disabled=false;

		document.all.dd.style.background="#ffffff";
		document.cadnews.dd.disabled=false;

		document.all.mm.style.background="#ffffff";
		document.cadnews.mm.disabled=false;

		document.all.yyyy.style.background="#ffffff";
		document.cadnews.yyyy.disabled=false;

		document.all.contactus_gender.style.background="#ffffff";
		document.cadnews.contactus_gender.disabled=false;

		//Dados Pessoa Jurídica
		document.all.contactus_company.style.background="#f4f4f4";
		document.cadnews.contactus_company.disabled=true;

		document.all.contactus_companycontact.style.background="#f4f4f4";
		document.cadnews.contactus_companycontact.disabled=true;
		}
	else
		{
		//Dados Pessoa Jurídica
		document.all.contactus_name.style.background="#f4f4f4";
		document.cadnews.contactus_name.disabled=true;

		document.all.dd.style.background="#f4f4f4";
		document.cadnews.dd.disabled=true;

		document.all.mm.style.background="#f4f4f4";
		document.cadnews.mm.disabled=true;

		document.all.yyyy.style.background="#f4f4f4";
		document.cadnews.yyyy.disabled=true;

		document.all.contactus_gender.style.background="#f4f4f4";
		document.cadnews.contactus_gender.disabled=true;

		//Dados Pessoa Jurídica
		document.all.contactus_company.style.background="#ffffff";
		document.cadnews.contactus_company.disabled=false;

		document.all.contactus_companycontact.style.background="#ffffff";
		document.cadnews.contactus_companycontact.disabled=false;
		}
	}
