window.onscroll = scrollEvent;

document.oncontextmenu = 	function(){
	
								alert('Todos os Direito Reservados Self Imóveis LTDA.');
								return false;

							}

	
//Controlando o scroll da div transparente
function scrollEvent(){
	
	if(document.getElementById('divTrasnp')){
		document.getElementById('divTrasnp').style.top = document.body.scrollTop;
		document.getElementById('divTrasnp').style.left = document.body.scrollLeft;
	}

	if(document.getElementById('divEnviando')){
		document.getElementById('divEnviando').style.top = document.body.scrollTop + 200;
	}

	if(document.getElementById('divCarregando')){
		document.getElementById('divCarregando').style.top = document.body.scrollTop + 200;
	}
	
	if(document.getElementById('divFoto')){
		document.getElementById('divFoto').style.top = document.body.scrollTop + 20;
	}

}

function favorito(){
	
    var url = "http://www.self-imoveis.com.br";
    var title = "Self Imóveis - Imobiliária Digital";
	
    if (window.sidebar){
		window.sidebar.addPanel(title, url,"");
	
	}else if(window.opera && window.print){
		
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    
	}else if(document.all){
		
		window.external.AddFavorite(url, title);
	}
}

function indicaAmigo(formulario){

	var objEmail = document.getElementById(formulario).txtEmail;
	var objEmailDestino = document.getElementById(formulario).txtEmailDestino;
	var objNome = document.getElementById(formulario).txtNome;
	var objProduto = document.getElementById(formulario).pk_id_produto;

	if(!validaRequerido(objNome)){

		if(!validaRequerido(objEmailDestino)){
	
			if(!validaRequerido(objEmail)){
		
				var destino = 'indique_amigo.asp?txtEmail='+objEmail.value+'&txtEmailDestino='+objEmailDestino.value+'&txtNome='+objNome.value+'&pk_id_produto='+objProduto.value;
		
				if(!validaTipoEmail(objEmail)){
					abrePop( { popUrl:destino, popClass: 'pop' } );
				}
			}
		}
	}
}


function ampliar(alvo){
	
	document.getElementById('foto').src = document.getElementById('carregando').src;
	
	if(document.getElementById('divFoto').style.visibility == 'hidden'){

		document.getElementById('divFoto').style.top = document.body.scrollTop + 50;
//		document.getElementById('divFoto').style.left = document.body.scrollLeft + 50;

		document.getElementById('foto').src = document.getElementById(alvo).src;

		document.getElementById('foto').setAttribute('numFoto',alvo.replace('foto',''));

	}
		
	visible('divFoto');
	visible('divTrasnp');
	
	if(document.getElementById('divLancamentosFlash'))visible('divLancamentosFlash');
	
	ampliarProxima(0);

}

function ampliarProxima(indice){
	
	if(document.getElementById('foto').getAttribute('numFoto') != ''){
		
		var numFoto = parseInt(document.getElementById('foto').getAttribute('numFoto'));
		
		numFoto += indice;
		
		var alvo = 'foto' + numFoto;
		var testeAlvoAnterior = 'foto' + (numFoto - 1);
		var testeAlvoProximo = 'foto' + (numFoto + 1);
		
		document.getElementById('foto').src = document.getElementById(alvo).src;

		document.getElementById('foto').setAttribute('numFoto',alvo.replace('foto',''));
	
		if(document.getElementById(testeAlvoAnterior)){
			document.getElementById('setaFotoAnterior').style.visibility = 'visible';
		}else{
			document.getElementById('setaFotoAnterior').style.visibility = 'hidden';
		}

		if(document.getElementById(testeAlvoProximo)){
			document.getElementById('setaFotoProxima').style.visibility = 'visible';
		}else{
			document.getElementById('setaFotoProxima').style.visibility = 'hidden';
		}

	}

}

