/* <MOUSE HOVER DO MENU HORIZONTAL> */
function ocultaFaixaLancamento()
{
	var objLancamento = document.getElementById ('tblLancamento');
	objLancamento.style.display = 'none';
	
	var dataAtual = '10/12/2007';
	var arrDiaAtual = dataAtual.split('/');
	var dia = arrDiaAtual[0];
	var mes = arrDiaAtual[1];
	var ano = arrDiaAtual[2];
	
	var data = new Date();
	var diaAtual = data.getDate();
	var mesAtual = data.getMonth() + 1;
	var anoAtual = data.getFullYear();

	if (diaAtual < dia && mesAtual == mes && ano == anoAtual)
	{
		objLancamento.style.display = 'block';
	}
}

function write_dhtml (movie, width, height, top, left, marginTop, marginLeft, zIndex, display)
{
	document.write('<DIV ID="DHTMLHOME" STYLE="position:absolute; top:' + top + 'px; left:' + left + 'px; margin-top:' + marginTop + 'px; margin-left:' + marginLeft + 'px; z-index:' + zIndex + '; display:' + display + ';">');
	document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="' + width + '" HEIGHT="' + height + '" VIEWASTEXT>');
	document.write('<PARAM NAME="movie" VALUE="/Web/util/swf/dhtml/' + movie + '">');
	document.write('<PARAM NAME="quality" VALUE="high">');
	document.write('<PARAM NAME="wmode" VALUE="transparent">');
	document.write('<EMBED SRC="/Web/util/swf/dhtml/' + movie + '" WMODE="transparent" QUALITY=HIGH PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" TYPE="application/x-shockwave-flash" WIDTH="' + width + '" HEIGHT="' + height + '">');
	document.write('</EMBED>');
	document.write('</OBJECT>');
	document.write('</DIV>');	
}

function aplicaFlash(swf, width, height, wmode, cache) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}

function aplicaFlash2(swf, width, height, wmode, cache) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}

function init() {
  handleMouseOver('img');
  handleMouseOver('input');
}

function handleMouseOver(tagType)
{
	if (!document.getElementById) return
		var imgOriginSrc;
		var imgTemp = new Array();
		var imgarr = document.getElementsByTagName(tagType);
		for (var i = 0; i < imgarr.length; i++) {
		if (imgarr[i].getAttribute('hsrc')) {
			imgTemp[i] = new Image();
			imgTemp[i].src = imgarr[i].getAttribute('hsrc');
			imgarr[i].onmouseover = function() {
				imgOriginSrc = this.getAttribute('src');
				this.setAttribute('src',this.getAttribute('hsrc'))
			}
			imgarr[i].onmouseout = function() {
				this.setAttribute('src',imgOriginSrc)
			}
		}
	}
}
onload=init;
/* </MOUSE HOVER DO MENU HORIZONTAL> */

/* <MOUSE HOVER DO MENU HORIZONTAL CORRETO> */
function menuNewOver(objMenu,objImagem){
//	alert(objMenu + ' - ' + objImagem);
	document.getElementById(objMenu).src = objImagem;
}
/* </MOUSE HOVER DO MENU HORIZONTAL CORRETO> */

/* <FUNÇÃO PARA ABRIR AS POPS QUE SÃO GERADAS AUTOMÁTICAMENTE> */
function abrepopficha(x)
{
	eval("window.open('"+ x +"','pop','left=1,top=1,width=450,height=320,scrollbars=1,resizable=0,resizable=0,status=0');");
}

/* </FUNÇÃO PARA ABRIR AS POPS QUE SÃO GERADAS AUTOMÁTICAMENTE> */

