function NOME_FUNCAO()
{
    try
    {
    }
    catch(err)
    {
        document.write('<!-- VerificaTipoPessoa() ' + err.description + '-->');
    }
}



function VerificaTipoPessoa()
{
}


function CamposPreenchidos(ParentForm)
{   
}

function MudaCorBorda(obj, cor)
{
}

function verificaCNPJ(obj)
{
	var cnpj = Trim(document.getElementById(obj).value);
	//cnpj = cnpj.replace(/\./g, '');
	//cnpj = cnpj.replace('-', '');
	//cnpj = cnpj.replace('/', '');
	cnpj = cnpj.replace(/\D+/g, '');
	
	if(cnpj)return valida_cnpj(cnpj);
	else return false;
}

function valida_cnpj(cnpj)
{
	var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
	digitos_iguais = 1;
	if (cnpj.length != 14)
    	return false;
	for (i = 0; i < cnpj.length - 1; i++)
    	if (cnpj.charAt(i) != cnpj.charAt(i + 1))
            	{
            	digitos_iguais = 0;
            	break;
            	}
	if (!digitos_iguais)
    	{
    	tamanho = cnpj.length - 2
    	numeros = cnpj.substring(0,tamanho);
    	digitos = cnpj.substring(tamanho);
    	soma = 0;
    	pos = tamanho - 7;
    	for (i = tamanho; i >= 1; i--)
            	{
            	soma += numeros.charAt(tamanho - i) * pos--;
            	if (pos < 2)
                	pos = 9;
            	}
    	resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
    	if (resultado != digitos.charAt(0))
            	return false;
    	tamanho = tamanho + 1;
    	numeros = cnpj.substring(0,tamanho);
    	soma = 0;
    	pos = tamanho - 7;
    	for (i = tamanho; i >= 1; i--)
            	{
            	soma += numeros.charAt(tamanho - i) * pos--;
            	if (pos < 2)
                	pos = 9;
            	}
    	resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
    	if (resultado != digitos.charAt(1))
            	return false;
    	return true;
    	}
	else
    	return false;
} 


function verificaCPF(obj)
{
	var cpf = Trim(document.getElementById(obj).value);
	//cpf = cpf.replace(/\./g, '');
	//cpf = cpf.replace('-', '');
	cpf = cpf.replace(/\D+/g, '');
	
	if(cpf)return valida_cpf(cpf);
	else return false;
}


function valida_cpf(cpf)
{
	var numeros, digitos, soma, i, resultado, digitos_iguais;
	digitos_iguais = 1;
	if (cpf.length < 11)
    	return false;
	for (i = 0; i < cpf.length - 1; i++)
    	if (cpf.charAt(i) != cpf.charAt(i + 1))
            	{
            	digitos_iguais = 0;
            	break;
            	}
	if (!digitos_iguais)
    	{
    	numeros = cpf.substring(0,9);
    	digitos = cpf.substring(9);
    	soma = 0;
    	for (i = 10; i > 1; i--)
            	soma += numeros.charAt(10 - i) * i;
    	resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
    	if (resultado != digitos.charAt(0))
            	return false;
    	numeros = cpf.substring(0,10);
    	soma = 0;
    	for (i = 11; i > 1; i--)
            	soma += numeros.charAt(11 - i) * i;
    	resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
    	if (resultado != digitos.charAt(1))
            	return false;
    	return true;
    	}
	else
    	return false;
}

function validaCNPJ(cnpj)
{
	var retorno = true;
	
	CNPJ = Trim(cnpj);
	
	erro = new String;
	
	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! "; 
	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)
		retorno = false;
				
    return retorno;				
}

function ValidaEmail(email)
{
	var retorno = true;

    if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Trim(email)))) 
	{ 
		retorno = false;
	} 
	
	return retorno;
}

function Mascara(src, mask) 
{
     var i = src.value.length;
     var saida = mask.substring(0,1);
     var texto = mask.substring(i)
     if (texto.substring(0,1) != saida) 
     {
          src.value += texto.substring (0,1);
     }
}