/*
function carregarMenu(idPagina){

	var alvo

	for(x=1;x<7;x++){
	
		alvo = 'bt' + String(x)
		
		if(parseInt(idPagina) == x){
			document.getElementById(alvo).style.background='url(Arquivos/imagens/botao_ativo.gif)';
			document.getElementById(alvo).setAttribute('srcDefault','url(Arquivos/imagens/botao_ativo.gif)');
			
		}else{
			document.getElementById(alvo).style.background='url(Arquivos/imagens/botao_inativo.gif)';
			document.getElementById(alvo).setAttribute('srcDefault','url(Arquivos/imagens/botao_inativo.gif)');
		}

		document.getElementById(alvo).onmouseover = 	function btAtivo(){
									
												this.style.background = 'url(Arquivos/imagens/botao_ativo.gif)';
											}

		document.getElementById(alvo).onmouseout = 	function btInativo(){
												
												this.style.background = this.getAttribute('srcDefault');
											}
	}
	
}
*/

function carregaListaImovel(txtLista){

	if(!isArray(txtLista)){
	
		 eval('var arrayLista = new Array('+txtLista+')');
		
	}else{
		
		var arrayLista = txtLista;
	}

	if(arrayLista.length != -1){
		
		if(arrayLista[0] != null){
			document.getElementById('listaImoveis').innerHTML = "";
			
			for(x=0;x < arrayLista.length;x++){
				//Inserindo imóvel na lista lateral
				document.getElementById('listaImoveis').innerHTML += "<a href='#' onClick='document.frmResultado.txtCD.value="+arrayLista[x]+";document.frmResultado.optPesquisa.value=1;document.frmResultado.submit();' style='color:#CC0000;'>CD "+arrayLista[x]+"</a><a href='#' onClick='document.frmResultado.cmbFavoritos.selectedIndex = "+x+";ExcluirImovelAdicionado();'><img src='Arquivos/imagens/exclui_imovel.gif' align='absmiddle' hspace='4' vspace='4' alt='Clique aqui para excluir este imóvel da lista.'>Excluir</a><br>";
			}
			
			document.getElementById('listaImoveis').innerHTML += "<hr style='border:1px solid #ffffff'><a href='#formEnviarLista'>Envie sua lista!</a>";
		}else{
			document.getElementById('listaImoveis').innerHTML = '<b>Sua lista está vazia!</b>';
		}
	}
}

function ampliaFotoImovel(objeto){
	
	document.getElementById('fotoImovel').style.visibility = 'hidden';


	document.getElementById('fotoImovel').width = objeto.width;
	document.getElementById('fotoImovel').height = objeto.height;
	document.getElementById('fotoImovel').src = objeto.src;
	
	document.getElementById('fotoLegenda').innerHTML = objeto.getAttribute('alt');
	
	redimImg(document.getElementById('fotoImovel'),420,300);
	

}

function redimImg(objeto,largura,altura,objetoOrigem){
	
	//Redimencionando a imagem do produto
	if(objeto){
		
		objeto.style.visibility = 'hidden';

		if(objetoOrigem == null){
			objetoOrigem = objeto;
		}

		heightValue = objetoOrigem.height;

		widthValue = objetoOrigem.width;

		//Se a altura for maior que a largura
		if(heightValue > widthValue){
			
			if(heightValue > altura){
				
				objeto.height = altura;
				objeto.width = widthValue/(heightValue/altura);

			}
			
		}else{

			if(widthValue > largura){
				
				objeto.width = largura;
				objeto.height = heightValue/(widthValue/largura);

			}
		}
		
		objeto.style.position = 'static';
		objeto.style.visibility = 'visible';
	}
	

}

function abrirDetalheImovel(codigo){
	
	if(codigo != null && codigo != ''){

		//if(document.getElementById('detalhe'+String(codigo)))display('detalhe'+String(codigo));
		
		//if(document.getElementById('descricao'+String(codigo)))display('descricao'+String(codigo));
	
		if(document.getElementById('foto'+String(codigo)))display('foto'+String(codigo));
	
		if(document.getElementById('foto360'+String(codigo)))display('foto360'+String(codigo));
	}
}

function infoTexto(alvo){
	
	if(document.getElementById('divInfo').style.visibility == 'hidden')visible('divInfo');
		
	document.getElementById('divInfo').style.top = Ymouse+5;
	document.getElementById('divInfo').style.left = Xmouse+5;
	
	if(document.getElementById(alvo).getAttribute('ampliar') == 'true'){
	
		document.getElementById('divInfo').innerHTML = document.getElementById(alvo).getAttribute('texto') + '<br>&nbsp;<br><strong>Clique o botão direito do mouse para ampliar.<strong>';
	}else{
	
		document.getElementById('divInfo').innerHTML = document.getElementById(alvo).getAttribute('texto');
	}
			
}




