// JavaScript Document


function $(id)
{	
	if(document.getElementById(id)) {
		return document.getElementById(id);	
	}
	else {
		return document.getElementById('debug');	
	}
}



function liga(item){
	item.style.display='';
}

function desliga(item){
	item.style.display='none';
}


function Validate()
{
	var mensagem = '';  
	
	
	
	if($('nome').value == '')
	
	
	if (mensagem != '')
	{
		alert('Erros encontrados:\n\n' + mensagem);
		return false;
	}
	else 
	{ 
		return true; 
	}
}


//FIM COMBO ESTADOS E CIDADES

function AtualizaTipoLargadouro(largadouro)
{
	if(document.getElementById('tipo_largadouro'))
		document.getElementById('tipo_largadouro').value = largadouro;
}


function resumoTamanhoMaximo(txarea)
{
	total = 450;
	tam = txarea.value.length;
	str="";
	str=str+tam;

	document.getElementById('Digitado').innerHTML = str;
	document.getElementById('Restante').innerHTML = total - str;

	if (tam > total)
	{
		aux = txarea.value;
		txarea.value = aux.substring(0,total);
		document.getElementById('Digitado') = total
		document.getElementById('Restante').innerHTML = 0
		alert("O número máximo de "+ total +" caracteres permitidos já foi atingido!");
	}
}