function ValidaData(dia, mes, ano)
{
	retorno = true;
		
	/* foi encontrado um bug no javascript (IE 6 e Firefox 2) na execucção
	   de parseInt com a string '08' retornando 0.   
    */
	dia = Number(dia);
	mes = Number(mes);
	ano = Number(ano);    
		
	switch(mes)
	{
	    case 1: case 3: case 5: case 10: case 12:	              
	    {
	        if(dia > 31)
	        {   
	            retorno = false;
	        }
	        break;
	    }
	    case 4: case 6: case 9: case 11:
	    {
	        if(dia > 30)
	        {   	                
	            retorno = false;
	        }
	        break;
	    }
	    case 2:
	    {
	        bissexto = (((ano%4 == 0) && (ano%100 != 0)) || (ano%400 == 0));
    	    
	        if(bissexto)
	        {
	            if(dia > 29)
	            {	                    
	                retorno = false;
	            }
	        }
	        else
	        {
	            if(dia > 28)
	            {                        
	                retorno = false;
	            }	            
	        }
	    }  
	    default:
	    {
	        if(mes==7 || mes==8)
	        {
	            if(dia > 31)
	            {  	                  
	                retorno = false;
	            }
	        }   
	        else
	        {  	               
	            retorno = false;
	        }  
	    }
	}
    	
	return retorno;
}

function Trim(STRING)
{
    STRING = LTrim(STRING);
    
    return RTrim(STRING);
}   

function RTrim(STRING)
{
    while(STRING.charAt((STRING.length -1))==" ")
    {
        STRING = STRING.substring(0,STRING.length-1);
    }
    
    return STRING;
}


function LTrim(STRING)
{
    while(STRING.charAt(0)==" ")
    {
        STRING = STRING.replace(STRING.charAt(0),"");
    }
    
    return STRING;
}

function ColocaFocoEm(NomeObj, e) 
{ 
	try
	{
		var key; 
		if(window.event) 
		{ 
			key = event.keyCode; 
		}
		else
		{ 
			key = e.which; 
		}
		if(key == 13)
		{
			document.getElementById(NomeObj).focus();
			event.keyCode = 0;
		}
	} 
	catch(err)
	{
		alert(err.description);
	}
	
	return false;
} 

function CarregaEndereco(campo,tipo)
{
	TrocaImagem("loading", "visible");
}

function CarregaEndereco_CallBack(response)
{
	TrocaImagem("loading", "hidden");
}

function PreencherIgual(tipo)
{
}


function IsentoIE(chk)
{	
}


function TrocaImagem(name, visibilidade)
{
	try
	{
		document.getElementById(name).style.visibility = visibilidade;
	}
	catch(err)
	{
	}
}	
	
	
function ValCNPJ(cpo)	
{
	TrocaImagem("loading", "visible");

	var oTextboxConsultaCNPJ = document.getElementById('txtPJCNPJ');
	var MsgErro = false;
	var Msg = '';
	
     var CorErro                 			= '#EE0000';
     var CorOk                   			= '#B5B5B5';
     
    
    if(Trim(txtPJCNPJ.value) == '' || !validaCNPJ(Trim(txtPJCNPJ.value)))
    {
		Msg += 'Preencha corretamente o campo CNPJ.\n';
		
		MudaCorBorda(oTextboxConsultaCNPJ, CorErro);                
		
		MsgErro = true;
	} 
	else
	{
		MudaCorBorda(oTextboxConsultaCNPJ, CorOk); 
	}
	
	if(MsgErro)
	{
		alert(Msg);		
		TrocaImagem("loading", "hidden");
	}
	else
	{
		var Alerta = formcadastro.ConsultaCNPJ(oTextboxConsultaCNPJ.value, ValCNPJ_CallBack);
	}
}

function ValCNPJ_CallBack(response)
{
	if(response.error)
	{
		alert(response.error.Message);
		TrocaImagem("loading", "hidden");
	}
	else
	{
		var retorno = response.value;
		TrocaImagem("loading", "hidden");
		
		if (retorno[0] == "!Existente")
			alert("CNPJ já existente. Por favor, efetue seu login no menu acima.");
		else if (retorno[0] == "!RamoAtividadeInválido")
			alert("Cadastro Permitido apenas para Revendas.");
		else
			window.location.href = retorno[1];
	}
}
	

function validaCPF(cpf) 
{
	//cpf = document.validacao.cpfID.value;
	cpf = cpf.replace(/\D+/g, '');
	erro = new String;
	if (cpf.length < 11) erro += "Sao necessarios 11 digitos para verificacao do CPF! \n\n"; 
	var nonNumbers = /\D/;
	if (nonNumbers.test(cpf)) erro += "A verificacao de CPF suporta apenas numeros! \n\n"; 
	
	if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999")
	{
		erro += "Numero de CPF invalido!"
    }
    var a = [];
    var b = new Number;
    var c = 11;

    for (i=0; i<11; i++)
    {
		a[i] = cpf.charAt(i);
		if (i < 9) b += (a[i] * --c);
    }
    if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
    b = 0;
    c = 11;
    for (y=0; y<10; y++) b += (a[y] * c--); 
    
    if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
    if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10]))
	{
		erro +="Digito verificador com problema!";
    }
    if (erro.length > 0)
    {
        //alert(erro);
        return false;
    }
	return true;
}

