function swapImage(idImage, nomeImage) {

	myImg = document.getElementById(idImage)

	myImg.src = "img/menu/"+nomeImage+".gif";

}

function adiciona_bookmark(){

	if (document.all){

		window.external.AddFavorite('http://www.imoveisgoias.com.br','Portal Imóveis Goiás');	

	}

} 
function alterarTitulo(texto){
	document.getElementById('titulos').innerHTML=texto;
}




function cresce(){

	myLay = document.getElementById("conteudo")

	myLay2 = document.getElementById("divMenu")

	if (myLay.offsetHeight > myLay2.offsetHeight){

		myLay2.style.height = (myLay.offsetHeight);

	}

	else{

		myLay.style.height = (myLay2.offsetHeight);

	}

}

function mudaLink(lnk){

	window.location.href=lnk

}



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);

	}



function rodaFloat(){	

	myFloat = document.getElementById("floatDetran")

	//myBack = document.getElementById("backDivs")

	if ((navigator.userAgent.indexOf("MSIE")==-1) || navigator.appVersion.substring(0,1) < 4){	

		posLeft = (window.outerWidth - 650)/2;	

	}

	else{

		posLeft = (window.screen.width - 650)/2;		

	}	

	myFloat.style.left = posLeft+"px";

}



function fechaDente(id, est){

	myFloat = document.getElementById("floatDetran")

	myFloat.style.display = "none";	

}



function dropBusca(){

	myLayBusca = document.getElementById("layBusca")

	if (myLayBusca.style.display=="none")

	{

		myLayBusca.style.display = "block";

	}

	else{

		myLayBusca.style.display = "none";	

	}

}





function showHideLay(idlay, estlay){

	myLay = document.getElementById(idlay)

	myBackFloat2 = document.getElementById("layTraz1");

	myLay.style.display = estlay;

	if (myBackFloat2.style.display=="block" && estlay=="none"){

		myBackFloat2.style.display = "none";

	}

}



function srcImg(idImg, camImg){

	var myImg = document.getElementById(idImg)

	myImg.src = camImg;

}

//mostra a data e hora

function infData()

	{

	mydate = new Date();

	myday = mydate.getDay();

	mymonth = mydate.getMonth();

	myweekday= mydate.getDate();

	weekday= myweekday;

	myyear= mydate.getYear();

	year = myyear;

	myHour = mydate.getHours();

	hora = myHour	

	myMinutes = mydate.getMinutes();

	minutos = myMinutes

	mySeconds = mydate.getSeconds();

	segundos = mySeconds



	if(myday == 0){day = " Domingo, "} 

	else if(myday == 1){day = " Segunda-Feira, "}

	else if(myday == 2){day = " Terça-Feira, "} 

	else if(myday == 3){day = " Quarta-Feira, "} 

	else if(myday == 4){day = " Quinta-Feira, "}

	else if(myday == 5){day = " Sexta-Feira, "}

	else if(myday == 6){day = " Sábado, "}



	if(mymonth == 0){month = "Janeiro "}

	else if(mymonth ==1){month = "Fevereiro "}

	else if(mymonth ==2){month = "Março "}

	else if(mymonth ==3){month = "Abril "}

	else if(mymonth ==4){month = "Maio "}

	else if(mymonth ==5){month = "Junho "}

	else if(mymonth ==6){month = "Julho "}

	else if(mymonth ==7){month = "Agosto "}

	else if(mymonth ==8){month = "Setembro "}

	else if(mymonth ==9){month = "Outubro "}

	else if(mymonth ==10){month = "Novembro "}

	else if(mymonth ==11){month = "Dezembro "}





	

	document.write(""+ day);

		if ((navigator.userAgent.indexOf("MSIE")==-1) || navigator.appVersion.substring(0,1) < 4) 

			{

			document.write(myweekday+" de "+month+ " de 2005"+minutes);

			}

		else 

			{

			document.write(myweekday+" de "+month+ " de " + "<img src=\"img/relogio.gif\" hspace=\"3\" align=\"absMiddle\">"+hora+":"+ minutos+":"+ segundos);

			}

	

	}

	function mudaImagem(imagem, div){

		immggg = document.getElementById(div);

		immggg.style.display = 'block'

		immggg.src = imagem;

		

	}

	function confirmar(){

		var submit

		submit=confirm("Você Confirma a Ação Selecionada?");



		if (submit==false){

		return false;

		}



		else{

		 return true;

		 }

	}



	var xmlhttp

	function loadXMLDoc(url, idWrite, tRequest)

	{

		if(tRequest!="GET" || tRequest!="POST")

			tRequest = "GET";

		element	=  document.getElementById(idWrite);

		element.innerHTML  = "<div style='color:#FF0000;' align='center'>Carregando...</div>";   

	// code for Mozilla, 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)

				}

		  }

	  }

	  xmlhttp.open(tRequest,url,true)

	  xmlhttp.send(null)

	  }

	// code for 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)

				}

		  }

	  }

		xmlhttp.open(tRequest,url,true)

		if(tRequest=="POST")

			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		xmlhttp.send()

		}

	  }

	}

