// Funções Macromedia
//alert ("carregou!");

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Funções checagem Formularios

var isIE = document.all?true:false;
var isNS = document.layers?true:false;
function soNum(e) {
  var _ret = true;
  if (isIE) {
    if (window.event.keyCode < 46 || window.event.keyCode > 57) {
      window.event.keyCode = 0;
      _ret = false;
    }
  }
  if (isNS) {
    if (e.which < 46 || e.which > 57) {
      e.which = 0;
      _ret = false;
    }
  }
  return (_ret);
}

VerifiqueTAB=true;
function Mostra(quem, tammax) {
	if ( (quem.value.length == tammax) && (VerifiqueTAB) ) {
		var i=0,j=0, indice=-1;
		for (i=0; i<document.forms.length; i++) {
			for (j=0; j<document.forms[i].elements.length; j++) {
				if (document.forms[i].elements[j].name == quem.name) {
					indice=i;
					break;
				}
			}
			if (indice != -1)
		         break;
		}
		for (i=0; i<=document.forms[indice].elements.length; i++) {
			if (document.forms[indice].elements[i].name == quem.name) {
				while ( (document.forms[indice].elements[(i+1)].type == "hidden") &&
						(i < document.forms[indice].elements.length) ) {
							i++;
				}
				document.forms[indice].elements[(i+1)].focus();
				VerifiqueTAB=false;
				break;
			}
		}
	}
}

function PararTAB(quem) 
{ 
   VerifiqueTAB=false; 
} 

function ChecarTAB() 
{ 
   VerifiqueTAB=true; 
} 

function confereContato(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == ""){
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null){
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.EMAIL.value != caminho.EMAILConf.value){
			alert("E-mails não conferem!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.DdPHONE1.value == "" | caminho.PHONE1.value == "" ){
			alert("Favor preencher o campo Telefone !");
			caminho.PHONE1.focus();
		}else if(caminho.UPFMEN.value == ""){
			alert("Favor preencher o campo Mensagem !");
			caminho.UPFMEN.focus();
		}else{
			caminho.submit();
		}
}

/*
function propostaServContPess(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == "")	{
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null)	{
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.DdPHONE1.value == "")	{
			alert("Favor preencher o campo DDD Telefone !");
			caminho.DdPHONE1.focus();
		}else if(caminho.PHONE1.value == "" )  {
			alert("Favor preencher o campo Telefone !");
			caminho.PHONE1.focus();
		}else if(caminho.ZIP.value == "" )	{
			alert("Favor preencher o campo CEP !");
			caminho.ZIP.focus();
		}else if(caminho.ZIP2.value == "" )		{
			alert("Favor preencher o campo CEP !");
			caminho.ZIP2.focus();
		} else {
			caminho.submit();
		}

}

function propostaServContEmp(){
	caminho  = document.forms.Mail;
		if(caminho.CONTACT.value == "" | caminho.EMAIL.value == "")		{
			alert ("Dados Incompletos!");
			window.location.replace('proposta-contabil-pessoais.asp');
		}else if(caminho.numEmp.value == "")	{
			alert("Favor preencher o campo número de Empregados !");
			caminho.numEmp.focus();
		}else if(caminho.empCidade.value == "" )  {
			alert("Favor preencher o campo Cidade !");
			caminho.empCidade.focus();
		}else if(caminho.empAtividade.value == "" )		{
			alert("Favor preencher o campo atividade !");
			caminho.empAtividade.focus();
		} else {
			caminho.submit();
		}
}

function propostaServContOutras(){
	caminho  = document.forms.Mail;
		if(caminho.CONTACT.value == "" | caminho.EMAIL.value == "" | caminho.PHONE1.value == "" | caminho.empCidade.value == "")		{
			alert ("Dados Incompletos!");
			window.location.replace('proposta-contabil-pessoais.asp');
		}else if(caminho.UPFMEN.value == "")	{
			alert("Favor preencher o campo Mensagem !");
			caminho.UPFMEN.focus();
		} else {
		caminho.submit();
		}
}
*/
function propostaServCont(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == "")	{
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null)	{
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.DdPHONE1.value == "")	{
			alert("Favor preencher o campo DDD Telefone !");
			caminho.DdPHONE1.focus();
		}else if(caminho.PHONE1.value == "" )  {
			alert("Favor preencher o campo Telefone !");
			caminho.PHONE1.focus();
		}else if(caminho.ZIP.value == "" )	{
			alert("Favor preencher o campo CEP !");
			caminho.ZIP.focus();
		}else if(caminho.ZIP2.value == "" )		{
			alert("Favor preencher o campo CEP !");
			caminho.ZIP2.focus();
		}else if(caminho.numEmp.value == "")	{
			alert("Favor preencher o campo número de Empregados !");
			caminho.numEmp.focus();
		}else if(caminho.empCidade.value == "" )  {
			alert("Favor preencher o campo Cidade !");
			caminho.empCidade.focus();
		}else if(caminho.empAtividade.value == "" )		{
			alert("Favor preencher o campo atividade !");
			caminho.empAtividade.focus();
		}else if(caminho.UPFMEN.value == "")	{
			alert("Favor preencher o campo Mensagem !");
			caminho.UPFMEN.focus();
		} else {
		caminho.submit();
		}
}