function ConsultaCPF()
{
	TrocaImagem("loading_PF", "visible");

	var oTextCPF = document.getElementById('txtConsultaCPF');
	var MsgErro = false;
	var Msg = '';
	
    var CorErro                 			= '#EE0000';
    var CorOk                   			= '#B5B5B5';
	if(Trim(oTextCPF.value) == '' || !validaCPF(Trim(oTextCPF.value)))
	{
		Msg += 'Preencha corretamente o campo CPF.\n';
		
		MudaCorBorda(oTextCPF, CorErro);                
		
		MsgErro = true;
	} 
	else
	{
		MudaCorBorda(oTextCPF, CorOk); 
 	}

	if(MsgErro)
	{
		alert(Msg);		
		TrocaImagem("loading_PF", "hidden");		
	}
	
	else
	{
		var Alerta = consultacnpj.ConsultaCNPJ(oTextCPF.value,'PF', ConsultaCNPJ_CallBack);
	}
	

}

function ConsultaCNPJ()
{
	TrocaImagem("loading", "visible");

	var oTextboxConsultaCNPJ = document.getElementById('TextboxConsultaCNPJ');
	var MsgErro = false;
	var Msg = '';
	
     var CorErro                 			= '#EE0000';
     var CorOk                   			= '#B5B5B5';
    
    if(Trim(oTextboxConsultaCNPJ.value) == '' || !validaCNPJ(Trim(oTextboxConsultaCNPJ.value)))
    {
		Msg += 'Preencha corretamente o campo CNPJ.\n';
		
		MudaCorBorda(oTextboxConsultaCNPJ, CorErro);                
		
		MsgErro = true;
	} 
	else
	{
		MudaCorBorda(oTextboxConsultaCNPJ, CorOk); 
	}
	
	if(MsgErro)
	{
		alert(Msg);		
		TrocaImagem("loading", "hidden");		
	}
	else
	{
		var Alerta = consultacnpj.ConsultaCNPJ(oTextboxConsultaCNPJ.value,'PJ', ConsultaCNPJ_CallBack);
	}
}

function ConsultaCNPJ_CallBack(response)
{
	if(response.error)
	{
		alert(response.error.Message);
		TrocaImagem("loading", "hidden");
		TrocaImagem("loading_PF", "hidden");
	}
	else
	{
		var retorno = response.value;
		TrocaImagem("loading", "hidden");
		TrocaImagem("loading_PF", "hidden");
		
		if (retorno[0] == "!Existente")
			alert("Cadastro já existente. Por favor, efetue seu login no menu acima.");
		else if (retorno[0] == "!RamoAtividadeInválido")
			alert("Cadastro Permitido apenas para Revendas.");
		else if (retorno[0] == "!RamoAtividadeInativo")
			alert("Cadastro aguardando processo de liberação.");
		else
			window.location.href = retorno[1];
	}
}

function TipoPessoa(Radio)
{

	var rdb = document.getElementById(Radio);
	var oTextCPF = document.getElementById('txtConsultaCPF');
	var oTextCNPJ = document.getElementById('TextboxConsultaCNPJ');
	
	if (document.getElementById('RbtPessoaJuridica') != null)	
		{
		document.getElementById('RbtPessoaJuridica').checked = false; 
		}
	if (document.getElementById('RbtPessoaFisica') != null )
		{
		document.getElementById('RbtPessoaFisica').checked = false; 
		}
	rdb.checked = true;
		
	if (rdb.id == 'RbtPessoaJuridica')
	{
		document.getElementById('DIVPF').style.visibility = 'hidden';
		document.getElementById('DIVPJ').style.visibility = 'visible';
		oTextCPF.value='';		
	}
	else if (rdb.id == 'RbtPessoaFisica')
	{	
		document.getElementById('DIVPJ').style.visibility = 'hidden';
		document.getElementById('DIVPF').style.visibility = 'visible';
		oTextCNPJ.value = '';
	}
	else
	{
		document.getElementById('DIVPF').style.visibility = 'hidden';
		document.getElementById('DIVPJ').style.visibility = 'hidden';
		oTextCNPJ.value = ''
		oTextCPF.value='';
	}
}


function DownloadTabelaPreco()
{
	alert('PAssei');
	TrocaImagem("bt_download","hidden");
	TabelaPreco.GeraTabelaPreco()
}

