    NUM_DIGITOS_CPF = 11;
    NUM_DIGITOS_CNPJ = 14;
    NUM_DGT_CNPJ_BASE = 8;
    
    
    
/********************
IMPRESSÃO
*********************/
function VerificaImpressao()
{
            
    var url = window.location.href;
    url += '';
    
    var tamanhoUrl = url.length;
    
    var parametro = url.substr(tamanhoUrl - 3, tamanhoUrl);
    
    if (parametro == "imp")
    {
        //document.getElementById('masterDiv').style.display = 'none';
        
        return true;
    }
    else
    {
        return false;
    }
        
}



function RecuperaParametros()
{

  //  document.getElementById('ctl00_Tipo_Atual').value = parent.opener.document.forms[0].ctl00_Tipo_Atual.value;
  //  document.getElementById('ctl00_Data_Atual').value = parent.opener.document.forms[0].ctl00_Data_Atual.value;

}





/*******************************************
 * VALIDACAO CPF/CNPJ
 */
function validarCPFCNPJ(nCpfCnpf, tipoCPF, tipoCNPJ){ 
// nCpfCnpf = document.getElementById("txtCPFCNPJ");
// tipoCPF = document.getElementById("radioCPF");
// tipoCNPJ = document.getElementById("radioCNPJ");
    
  if (nCpfCnpf.value == ""){ 
   // alert("Campo inválido. É necessário informar o CPF ou CNPJ"); 
   // nCpfCnpf.focus(); 
    return (true); 
  }

 exp = /\.|\-|\//g;
 nCpfCnpf.value = nCpfCnpf.value.toString().replace( exp, '' );
  if (tipoCPF != null || tipoCNPJ != null )
 {
	 if	( (nCpfCnpf.value.length != 11) && tipoCPF.checked )
	 {
		 alert("CPF inválido."); 
		  return (false); 
	 }
	 if	( (nCpfCnpf.value.length != 14) &&  tipoCNPJ.checked )
	 {
		 alert("CNPJ inválido."); 
	     return (false); 
	 }
}
  if (((nCpfCnpf.value.length == 11) && 
        (nCpfCnpf.value == 11111111111) || 
        (nCpfCnpf.value == 22222222222) || 
        (nCpfCnpf.value == 33333333333) || 
        (nCpfCnpf.value == 44444444444) || 
        (nCpfCnpf.value == 55555555555) || 
        (nCpfCnpf.value == 66666666666) || 
        (nCpfCnpf.value == 77777777777) || 
        (nCpfCnpf.value == 88888888888) || 
        (nCpfCnpf.value == 99999999999) || 
        (nCpfCnpf.value == 00000000000))){ 
    
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";
    nCpfCnpf.focus(); 
    
    return (false); 
  } 
  if (!((nCpfCnpf.value.length == 11) || (nCpfCnpf.value.length == 14))){ 
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";         
    nCpfCnpf.focus(); 
    return (false); 
  } 
  var checkOK = "0123456789"; 
  var checkStr = nCpfCnpf.value; 
  var allValid = true; 
  var allNum = ""; 
  for (i = 0;  i < checkStr.length;  i++){ 
    ch = checkStr.charAt(i); 
    for (j = 0;  j < checkOK.length;  j++) 
      if (ch == checkOK.charAt(j)) 
        break; 
    if (j == checkOK.length){ 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid){ 
    alert("Favor preencher o campo CPF/CNPJ somente com números."); 
    nCpfCnpf.focus(); 
    return (false); 
  } 
  var chkVal = allNum; 
  var prsVal = parseFloat(allNum); 
  if (chkVal != "" && !(prsVal > "0")){ 
    alert("CPF zerado !"); 
    nCpfCnpf.focus(); 
    return (false); 
  } 
if (nCpfCnpf.value.length == 11){ 
  var tot = 0; 
  for (i = 2;  i <= 10;  i++) 
    tot += i * parseInt(checkStr.charAt(10 - i)); 
  if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(9))){ 
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";
    nCpfCnpf.focus(); 
    return (false); 
  } 
  tot = 0; 
  for (i = 2;  i <= 11;  i++) 
    tot += i * parseInt(checkStr.charAt(11 - i)); 
  if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(10))){ 
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";
    nCpfCnpf.focus(); 
    return (false); 
  } 
} 
else { 
  var tot  = 0; 
  var peso = 2; 
  
  for (i = 0;  i <= 11;  i++){ 
    tot += peso * parseInt(checkStr.charAt(11 - i)); 
    peso++; 
    if (peso == 10){ 
        peso = 2; 
    } 
  }
  if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(12))){ 
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";
    nCpfCnpf.focus(); 
    return (false); 
  } 
  tot  = 0; 
  peso = 2; 
  for (i = 0;  i <= 12;  i++){ 
    tot += peso * parseInt(checkStr.charAt(12 - i)); 
    peso++; 
    if (peso == 10){ 
        peso = 2; 
    } 
  } 
  if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(13))){ 
    alert("CPF/CNPJ inválido."); 
    nCpfCnpf.value = "";
    nCpfCnpf.focus(); 
    return (false); 
  } 
} 
  cpfCnpj = nCpfCnpf.value
  if(cpfCnpj.length == 11)
    cpfCnpj = cpfCnpj.substring(0,3)+'.'+cpfCnpj.substring(3,6)+'.'+cpfCnpj.substring(6,9)+'-'+cpfCnpj.substring(9,11)
  else
    cpfCnpj = cpfCnpj.substring(0,2)+'.'+cpfCnpj.substring(2,5)+'.'+cpfCnpj.substring(5,8)+'/'+cpfCnpj.substring(8,12)+'-'+cpfCnpj.substring(12,14)
  nCpfCnpf.value = cpfCnpj;
  return(true);
}