function selectIndex(alvo,valor){
	
	var objeto = document.getElementById(alvo);
	
	for(x=0; x < objeto.length; x++){
		
		if(objeto.options[x].value == valor){
			objeto.selectedIndex = x;
		}
	}
}

function visible(visibleAlvo,estado){
	
	
	if(estado == null || estado == 'undefined'){
	
		if(document.getElementById(visibleAlvo).style.visibility=='visible' || document.getElementById(visibleAlvo).style.visibility==''){
			estado = 'hidden';
		}else{
			estado = 'visible';
		}

	}
	
	document.getElementById(visibleAlvo).style.visibility = estado;

}

function position(positionAlvo,estado){

	if(estado == null || estado == 'undefined'){

		if(document.getElementById(positionAlvo).style.position=='static' || document.getElementById(positionAlvo).style.position==''){
			estado = 'absolute';
		}else{
			estado = 'static';
		}
	
	}

	document.getElementById(positionAlvo).style.position = estado;
}

function display(displayAlvo,estado){

	if(estado == null || estado == 'undefined'){

		if(document.getElementById(displayAlvo).style.display=='block' || document.getElementById(displayAlvo).style.display==''){
			estado = 'none';
		}else{
			estado = 'block';
		}
	
	}

	document.getElementById(displayAlvo).style.display = estado;
}



//Função para exibir o flash sem ativar o controle active-X
function filmeFlash(nome,caminho,largura,altura,transparente){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="'+nome+'" width="'+largura+'" height="'+altura+'" id="'+nome+'">');
	document.write('<param name="movie" value="'+caminho+'">');
	document.write('<param name="quality" value="high">');
	if(transparente==true)document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="'+caminho+'" width="'+largura+'" height="'+altura+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="'+nome+'"></embed>');
	document.write('</object>');
	
}

//Função para exibir data e Hora
function dataHora(nomeDiv){

	arrayDia = new Array("Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"); 
	arrayMes = new Array("janeiro","fevereiro","março","abril","maio","junho","julho", "agosto","setembro","outubro","novembro","dezembro"); 
	
	objData = new Date(); 
	ano = objData.getFullYear(); 
	mes = objData.getMonth(); 
	data = objData.getDate(); 
	dia = objData.getDay(); 
	hora = objData.getHours(); 
	minuto = objData.getMinutes(); 
	segundo = objData.getSeconds(); 

	if (hora < 10) { hora = "0" + hora; } 
	if (minuto < 10)  { minuto = "0" + minuto; } 
	if (segundo < 10)  { segundo = "0" + segundo; } 

	txt = arrayDia[dia]+", "+data+" de " +arrayMes[mes]+" de "+ano+" - "+hora+":"+minuto+":"+segundo;

	document.getElementById(nomeDiv).innerHTML = txt; 
	
	setTimeout("dataHora('"+nomeDiv+"')",1000); 
} 

//Função para exibir popup com informações do produto
function getProdutoDetalhe(pk_id_produto){

	popup('janela','detalhe_produto.asp?PK_ID_PRODUTO='+String(pk_id_produto),'450','300','top=30,left=30,noresize');

}