function confereContatoTrabalhe(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == ""){
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null){
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.EMAIL.value != caminho.EMAILConf.value){
			alert("E-mails não conferem!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.DdPHONE1.value == "" | caminho.PHONE1.value == "" ){
			alert("Favor preencher o campo Telefone !");
			caminho.PHONE1.focus();
		}else if(caminho.UPFMEN.value == ""){
			alert("Favor preencher o campo Mensagem !");
			caminho.UPFMEN.focus();
		}else if(caminho.attach.value == ""){
			alert("Favor selecionar o arquivo a ser atachado !");
			caminho.attach.focus();
		}else{
			caminho.submit();
		}
}

function confNewslet(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == ""){
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null){
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.EMAIL.value != caminho.EMAILConf.value){
			alert("E-mails não conferem!");
			caminho.EMAIL.focus();
			return;
		}else{
			caminho.submit();
		}
}


function confereContactFranquia(){
	caminho  = document.forms.Mail;
	pattern = /.+@.+\..+/i;
	var mail = caminho.EMAIL.value.match(pattern);
		if(caminho.CONTACT.value == ""){
			alert("Favor preencher o campo nome !");
			caminho.CONTACT.focus();
		}else if(mail == null){
			alert("Favor preencher corretamente o seu E-Mail!");
			caminho.EMAIL.focus();
			return;
		}else if(caminho.EMAIL.value != caminho.EMAILConf.value){
			alert("E-mails não conferem!");
			caminho.EMAIL.focus();
			return;
/*		}else if(caminho.empRazao.value == ""){
			alert("Favor preencher a Razão Social da Empresa !");
			caminho.empRazao.focus();
		} else if (caminho.empEnd.value == ""){
			alert("Favor preencher o campo endereço !");
			caminho.empEnd.focus();
*/
		} else if (caminho.empCidade.value == ""){
			alert("Favor preencher o campo Cidade !");
			caminho.empCidade.focus();
		} else if (caminho.empEstado.value == ""){
			alert("Favor selecionar o Estado !");
			caminho.empEstado.focus();
		} else if (caminho.ZIP.value == ""){
			alert("Favor preencher o campo CEP!");
			caminho.ZIP.focus();
/*		} else if(caminho.empDddPhone.value == "" | caminho.empPhone.value == "" ){
			alert("Favor preencher o campo Telefone !");
			caminho.empPhone.focus();
		}else if(caminho.empDddPhone.value == "" | caminho.empPhone.value == "" ){
			alert("Favor preencher o campo Telefone !");
			caminho.empPhone.focus();
*/
		}else{
			caminho.submit();
		}
}