function fielsNoEmpty(ids, respostas){

	//var fiels = new Array()

	//var fieldsArr	= campos.split(";");

	var idsArr		= ids.split(";");

	var asksArr		= respostas.split(";");		

	for(i=0; i<idsArr.length; i++){

		if(idsArr[i]!=""){

			if(document.getElementById(idsArr[i]).value==""){

				alert(asksArr[i]);

				document.getElementById(idsArr[i]).focus();

				return false;

			}

		}			

	}

}



function onlyNumbers(){

	if (event.keyCode < 45 || event.keyCode > 57) 

			event.returnValue = false;

	if(event.keyCode==32)

		event.returnValue = true;

}

function mailInvalido(emailInvalido){

	emailInvalido = document.getElementById(emailInvalido);

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailInvalido.value))) 

    { 

		alert("E-mail Inválido");

		emailInvalido.focus();

		return false;

	} 

}

function montaFlash1(destino, flavez, width, height, trans, scale, salign,parametros){

	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?'+parametros+'" />'

	;

	if (trans == "yes"){

		myFlash += '<param name="wmode" value="transparent" />';

		transNet = 'wmode="transparent"';

	}

	if (scale == "yes"){

		myFlash += '<param name="scale" value="noscale" />';

		scaleNet = 'scale="noscale"';

	}

	if (salign != '' || salign != undefined){

		myFlash += '<param name="salign" value="'+salign+'" />';

		salignNet = 'salign="'+salign+'"';

	}



	myFlash +=

		'<param name="quality" value="high" />'+

		'<param name="bgcolor" value="#ffffff" />'+

		'<embed src="'+flavez+'.swf?'+parametros+'" '+salignNet+' quality="high" '+transNet+' bgcolor="#ffffff" '+scaleNet+' width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+

		'</object>'

	;

	document.getElementById(destino).innerHTML = myFlash;

}

function montaFlash(destino, flavez, width, height, trans, scale, salign){

	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" />'

	;

	if (trans == "yes"){

		myFlash += '<param name="wmode" value="transparent" />';

		transNet = 'wmode="transparent"';

	}

	if (scale == "yes"){

		myFlash += '<param name="scale" value="noscale" />';

		scaleNet = 'scale="noscale"';

	}

	if (salign != '' || salign != undefined){

		myFlash += '<param name="salign" value="'+salign+'" />';

		salignNet = 'salign="'+salign+'"';

	}



	myFlash +=

		'<param name="quality" value="high" />'+

		'<param name="bgcolor" value="#ffffff" />'+

		'<embed src="'+flavez+'.swf" '+salignNet+' quality="high" '+transNet+' bgcolor="#ffffff" '+scaleNet+' width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+

		'</object>'

	;

	document.getElementById(destino).innerHTML = myFlash;

}

function abreJanela(url){
	if (window.screen.height > 600){
		rola="no";
		width="1024";
		height="768";
		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 scripts_flash(pagina,parametros){
	window.dados.location= pagina+"?"+parametros;
}
