var contador = 0;
var contadorLinha = 0;
var innerHtmlSocioFim = '</tr>' + 
        '</table>' ;

function Mascara(objeto, evt, mask)  
{
        var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
        var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
        var Numeros = '0123456789';
        var Fixos  = '().-:/ '; 
        var Charset = " !\"#$%&\"()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";
 
        evt = (evt) ? evt : (window.event) ? window.event : "";
        var value = objeto.value;
        
        if (evt) {
           var ntecla = (evt.which) ? evt.which : evt.keyCode;
         
         tecla = Charset.substr(ntecla - 32, 1);
 
           if (ntecla < 32) return true;
             var tamanho = value.length;
             if (tamanho >= mask.length) return false;
                var pos = mask.substr(tamanho,1); 
                while (Fixos.indexOf(pos) != -1) {
                    value += pos;
                    tamanho = value.length;
                    if (tamanho >= mask.length) return false;
                       pos = mask.substr(tamanho,1);
                    }
                switch (pos) {
                    //case '#' : if (Numeros.indexOf(tecla) == -1) return false; break;
                    case '#' : if (!somenteNumeros(evt)) return false; break;
                    case 'A' : if (LetrasU.indexOf(tecla) == -1) return false; break;
                    case 'a' : if (LetrasL.indexOf(tecla) == -1) return false; break;
                    case 'Z' : if (Letras.indexOf(tecla) == -1) return false; break;
                    case '*' : objeto.value = value; return true; break;
                    default : return false; break;
                }
        }
        objeto.value = value; 
     return true;
}


function somenteNumeros(e) {
var key;
if(window.event) {
  key = e.keyCode;
}
else if(e.which) {
   key = e.which;
}
 
key = (e.which) ? e.which : e.keyCode;
 
if (key==13 || key == 9){
   return true;
}
 
if (key!=8 || key < 48 || key > 57) return (((key > 47) && (key < 58)) || (key==8));
{
    return true;
}
}

function MaskCNPJ(objeto, evt)
{
   return Mascara(objeto, evt, '##.###.###/####-##'); 
}

function maskData(objeto, evt) {
    return Mascara(objeto,evt,'##/##/####');
}

function maskCep(objeto,evt) {
    return Mascara(objeto,evt,'#####-###')
}

function maskCPF(objeto,evt) {
    return Mascara(objeto,evt,'###.###.###-##');
}

function validarCNPJ(CNPJ) 
{
   //CNPJ = LimpaFormatoStr(CNPJ);
   erro = new String;
   if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
   if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
   if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! \n\n";
   }
   //substituir os caracteres que não são números
   if(document.layers && parseInt(navigator.appVersion) == 4){
            x = CNPJ.substring(0,2);
            x += CNPJ. substring (3,6);
            x += CNPJ. substring (7,10);
            x += CNPJ. substring (11,15);
            x += CNPJ. substring (16,18);
                       CNPJ = x;
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! \n\n";
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]);
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
               if (erro.length > 0){
                       return false;
               } else {
               }
               return true;
}

function validarCPF (CPF) 
{
   CPF = LimpaFormatoStr(CPF);
    
    if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
        CPF == "22222222222" ||    CPF == "33333333333" || CPF == "44444444444" ||
        CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
        CPF == "88888888888" || CPF == "99999999999")
        return false;
    soma = 0;
    for (i=0; i < 9; i ++)
        soma += parseInt(CPF.charAt(i)) * (10 - i);
    resto = 11 - (soma % 11);
    if (resto == 10 || resto == 11)
        resto = 0;
    if (resto != parseInt(CPF.charAt(9)))
        return false;
    soma = 0;
    for (i = 0; i < 10; i ++)
        soma += parseInt(CPF.charAt(i)) * (11 - i);
    resto = 11 - (soma % 11);
    if (resto == 10 || resto == 11)
        resto = 0;
    if (resto != parseInt(CPF.charAt(10)))
        return false;
    return true;
}