//Função para verificar os itens do formulário
function verificaForm(form){
	
	
	//Capturando o formulário
	var formulario = document.getElementById(form);
	
	//Verificando quantos elementos tem o formulário
	var numElementos = formulario.length;
	
	//Verificando seu elementos
	for (x=0; x < numElementos; x++){
		
		//Verificando se o campo é requerido
		if((formulario.elements[x].getAttribute('requerido') == "true") && (validaRequerido(formulario.elements[x])))return false;

		//Verificando existe tamanho máximo de caracteres			
		if((formulario.elements[x].getAttribute('maxCaracteres') != "") && validaMaxCaracteres(formulario.elements[x]))return false;

		//Verificando existe tamanho mínimo de caracteres			
		if((formulario.elements[x].getAttribute('minCaracteres') != "") && validaMinCaracteres(formulario.elements[x]))return false;

		//Verificando o tipo do campo caso seja dinheiro			
		if((formulario.elements[x].getAttribute('tipo') == "dinheiro") && validaTipoDinheiro(formulario.elements[x]))return false;

		//Verificando o tipo do campo caso seja numérico			
		if((formulario.elements[x].getAttribute('tipo') == "numero") && validaTipoNum(formulario.elements[x]))return false;

		//Verificando o tipo do campo caso seja letras			
		if((formulario.elements[x].getAttribute('tipo') == "letra") && validaTipoLetra(formulario.elements[x]))return false;

		//Verificando se o campo é uma url válida			
		if((formulario.elements[x].getAttribute('tipo') == "URL") && validaTipoURL(formulario.elements[x]))return false;

		//Verificando se o e-mail é válido			
		if((formulario.elements[x].getAttribute('tipo') == "email") && validaTipoEmail(formulario.elements[x]))return false;

		//Comparando os valores dos campos		
		if((formulario.elements[x].getAttribute('comparar') != null) && (validaComparar(formulario.elements[x])))return false;

	}

}

//Verificando se o campo é requerido
function validaRequerido(objeto){

	if(objeto.value == ""){
		objeto.focus();
		alert('Favor preencher este campo!');
		return true;
	}
	
}



//Verificando existe tamanho máximo de caracteres
function validaMaxCaracteres(objeto){

	if(objeto.value.length > parseInt(objeto.maxCaracteres)){
		objeto.focus();
		alert('Máximo de ' + objeto.maxCaracteres + ' caracteres permitidos!');
		return true;
	}
}

//Verificando existe tamanho mínimo de caracteres
function validaMinCaracteres(objeto){

	if(objeto.value.length < parseInt(objeto.minCaracteres) ){
		objeto.focus();
		alert('Mínimo de ' + objeto.minCaracteres + ' caracteres permitidos!');
		return true;
	}
}


//Verificando o tipo do campo caso seja numérico
function validaTipoNum(objeto){

	if( isNaN(objeto.value) ){
		objeto.focus();
		alert('Favor preencher este campo somente com números!');
		return true;
	}
}

//Verificando o tipo do campo caso seja dinheiro
function validaTipoDinheiro(objeto){
	
	if(validaTipoNum(objeto)){
		return true;
	}else{
		
	}

}

//Verificando o tipo do campo caso seja numérico
function validaTipoLetra(objeto){

	for(numCont=0; numCont <= 9; numCont++){
		
		if(objeto.value.indexOf(String(numCont)) != -1){
			objeto.focus();
			alert('Favor preencher este campo somente com letras!');
			return true;
		}
	}
}

//Verificando se o campo é uma url válida
function validaTipoURL(objeto){

	if(objeto.value != ""){

		//Convertendo os caracteres para minúsculo
		objString = new String(objeto.value);
		var valor = objString.toLowerCase();
		var erro = 0;
	
		if(valor.indexOf("http://")==-1){
			erro=1;
		}else if(objeto.value.indexOf(".")==-1){
			erro=2;
		}

		if( erro != 0 ){
			alert("Por favor, preencha este campo com uma URL válida!");
			objeto.focus();
			return true;
		}
	}
}

//Verificando se o e-mail é válido
function validaTipoEmail(objeto){

	if(objeto.value != ""){

		var erro = 0;
	
		if(objeto.value.indexOf("@")==-1){
			erro = 1;		
		}else if(objeto.value.indexOf(".")==-1){
			erro = 2;
		}else if( objeto.value.indexOf("@") != objeto.value.lastIndexOf("@") ){
			erro = 3;
		}

		if( erro != 0 ){
			alert("Por favor, preencha este campo com um E-mail válido!");
			objeto.focus();
			return true;
		}
	}
}


