// JavaScript Document

function abrirPodcast(Cod_PodCast){
	
	location = "detalhe_podcast.php?Cod_PodCast="+Cod_PodCast;
}

function getEmpreendimentoNome(valor){
	
	if(valor > -1 ){		
		location = "detalhe-imovel-novo.php?id="+valor;		
	}
}

function buscaImovel(){
	
	//Armazena os campos do formulario de busca
	cidade = document.getElementById("busca_cidade").value;
	bairro = document.getElementById("busca_empreendimento_bairro").value;
	tipoImovel = document.getElementById("busca_empreendimento_tipo").value;
	estagio = document.getElementById("busca_estagio_obra").value;
	
	//Redireciona para a página da busca
	location = "frm_busca_imovel.php?cidade="+cidade+"&bairro="+bairro+"&tipoImovel="+tipoImovel+"&estagio="+estagio;	
}
/*function abrirCorretorOnLine(){	
	window.open("http://online.chatlive.com.br/morar/request.php?l=morar&x=1&deptid=1&page=http://www.morar.com.br/","","width=450,height=350");
}
*/
//testando função java
function abrirCorretorOnLine(){	
	openWindow('http://online.chatlive.com.br/morar/pedido.php?login=morar&yid=1&deptid=1', 'remote');
	}
function openWindow(url, name)
{ var winWidth = 488;
  var winHeight = 450;
  var winTop = parseInt((screen.availHeight - winHeight) / 2);
  var winLeft = parseInt((screen.availWidth - winWidth) / 2);
     
  popupWin = window.open(url,name,"width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft + ",resizable=no,scrollbars=no,statusbar=no");
  if (popupWin.opener == null) popupWin.opener = self;
}

function todosPodcasts(){

	location = "lista_podcast.php";
}

function format(value,format)
{
	value = value.replace(/\D/g,"");
	var result="";
	
	if(format.length < value.length)
		return value;
	
	for(i=0,j=0;(i<format.length)&&(j<value.length);i++)
	{
		var ch = format.charAt(i) ;
		if(ch == '#')
		{
			result += value.charAt(j++);
			continue;
		}
		result += ch;
	}
	return result;
}