function LimpaFormatoStr(strnoformat)
{
    strnoformat = strnoformat.replace(",","");
    strnoformat = strnoformat.replace("/","");
    strnoformat = strnoformat.replace("-","");
    strnoformat = strnoformat.replace(".","");
    strnoformat = strnoformat.replace(".","");    
    return strnoformat;
}

function validaCNPJ(form) {
    var cnpj = form.numeroCgcEmpresaPagina.value;
    var campo = form.numeroCgcEmpresaPagina;
    if(cnpj == '') {
        alert('Por favor informe o CNPJ, para prosseguir com o cadastro.');
        campo.focus();
        return false;
    }
    if(validarCNPJ(cnpj)) {
        return true;
    }
    alert('O CNPJ informado não é valido, por favor verifique.');
    campo.focus();
    return false;
}



function removerSocio(id,linha) {
    var tabela = document.getElementById(id);
    var r = document.getElementById(linha);
    tabela.deleteRow(r.rowIndex);
}
function validarFormulario(form)
{
 add_loading();
 nomeEmpresa = document.forms[0]['nomeEmpresa'];
 dataFundacaoEmpresa = document.forms[0]['dataFundacao'];
 numeroCGCEmpresa = document.forms[0]['numeroCgcEmpresaPagina'];
 inscricaoEstadual = document.forms[0]['numeroIEEmpresa'];
 descricaoEnderecoComercialEmpresa = document.forms[0]['descricaoEnderecoComercialEmpresa'];
 numeroEnderecoComercialEmpresa = document.forms[0]['numeroEnderecoComercialEmpresa'];
 descricaoBairroEmpresa =document.forms[0]['descricaoBairroEmpresa'];
 unidadeFederativaEmpresa = document.forms[0]['siglaUnidadeFederativa'];
 codigoCepEmpresa = document.forms[0]['codigoCepEmpresa'];
 codigoCidade = document.forms[0].elements[9];
 dddTelefoneEmpresa = document.forms[0]['dddTelefoneEmpresa'];
 telefoneEmpresa = document.forms[0]['telefoneEmpresa'];
 dddCelularEmpresa = document.forms[0]['dddCelularEmpresa'];
 celularEmpresa = document.forms[0]['celularEmpresa'];
 emailEmpresa = document.forms[0]['emailEmpresa']; 
 
 if(inscricaoEstadual != '' ){
  var ie = inscricaoEstadual.value.toUpperCase();
  if(ie == 'ISENTO'){
   document.forms[0]['numeroInscricaoEstadualEmpresa'].value = '0';  
  }else{
   document.forms[0]['numeroInscricaoEstadualEmpresa'].value = ie;  
  }
 }
 if(nomeEmpresa.value == '')
 {
  alert('O campo Nome da Empresa é requerido.');
  nomeEmpresa.focus();
  remove_loading();
 return false;
 }
 else if(dataFundacaoEmpresa.value == '')
 {
  alert('O campo Data da Fundação da empresa é requerido.');
  dataFundacaoEmpresa.focus();
  remove_loading();
  return false;
 }
 else if(numeroCGCEmpresa.value == '')
 {
  alert('O campo Numero do CGC é requerido.');
  numeroCGCEmpresa.focus();
  remove_loading();
  return false;
 }
 else if(!validaCNPJ(form))
 {  
  numeroCGCEmpresa.focus(); 
  remove_loading();
  return false;
 }
 else if(inscricaoEstadual.value == '')
 {
  alert('O campo Numero da Inscrição Estadual é requerido.');
  inscricaoEstadual.focus(); 
  remove_loading();
  return false;
 } 
 else if(descricaoEnderecoComercialEmpresa.value == '')
 {
  alert('O campo Endereço Comercial é requerido.');
  descricaoEnderecoComercialEmpresa.focus(); 
  remove_loading();
  return false;
 }
 else if(numeroEnderecoComercialEmpresa.value == '')
 {
    alert('O campo Numero Endereço Comercial é requerido.');
    numeroEnderecoComercialEmpresa.focus();
    remove_loading();
    return false;
 }
 else if(descricaoBairroEmpresa.value == '')
 {
  alert('O campo Bairro é requerido.');
  remove_loading();
  descricaoBairroEmpresa.focus();
  return false;
 }
 else if(unidadeFederativaEmpresa.value == '0')
 {
  alert('Por favor selecione um estado.');
  unidadeFederativaEmpresa.focus();
  remove_loading();
  return false;
 }
 else if(codigoCidade.value == '0')
 {
    alert('Por favor selecione uma cidade.');
    remove_loading();
    codigoCidade.focus();
    return false;
 }
 else if(codigoCepEmpresa.value == '')
 {
  alert('O campo CEP é requerido.');
  remove_loading();
  codigoCepEmpresa.focus();
  return false;
 }
 else if(dddTelefoneEmpresa.value == '') 
 {
  alert('O campo DDD do Telefone é requerido.');
  remove_loading();
  dddTelefoneEmpresa.focus();
  return false;
 }
 else if(telefoneEmpresa.value == '')
 {
  alert('O campo Telefone da Empresa é requerido.');
  remove_loading();
  telefoneEmpresa.focus();
  return false;
 }
 else if(dddCelularEmpresa.value == '')
 {
  alert('O campo DDD do Celular da Empresa é requerido.');
  remove_loading();
  dddCelularEmpresa.focus();
  return false;
 } 
 else if(celularEmpresa.value == '')
 {
  alert('O campo Celular da Empresa é requerido.');
  remove_loading();
  celularEmpresa.focus();
  return false;
 } 
 else if(emailEmpresa.value == '')
 {
  alert('O campo Email é requerido.');
  remove_loading();
  emailEmpresa.focus(); 
  return false;
 }
 else if(!verificaSocio(contador))
 { 
   remove_loading();
   return false;    
 } else if(!validarData(form)) {
   remove_loading();
   return false; 
 } 
 document.getElementById('qtdSocio') = contadorLinha;
 return true;
}

