 
 function validaimoveisz(frm){
	todos=document.getElementsByTagName('input');
	for(x=0;x<todos.length;x++){
		//alert(todos.length);
    if(todos[x].type=='checkbox'){
		if(todos[x].checked==true){
			return true;
		}
			alert("Marca pelo menos um Imovel");
			return false;
		}
	}
	//alert("Marca pelo menos um Imovel");
	return false;
}


<!-- ***** funcao javascript ***** -->
function contaCheckbox(selecionados){
  var inputs, x, selecionados=0;
  inputs = document.getElementsByTagName('input');
  for(x=0;x<inputs.length;x++){
    if(inputs[x].type=='checkbox'){
      if(inputs[x].checked==true && inputs[x].id == 'check'){
        selecionados++;
      }
    }
  }
  return selecionados;
}

function validaimoveis(valor){
	//alert(valor);
  var total; 
  total = contaCheckbox();
 // alert("Quantidade retornada: " + total);
  if (total > 0){
	  if (total <= valor){
    	//alert("Quantidade retornada: " + total);
		return true
	  }else{
		 alert("Quantidade maior que o permitido "); 
		 return false
	}
  }else{
    alert("Selecione pelo menos um checkbox");
	return false
  } 
}

function TrazBairro(){
	var valor =document.getElementById('cidade').value;
	//alert('funcoes/montaCombo.asp?id='+valor);
	preencheConteudo('funcoes/montaCombo.asp?id='+valor);

}

function preencheConteudo(pagina){
	document.getElementById('conteudo').innerHTML = '<select class="select" id="bairro" name="bairro" style="font-size:11px; font-family:Verdana, Arial, Helvetica, sans-serif;width:170px;"><option value="">AGUARDE</option></select>';
	// Chama o arquivo ASP, passando os parametros pela URL
	xmlhttp.open("GET",pagina, true);
	xmlhttp.setRequestHeader("encoding", "ISO-8859-1"); 
	xmlhttp.send(null);
	intervalo = window.setInterval(fPreencheConteudo, 500);
}

function fPreencheConteudo(){
	if(xmlhttp.readyState == 4){
		var valorRetorno = xmlhttp.responseText;
		document.getElementById('conteudo').innerHTML = valorRetorno;
		clearInterval(intervalo);
	}
}


//Conceitos Ajax
try{
	xmlhttp = new XMLHttpRequest();
}catch(ee){
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}
}
//function preencheConteudo(pagina, arq)
//
function newTag(){       
        // Pegando a div que recebrá o Javascript
        var conteudo = document.getElementById('resposta');
        
        // Declarando a criação de uma nova tag <script>
        var newElement = document.createElement("script");
        
        // Pegando os valores das Tags <script> que estão na página carregada pelo AJAX
        var scripts = conteudo.getElementsByTagName("script");
                
        // Aki, vamos inserir o conteúdo da tag <script> que pegamos na linha acima     
                for(i = 0; i < scripts.length; i++){
                        newElement.text = scripts[i].innerHTML;
           }
           
           // Agora, inserimos a nova tag <script> dentro da div na página inicial
           conteudo.appendChild(newElement);
		   //alert('opa')
}

//alert('sdsd')