function Valida1CPF(obj) {
    var i;

    s = document.getElementById("ctl00_ContentPlaceHolder1_txtCPFContato").value;

    var c = s.substr(0, 9);

    var dv = s.substr(9, 2);

    var d1 = 0;

    for (i = 0; i < 9; i++) {

        d1 += c.charAt(i) * (10 - i);

    }

    if (d1 == 0) {

        alert("CPF Invalido")

        return false;

    }

    d1 = 11 - (d1 % 11);

    if (d1 > 9) d1 = 0;

    if (dv.charAt(0) != d1) {

        alert("CPF Invalido")

        return false;

    }


    d1 *= 2;

    for (i = 0; i < 9; i++) {

        d1 += c.charAt(i) * (11 - i);

    }

    d1 = 11 - (d1 % 11);

    if (d1 > 9) d1 = 0;

    if (dv.charAt(1) != d1) {

        alert("CPF Invalido")

        return false;

    }

    return true;
} 






    function ValidaCPF(source, args)
    {
        var confirmacao = true;
        var Objcpf = document.getElementById('ctl00_ContentPlaceHolder1_txtCPFCNPJ').value;
        var cpf = Objcpf;

        exp = /\.|\-/g;
        cpf = cpf.toString().replace( exp, '' );

        var digitoDigitado = eval(cpf.charAt(9)+cpf.charAt(10));
        var soma1=0, soma2=0;
        var vlr =11;

        for(i=0;i<9;i++)
        {
            soma1+=eval(cpf.charAt(i)*(vlr-1));
            soma2+=eval(cpf.charAt(i)*vlr);
            vlr--;
        }

        soma1 = (((soma1*10)%11)==10 ? 0:((soma1*10)%11));
        soma2=(((soma2+(2*soma1))*10)%11);
        var digitoGerado=(soma1*10)+soma2;

        if(digitoGerado!=digitoDigitado)
        {
            confirmacao = false;
        }
        else
        {
            confirmacao = true;
        }

        //args.IsValid = confirmacao;
        
        return confirmacao;
    } 

    function dvCpfCnpj(pEfetivo, pIsCnpj)
    {
        if (pIsCnpj==null) pIsCnpj = false;

        var i, j, k, soma, dv;
        var cicloPeso = pIsCnpj? NUM_DGT_CNPJ_BASE: NUM_DIGITOS_CPF;
        var maxDigitos = pIsCnpj? NUM_DIGITOS_CNPJ: NUM_DIGITOS_CPF;
        var calculado = formatCpfCnpj(pEfetivo, false, pIsCnpj);
        calculado = calculado.substring(2, maxDigitos);
        var result = "";
        for (j = 1; j <= 2; j++)
        {
            k = 2;
            soma = 0;
            for (i = calculado.length-1; i >= 0; i--)
            {
                soma += (calculado.charAt(i) - '0') * k;
                k = (k-1) % cicloPeso + 2;
            }
            dv = 11 - soma % 11;
            if (dv > 9) dv = 0;
            calculado += dv;
            result += dv
        }
        return result;
    }

 

    function isCnpj(pCnpj)
    {
        var numero = formatCpfCnpj(pCnpj, false, true);
        var base = numero.substring(0, NUM_DGT_CNPJ_BASE);
        var ordem = numero.substring(NUM_DGT_CNPJ_BASE, 12);
        var digitos = dvCpfCnpj(base + ordem, true);
        var algUnico;

        // Valida dígitos verificadores
        if (numero != base + ordem + digitos) return false;

        /* Não serão considerados válidos os CNPJ com os seguintes números BÁSICOS:
        * 11.111.111, 22.222.222, 33.333.333, 44.444.444, 55.555.555,
        * 66.666.666, 77.777.777, 88.888.888, 99.999.999.
        */
        algUnico = numero.charAt(0) != '0';
        for (i=1; i<NUM_DGT_CNPJ_BASE; i++)
        {
        algUnico = algUnico && (numero.charAt(i-1) == numero.charAt(i));
        }

        if (algUnico) return false;

        if (ordem == "0000") return false;

        return (base == "00000000" || parseInt(ordem, 10) <= 300 || base.substring(0, 3) != "000");
    } //isCnpj

 

    function isCpf(pCpf)
    {
        var numero = formatCpfCnpj(pCpf, false, false);
        var base = numero.substring(0, numero.length - 2);
        var digitos = dvCpfCnpj(base, false);
        var algUnico, i;

        // Valida dígitos verificadores
        if (numero != base + digitos) return false;

        /* Não serão considerados válidos os seguintes CPF:
        * 000.000.000-00, 111.111.111-11, 222.222.222-22, 333.333.333-33, 444.444.444-44,
        * 555.555.555-55, 666.666.666-66, 777.777.777-77, 888.888.888-88, 999.999.999-99.
        */

        algUnico = true;
        for (i=1; i<NUM_DIGITOS_CPF; i++)
        {
        algUnico = algUnico && (numero.charAt(i-1) == numero.charAt(i));
        }
        return (!algUnico);
    }           
    
    String.prototype.lpad = function(pSize, pCharPad)
    {
        var str = this;
        var dif = pSize - str.length;
        var ch = String(pCharPad).charAt(0);
        for (; dif>0; dif--) str = ch + str;
        return (str);
    } 
   
    function formatCpfCnpj(pCpfCnpj, pUseSepar, pIsCnpj)
    {
        if (pIsCnpj==null) pIsCnpj = false;

        if (pUseSepar==null) pUseSepar = true;

        var maxDigitos = pIsCnpj? NUM_DIGITOS_CNPJ: NUM_DIGITOS_CPF;
        var numero = unformatNumber(pCpfCnpj);

        numero = numero.lpad(maxDigitos, '0');

        if (!pUseSepar) return numero;

        if (pIsCnpj)
        {
            reCnpj = /(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/;
            numero = numero.replace(reCnpj, "$1.$2.$3/$4-$5");
        }
        else
        {
            reCpf = /(\d{3})(\d{3})(\d{3})(\d{2})$/;
            numero = numero.replace(reCpf, "$1.$2.$3-$4");
        }
        return numero;
        }

        String.prototype.trim = function()
        {
            return this.replace(/^\s*/, "").replace(/\s*$/, "");
        } 

        function unformatNumber(pNum)
        {
            return String(pNum).replace(/\D/g, "").replace(/^0+/, "");
        }


        function isCpfCnpj(source, args)
        {
            var confirmacao = true;
            
            var pCpfCnpj = document.getElementById('txtCPFCNPJ').value;
            var numero = pCpfCnpj.replace(/\D/g, "");

            if (isCnpj(numero) || isCpf(numero))
            {
                confirmacao = true;
                //document.getElementById('ctl00_ContentPlaceHolder1_txtCPF').style.borderColor = '#7f9db9';
                //document.getElementById('ctl00_ContentPlaceHolder1_lblErro').style.display = "none";
                pCpfCnpj.value = formatCpfCnpj(numero, true, isCnpj(numero));
            }
            else
            {
                pCpfCnpj.value = "";
                confirmacao = false;
                //document.getElementById('ctl00_ContentPlaceHolder1_txtCPF').style.borderColor = '#FF0000';
                //document.getElementById('ctl00_ContentPlaceHolder1_lblErro').style.display = "block";
            }
            args.IsValid = confirmacao;
            return confirmacao;
        }



/*******************************************
 * MASCARA MOEDA
 */
function mascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) objTextBox.value = '';
    if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2)
        objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}