function verificaEmail(campo)
{
  myString = campo.value;
  if (myString == '')
   return true;
  myString = myString.toLowerCase();
  var newString = myString.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi)
  if (!newString)
  {
   alert('Por favor digite um E-mail válido! ' );
   //campo.value = '';
   campo.focus();
   return false;
  }
 return true;
}

function verificaSocio(contador)
{ 
 var nomeSocioEmpresa;
 var cpfSocioEmpresa;
 var nomeMaeSocioEmpresa;
 var nomePaiSocioEmpresa;
 var grauParentesco;
 var rgSocioEmpresa;
 var y = 0; 

   
   var inserirSocio2 = document.forms[0].elements['segundoSocioSalvar'];
   var inserirSocio3 = document.forms[0].elements['terceiroSocioSalvar'];
    
    nomeSocioEmpresa = document.forms[0]['nomeSocioEmpresa'+y];
    cpfSocioEmpresa = document.forms[0]['cpfSocioEmpresa'+y];
    rgSocioEmpresa = document.forms[0]['rgSocioEmpresa'+y];
    nomeMaeSocioEmpresa = document.forms[0]['nomeMaeSocioEmpresa'+y];
    nomePaiSocioEmpresa = document.forms[0]['nomePaiSocioEmpresa'+y];
    grauParentesco = document.forms[0]['grauParentesco'+y];
     
   if(nomeSocioEmpresa.value == '')
   {
    alert('O campo Nome do Sócio Majoritario é requerido.');
    nomeSocioEmpresa.focus();
    return false;
   }
   else if(cpfSocioEmpresa.value == '')
   {
    alert('O campo CPF do Sócio Majoritario é requerido.');
    cpfSocioEmpresa.focus();   
    return false;
   } else if(!validarCPF(cpfSocioEmpresa.value)) {
        alert('O CPF do Sócio Majoritario é inválido, por favor verifique!');
        cpfSocioEmpresa.focus();   
        return false;
   } else if(rgSocioEmpresa.value == '') {
        alert('O campo RG do Sócio Majoritario é requerido.');
        rgSocioEmpresa.focus();
        return false;
   }
   else if(nomeMaeSocioEmpresa.value == '')
   {
    alert('O campo Nome da Mãe do Sócio Majoritario é requerido.');
    nomeMaeSocioEmpresa.focus();
    return false;
   }
   else if(nomePaiSocioEmpresa.value == '')
   {
    alert('O campo Nome do Pai do Sócio Majoritario é requerido.');
    nomePaiSocioEmpresa.focus();
    return false;
   }
   else if(!verificaGrauParentescoSocio('grauParentesco'+y))
   {
    alert('O campo Grau de Parentesco do Sócio Majoritario é requerido.');
    return false;
   }
   
   if(inserirSocio2.value == 'S') {
        y++;
        nomeSocioEmpresa = document.forms[0]['nomeSocioEmpresa'+y];
        cpfSocioEmpresa = document.forms[0]['cpfSocioEmpresa'+y];
        rgSocioEmpresa = document.forms[0]['rgSocioEmpresa'+y];
        nomeMaeSocioEmpresa = document.forms[0]['nomeMaeSocioEmpresa'+y];
        nomePaiSocioEmpresa = document.forms[0]['nomePaiSocioEmpresa'+y];
        grauParentesco = document.forms[0]['grauParentesco'+y];
        if(nomeSocioEmpresa.value == '')
       {
        alert('O campo Nome do 2º Sócio é requerido.');
        nomeSocioEmpresa.focus();
        return false;
       }
       else if(cpfSocioEmpresa.value == '')
       {
        alert('O campo CPF do 2º Sócio é requerido.');
        cpfSocioEmpresa.focus();   
        return false;
       } else if(!validarCPF(cpfSocioEmpresa.value)) {
            alert('O CPF do 2º Sócio é inválido, por favor verifique!');
            cpfSocioEmpresa.focus();   
            return false;
       } else if(rgSocioEmpresa.value == '') {
            alert('O campo RG do 2º Sócio é requerido.');
            rgSocioEmpresa.focus();
            return false;
       }
       else if(nomeMaeSocioEmpresa.value == '')
       {
        alert('O campo Nome da Mãe do 2º Sócio é requerido.');
        nomeMaeSocioEmpresa.focus();
        return false;
       }
       else if(nomePaiSocioEmpresa.value == '')
       {
        alert('O campo Nome do Pai do 2º Sócio é requerido.');
        nomePaiSocioEmpresa.focus();
        return false;
       }
       else if(!verificaGrauParentescoSocio('grauParentesco'+y))
       {
        alert('O campo Grau de Parentesco do 2º Sócio é requerido.');
        return false;
       }
   }
   if(inserirSocio3.value == 'S') {
        y++;
        nomeSocioEmpresa = document.forms[0]['nomeSocioEmpresa'+y];
        cpfSocioEmpresa = document.forms[0]['cpfSocioEmpresa'+y];
        rgSocioEmpresa = document.forms[0]['rgSocioEmpresa'+y];
        nomeMaeSocioEmpresa = document.forms[0]['nomeMaeSocioEmpresa'+y];
        nomePaiSocioEmpresa = document.forms[0]['nomePaiSocioEmpresa'+y];
        grauParentesco = document.forms[0]['grauParentesco'+y];
        if(nomeSocioEmpresa.value == '')
       {
        alert('O campo Nome do 3º Sócio é requerido.');
        nomeSocioEmpresa.focus();
        return false;
       }
       else if(cpfSocioEmpresa.value == '')
       {
        alert('O campo CPF do 3º Sócio é requerido.');
        cpfSocioEmpresa.focus();   
        return false;
       } else if(!validarCPF(cpfSocioEmpresa.value)) {
            alert('O CPF do 3º Sócio é inválido, por favor verifique!');
            cpfSocioEmpresa.focus();   
            return false;
       } else if(rgSocioEmpresa.value == '') {
            alert('O campo RG do 3º Sócio é requerido.');
            rgSocioEmpresa.focus();
            return false;
       }
       else if(nomeMaeSocioEmpresa.value == '')
       {
        alert('O campo Nome da Mãe do 3º Sócio é requerido.');
        nomeMaeSocioEmpresa.focus();
        return false;
       }
       else if(nomePaiSocioEmpresa.value == '')
       {
        alert('O campo Nome do Pai do 3º Sócio é requerido.');
        nomePaiSocioEmpresa.focus();
        return false;
       }
       else if(!verificaGrauParentescoSocio('grauParentesco'+y))
       {
        alert('O campo Grau de Parentesco do 3º Sócio é requerido.');
        return false;
       }
   }
 return true;
}