/* <FUNÇÃO PARA ABRIR A POP DE VISITA VIRTUAL DAS FICHAS> */
function popup(URL) {
	var width = 450;
	var height = 510;
	var left = 1;
	var top = 1;
	window.open(URL,'popup', 'width='+width+', height='+height+', top='+top+', left='+left+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, fullscreen=no');
}
/* </FUNÇÃO PARA ABRIR A POP DE VISITA VIRTUAL DAS FICHAS> */

/* <FUNÇÃO PARA ABRIR A POP DE FICHA DE INSCRIÇÃO> */
function fichaDeInscricao(){

window.open('http://zeus.e-hunter.com.br/cyrela/html/candidato.html', 'Cyrela', 'toolbar=no, location=no, directories=no, status=no,scrollbars=yes, resizable=no, menubar=no, width=760, height=450, left=2, top=10');
}
/* </FUNÇÃO PARA ABRIR A POP DE FICHA DE INSCRIÇÃO> */

/* <PRELOAD DO MENU> */
var preloads = [
		'/Web/Util/img/bt_sp_on.jpg',
		'/Web/Util/img/bt_sp_off.jpg',
		'/Web/Util/img/bt_rj_on.jpg',
		'/Web/Util/img/bt_rj_off.jpg',
		'/Web/Util/img/menu/rj/bt_produtos_on.jpg',
		'/Web/Util/img/menu/rj/bt_produtos_off.jpg',
		'/Web/Util/img/menu/rj/bt_moradores_on.jpg',
		'/Web/Util/img/menu/rj/bt_moradores_off.jpg',
		'/Web/Util/img/menu/rj/bt_cadastro_on.jpg',
		'/Web/Util/img/menu/rj/bt_cadastro_off.jpg',
		'/Web/Util/img/menu/rj/bt_imobiliarias_on.jpg',
		'/Web/Util/img/menu/rj/bt_imobiliarias_off.jpg',
		'/Web/Util/img/menu/rj/bt_relacoes_on.jpg',
		'/Web/Util/img/menu/rj/bt_relacoes_off.jpg',
		'/Web/Util/img/menu/bt_relacionamento_on.jpg',
		'/Web/Util/img/menu/bt_relacionamento_off.jpg',
		'/Web/Util/img/menu/bt_produtos_on.jpg',
		'/Web/Util/img/menu/bt_produtos_off.jpg',
		'/Web/Util/img/menu/bt_moradores_on.jpg',
		'/Web/Util/img/menu/bt_moradores_off.jpg',
		'/Web/Util/img/menu/bt_cadastro_on.jpg',
		'/Web/Util/img/menu/bt_cadastro_off.jpg',
		'/Web/Util/img/menu/bt_imobiliarias_on.jpg',
		'/Web/Util/img/menu/bt_imobiliarias_off.jpg',
		'/Web/Util/img/menu/bt_relacoes_on.jpg',
		'/Web/Util/img/menu/bt_relacoes_off.jpg',
		'/Web/Util/img/menu/bt_lajes_on.jpg',
		'/Web/Util/img/menu/bt_lajes_off.jpg'
	];
	preloadimg = function (){
		if(document.images){
			for(nP=0; nP < preloads.length; nP++){
				eval('image' + nP + ' = new Image();');
				eval("image" + nP + ".src = '" + preloads[nP] + "';");
			};
		}
		delete preloads;
	};
	preloadimg();
/* </PRELOAD DO MENU> */



/*OVER ESCOLHA*/
sp_ON = new Image(); sp_ON.src="/Web/shared/img/home/bot_sp_on.gif";
sp_OFF = new Image(); sp_OFF.src="/Web/shared/img/home/bot_sp.gif";
rj_ON = new Image(); rj_ON.src="/Web/shared/img/home/bot_rj_on.gif";
rj_OFF = new Image(); rj_OFF.src="/Web/shared/img/home/bot_rj.gif";

/*OVER DETALHES IMÓVEL*/
atendimento_ON = new Image(); atendimento_ON.src="/Web/shared/img/busca/bt_atendimento_on.gif";
atendimento_OFF = new Image(); atendimento_OFF.src="/Web/shared/img/busca/bt_atendimento.gif";
estagio_ON = new Image(); estagio_ON.src="/Web/shared/img/busca/bt_estagio_on.gif";
estagio_OFF = new Image(); estagio_OFF.src="/Web/shared/img/busca/bt_estagio.gif";
condicoes_ON = new Image(); condicoes_ON.src="/Web/shared/img/busca/bt_condicoes_on.gif";
condicoes_OFF = new Image(); condicoes_OFF.src="/Web/shared/img/busca/bt_condicoes.gif";
visita_ON = new Image(); visita_ON.src="/Web/shared/img/busca/bt_visita_on.gif";
visita_OFF = new Image(); visita_OFF.src="/Web/shared/img/busca/bt_visita.gif";
mapa_ON = new Image(); mapa_ON.src="/Web/shared/img/busca/bt_mapa_on.gif";
mapa_OFF = new Image(); mapa_OFF.src="/Web/shared/img/busca/bt_mapa.gif";
memorial_ON = new Image(); memorial_ON.src="/Web/shared/img/busca/bt_memorial_on.gif";
memorial_OFF = new Image(); memorial_OFF.src="/Web/shared/img/busca/bt_memorial.gif";

/*OVER HOTSITES*/
um_on = new Image(); um_on.src="/Web/shared/img/hotsites/ico_corretoronline_on.gif";
um_off = new Image(); um_off.src="/Web/shared/img/hotsites/ico_corretoronline.gif";
dois_on = new Image(); dois_on.src="/Web/shared/img/hotsites/ico_visitavirtual_on.gif";
dois_off = new Image(); dois_off.src="/Web/shared/img/hotsites/ico_visitavirtual.gif";
tres_on = new Image(); tres_on.src="/Web/shared/img/hotsites/ico_comochegar_on.gif";
tres_off = new Image(); tres_off.src="/Web/shared/img/hotsites/ico_comochegar.gif";
quatro_on = new Image(); quatro_on.src="/Web/shared/img/hotsites/ico_condicoespagto_on.gif";
quatro_off = new Image(); quatro_off.src="/Web/shared/img/hotsites/ico_condicoespagto.gif";
cinco_on = new Image(); cinco_on.src="/Web/shared/img/hotsites/ico_estagioobra_on.gif";
cinco_off = new Image(); cinco_off.src="/Web/shared/img/hotsites/ico_estagioobra.gif";
seis_on = new Image(); seis_on.src="/Web/shared/img/hotsites/ico_maisinfo_on.gif";
seis_off = new Image(); seis_off.src="/Web/shared/img/hotsites/ico_maisinfo.gif";


function TV1(x,y){
	document.images[x].src = eval(y).src;
}

/*DIVS*/
function MostraDiv(x){
	document.getElementById(x).style.visibility="visible";
}

function EscondeDiv(x){
	document.getElementById(x).style.visibility="hidden";
}

/*RESOLUCAO*/
function checkBrowser(){
	T=this;
	b=navigator.appName;
	v=navigator.appVersion;
	u=navigator.userAgent;
	if(b=='Netscape')T.b='ns'
	else if(b=='Microsoft Internet Explorer')T.b='ie'
	else T.b=b
	T.v=parseInt(v);
	T.ns=(T.b=='ns'&&T.v>=4);
	T.ns4=(T.b=='ns'&&T.v==4);
	T.ns5=(T.b=='ns'&&T.v==5);
	T.ns6=(T.b=='ns'&&T.v==5);
	T.ie=(T.b=='ie'&&T.v>=4);
	T.ie4=(u.indexOf('MSIE 4')>0);
	T.ie5=(u.indexOf('MSIE 5.0')>0);
	T.ie55=(u.indexOf('MSIE 5.5')>0);
	T.ie6=(u.indexOf('MSIE 6.0')>0);
	if(T.ie5)T.v=5;
	if(T.ie55)T.v=5.5;
	if(T.ie6)T.v=6;
	T.min=(T.ns||T.ie);
	T.dom=(T.v>=5);
	T.win=(u.indexOf('Win')>0);
	T.mac=(u.indexOf('Mac')>0);
}
is=new checkBrowser();

var d=document;
var w=(is.ie?(screen.width):(window.innerWidth));

/*SKY*/

var swf="/Web/shared/Swf/banner_corretor.swf";

/* ======================== */
/* Chat´s Rio / Niterói */
/* ======================== */

function openChat_Rio(p_IdArea, p_Origem)
{	
	//alert('/Web/Util/Pops/PopRio.aspx?IDArea=' + p_IdArea + '&origem=' + p_Origem);
	window.open('/Web/Util/Pops/PopRio.aspx?IDArea=' + p_IdArea + '&origem=' + p_Origem,'remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
}

function openChatRio(p_IdArea, p_Sel, p_Destino)
{
	//alert('IDArea ' + p_IdArea);
	//alert('Sel ' + p_Sel);
	//alert('Destino ' + p_Destino);
	window.location = '/Web/Util/html/pop_chat.aspx?IDArea=' + p_IdArea + '&sel=' + p_Sel + '&destino=' + p_Destino;
}

function openChatRio_Header(p_Destino)
{
	//alert(p_Destino);
	//alert('/Web/Util/html/pop_chat.aspx?IDArea=16&sel=FlashHeader&destino=' + p_Destino);
	window.location = '/Web/Util/html/pop_chat.aspx?IDArea=16&sel=FlashHeader&destino=' + p_Destino;
}

function openChatRio_Sky(p_Destino)
{
	//alert(p_Destino);
	//alert('/Web/Util/html/pop_chat.aspx?IDArea=17&sel=Skyscraper&destino=' + p_Destino);	
	window.location = '/Web/Util/html/pop_chat.aspx?IDArea=17&sel=Skyscraper&destino=' + p_Destino;
}

/* ======================== */

/*OVER MENU DIREITA*/



function MenuOver(eItemMenu){
	eItemMenu.DefaultClass = eItemMenu.className;
	eItemMenu.className = "bg_azulM branco";
	eItemMenu.style.cursor = "hand";
}

function MenuOut(eItemMenu){
	eItemMenu.className = eItemMenu.DefaultClass;
}

function openChat_sky(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=17&sel=Skyscraper','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=17&sel=Skyscraper','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
	//window.open('/pop_chat.asp?IDArea=17&sel=Skyscraper','remote','width=320,height=450,top=0,resizable=no,scrollbars=no');
}

function openChat_sky_Place(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=17&sel=Skyscraper_Place_Royale','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=17&sel=Skyscraper','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
	//window.open('/pop_chat.asp?IDArea=17&sel=Skyscraper','remote','width=320,height=450,top=0,resizable=no,scrollbars=no');
}

function openChat(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=16&sel=FlashHeader','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
	//window.open('/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=320,height=450,top=0,resizable=no,scrollbars=no');
}

function openChatApaixonar(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=145&sel=PagApaixonados','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
	//window.open('/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=320,height=450,top=0,resizable=no,scrollbars=no');
}

function openFichaFale(){
	window.open('/Web/Util/html/fale.asp','pop2','left=18,top=18,width=580,height=445,scrollbars=0,resizable=1');
}

function OpenChatHeader(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=16&sel=FlashHeader','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
}

function OpenChatHeaderRJ(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=21&sel=FlashHeader','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
}

function OpenChatHeaderBA(idArea, sel){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea='+ idArea +'&sel='+ sel ,'remote','width=775,height=495,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
}
function OpenChatHeaderBA()
{
	window.open('/Web/Util/html/pop_chat.aspx?IDArea='+ idArea +'&sel=FlashHeader' ,'remote','width=775,height=495,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
}
function OpenChatAtivo(){
	window.open('/Web/Util/html/pop_chat.aspx?IDArea=234&sel=ChatAtivo','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	//window.open('/Web/Util/html/pop_chat.asp?IDArea=16&sel=FlashHeader','remote','width=386,height=440,top=0,resizable=no,scrollbars=no');
}

function openInvestidor(){
alert();
}

//http://proteus.e-hunter.com.br/cyrela/html/candidato.html
function fichaDeInscricao(){

window.open('http://zeus.e-hunter.com.br/cyrela/html/candidato.html', 'Cyrela', 'toolbar=no, location=no, directories=no, status=no,scrollbars=yes, resizable=no, menubar=no, width=760, height=450, left=2, top=10');
}

function abrepopficha(x){
eval("window.open('"+ x +"','pop','left=1,top=1,width=450,height=320,scrollbars=1,resizable=0,resizable=0,status=0');");
}


/* <MOUSE HOVER DO MENU HORIZONTAL> 
function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}
onload=init;
*/
/* </MOUSE HOVER DO MENU HORIZONTAL> */

/* <FUNÇÃO PARA ABRIR AS POPS QUE SÃO GERADAS AUTOMÁTICAMENTE> */
function abrepopficha(x){
eval("window.open('"+ x +"','pop','left=1,top=1,width=450,height=320,scrollbars=1,resizable=0,resizable=0,status=0');");
}
/* </FUNÇÃO PARA ABRIR AS POPS QUE SÃO GERADAS AUTOMÁTICAMENTE> */

/* <FUNÇÃO PARA ABRIR A POP DE FICHA DE INSCRIÇÃO> */
function fichaDeInscricao(){

window.open('http://zeus.e-hunter.com.br/cyrela/html/candidato.html', 'Cyrela', 'toolbar=no, location=no, directories=no, status=no,scrollbars=yes, resizable=no, menubar=no, width=760, height=450, left=2, top=10');
}
/* </FUNÇÃO PARA ABRIR A POP DE FICHA DE INSCRIÇÃO> */


/* <fUNÇÃO PARA ABRIR O CHAT DA CIDADE CORRETA> */

function fecharDHTML() {
	document.getElementById("DHTMLHOME").style.display = "none";
	
	var selects = document.getElementsByTagName("select");
	for(var i=0;i<selects.length;i++)
	{
		if(selects[i].id == "ddlHome")
			document.getElementById(selects[i].id).style.display = "";
	}
}

// Receive Data from Flash
function dhtml_DoFSCommand(command, args)
{
	//Invoke functions in accordance with command
	if(command=="OPEN") {
		fecharDHTML();
	}
}
// Hook for Internet Explorer.

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub dhtml_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call dhtml_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}


	function fechaBanner() {
		document.getElementById("html").style.display = 'none';
		//document.getElementById('dhtml').style.visibility="hidden";
	}
	
	function timerFechaImg(){
		 setTimeout("fechaBanner()",20000)
	}
	
	
/*<FUNÇÃO DROP DOWN MENU HORIZONTAL RELAÇÕES COM INVESTIDOR>*/

// <script>

// Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Distribute this code, any part or any modified version of it.
//     Instead, you can link to the homepage of this code:
//     http://www.php-development.ru/javascripts/smart-forms.php.
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as a part of another product provided that
//     its main use is not creating javascript menus.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind, either
// expressed or implied, including, but not limited to, the implied warranties
// of merchantability and fitness for a particular purpose. You expressly
// acknowledge and agree that use of this code is at your own risk.

// If you find my script useful, you can support my site in the following ways:
// 1. Vote for the script at HotScripts.com (you can do it on my site)
// 2. Link to the homepage of this script or to the homepage of my site:
//    http://www.php-development.ru/javascripts/smart-forms.php
//    http://www.php-development.ru/
//    You will get 50% commission on all orders made by your referrals.
//    More information can be found here:
//    http://www.php-development.ru/affiliates.php


// ----- Popup Control ---------------------------------------------------------

function at_display(x)
{
  win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- Show Aux -----

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  var top  = (c["at_position"] == "y") ? p.offsetHeight+0 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +1 : 15;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ----- Show -----

function at_show()
{
  p = document.getElementById(this["at_parent"]);
  c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

// ----- Hide -----

function at_hide()
{
  c = document.getElementById(this["at_child"]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 0);
}

// ----- Click -----

function at_click()
{
  p = document.getElementById(this["at_parent"]);
  c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

// ----- Attach -----

// PARAMETERS:
// parent   - id of visible html element
// child    - id of invisible html element that will be dropdowned
// showtype - "click" = you should click the parent to show/hide the child
//            "hover" = you should place the mouse over the parent to show
//                      the child
// position - "x" = the child is displayed to the right of the parent
//            "y" = the child is displayed below the parent
// cursor   - Omit to use default cursor or check any CSS manual for possible
//            values of this field

function at_attach(parent, child, showtype, position, cursor)
{
  p = document.getElementById(parent);
  c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

/*</FIM DA FUNÇÃO DROP DOWN MENU HORIZONTAL RELAÇÕES COM INVESTIDOR>*/

/*<POP DHTML>*/
function popdhtml(){
		window.open('http://200.225.91.178/cyrelario116/chat4/cliente/frm_login.asp?idarea=1&sel=dhtmlIles','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	}
/*</POP DHTML>*/

/*<DESTAQUE 1 - ILES>*/
function popfichailes(){
		window.location.href = "/web/ficha/iles";
		window.open('http://200.225.91.178/cyrelario116/chat4/cliente/frm_login.asp?idarea=1&sel=dhtmlIles','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	}	
/*</DESTAQUE 1 - ILES>*/

/*<DESTAQUE 1 - ESSENCIA>*/
function popficha(){
		window.location.href = "/web/ficha/essenciaalphaville";
		window.open('http://200.225.91.178/cyrela116/chat4/cliente/frm_login.asp?idarea=1&sel=Essência_Alphaville','remote','width=500,height=500,top=0,resizable=no,scrollbars=no');
	}	
/*</DESTAQUE 1 - ESSENCIA>*/


function abreEstagioObra(urlXml) {

	var x = "";
	
	x+= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	x+= '		id="main" width="800" height="575"';
	x+= '		codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" VIEWASTEXT>';
	x+= '		<param name="movie" value="/web/Util/swf/Obra/main.swf" />';
	x+= '		<param name="quality" value="high" />';
	x+= '		<param name="bgcolor" value="#869ca7" />';
	x+= '		<param name="allowScriptAccess" value="sameDomain" />';
	x+= '		<param name="flashvars" value="CaminhoXML=' + urlXml + '"/>';
	x+= '		<embed src="/web/Util/swf/Obra/main.swf" quality="high" bgcolor="#869ca7"';
	x+= '			width="800" height="575" name="main" align="middle"';
	x+= '			play="true"';
	x+= '			loop="false"';
	x+= '			quality="high"';
	x+= '			flshvars="CaminhoXML=' + urlXml + '"';
	x+= '			allowScriptAccess="sameDomain"';
	x+= '			type="application/x-shockwave-flash"';
	x+= '			pluginspage="http://www.adobe.com/go/getflashplayer">';
	x+= '		</embed>';
	x+= '</object>';
	
		document.getElementById('divLightboxContent').innerHTML = x;
		document.getElementById('divLightbox').style.display = 'block';
		
		var width = getPageSizeWithScroll('w');
		var height = getPageSizeWithScroll('h');
		
		document.getElementById('divOverlay').style.width = width + "px";
		document.getElementById('divOverlay').style.height = height + "px";
		
		window.scrollTo(0,0);
}

function getPageSizeWithScroll(type){
     if (window.innerHeight && window.scrollMaxY) {
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	}else if (document.body.scrollHeight > document.body.offsetHeight){
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else {
	    yWithScroll = document.body.offsetHeight;
	    xWithScroll = document.body.offsetWidth;
	}
	
	switch(type){
		case 'w':
			return xWithScroll;
			break;
		case 'h':
			return yWithScroll;
			break;
	}
}

function fechaLightbox() {
		document.getElementById('divLightbox').style.display = 'none';
		document.body.style.overflowY = 'auto';
}




// JavaScript Document
function checkBrowser(){
	T=this;
	b=navigator.appName;
//	alert (navigator.appName);
	v=navigator.appVersion;
	u=navigator.userAgent;
	if(b=='Netscape')T.b='ns'
	else if(b=='Microsoft Internet Explorer')T.b='ie'
	else T.b=b
	T.v=parseInt(v);
	T.ns=(T.b=='ns'&&T.v>=4);
	T.ns4=(T.b=='ns'&&T.v==4);
	T.ns5=(T.b=='ns'&&T.v==5);
	T.ns6=(T.b=='ns'&&T.v==5);
	T.ie=(T.b=='ie'&&T.v>=4);
	T.ie4=(u.indexOf('MSIE 4')>0);
	T.ie5=(u.indexOf('MSIE 5.0')>0);
	T.ie55=(u.indexOf('MSIE 5.5')>0);
	T.ie6=(u.indexOf('MSIE 6.0')>0);
	if(T.ie5)T.v=5;
	if(T.ie55)T.v=5.5;
	if(T.ie6)T.v=6;
	T.min=(T.ns||T.ie);
	T.dom=(T.v>=5);
	T.win=(u.indexOf('Win')>0);
	T.mac=(u.indexOf('Mac')>0);
}



function abreEstagioObraFicha(urlXml) {

	var x = "";
	var browser = new checkBrowser();
	
	if(browser.ie)
	{
	
	var objBody = document.getElementById ('Corpo');
			objBody.scroll = 'no';
	
	}
	else
	{
		document.body.style.overflow = 'hidden';
	}
	
	
	x+= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	x+= '		id="main" width="800" height="575"';
	x+= '		codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" VIEWASTEXT>';
	x+= '		<param name="movie" value="/web/Util/swf/Obra/main.swf" />';
	x+= '		<param name="quality" value="high" />';
	x+= '		<param name="bgcolor" value="#869ca7" />';
	x+= '		<param name="allowScriptAccess" value="sameDomain" />';
	x+= '		<param name="flashvars" value="CaminhoXML=' + urlXml + '"/>';
	x+= '		<embed src="/web/Util/swf/Obra/main.swf" quality="high" bgcolor="#869ca7"';
	x+= '			width="800" height="575" name="main" align="middle"';
	x+= '			play="true"';
	x+= '			loop="false"';
	x+= '			quality="high"';
	x+= '			flshvars="CaminhoXML=' + urlXml + '"';
	x+= '			allowScriptAccess="sameDomain"';
	x+= '			type="application/x-shockwave-flash"';
	x+= '			pluginspage="http://www.adobe.com/go/getflashplayer">';
	x+= '		</embed>';
	x+= '</object>';
	
		document.getElementById('divLightboxContent').innerHTML = x;
		document.getElementById('divLightbox').style.display = 'block';
		
		var width = getPageSizeWithScroll('w');
		var height = getPageSizeWithScroll('h');
		
		document.getElementById('divOverlay').style.width = width + "px";
		document.getElementById('divOverlay').style.height = height + "px";
		
		window.scrollTo(0,0);

		
}



function getPageSizeWithScroll(type){
     if (window.innerHeight && window.scrollMaxY) {
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	}else if (document.body.scrollHeight > document.body.offsetHeight){
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else {
	    yWithScroll = document.body.offsetHeight;
	    xWithScroll = document.body.offsetWidth;
	}
	
	switch(type){
		case 'w':
			return xWithScroll;
			break;
		case 'h':
			return yWithScroll;
			break;
	}
}