function mascaraNumero(valor, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = valor.length;
    for(i = 0; i < len; i++)
        if ((valor.charAt(i) != '0') && (valor.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(valor.charAt(i))!=-1) aux += valor.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) valor = '';
    if (len == 1) valor = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2)
        valor = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        valor = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        valor += aux2.charAt(i);
        valor += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return valor;
}
/*******************************************
 * MASCARA NUMERO
 */
function somenteNumero(event){
	var cont = 0;
	if(navigator.appName.indexOf("Netscape")!= -1) { 
		tecla= event.which; 
	} else { 
		tecla= event.keyCode;
	}

	//if((tecla > 47 && tecla < 58) || (tecla == 13 || tecla == 9 || tecla == 8)) { // numeros de 0 a 9
		if(tecla > 47 && tecla < 58){
		return true;
	} else {
		if (tecla != 8 || tecla == 13) {// backspace
			return false;
		} else {
			return true;
		}
	}
}
function somenteNumeroVirgula(thisone, event){
    var amount = thisone.value;
    if(CommaFormatted(event) == false){
        return false;
    }
	thisone.value = mascaraNumero(amount, ".", ",", event);
	return false;
}

function CommaFormatted(event)
{
	var cont = 0;
	if(navigator.appName.indexOf("Netscape")!= -1) { 
		tecla= event.which; 
	} else { 
		tecla= event.keyCode;
	}

	//if((tecla > 47 && tecla < 58) || (tecla == 13 || tecla == 9 || tecla == 8)) { // numeros de 0 a 9
		if((tecla > 47 && tecla < 58)){
		return true;
	} else {
		if (tecla != 8 || tecla == 13) {// backspace
			return false;
		} else {
			return true;
		}
	}
}


/*function campoNotNull(campo){
 if (campo.value == ""){ 
    alert("Este campo não pode ficar em branco"); 
    campo.focus(); 
    return (false); 
 }*/
  

/*******************************************
 * VERIFICA CAMPOS DA DIV1
 */