function verificaGrauParentescoSocio(idRadio) {
    var radio = document.forms[0].elements[idRadio];
    var retorno = false;
    for(a = 0;a < radio.length; a++) {
        if(radio[a].checked) {
            retorno = true;
        }
    }
    return retorno;
}

function verificarRadioSelecionado()//verifica os objetos radio selecionados
{
 achou = false;
 inputs = document.getElementsByTagName('input');
 for (k=0;k<inputs.length && !achou ;k++)
 {
  if (inputs[k].type == 'radio')
  {
   if (inputs[k].checked)
   {
    achou = true;
    return achou;
   }
  }
 }
  return achou;
}
function verificaData(campo) {

    if (campo.value == '')
        return true;
   
    Data = campo.value;
    var dma = -1;
    var data = Array(3);
    var ch = Data.charAt(0);
    var valor = 0;
    for(i=0; i < Data.length && (( ch >= '0' && ch <= '9' ) || ( ch == '/' && i != 0 ) ); ) {
        data[++dma] = '';
        if(ch!='/' && i != 0) valor = 1;
       
        if(i != 0 ) ch = Data.charAt(++i);
       
        if(ch=='0') ch = Data.charAt(++i);
        while( ch >= '0' && ch <= '9' ){
            data[dma] += ch;
            ch = Data.charAt(++i);
        }
    }
    if(ch!='') valor = 1;
    if(data[0] == '' || isNaN(data[0]) || parseInt(data[0]) < 1) valor = 1;
    if(data[1] == '' || isNaN(data[1]) || parseInt(data[1]) < 1 || parseInt(data[1]) > 12) valor = 1;
    if(data[2] == '' || isNaN(data[2]) || ((parseInt(data[2]) < 0 || parseInt(data[2]) > 99 ) && (parseInt(data[2]) < 1900 || parseInt(data[2]) > 9999))) valor = 1;
    if(data[2] < 50) data[2] = parseInt(data[2]) + 2000;
    else if(data[2] < 100) data[2] = parseInt(data[2]) + 1900;

    switch(parseInt(data[1])){
        case 2: { if(((parseInt(data[2])%4!=0 || (parseInt(data[2])%100==0 && parseInt(data[2])%400!=0)) && parseInt(data[0]) > 28) || parseInt(data[0]) > 29 ) valor = 1; break; }
        case 4: case 6: case 9: case 11: { if(parseInt(data[0]) > 30) valor = 1; break;}
        default: { if(parseInt(data[0]) > 31) valor = 1;}
    }
   
    if (valor == 1) {
        campo.focus();
        return false;
    }
    return true;
}