//Comparando dois valores
function validaComparar(objeto){
	
	//Declarando a variável para conter o resultado do teste
	var teste;
	//Declarando a variável para conter o operador e os alvos
	var arrayValor = new Array();
	
	//Caso não tenha operador, automaticamente será igualdade
	if(objeto.comparar.indexOf(',')==-1)objeto.comparar = '==,' + objeto.comparar
	
	//Separando o operador dos alvos da comparação
	arrayValor = objeto.comparar.split(',');
	var operador = arrayValor[0];
	
	//Definindo quais são os alvos da comparação
	var alvo1 = objeto.name;
	var alvo2 = arrayValor[1];
	
	//Verificando qual a operação solicitada e quias são os tipos de valores
	if(arrayValor[0].indexOf('==') != -1){
		
		teste = comparaIgual(alvo1,alvo2);
	}else if(objeto.value.indexOf(':') != -1){
		
		teste = comparaHora(alvo1,alvo2,operador);
	}else if(objeto.value.indexOf('/') != -1){
		
		teste = comparaData(alvo1,alvo2,operador);
	}else{
		
		teste = comparaNum(alvo1,alvo2,operador);
	}

	//Caso não tenha algum sinal de comparação
	if(!teste){
		objeto.focus();
		alert('Valor incorreto!');
		return true;
	}

}

//Função para comparar horas
function comparaHora(alvo1,alvo2,comparacao){
	
	//Recuperando os objetos alvo
	var objeto1 = document.getElementById(alvo1);
	var objeto2 = document.getElementById(alvo2);
	
	//Criando arrays para conter os valores
	var array1 = new Array();
	var array2 = new Array();
	
	var array1 = objeto1.value.split(':');
	var array2 = objeto2.value.split(':');	
	
	//Criando objetos para conter as horas
	var tempo1 = new Date();
	var tempo2 = new Date();
	
	tempo1.setHours(array1[0],array1[1],array1[2]);
	tempo2.setHours(array2[0],array2[1],array2[2]);
	
	return eval('tempo1 '+comparacao+' tempo2');
}

//Função para comparar datas
function comparaData(alvo1,alvo2,comparacao){
	
	//Recuperando os objetos alvo
	var objeto1 = document.getElementById(alvo1);
	var objeto2 = document.getElementById(alvo2);
	
	//Criando arrays para conter os valores
	var array1 = new Array();
	var array2 = new Array();
	
	var array1 = objeto1.value.split('/');
	var array2 = objeto2.value.split('/');	
	
	//Criando objetos para conter as datas
	var tempo1 = new Date();
	var tempo2 = new Date();
	
	tempo1.setHours(array1[2],array1[1],array1[0]);
	tempo2.setHours(array2[2],array2[1],array2[0]);
	
	return eval('tempo1 '+comparacao+' tempo2');
}

//função para comparar valores
function comparaNum(alvo1,alvo2,comparacao){

	//Recuperando os objetos alvo
	var objeto1 = document.getElementById(alvo1);
	var objeto2 = document.getElementById(alvo2);
	
	//Criando arrays para conter os números
	var valor1 = parseInt(objeto1.value);
	var valor2 = parseInt(objeto2.value);
	
	return eval('valor1 '+comparacao+' valor2');
}

//função para comparar valores
function comparaIgual(alvo1,alvo2){

	//Recuperando os objetos alvo
	var objeto1 = document.getElementById(alvo1);
	var objeto2 = document.getElementById(alvo2);
	
	//Criando arrays para conter os números
	var valor1 = objeto1.value;
	var valor2 = objeto2.value;
	
	return eval('valor1 == valor2');
}

function mascaraValor(ev,mascara){
	
	ev = ev || window.event
	
	var objeto = ev.target || ev.srcElement;
	
	valorReal = new String(objeto.value);
	valorFinal  = new String();
	valorPuro = new String(objeto.value);
	caractEspeciais = new String();
	
	if(valorReal.length > mascara.length){
		valorReal = valorReal.substring(0,mascara.length)
	}
	   
	//Verificando quais são os caracteres especiais
	for(x=1; x <= mascara.length; x++){
		if(mascara.charAt(x-1) != 'x')caractEspeciais += mascara.charAt(x-1);
	}
	
	//Retirando os caracteres especiais do valor real
	for(x=0; x <= valorReal.length; x++){
		
		if( (caractEspeciais.indexOf(valorReal.charAt(x-1)) != -1) ){
			valorReal = valorReal.substring(0,x-1) + valorReal.substring(x,valorReal.length);
		}
	}
	
	var cont = 0;
	

	//Substituindo os caracteres do valor real pelos da mascara	onde forem diferentes de x
	for(x=0; x < valorReal.length; x++){
		
		if(mascara.charAt(x + cont) == 'x'){
			valorFinal += valorReal.charAt(x);
		}else{	
			if(mascara.charAt(x + cont) != valorReal.charAt(x)){
				valorFinal += mascara.charAt(x + cont) + valorReal.charAt(x);
				cont = cont + 1;
			}else{
				valorFinal += valorReal.charAt(x);
			}
		}

	}
	
	//Retornando o valor formatado
	objeto.value = valorFinal;
}

