

/*SCRITP PARA O IMOBSYS FUNCIONAR*/
function mudaCor(myTr,myCor){
	myTr.className=myCor;
}

function abreDet(url2){
	if (window.screen.height > "600"){
		rola2="no";
		width2="773";
		height2="587";
		posTop2=(window.screen.height - height2)/2;
		posLeft2=(window.screen.width - width2)/2;
	}
	else{
		rola2="yes";
		width2="792";
		height2="510";
		posTop2="0";
		posLeft2="0";
	}
	window.open(url2,"_blank","resizable=no,toolbar=no,status=yes,top=" + posTop2 + ",left=" + posLeft2 + ",menubar=no,scrollbars=" + rola2 + ",width=" + width2 + ",height=" + height2);
}
function submitBusca(obj,destino){
	objAux = obj.elements;
	parametros = "";
	//alert(obj);
	for(var i=0; i < objAux.length; i++) {
		if(obj[i].type=="select-one" || obj[i].type=="text" || obj[i].type=="hidden") {
			parametros += obj[i].name+"="+obj[i].value+"&";
		}
	}
	consultaAjaxText("internas/gedoor_list.php", parametros, "get", ""+destino+"", "Carregando Aguarde...");
}
function Limpa_Campo(campo){
	if(campo.value=="Pesquisa Rápida"){
		campo.value="";
	}
}
function abreDentro(url){
	if (window.screen.height > 600){
		rola="no";
		width="660";
		height="356";
		posTop=(window.screen.height - height)/2;
		posLeft=(window.screen.width - width)/2;
	}
	else{
		rola="yes";
		width="792";
		height="510";
		posTop="0";
		posLeft="0";
	}
	window.open(url,"_blank","resizable=no,toolbar=NO,status=yes,top=" + posTop + ",left=" + posLeft + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
}

function abreUrlNew(url, width, height, scrools){
	win=window.open(url,"","width="+width+",height="+height+",top=100, left=200, scrollbars="+scrools+", resizable=YES, status=no");
	return win;
}

function abreUrlHidden(url, width, height,scrools){
	win=window.open(url,"","width="+width+",height="+height+",top=200, left=200, scrollbars="+scrools+", resizable=NO");
	return win;
}

/*fim SCRIPT PARA O IMOBSYS FUNCIONAR*/




function Abre(url, width, height, rola)	{
	if (rola==""){rola="yes"}
	window.open(url,"_blank","resizable=no,toolbar=no,status=no,top=" + (window.screen.height - height)/2 + ",left=" + (window.screen.width - width)/2 + ",menubar=no,scrollbars=" + rola + ",width=" + width + ",height=" + height);
}

/*função para abrir o flash sem dar erro*/
function montaFlash(destino, flavez, width, height, trans, scale){
	var myFlash =
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+flavez+'" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="'+flavez+'.swf" />' +
	'<param name="menu" value="false" />'
	;
	if (trans == "yes"){
		myFlash += '<param name="wmode" value="transparent" />';
	}
	if (scale == "yes"){
		myFlash += '<param name="scale" value="noscale" />';
	}
	myFlash +=
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value="#ffffff" />'+
	'<embed src="'+flavez+'.swf" quality="high" width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />'+
	'</object>'
	;
	document.getElementById(destino).innerHTML = myFlash;
}

/* valida o e-mail */
function validaEmail(email){
	ER = new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]{2,64}(\.[a-z0-9-]{2,64})*\.[a-z]{2,4}$");
	if (ER.test(email)){
		return true;
	}
	else{
		return false;
	}
}

/* oculta a div conteudo qndo clicar em principal */
function ocultaConteudo(){
	document.getElementById("conteudo").style.display = "none";
}

/* função que gera mascara para input */
function mascara(src, mask) {
	var i = src.value.length;
	var saida = mask.substring(0,1);

	var texto = mask.substring(i)

	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

/* @author fernando & wesley */
var controlerImagem;
var i = 0;
function percorre(img){
	mudarImagem(i);
	if(arrayFotos.length-2==i){
		i=0;
	}else{
		++i;
	}
	controlerImagem=setTimeout("percorre()",25000);
}
function mudarImagem(i){
	var obj = document.getElementById('foto');
	if(obj){
		obj.src=arrayFotos[i];
	}
}
function mapinha(){
	if(controlerImagem){
		clearTimeout(controlerImagem);
	}

	Mapinhas.setImovel(imoveis);
	Mapinhas.setImobiliaria(clientes);
	Mapinhas.setImoveis(codimovel);
	Mapinhas.setCidade(cidades);
	Mapinhas.setUf(uf);
	Mapinhas.setQuartos(quarto);
	Mapinhas.setSuites(suite);
	Mapinhas.setGaragem(garagem);
	Mapinhas.setBairros(setor);
	Mapinhas.setComercializacao(comercializacao);

	Mapinhas.setValor(valores);
	Mapinhas.setSite(urls);
	setTimeout("Mapinhas.CriarMapa('')",0);
}


function mudaImagem(imagem, div){
	immggg = document.getElementById(div);
	immggg.style.display = 'block'
	immggg.src = imagem;
}

var xmlhttp
function loadXMLDoc(url, idWrite, tRequest)
{
	if(tRequest!="GET" || tRequest!="POST")
	tRequest = "GET";
	element	=  document.getElementById(idWrite);
	element.innerHTML  = "<div style=\"width:100%; padding-top:70px; text-align:center;\"><div style=\"width:150px;\"><div style=\"float:left; padding-top:5px;\">Carregando Aguarde...</div><div style=\"float:left;\"><img src=\"img/clocks.gif\" style=\"margin-left:10px;\" align=\"center\"></div></div</div>";
	// código para Firefox, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState==4)
			{
				// if OK
				if (xmlhttp.status==200)
				{
					element.innerHTML=xmlhttp.responseText
				}
				else
				{
					alert("Problem Ao Tentar Abrir Arquivo:" + xmlhttp.statusText+" "+url )
				}
			}
		}
		xmlhttp.open(tRequest,url,true)
		xmlhttp.send(null)
	}
	// código para IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=function(){
				if (xmlhttp.readyState==4)
				{
					// if OK
					if (xmlhttp.status==200)
					{
						element.innerHTML=xmlhttp.responseText
					}
					else
					{
						alert("Problem Ao Tentar Abrir Arquivo:" + xmlhttp.statusText+" "+url)
					}
				}
			}
			xmlhttp.open(tRequest,url,true)
			if(tRequest=="POST")
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlhttp.send()
		}
	}
}


/****
Curriculo
*/
function redimenIfra() {				
	var iframe = document.getElementById('iframeFrmFcc');	
	
	alert(iframe);
}


/* Mostrar e ocultar div */
function mostraEsconde(div){
	var status = document.getElementById(div).style.display;
	if(status=="none"){
		document.getElementById(div).style.display = "block";
	}else if((status=="block") || (status=="")){
		document.getElementById(div).style.display = "none";
	}
}

/* Abre e fecha div dos clientes */
function MostraClientes(div){
		document.getElementById(div).style.display = '';
}
function SomeClientes(div){
		document.getElementById(div).style.display = 'none';
}