function validarData(campo) {
    if(!verificaData(campo)) {
        alert('A Data de Fundação informada não é valida, por favor verifique.');
        campo.focus();
        return false;
    }
    return true;
}


function proximoCampoEnter(event,idProximoCampo,form) {
    key = (event.which) ? event.which : event.keyCode;
    var proximo = document.forms[0].elements[idProximoCampo];
    if(key == 13) {
     if(proximo){ 
        proximo.focus();
        return false;
     }else{
      return true; 
     }
    }
    return true;
}

function proximoCampo(event,idProximoCampo,form,objeto) {
    key = (event.which) ? event.which : event.keyCode;
    var proximo = document.forms[0].elements[idProximoCampo];
    if(objeto.value.length == objeto.maxLength && (key != 127 && key != 80 && key != 8 && key != 9 && key != 46 && key != 35 && key != 36)) {       
       if(proximoCampo)
        {
         proximo.focus();
         if(proximo.value == '' || proximo.value.length < proximo.maxLength) {
            proximo.value=String.fromCharCode(key);
         }
         //document.getElementById(idProximoCampo).focus();
         //document.getElementById(idProximoCampo).value=key;
         return false;
        } else {
         return true;
        }
    }
    return proximoCampoEnter(event,idProximoCampo,form);
}

