function move_i(what) { 
	what.style.background='#9d0414'; 
}
function move_o(what) { 
	what.style.background='#dddddd'; 
}


function dasabilitarenter() {
var tecla = event.keyCode;
if ((tecla == 13)) { 
return false;
}
return tecla;
}
function reloadpagini(){

	if (document.buscainicio.tp_consulta.value == "venda"){ 
		window.location="index.asp?tp_consulta=venda";
	}
	else if(document.buscainicio.tp_consulta.value == "locacao"){
		window.location="index.asp?tp_consulta=locacao";
	}
	else{
		window.location="index.asp";
	}
}




var now = new Date();
var mName = now.getMonth() + 1;
var dName = now.getDay() + 1;
var dayNr = now.getDate();
var yearNr=now.getYear();
if(dName==1) Day = "domingo";
if(dName==2) Day = "segunda-feira ";
if(dName==3) Day = "ter&ccedil;a-feira";
if(dName==4) Day = "quarta-feira";
if(dName==5) Day = "quinta-feira";
if(dName==6) Day = "sexta-feira";
if(dName==7) Day = "s&aacute;bado";
if(yearNr < 2000) Year = 1900 + yearNr;
else Year = yearNr;
// String to display current date.
var todaysDate =(" " + Day + ", " +  dayNr + "/" + " " +  mName + "/" + " " + Year);


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function Action(bairro){
	document.busca_result.action = "index2.asp?opc=busca_result&bairro=" + bairro;
	document.busca_result.submit();
	}
	function Action2(dorms){
	document.busca_result.action = "index2.asp?opc=busca_result&dorms=" + dorms;
	document.busca_result.submit();
	}	
	function Action3(metragem){
	document.busca_result.action = "index2.asp?opc=busca_result&metragem=" + metragem;
	document.busca_result.submit();	
	}
	function Action4(valor){
	document.busca_result.action = "index2.asp?opc=busca_result&valor=" + valor;
	document.busca_result.submit();	
	}
	
function reloadpagAv()
{
if (document.busca.tp_consulta.value == "venda"){ 
		window.location="index2.asp?opc=busca_avancada&tp_consulta=venda";
	}
	else if(document.busca.tp_consulta.value == "locacao"){
		window.location="index2.asp?opc=busca_avancada&tp_consulta=locacao";
	}
	else{ 	
		window.location="index2.asp?opc=busca_avancada";
	}
}	



function mudacor(ref,cor)
{
  document.getElementById(ref).style.backgroundColor=cor;
}

function voltaCor(ref,cor)
{
  ref.style.backgroundColor=cor;
}

function verifica ()
{
if (document.fale_conosco.nome.value=="")
  {
  alert("Favor preencher o campo NOME"); 
	document.getElementById("nome").focus();
	mudacor('nome','#cccccc');
  return false
  }
if (document.fale_conosco.telefone.value=="")
  {
  alert("Favor preencher o campo TELEFONE");
	document.getElementById("telefone").focus();
	mudacor('telefone','#cccccc');	
  return false
  }  
if (document.fale_conosco.email.value=="")
  {
  alert("Favor preencher o campo EMAIL"); 
	document.getElementById("email").focus();
	mudacor('email','#cccccc');	
  return false
  }
if (document.fale_conosco.mensagem.value=="")
  {
  alert("Favor preencher o campo MENSAGEM");
	document.getElementById("mensagem").focus();
	mudacor('mensagem','#cccccc');	
  return false
  }  
else
  {
  return true
  }
}


function busca_referencia(){

	if (document.buscareferencia.codigo.value=="")
  {
  alert("Favor preencher o campo"); 
	document.getElementById("codigo").focus();
	mudacor('codigo','#cccccc');
  return false
  }
}

function popup(N) {

			newWindow = window.open(N, '','toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,location=yes');

		}



		function cadastraSenha(form)

		{	

			var c

			c = form.identificador.value;

			if (c == "")

			{

				alert("Por favor, primeiramente informe seu identificador.");

				form.identificador.focus();

				return;

			}

			else

			{

				popup('http://comunidades21.com.br/clientes/default.asp?codadm=&dir=&direto=yes&URLDestino=http://comunidades21.com.br/login_site/cadastro_senha.asp?n=9429|c='+c)

			}

		}

		function limpaCampos()

		{

			setTimeout("document.login.identificador.value='';", 1000)

		}
function ValidaLogin(form){

	if(form.identificador.value==""){

		alert("Digite o identificador.");

		form.identificador.focus();

		return false;

	}



	return true;

}