function TabelaPreco()
{
	document.getElementById('ImgDownload').style.visibility = 'hidden';	
}

//Customizado por Elder Vinicius em 28/07/2009 - INICIO
function AceitaNewsLetter()
{
	//var oTextboxConsultaCNPJ = document.getElementById('TextboxConsultaCNPJ');
	//alert ("NewsLetter Atualizada");
	var ok = WebForm1.AceitaNewLetter(AceitaNewsLetter_CallBack);
}
//Customizado por Elder Vinicius em 28/07/2009 - FIM

//Customizado por Elder Vinicius em 28/07/2009 - INICIO
function AceitaNewsLetter_CallBack(response)
{	
	var retorno = response.value;
	
	if (retorno == "S")
	{
		//alert("Ok");
		TrocaImagem("aceite_newsletter","hidden");
	}	
}
//Customizado por Elder Vinicius em 28/07/2009 - FIM

//Customizado por Elder Vinicius em 28/07/2009 - INICIO
function RejeitaNewsLetter()
{
	//var oTextboxConsultaCNPJ = document.getElementById('TextboxConsultaCNPJ');
	//alert ("NewsLetter Atualizada");
	var ok = WebForm1.RejeitaNewsLetter(RejeitaNewsLetter_CallBack);
}
//Customizado por Elder Vinicius em 28/07/2009 - FIM

//Customizado por Elder Vinicius em 28/07/2009 - INICIO
function RejeitaNewsLetter_CallBack(response)
{	/*
	var retorno = response.value;
	
	if (retorno == "S")
	{
		alert("Ok");
	}	*/
	TrocaImagem("aceite_newsletter","hidden");
	//alert("Rejeitado");
	
}
//Customizado por Elder Vinicius em 28/07/2009 - FIM


function FormataCNPJ(el) 
{
	vr = el.value; 
	tam = vr.length; 
	if(vr.indexOf(".") == -1 && vr.indexOf("/") == -1 && vr.indexOf("-") == -1) 
	{
		if ( tam <= 2 ) 
			el.value = vr; 
  		if ( (tam > 2) && (tam <= 6) ) 
			el.value = vr.substr( 0, 2 ) + '.' + vr.substr( 2, tam ); 
		if ( (tam >= 7) && (tam <= 10) ) 
			el.value = vr.substr( 0, 2 ) + '.' + vr.substr( 2, 3 ) + '.' + vr.substr( 5, 3 ) + '/'; 
		if ( (tam >= 11) && (tam <= 18) ) 
			el.value = vr.substr( 0, 2 ) + '.' + vr.substr( 2, 3 ) + '.' + vr.substr( 5, 3 ) + '/' + vr.substr( 8, 4 ) + '-' + vr.substr( 12, 2 ); 
	} 
} 

function FormataCPF(el) 
{
	vr = el.value; 
	tam = vr.length; 
	if(vr.indexOf(".") == -1 && vr.indexOf("-") == -1) 
	{
		if ( tam <= 3 ) 
			el.value = vr; 
  		if ( (tam > 3) && (tam <= 7) ) 
			el.value = vr.substr( 0, 3 ) + '.' + vr.substr( 3, tam ); 
		if ( (tam >= 8) && (tam <= 11) ) 
			el.value = vr.substr( 0, 3 ) + '.' + vr.substr( 3, 3 ) + '.' + vr.substr( 6, 3 ) + '-' + vr.substr( 9, 2 ); 
	} 
} 