function proximoSocio(event,numeroProximoCampo,form,objeto) {
    key = (event.which) ? event.which : event.keyCode;
    /*if(key != 127 && key != 80 && key != 8 && key != 9 && key != 46 && key != 35 && key != 36) {
       for(xyz = numeroProximoCampo; xyz <= contador; xyz++) {
       idProximoCampo = 'nomeSocioEmpresa';
       idProximoCampo += xyz
        if(form.elements[idProximoCampo]) {
         form.elements[idProximoCampo].focus();
         return false;
        } 
       }
    }*/
    idProximoCampo = 'nomeSocioEmpresa'+numeroProximoCampo;
    contador++;
    return proximoCampoEnter(event,idProximoCampo,form);
}

function inserirSocio(id) {
    tabela = document.getElementById(id);
    var linha = tabela.insertRow(tabela.rows.length);
    var id = 'linhaSocio'+(++contadorLinha);
    linha.id = id;
    var celula = linha.insertCell(0);
    var rowValue = '<td width=\"19%\" colspan=\"2\">&nbsp;<input type=\"button\" class=\"rodfontemenor\" onclick=\"removerSocio(\'socios\',\''+id+'\');\" value=\"Remover\"/></td>';
    //celula.innerHTML = innerHtmlSocioInicio()+rowValue+innerHtmlSocioFim;
    criarSocio(celula)
    document.getElementById('contador').value = contadorLinha;
    document.getElementById('qtdSocio').value = contadorLinha;
}

function criarSocio(elemento) {
    var className = '';
     if (navigator.userAgent.indexOf("Firefox")!=-1) {
        className = 'class';
    }
    else if(navigator.userAgent.indexOf("MSIE")!=-1){
        className = 'className';
    }
    var tabela = document.createElement('table');
    var texto = document.createElement('text');
    tabela.setAttribute('cellpadding','0');
    tabela.setAttribute('cellspacing','0');
    tabela.setAttribute('border','0');
    tabela.setAttribute('width','90%');
    tabela.setAttribute(className,'rodlaterais');
    var linha = tabela.insertRow(tabela.rows.length);
    var coluna = linha.insertCell(linha.rowIndex);
    texto.setAttribute('name','nomeSocioEmpresa'+contadorLinha);
    coluna.innerHTML = texto;
    elemento.innerHTML = tabela;
}