function verificarCampos(){

var campos = "Os campos a seguir devem ser preenchidos \n";
var ok = true;


var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtRazaoSocial').value;
if (campo == ""){ 
campo = "RAZÃO SOCIAL \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtLogadouro').value;
if (campo == ""){ 
campo = "ENDEREÇO \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtNomeFantasia').value;
if (campo == ""){ 
campo = "NOME FANTASIA \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtCEP').value;
if (campo == ""){ 
campo = "CEP \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtBairro').value;
if (campo == ""){ 
campo = "BAIRRO \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtCPFCNPJ').value;
if (campo == ""){ 
campo = "CNPJ/CPF \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_cboCidade').value;
if (campo == "0"){ 
campo = "CIDADE \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtDataAberturaEmp').value;
if (campo == ""){ 
campo = "DATA DE ABERTURA DA EMPRESA \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtNumEmpregados').value;
if (campo == ""){ 
campo = "NÚMERO DE EMPREGADOS \n";
campos = campos + campo;
ok = false;
}

var index= document.getElementById('ctl00_ContentPlaceHolder1_cboEstados').selectedIndex;
if (index == 0){ 
campo = "ESTADO \n";
campos = campos + campo;
ok = false;
}

/*var index= document.getElementById('ctl00_ContentPlaceHolder1_cboAtivEconomica').selectedIndex;
if (index == 0){ 
campo = "ATIVIDADE ECONÔMICA \n";
campos = campos + campo;
ok = false;
}*/

var campo = document.getElementById('ctl00_ContentPlaceHolder1_hidCDA_ATIVIDADE_ECONOMICA').value;
if (campo == "") {
    campo = "ATIVIDADE ECONÔMICA \n";
    campos = campos + campo;
    ok = false;
}

var index = true;
for (i=0;(document.getElementById('ctl00_ContentPlaceHolder1_rblTipoEmpresa_' + i)!=null);i++){
   if(document.getElementById('ctl00_ContentPlaceHolder1_rblTipoEmpresa_' + i).checked == true)
        index = false;
    }
if (index == true){ 
campo = "TIPO DE EMPRESA \n";
campos = campos + campo;
ok = false;
}

var index = true;
for (i=0;(document.getElementById('ctl00_ContentPlaceHolder1_rblFaturamento_' + i)!=null);i++){
   if(document.getElementById('ctl00_ContentPlaceHolder1_rblFaturamento_' + i).checked == true)
        index = false;
    }
if (index == true){ 
campo = "FATURAMENTO ANUAL EM 2008 \n";
campos = campos + campo;
ok = false;
}

var index = true;
for (i=0;(document.getElementById('ctl00_ContentPlaceHolder1_rblCategorias_' + i)!=null);i++){
   if(document.getElementById('ctl00_ContentPlaceHolder1_rblCategorias_' + i).checked == true)
        index = false;
    }
if (index == true){ 
campo = "CATEGORIA \n";
campos = campos + campo;
ok = false;
}

var checados = 0;
if(document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao11')!=null){
    if(document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao11').checked == true ||
        document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao12').checked == true)
            checados++;
    if(document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao21').checked == true ||
        document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao22').checked == true)
            checados++;
    if(document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao31').checked == true ||
        document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao32').checked == true)
            checados++;
    if(document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao41').checked == true ||
        document.getElementById('ctl00_ContentPlaceHolder1_rbQuestao42').checked == true)
            checados++;    
}else{
checados=4;
}
if (checados < 4){ 
campo = "QUESTÕES \n";
campos = campos + campo;
ok = false;
}

  
if (ok == true){
mostraOutraDiv();
return true;
}
else{
alert(campos); 
return false;
}


}

/*******************************************
 * VERIFICA CAMPOS DA DIV2
 */

function verificarCamposDiv2(){

var campos = "Os campos a seguir devem ser preenchidos \n";
var ok = true;


var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtNomeContato').value;
if (campo == ""){ 
campo = "NOME COMPLETO \n";
campos = campos + campo;
ok = false;
}

var index = true;
for (i=0;(document.getElementById('ctl00_ContentPlaceHolder1_rblNivelEscolaridade_' + i)!=null);i++){
   if(document.getElementById('ctl00_ContentPlaceHolder1_rblNivelEscolaridade_' + i).checked == true)
        index = false;
    }
if (index == true){ 
campo = "NÍVEL DE ESCOLARIDADE \n";
campos = campos + campo;
ok = false;
}


var index = true;
for (i=0;(document.getElementById('ctl00_ContentPlaceHolder1_rblFaixaEtaria_' + i)!=null);i++){
   if(document.getElementById('ctl00_ContentPlaceHolder1_rblFaixaEtaria_' + i).checked == true)
        index = false;
    }
if (index == true){ 
campo = "FAIXA ETÁRIA \n";
campos = campos + campo;
ok = false;
}


var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtSenha').value;
if (campo == ""){ 
campo = "SENHA \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtConfimacaoSenha').value;
if (campo != document.getElementById('ctl00_ContentPlaceHolder1_txtSenha').value){ 
campo = "CONFIRMAR SENHA \n";
campos = campos + campo;
ok = false;
}


/*var campo = document.getElementById('checkbox1').checked;
if (campo == false){ 
campo = "Confirme aceitação de participação. \n";
campos = campos + campo;
ok = false;
}*/


var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtCargoContato').value;
if (campo == ""){ 
campo = "CARGO \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtTelDDD').value;
if (campo == "") {
    campo = "DDD TELEFONE FIXO \n";
    campos = campos + campo;
    ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtTelContato').value;
if (campo == ""){ 
campo = "TELEFONE FIXO \n";
campos = campos + campo;
ok = false;
}

/*var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtCelContato').value;
if (campo == ""){ 
campo = "CELULAR \n";
campos = campos + campo;
ok = false;
}*/

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtEmailContato').value;
if (campo == ""){ 
campo = "E-MAIL \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtDataNascContato').value;
if (campo == ""){ 
campo = "DATA DE NASCIMENTO \n";
campos = campos + campo;
ok = false;
}

var campo = document.getElementById('ctl00_ContentPlaceHolder1_txtEnderecoContato').value;
if (campo == ""){ 
campo = "ENDEREÇO COMPLETO\n";
campos = campos + campo;
ok = false;
}

var campof= document.getElementById('ctl00_ContentPlaceHolder1_rbSexoMasc').checked;
var campom = document.getElementById('ctl00_ContentPlaceHolder1_rbSexoFem').checked;
if (campof == false && campom == false){ 
campo = "SEXO \n";
campos = campos + campo;
ok = false;
}

if (ok == true){
return true;
}
else{

alert(campos); 
return false;
}


}
/**** Validar Tudo na Div 1 no Botão Continuar
/*
*/
function validarDiv1(){

var continua= false;
var camposErro = "Campos Inválidos: \n";
var CPF_CNPJ = document.getElementById("ctl00_ContentPlaceHolder1_txtCPFCNPJ");
var aberturaEmp = document.getElementById("ctl00_ContentPlaceHolder1_txtDataAberturaEmp");
var alertExibido = false;


if (verificarCampos() == true){
continua = true;
}
else{
alertExibido = true;
} 

if (continua == true){
if (validarCPFCNPJ(CPF_CNPJ) == true){
continua = true;
}
else{
camposErro = "CNPJ/CPF \n";

}
}

if (continua == true){
if (check_date(aberturaEmp) == true){
continua = true;
}
else{
camposErro = "DATA DE ABERTURA DA EMPRESA \n";
}
}

if (continua == true){
if (validarCEP() == true){
camposErro = "CEP \n";
continua = false;

}
else{
continua = true;
}
}

if (continua == true){
if (empregados() == true){
continua = true;
}
else{
camposErro = "NÚMERO DE EMPREGADOS \n";
}
}

if (continua == true){
//trataInicio();   ****** Alterar link.
return true;
}
else
{
        if (alertExibido != true){
            alert(camposErro);
            return false;
        }
        else
        {
            return false;
        }

return false;

}
}

/**** Validar Tudo na Div 2 no Botão Finalizar
/*
*/
function validarDiv2(){
var continua= false;
var camposErro = "Campos Inválidos: \n";
var alertExibido = false;

var CPF_CNPJ = document.getElementById("ctl00_ContentPlaceHolder1_txtCPFContato");
var dataNasc = document.getElementById("ctl00_ContentPlaceHolder1_txtDataNascContato");

if (verificarCamposDiv2() == true){
continua = true;
}
else{
continua = false;
alertExibido = true;
//return false;
} 

if (continua == true){
var valorCPFCNPJ = CPF_CNPJ.value;
CPF_CNPJ.value = valorCPFCNPJ.replace(".", "").replace("-", "").replace(".", "");
var CPF_CNPJ2 = document.getElementById("ctl00_ContentPlaceHolder1_txtCPFContato");
if (validarCPFCNPJ(CPF_CNPJ2) == true){
continua = true;
}
else{
camposErro = "CNPJ/CPF \n";
continua = false;
//return false;
}
}

if (continua == true){
if (validarSenhaConf() == true){
continua = true;
}
else{
continua = false;
camposErro = "SENHA \n";
alertExibido = true;
}
}

if (continua == true){
if (validarSenha() == true){
continua = true;
}
else{
continua = false;
camposErro = "SENHA \n";
alertExibido = true;
//return false;
}
}

if (continua == true){
if (validarMail() == true){
continua = true;
}
else{
camposErro = "E-MAIL \n";
continua = false;
//return false;
}
}

if (continua == true){
if (check_date(dataNasc) == true){
continua = true;
}
else{
camposErro = "DATA DE NASCIMENTO \n";
continua = false;
//return false;
}
}

if (continua == true){
if (validarTel() == true){
continua = true;
}
else{
camposErro = "TELEFONE FIXO \n";
continua = false;
//return false;
}
}

/*if (continua == true){
if (validarCel() == true){
continua = true;
}
else{
camposErro = "CELULAR \n";
continua = false;
//return false;
}
}*/


if (continua == true){
    return true;
}
else{
    if (alertExibido != true){
    alert(camposErro);
    return false;
    }
    else{
    return false;
    }
}
}



/*******************************************
 * Verificar Confirmação de senha
 */
function validarSenhaConf()
{

   var senha = document.getElementById('ctl00_ContentPlaceHolder1_txtSenha').value;
   var confirmarSenha = document.getElementById('ctl00_ContentPlaceHolder1_txtConfimacaoSenha').value;
   
   if (senha != "" && confirmarSenha!= ""){
        if (senha != confirmarSenha){
              alert("A confirmação da senha não é igual a senha!");
              return false;
        }
        else{
        return true;
        }
    return false;
    } 
   
        
 
}


function validarSenha()
{

   var confirmarSenha = document.getElementById('ctl00_ContentPlaceHolder1_txtConfimacaoSenha').value;
   var senha = document.getElementById('ctl00_ContentPlaceHolder1_txtSenha').value;
   
   if (confirmarSenha != "" && senha != ""){
   
        if (senha != confirmarSenha){
              alert("A confirmação da senha não é igual a senha!");
              return false;
        }
        else{
        return true;
        }
        
   return false;
   }
 
}


/*******************************************
 * Validar E-mail
 */
function validarMail(){

var email = document.getElementById('ctl00_ContentPlaceHolder1_txtEmailContato');
if (email.value !=""){
    if (!checkMail(email)) {

         str = email.value.trim();
                if (str == ""){
                    alert("Este campo não pode ficar vazio.");
                    email.value = "";
                    email.focus();
                    return false;
                }
                else{
                    alert("Email inválido");
                    email.focus();
                    return false;
                }
    }
    else{
    return true;
    }
}
}

function checkMail(mail){
   var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(mail) == "string"){
        if(er.test(mail)){ return true; }
    }else if(typeof(mail) == "object"){
        if(er.test(mail.value)){ 
                    return true; 
                }
    }else{
    
        return false;
        }
}

/*******************************************
 * VAlidar e Formatar Data
 */
 
 function check_date(DATA) {

        if (DATA.value != ""){
        mascData(DATA);

        var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
        var msgErro = 'Formato inválido de data.';
        var vdt = new Date();
        var vdia = vdt.getDay();
        var vmes = vdt.getMonth();
        var vano = vdt.getFullYear();
                      
        if ((DATA.value.match(expReg)) && (DATA.value!='')){
                var dia = DATA.value.substring(0,2);
                var mes = DATA.value.substring(3,5);
                var ano = DATA.value.substring(6,10);
                
             if ((dia== 00) || (mes== 00) || (ano == 00) ){
                alert('Data Inválida');
                 DATA.focus();
                return false;
             }

			 if((dia ==1) && (mes==1) && (ano <= 1753 ))
			{
				alert('Data Inválida');
                DATA.focus();
                return false;
			}
                
                if((mes==4 && dia > 30) || (mes==6 && dia > 30) || (mes==9 && dia > 30) || (mes==11 && dia > 30)){
                        alert("Dia incorreto !!! O mês especificado contém no máximo 30 dias.");
                        DATA.focus();
                        return false;
                } else{ //1
                                if(ano%4!=0 && mes==2 && dia>28){
                                        alert("Data incorreta!! O mês especificado contém no máximo 28 dias.");
                                        DATA.focus();
                                        return false;
                                } else{ //2
                                                if(ano%4==0 && mes==2 && dia>29){
                                                                alert("Data incorreta!! O mês especificado contém no máximo 29 dias.");
                                                                DATA.focus();
                                                                return false;
                                                } else{ //3
                                                if (ano > vano) {
                                                                                alert("Data incorreta!! Ano informado maior que ano atual.");
                                                                                DATA.focus();
                                                                                return false;
                                                                }else{ //4
                                                                        //alert ("Data correta!");
                                                                        return true;
                                                                } //4-else
                                                } //3-else
                                }//2-else
                }//1-else                       
        } else { //5

                        alert(msgErro);
                        DATA.focus(); 
                        return false;
        } //5-else
}

 }
 
 
function formataData(obj,event){
	if(somenteNumero(event)) {
		setTimeout("mascData(document.all." + obj.name + ");",60);
	} else {
		return false;
	}
}

function mascData(obj)  {
	tamanho = obj.value.length;
	strString = obj.value;
	strString = strString.replace("/","");
	strString = strString.replace("/","");
	if(tamanho>=2)  {
		strDia = strString.substring(0,2);
		strMes = strString.substring(2,4);
		strAno = strString.substring(4,8);
		strAno = strAno.replace("/","");
		//alert("dia=" + strDia +" mes=" + strMes + " ano=" + strAno)
		strString = strDia + "/";
		if (trim(strMes)!="")  {
			strString = strString + strMes;
			if(strMes.length==2)  {
				strString = strString + "/" + strAno;
			}
		}
		else  {
			strString = strString;
		}
	}
	obj.value = strString;
}


/* function onPaste(cep){
 
 alert('Essa função não é permitida'); 
 cep.value = "";
 cep.focus();
 return false;
 
 }*/


function validarCEP()
{

    var cep    = document.getElementById('ctl00_ContentPlaceHolder1_txtCEP');
    var strcep  = cep.value; 
    var str = "";
    var continua = true;
    if (strcep != ""){
        
        if (strcep.length < 8){
        alert('CEP Inválido');
        cep.focus();
        return false;
        }
        
        else{
         if (strcep.length == 8){  
         
             var teste = strcep.substring(0,5);
             var teste_ = strcep.substring(5,8);
             var cpffim = teste + '-' + teste_;
             cep.value = cpffim;
             
             for (i = 0; i <= 7; i++){
                    if (continua == true){
                    var strNum = strcep.substring(i,i+1);
                     
                            for (num=0 ; num<=9; num++){
                                if (strNum == num){
                                    continua = true;
                                    break;
                                }
                                else {
                                continua = false;
                                
                                }
                                   
                            }
                           // return true;
                     }
                     
                     else{   
                            alert('CEP Inválido');
                            cep.focus();
                            return false;
                     }    
                            
                  }
             
             
             
         }
         
         if(strcep.length == 9){  
            
           
               str = str + strcep.substring(0,5);
               str = str + strcep.substring(6,9);
               var separador = strcep.substring(5,6);
                    if (separador != '-'){
                        alert('CEP Inválido');
                        cep.focus();
                        return false;
                    }
                    else{
           
                         for (i = 0; i <= 7; i++){
                            if (continua == true){
                            var strNum = str.substring(i,i+1);
                             
                                    for (num=0 ; num<=9; num++){
                                        if (strNum == num){
                                            continua = true;
                                            break;
                                        }
                                        else {
                                        continua = false;
                                        
                                        }
                                           
                                    }
                                     // return true;
                             }
                             else{   
                                  alert('CEP Inválido');
                                  cep.focus();
                                  return false;
                             }    
                                    
                          }
                   }                
          }
         
        }
        }
  
}   
      
      
/*******************************************
* Validar Número de empregados
*/
 
function empregados()
{


    var campo= document.getElementById('ctl00_ContentPlaceHolder1_txtNumEmpregados');
    var tamCampo = campo.value.length;
    var emp = campo.value;
    var continua = true;
    
    if (emp!= ""){  
         if (emp > 0){
            for (i = 0; i <= tamCampo; i++){
                        if (continua == true){
                        var strCel = emp.substring(i,i+1);
                         
                                for (num=0 ; num<=9; num++){
                                    if (strCel == num){
                                        continua = true;
                                        break;
                                    }
                                    else {
                                    continua = false;
                                    
                                    }
                                       
                                }
                         }
                         else{   
                                alert("NÚMERO DE EMPREGADOS INVÁLIDO");
                                campo.focus();
                                return false;
                         }    
                                
            }
        }
        else{
        alert("Quantidade de funcionários deve ser maior que zero");
        campo.focus();
        return false;
        
        }
        
    }
   if (continua== true){
    return true;
    }

}    
  
    
 /*******************************************
 * Validar Telefone
 */

function validarTel()
{


    var campo= document.getElementById('ctl00_ContentPlaceHolder1_txtTelContato');
    var tamTel = campo.value.length;
    var tel = campo.value;
    var continua = true;
    
    validaEspaco(campo);
    
    if (tel.value != ""){  
         
        for (i = 0; i <= tamTel; i++){
                    if (continua == true){
                    var strTel = tel.substring(i,i+1);
                     
                            for (num=0 ; num<=9; num++){
                                if (strTel == num){
                                    continua = true;
                                    break;
                                }
                                else {
                                continua = false;
                                
                                }
                                   
                            }
                            
                     }
                     else{   
                            alert("TELEFONE INVÁLIDO");
                            campo.focus();
                            continua = false;
                            return false;
                     }    
                     
                            
        }
        
        
    }
    if (continua== true){
    return true;
    }

}


/*******************************************
 * Validar Celular
 */

function validarCel()
{

    var campo= document.getElementById('ctl00_ContentPlaceHolder1_txtCelContato');
    var tamCel = campo.value.length;
    var cel = campo.value;
    var continua = true;
    
    validaEspaco(campo);
    
    if (cel != ""){  
         
        for (i = 0; i <= tamCel; i++){
                    if (continua == true){
                    var strCel = cel.substring(i,i+1);
                     
                            for (num=0 ; num<=9; num++){
                                if (strCel == num){
                                    continua = true;
                                    break;
                                }
                                else {
                                continua = false;
                                
                                }
                                   
                            }
                     }
                     else{   
                            alert("CELULAR INVÁLIDO");
                            campo.focus();
                            return false;
                     }    
                            
        }
        
    }
      if (continua== true){
    return true;
    }

}
/*******************************************
 * Função que tira os espaços em bancos da esquerda e da  direita de uma string
 */

function trim(string){
	tamanho=string.length;
	posicao=string.indexOf(" ");
	while(posicao==0){
		string=string.substring(1,tamanho);
		tamanho=string.length;
		posicao=string.indexOf(" ");
	}
	
	tamanho=string.length;
	tamanho=tamanho-1;
	posicao=string.lastIndexOf(" ");
	while(posicao==tamanho){
		string=string.substring(0,tamanho);
		tamanho=tamanho-1;
		posicao=string.lastIndexOf(" ");
	}
	return string;
}



function validaEspaco(nome){

        var strNome= nome.id;
        var campo = document.getElementById(strNome);
        var str  = nome.value; 
      
        if (str != ""){
        
        str = str.trim();
               
            if (str != ""){
                 campo.value = str;
                 return true;
            }
            else
            {          
                alert("Este campo não pode ficar vazio.");
                campo.value = "";
                campo.focus();
                return false;
           }
       }
}


/*******************************************
 * FValidações da Questão de Resultados da página de avaliação da gestão.
 */
function desabilitaCampo(txt1, txt2, txt3){
   
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt1).value = "";
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt1).disabled = true;
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt1).style.backgroundColor='#E8E8E8';
        
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt2).value = "";
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt2).disabled = true;
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt2).style.backgroundColor='#E8E8E8';
        
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt3).value = "";
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt3).disabled = true;
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt3).style.backgroundColor='#E8E8E8';
}

function habilitaCampo(txt1, txt2, txt3){
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt1).disabled = false;
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt1).style.backgroundColor='#FFFFFF';
                
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt2).disabled = false;
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt2).style.backgroundColor='#FFFFFF';
        
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt3).disabled = false;3
        document.getElementById('ctl00_ContentPlaceHolder1_' + txt3).style.backgroundColor='#FFFFFF';
}