function mascaraDinheiro(ev){
	
	ev = ev || window.event
	
	var objeto = ev.target || ev.srcElement;

	var valor = objeto.value;
	var virgula = false;
	
	//Retirando o ponto e a virgula do valor
	valor = valor.replace('.','');
	valor = valor.replace(',','');
	
	
	if( ev.keyCode != 110 && ev.keyCode != 188 && ev.keyCode != 190  && ev.keyCode != 194 ){
		objeto.setAttribute('valorSalvo',valor);
	}else{
		valor = objeto.getAttribute('valorSalvo');
	}

	//Recupernando o tamanho da string de valor
	var tamanho = valor.length;
	
	//Verificando se o valor possui somente números
	if(isNaN(valor)){
		alert('Favor preencher este campo somente com números');
		objeto.value = '';
		return false;
	}
	
	//inserindo a virgula antes dos dois últimos digitos
		
	if( tamanho >= 3 ) valor = valor.substring(0,tamanho-2) + ',' + valor.substring(tamanho-2,tamanho);
	
	//Redimencionand o o tamanho pára contar com a vírgula
	tamanho ++;
	
	//inserindo o ponto para o milhar
	if( tamanho > 6 ) valor = valor.substring(0,tamanho-6) + '.' + valor.substring(tamanho-6,tamanho);
	
	objeto.value = valor;

}

//Carrega o conteúdo de imóveis novos para dentro da respectiva DIV
function carregaImoveisNovos(){
	
	var divCamada = document.getElementById('divImoveisNovos');
	
	var pop = new popObj2('imoveis_novos.asp',divCamada);
	
	//Instanciiando o objeto que vai descarregar o conteúdo na DIV alvo
	setInterval(function(){var pop = new popObj2('imoveis_novos.asp',divCamada);},10*1000);
	
	
}

function popObj2(url,divAlvo) {

	try{
	
		var self = this;
		
		//Cria um novo objeto XML passando os valores. Esse obj e funções estao no arq. xml.js
		this.xml = new xmlObj( {
			url: url,
			obj: self, 
			func: 'show', 
			args: { divAlvo:divAlvo }
		} );

	}catch(e){
		erro(e);
	}	
}

popObj2.prototype.show = function(args) {

	try{
		var htm = args.responseText;
		var divAlvo = args.divAlvo;
		
		divAlvo.innerHTML = htm;
		
		divAlvo.style.visibility = 'visible';


	}catch(e){
		erro(e);
	}	
}



//Abre janela pop-up
function popup(nome,url,width,height,parametros){
	
	return window.open(url,nome,'width='+width+', height='+height+','+parametros);
	
}

			function popupFlash(nome,url,width,height,parametros){
			
				novaJanela = window.open(url,nome,'width='+width+', height='+height+','+parametros);
				
			}

function enviaPesquisaLateral(objForm){

	if(objForm.txtCD.value == ''){
	
		objForm.optPesquisa.value = '0';
		
	}else{

		objForm.optPesquisa.value = '1';
	
	}
	
	return true;
}

//Função que verifica se o objeto é do tipo Object
function isObject(objeto){
	if(typeof(objeto) == 'object')return true;
}

//Função que verifica se o objeto é do tipo Array
function isArray(objeto){
	if(isObject(objeto) && objeto.constructor == Array)return true;
}

function setValue(objeto,valor){
	
	if(!isObject(objeto))objeto = document.getElementById(objeto);
	
	
	objeto.value = valor;
		
}

//Define atributos dos filhos de um nó
function nodeChildAttribute(n,atributo,valor){

	if(n.tagName == 'INPUT'){

		n.setAttribute(atributo,valor);
		
	}

	var children = n.childNodes; 				
	
	for(var i=0; i < children.length; i++) {    
		nodeChildAttribute(children[i],atributo,valor);      
	}
	
}

