﻿function troca_img(id,src){
	document.getElementById(id).src=''+src+'';
}
function Mostra(nome)
{
//alert(navigator.appVersion)
//alert(navigator.appName)
	if (navigator.appName=="Microsoft Internet Explorer" /*|| navigator.appName=="Netscape"*/ ){
		var objeto = eval("document.all." + nome);

	}else{
		
		var objeto = eval("document.getElementById(\"" + nome + "\")"+"");
		}
		if ( objeto )
			{
			if ( objeto.style.display == "none" )
				{ objeto.style.display = ""; }
			else
				{ objeto.style.display = "none"; }
			}
		}
		
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0;(a=document.getElementsByTagName("link")[i]);i++)
 {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
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_showHideLayers() { 
//v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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_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 verif()
{
	if (document.restrito.email.value == '' || document.restrito.email.value.indexOf("@")==-1 || document.restrito.email.value.indexOf(".")==-1)
	{
	alert('Campo EMAIL inválido!')
	}
	else
	document.restrito.submit();
}

function verif_eng()
{
	if (document.restrito.email.value == '' || document.restrito.email.value.indexOf("@")==-1 || document.restrito.email.value.indexOf(".")==-1)
	{
	alert('Field EMAIL incorrect!')
	}
	else
	document.restrito.submit();
}

// função que verifica as manifestações investor excessão até o momento IOCHPE
function verif_manifestacao()
{
	if (document.frm.assunto.value == '' || document.frm.assunto.value.indexOf("@")==-1 || document.frm.assunto.value.indexOf(".")==-1)
	{
	alert('Campo ASSUNTO inválido!')
	}
	else if (document.frm.comentario.value == '')	
	{
	alert('Campo Descrição não pode ser em branco!')	
	}
	else
	document.frm.submit();
}

function verif_manifestacao_eng()
{
	if (document.frm.assunto.value == '' || document.frm.assunto.value.indexOf("@")==-1 || document.frm.assunto.value.indexOf(".")==-1)
	{
	alert('Field ASSUNTO incorrect!')
	}
	else if (document.frm.comentario.value == '')	
	{
	alert('Field Message blank!')	
	}	
	else
	document.frm.submit();
}
 
function MostraMenu(obj){

	if(document.getElementById){
	var el = document.getElementById(obj);
		if(el.style.display != "block"){ //DynamicDrive.com change
			el.style.display = "block";			
		}else{
			el.style.display = "none";
			//MM_swapImgRestore()
		}
	}
}

function verif_email()
{
	if (document.form1.email.value == '' || document.form1.email.value.indexOf("@")==-1 || document.form1.email.value.indexOf(".")==-1)
	{
	alert('Campo EMAIL inválido!')
	}
	else if (document.form1.msg.value == '')	
	{
	alert('Campo Mensagem não pode ser em branco!')	
	}
	else
	document.form1.submit();
}

function verif_email_eng()
{
	if (document.form1.email.value == '' || document.form1.email.value.indexOf("@")==-1 || document.form1.email.value.indexOf(".")==-1)
	{
	alert('Field EMAIL incorrect!')
	}
	else if (document.form1.msg.value == '')	
	{
	alert('Field Message blank!')	
	}	
	else
	document.form1.submit();
}
 
function Imprimir(url) {
window.open(url, 'print', 'width=1,height=1,left=0,top=0,scrollbars=0,resizable=0,menubar=0,toolbar=0');
} 

function VerificaEmpreendimento()
{
	if (document.form.status.value == 'NULL' && document.form.localizacao.value == 'NULL' && document.form.dorm.value == 'NULL')
	{
		alert('Escolha no mínimo uma opção!');
	}
	else
	{
		document.form.submit();
	}
}

function pop1(id){
	
	window.open('../web/empreendimento_flash.asp?id='+id,'PopUp','width=630,height=375,top=25,left=312,scrollbars=no');
	
	}
	
function pop2(id) { 

window.open('../web/empreendimento_imagem.asp?id='+id,'janela', 'width=450, height=450, top=100, left=315, scrollbars=no'); 

}

function TelefoneFormat(Campo, e) { 
    var key = ''; 
    var len = 0; 
    var strCheck = '0123456789'; 
    var aux = ''; 
    var whichCode = (window.Event) ? e.which : e.keyCode; 
    
    if (whichCode == 13 || whichCode == 8 || whichCode == 0) 
    { 
        return true;  // Enter backspace ou FN qualquer um que não seja alfa numerico 
    } 
    key = String.fromCharCode(whichCode); 
    if (strCheck.indexOf(key) == -1){ 
        return false;  //NÃO E VALIDO 
    } 
     
    aux =  Telefone_Remove_Format(Campo.value); 
     
    len = aux.length; 
    if(len>=10) 
    { 
        return false;    //impede de digitar um telefone maior que 10 
    } 
    aux += key; 
     
    Campo.value = Telefone_Mont_Format(aux); 
    return false; 
} 

function  Telefone_Mont_Format(Telefone) 
{ 
    var aux = len = ''; 
     
    len = Telefone.length; 
    if(len<=9) 
    { 
        tmp = 5; 
    } 
    else 
    { 
        tmp = 6; 
    } 
     
    aux = ''; 
    for(i = 0; i < len; i++) 
    { 
        if(i==0) 
        { 
            aux = '('; 
        } 
        aux += Telefone.charAt(i); 
        if(i+1==2) 
        { 
            aux += ')'; 
        } 
         
        if(i+1==tmp) 
        { 
            aux += '-'; 
        } 
    } 
    return aux ; 
} 

function  Telefone_Remove_Format(Telefone) 
{ 
    var strCheck = '0123456789'; 
    var len = i = aux = ''; 
    len = Telefone.length; 
    for(i = 0; i < len; i++) 
    { 
        if (strCheck.indexOf(Telefone.charAt(i))!=-1) 
        { 
            aux += Telefone.charAt(i); 
        } 
    } 
    return aux; 
} 

function textCounter(field, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
}

function validacao()
{
	if(document.sendMail.nomeD.value == '' || document.sendMail.emailD.value == '')
	{
		alert('Campos nome/e-mail obrigatórios!');
		return false;
	}
	if(document.sendMail.emailD.value.indexOf("@") == -1 || document.sendMail.emailD.value.indexOf(".") == -1)
	{
		alert('Campo e-mail inválido!');
		return false;
	}
	document.sendMail.submit();
	return true;
}

function valida_sendMailManual()
{
	if(document.sendMailManual.nome.value == '')
		alert('Campo nome obrigatório!');
		
	else if(document.sendMailManual.email.value == '')
		alert('Campo e-mail obrigatório!');
		
	else if(document.sendMailManual.email.value.indexOf("@") == -1 || document.sendMailManual.email.value.indexOf(".") == -1)
		alert('Campo e-mail inválido!');
		
	else
		document.sendMailManual.submit();
}