function validarReceita(campo){

  var nomeCampo = 'ctl00_ContentPlaceHolder1_' + campo;

  var valor = document.getElementById(nomeCampo).value;
  
  if (valor !=""){
      if (valor == "0,00"){
          alert("A receita total deve ser maior que zero");
          document.getElementById(nomeCampo).focus();
          return false;
      }
      if (valor <= 0){
          alert("A receita total deve ser maior que zero");
          document.getElementById(nomeCampo).focus();
          return false;
      }
      else
        if (valor < 1000){
            alert("A receita total deve ser maior que 1000");
            document.getElementById(nomeCampo).focus();
            return false;
        }
        else{
            return true;
        }
  }    

}

function validarSatiRotat(campo){

  var nomeCampo = 'ctl00_ContentPlaceHolder1_' + campo;
 
  var valor = document.getElementById(nomeCampo).value;
  if (valor !=""){
      if (valor <= 0){
      alert("O índice de satisfação deve ser maior que zero");
      document.getElementById(nomeCampo).focus();
      return false;
      }
      else
         if (valor > 100){
            alert("O índice de satisfação deve ser menor ou igual a 100%");
            document.getElementById(nomeCampo).focus();
            return false;
        }
        else{
            return true;
        }
  }    
}

function validarZero(campo){
   var nomeCampo = 'ctl00_ContentPlaceHolder1_' + campo;
   var valor = document.getElementById(nomeCampo).value;
      if (valor !=""){
          if (valor <= 0){
              alert("A produçao dever ser maior que zero");
              document.getElementById(nomeCampo).focus();
              return false;
          }
          else{
              return true;
          }
      }    
}