function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_timelinePlay(tmLnName, myID) { //v1.2
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_initTimelines() { //v4.0
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
    document.MM_Time = new Array(1);
    document.MM_Time[0] = new Array(1);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    document.MM_Time[0].fps = 15;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)
        document.MM_Time[0][0].obj = document["apDiv1"];
    else if (ns5)
        document.MM_Time[0][0].obj = document.getElementById("apDiv1");
    else
        document.MM_Time[0][0].obj = document.all ? document.all["apDiv1"] : null;
    document.MM_Time[0][0].keyFrames = new Array(1, 5, 12, 18, 26, 30);
    document.MM_Time[0][0].values = new Array(2);
	  
    if (ns5 || macIE5)
        document.MM_Time[0][0].values[0] = new Array("400px", "403px", "406px", "409px", "415px", "420px", "426px", "432px", "439px", "446px", "452px", "458px", "462px", "465px", "467px", "468px", "471px", "476px", "482px", "488px", "494px", "501px", "508px", "514px", "520px", "525px", "529px", "528px", "526px", "525px");
    else
        document.MM_Time[0][0].values[0] = new Array(370,373,376,379,382,385,388,392,396,400,402,408,412,418,412,408,402,400,396,392,390,388,385,382,379,376,373,370,370,370);
    document.MM_Time[0][0].values[0].prop = "left";

    if (ns5 || macIE5)
        document.MM_Time[0][0].values[1] = new Array("15px", "18px", "22px", "25px", "27px", "27px", "27px", "27px", "26px", "26px", "26px", "28px", "32px", "36px", "41px", "46px", "51px", "55px", "56px", "57px", "56px", "56px", "55px", "55px", "55px", "56px", "63px", "69px", "75px", "81px");
    else
        document.MM_Time[0][0].values[1] = new Array(370,378,382,385,387,397,397,397,396,396,396,398,392,396,400,396,391,385,386,380,376,376,376,376,375,375,373,373,370,370);

    document.MM_Time[0][0].values[1].prop = "top";
    if (!ns4) {
        document.MM_Time[0][0].values[0].prop2 = "style";
        document.MM_Time[0][0].values[1].prop2 = "style";
    }
    document.MM_Time[0].lastFrame = 30;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
    }
}

/*
function CarregaDadosCNPJExistente(response)
{
	alert('eu');
	return;
	var retorno = response.value;
	
	document.getElementById("formcadastro_txtPJNomeFantasia").value	= retorno[2];	
	document.getElementById("formcadastro_txtPJRazaoSocial").value	= retorno[3];	
	document.getElementById("formcadastro_txtPJCNPJ").value	= retorno[4];	
	document.getElementById("formcadastro_txtSite").value	= retorno[5];	

	document.getElementById("formcadastro_txtCep").value	= retorno[6];
	//document.getElementById("formcadastro_ddlEndereco").value	= retorno[7];
	document.getElementById("formcadastro_ddlTipoLogradouro").value	= retorno[8];
	document.getElementById("formcadastro_txtEndereco").value	= retorno[9];
	document.getElementById("formcadastro_txtNumero").value	= retorno[10];
	document.getElementById("formcadastro_txtComplemento").value	= retorno[11];
	document.getElementById("formcadastro_txtBairro").value	= retorno[12];
	document.getElementById("formcadastro_txtCidade").value	= retorno[13];
	document.getElementById("formcadastro_ddlEstado").value	= retorno[14];
	document.getElementById("formcadastro_ddlPais").value	= retorno[15];
	
	document.getElementById("formcadastro_txtEmail").value	= retorno[16];
	document.getElementById("formcadastro_txtPJIE").value	= retorno[17];
	document.getElementById("formcadastro_txtPJIE").disabled = (retorno[17].toUpperCase() == 'ISENTO');
	document.getElementById("formcadastro_chkIsento").checked	= (retorno[17].toUpperCase() == 'ISENTO');

	document.getElementById("formcadastro_txtTel1Ddd").value	= retorno[18];
	document.getElementById("formcadastro_txtTel1").value	= retorno[19];
	document.getElementById("formcadastro_txtRamal1").value	= retorno[20];

	document.getElementById("formcadastro_txtTel2Ddd").value	= retorno[21];
	document.getElementById("formcadastro_txtTel2").value	= retorno[22];
	document.getElementById("formcadastro_txtRamal2").value	= retorno[23];

	document.getElementById("formcadastro_txtTel3Ddd").value	= retorno[24];
	document.getElementById("formcadastro_txtTel3").value	= retorno[25];
	document.getElementById("formcadastro_txtRamal3").value	= retorno[26];

	document.getElementById("formcadastro_txtTelCelDdd").value	= retorno[27];
	document.getElementById("formcadastro_txtTelCel").value	= retorno[28];

	document.getElementById("formcadastro_txtTelFaxDdd").value	= retorno[29];
	document.getElementById("formcadastro_txtTelFax").value	= retorno[30];

	document.getElementById("formcadastro_txtRefEndereco").value	= retorno[31];
	
	
	var oTipoLog = document.getElementById("formcadastro_ddlTipoLogradouro");
	if(oTipoLog.selectedIndex == -1){
		oTipoLog.selectedIndex = 0;
	}
	
	var oPais = document.getElementById("formcadastro_ddlPais");
	if(oPais.selectedIndex == -1){
		//oPais.value = '31';
	}
	
	var oEstado = document.getElementById("formcadastro_ddlEstado");
	if(oEstado.selectedIndex == -1){
		//oEstado.value = 'SP';
	}			
}
*/