function innerHtmlSocioInicio() {
 var innerHtmlSocioInicio = '<br><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"90%\" class=\"rodlaterais\">' + 
        '  <tr> <td colspan=\"4\" class=\"rodfontemenor\">Dados do S&oacute;cio</td> </tr>          '+
        '        <tr>' + 
        '          <td width=\"21%\">&nbsp;</td>' + 
        '          <td width=\"38%\" colspan=\"3\">&nbsp;</td>' + 
        '        </tr>' + 
        '        <tr>' + 
        '          <td width=\"21%\" class=\"rodfontepadrao2\">Nome S&oacute;cio:</td>' + 
        '          <td width=\"27%\" colspan=\"3\">' + 
        '            <input type=\"text\" name=\"nomeSocioEmpresa'+(contadorLinha)+'\" onkeypress=\"return proximoCampo(event,\"cpfSocioEmpresa0\",document.forms[0],this)\" maxlength=\"40\"' + 
        '                   size=\"45\" class=\"rodfontepadrao\"/>' + 
        '          </td>' + 
        '        </tr>' + 
        '        <tr>' + 
        '          <td width=\"21%\" class=\"rodfontepadrao2\">CPF:</td>' + 
        '          <td width=\"38%\" colspan=\"3\">' + 
        '            <input type=\"text\" onkeypress=\"retorno = proximoCampo(event,\"rgSocioEmpresa\"'+(contadorLinha)+',document.forms[0],this); if(retorno){maskCPF(this,event);} else {return retorno;} name=\"cpfSocioEmpresa'+(contadorLinha)+'\" maxlength=\"14\" size=\"18\"' + 
        '                   class=\"rodfontepadrao\"/>' + 
        '          </td>' + 
        '        </tr>' + 
        '<tr>'+
            '<td width=\"21%\" class=\"rodfontepadrao2\">RG:</td>'+
            '<td width=\"49%\"><input type=\"text\" onkeypress=\"retorno = proximoCampo(event,\"nomeMaeSocioEmpresa'+(contadorLinha)+'\",document.forms[0],this);if(retorno){return somenteNumeros(event);}else{return retorno};\" name=\"rgSocioEmpresa'+(contadorLinha)+'\" maxlength=\"13\" size=\"15\"'+
            '       class=\"rodfontepadrao\"/> </td>'+
        '</tr>'+
        '        <tr>' + 
        '          <td width=\"21%\" class=\"rodfontepadrao2\">Nome M&atilde;e:</td>' + 
        '          <td width=\"49%\" colspan=\"3\">' + 
        '            <input type=\"text\" onkeypress=\"return proximoCampo(event,\"nomePaiSocioEmpresa'+(contadorLinha)+'\",document.forms[0],this)\" name=\"nomeMaeSocioEmpresa'+(contadorLinha)+'\" maxlength=\"40\"' + 
        '                   size=\"45\" class=\"rodfontepadrao\"/>' + 
        '          </td>' + 
        '        </tr>' + 
        '        <tr>' + 
        '          <td width=\"21%\" class=\"rodfontepadrao2\">Nome Pai:</td>' + 
        '          <td width=\"49%\" colspan=\"3\">' + 
        '            <input type=\"text\" onkeypress=\"return proximoSocio(event,1,document.forms[0],this)\" name=\"nomePaiSocioEmpresa'+(contadorLinha)+'\" maxlength=\"40\" size=\"45\"' + 
        '                   class=\"rodfontepadrao\"/>' + 
        '          </td>' + 
        '        </tr>' + 
        '        <tr>' + 
        '          <td width=\"53%\" colspan=\"4\" class=\"rodfontepadrao2\">Possui Parentesco com funcion&aacute;rio Rodobens ?</td>' + 
        '        </tr>' + 
        '        <tr>' + 
        '          <td width=\"17%\" colspan=\"2\" class=\"rodfontepadrao2\">&nbsp;' + 
        '             Sim ' + 
        '            <input type=\"radio\" name=\"grauParentesco'+(contadorLinha)+'\" value=\"S\" class=\"rodfontepadrao2\" />' + 
        '            N&atilde;o ' + 
        '            <input type=\"radio\" name=\"grauParentesco'+(contadorLinha)+'\" value=\"N\" class=\"rodfontepadrao2\"/>' + 
        '          </td>';
        alert(innerHtmlSocioInicio);
 return innerHtmlSocioInicio;
}

function mostrarSocio(id,idValor,objeto) {
    var divMostrar = document.getElementById(id);
    var chkTerceiro = document.getElementById('checkTerceiroSocio');
    var terceiroDiv = document.getElementById('terceiroSocio');
    var checkTerceiro = document.forms[0].elements['checkSocio'];
    if(objeto.checked) {
        divMostrar.style.display = '';
        document.forms[0].elements[idValor].value = 'S';
        if(id == 'segundoSocio') {
            chkTerceiro.style.display = '';
        }
    } else {
        divMostrar.style.display = 'none';
        document.forms[0].elements[idValor].value = 'N';
        if(id == 'segundoSocio') {
            checkTerceiro.checked = false;
            chkTerceiro.style.display = 'none';
            terceiroDiv.style.display = 'none';
        }
    }
}