function validarCamposResultados(){

var div = document.getElementById("ctl00_ContentPlaceHolder1_divResultados");
var retorno = true;
    if (div.style.display =='block'){
        
        retorno = validaReceitaTotal();
        
        if (retorno == true)
        retorno = validaDespesaTotal();
        
        if (retorno == true)
        retorno = validaSatisfacao();
        
        if (retorno == true)
        retorno = validaReclamacoes();
        
        if (retorno == true)
        retorno = validaColaboradores();
       
        if (retorno == true)
        retorno = validaRotatividade();
        
        if (retorno == true)
        retorno = validaAtenAfast();
        
        if (retorno == true)
        retorno = validaProducao();
        
                
    }
    else{
    return true;
    }

if (retorno==true){
    return true;
}
else{
    return false;
}
}

function validaReceitaTotal(){
        var rb32 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela32");
        var txt52 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela52");
        var txt62 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela62");
        var txt72 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela72");
        
        var msg = "Preencha corretamente o valor da receita total referente ao ano de:\n"; 
        var continua = true;
        if (rb32.checked == true){

            if ((txt52.value == "") && (txt62.value == "") && (txt72.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt62.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
	        }

	        if (txt72.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
		    }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
            alert(msg);
            return false;
        
        }
        else{
            return true;
        }
}

function validaDespesaTotal(){
        var rb33 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela33");
        var txt53 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela53");
        var txt63 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela63");
        var txt73 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela73");
        var msg = "Preencha corretamente o valor da despesa total referente ao ano de:\n"; 
        var continua = true;
        
        if (rb33.checked == true){

            if ((txt53.value == "") && (txt63.value == "") && (txt73.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt63.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
	        }

	        if (txt73.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
		    }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
            alert(msg);
            return false;
        
        }
        else{
            return true;
        }
}

function validaSatisfacao(){
        var rb34 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela34");
        var txt54 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela54");
        var txt64 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela64");
        var txt74 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela74");
        var msg = "Preencha corretamente o valor do índice de satisfação referente ao ano de:\n"; 
        var continua = true;
        if (rb34.checked == true){

            if ((txt54.value == "") && (txt64.value == "") && (txt74.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt64.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
		    }

	        if (txt74.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
}

function validaReclamacoes(){
        var rb35 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela35");
        var txt55 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela55");
        var txt65 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela65");
        var txt75 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela75");
        var msg = "Preencha corretamente o número de reclamações recebidas referente ao ano de:\n"; 
        var continua = true;
        if (rb35.checked == true){

            if ((txt55.value == "") && (txt65.value == "") && (txt75.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt65.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
		    }

	        if (txt75.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
}

function validaColaboradores(){
        var rb36 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela36");
        var txt56 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela56");
        var txt66 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela66");
        var txt76 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela76");
        var msg = "Preencha corretamente o número de colaboradores referente ao ano de:\n"; 
        var continua = true;
        if (rb36.checked == true){

            if ((txt56.value == "") && (txt66.value == "") && (txt76.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt66.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
		    }

	        if (txt76.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
}


function validaRotatividade(){
        var rb37 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela37");
        var txt57 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela57");
        var txt67 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela67");
        var txt77 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela77");
        var msg = "Preencha corretamente o valor da rotatividade referente ao ano de:\n"; 
        var continua = true;
        if (rb37.checked == true){

            if ((txt57.value == "") && (txt67.value == "") && (txt77.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt67.value == ""){
		        msg = msg + "2007 \n"
	            continua = false;
		    }

	        if (txt77.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
}


function validaAtenAfast(){
        var rb38 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela38");
        var txt58 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela58");
        var txt68 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela68");
        var txt78 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela78");
        var msg = "Preencha corretamente o número de atendentes com afastamento referente ao ano de:\n"; 
        var continua = true;
        if (rb38.checked == true){

            if ((txt58.value == "") && (txt68.value == "") && (txt78.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt68.value == ""){
		        msg = msg + "2008 \n"
	            continua = false;
		    }

	        if (txt78.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
}
        
        
function validaProducao(){
        var rb39 = document.getElementById("ctl00_ContentPlaceHolder1_rbtabela39");
        var txt59 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela59");
        var txt69 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela69");
        var txt79 = document.getElementById("ctl00_ContentPlaceHolder1_txttabela79");
        var msg = "Preencha corretamente o volume de produção referente ao ano de:\n"; 
        var continua = true;
        if (rb39.checked == true){

            if ((txt59.value == "") && (txt69.value == "") && (txt79.value == "")) {
	            msg = msg + "2006 \n"
	            continua = false;
		    }

	        /*if (txt69.value == ""){
		        msg = msg + "2009 \n"
	            continua = false;
		    }

	        if (txt79.value == ""){
	            msg = msg + "2008 \n"
	            continua = false;
	        }*/
	        
        }
        else
        {
            return true;
        }
        
        if (continua == false){
        alert(msg);
        return false;
        
        }
        else{
        return true;
        }
    }


    function trimAll(sString) {
        while (sString.substring(0, 1) == ' ' || sString.substring(0, 1) == '\n') {
            sString = sString.substring(1, sString.length);
        }
        while (sString.substring(sString.length - 1, sString.length) == ' ' || sString.substring(sString.length - 1, sString.length) == '\n') {
            sString = sString.substring(0, sString.length - 1);
        }
        return sString;
    }        
