﻿function EmailForm(comp1,comp2)
{

var name = prompt("Digite o e-mail que receberá as mensagens.", "")
var assunto = prompt("Digite um nome para o formulário.","")
var cont =document.getElementById(comp1).value;
 var oEditor = FCKeditorAPI.GetInstance(comp1);      
    
if (name == "" || name == null || assunto == "" || assunto == null) {
alert('Os campos Email e Nome são obrigatórios');
}
else {
if (checkMail(name) == true)
  oEditor.EditorDocument.body.innerHTML =   cont + "<iframe src='contato1.aspx?e="+name+"&a="+assunto+"' frameBorder=0 width=100% height=400 scrolling=NO></iframe>"; 
  else
  alert('Digite um e-mail válido');
}

}

function checkMail(mail){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(mail) == "string"){
        if(er.test(mail)){ return true; }
    }else if(typeof(mail) == "object"){
        if(er.test(mail.value)){ 
                    return true; 
                }
    }else{
        return false;
        }
}

function Popup(url,pagina,wd,hd)
{
window.open(url, pagina, 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=NO, SCROLLBARS=YES, TOP=110, LEFT=110, WIDTH=500, HEIGHT=300');
 //openModal(url,"excel");
}
function PopupPG(url,pagina,wd,hd)
{
window.open(url, pagina, 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=NO, SCROLLBARS=YES, TOP=110, LEFT=110, WIDTH='+wd+', HEIGHT='+hd+'');
 //openModal(url,"excel");
}
function ProcessaEnvio(url,pagina)
{
window.open(url, pagina, 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=NO, SCROLLBARS=YES, TOP=110, LEFT=110, WIDTH=500, HEIGHT=300');

 // openModal(url,500,250);
}
function chama_link(valor){
window.open(valor) 
}

function openModal(pUrl, pWidth, pHeight) {
	if (window.showModalDialog) {
		return window.showModalDialog(pUrl, window,
		  "dialogWidth:" + pWidth + "px;dialogHeight:" + pHeight + "px");
	} else {
		try {
			netscape.security.PrivilegeManager.enablePrivilege(
			  "UniversalBrowserWrite");
			window.open(pUrl, "wndModal", "width=" + pWidth
			  + ",height=" + pHeight + ",resizable=no,modal=yes");
			return true;
		}
		catch (e) {
			alert("Script não confiável, não é possível abrir janela modal.");
			return false;
		}
	}
}
	function flash(largura, altura, arquivo, transparencia)
{
 document.write('<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="'+largura+'" height="'+altura+'" id="teste" align="middle">');
 document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="'+transparencia+'" /><param name="menu" value="false" />');
 document.write('<param name="movie" value="'+arquivo+'" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><embed src="'+arquivo+'" wmode="'+transparencia+'" menu="false" quality="best" width="'+largura+'" height="'+altura+'" name="teste" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
 document.write('</object>');
}

function MM_formt(e,src,mask) 
{
 if(window.event) 
  { _TXT = e.keyCode; }
 else if(e.which) 
  { _TXT = e.which; }
 if(_TXT > 47 && _TXT < 58) 
  {
   var i = src.value.length;
   //if(mask.substring(0,1)!='#'){var saida = mask.substr(1,1);}else{var saida = '#';}
   var saida = '#';
   var texto = mask.substring(i);
   //for(j=0;j<=mask.length;j++)
    //{
	 if(mask.substr(0,1) != '#' && src.value.length == 0)
	  {
	   src.value += mask.substr(0,1);
	   texto = mask.substring(i+1);
	  }
	//}
   if (texto.substring(0,1) != saida) 
    { src.value += texto.substring(0,1); }
   return true; 
  }
 else 
  { if (_TXT != 8) 
     { return false; }
    else { return true; }
  }
}
  function abrePopup(id)
        {           
            window.open(id, 'Detalhe','width=150,height=100,resizable=0,statusbar=0,scrollbars=0');
        }
function abrePopupC(id,W,H,S)
        {           
          // window.open(id, 'Detalhe','width=500,height='+H+',resizable=0,statusbar=0,scrollbars=yes');
            window.open(id, 'Detalhe','width='+W+',height='+H+',resizable=0,left=400,statusbar=0,scrollbars=yes');void(0); 
        }

function aparecesome(numero){
	if(document.getElementById(numero).style.display == 'none'){
		document.getElementById(numero).style.display = '';
	}else{
		document.getElementById(numero).style.display = 'none';
	}	
}

contBT = 0;
function mudabotao(botaoatual){
	
	var primeira = new Array();
	primeira = ["images/menudiretoria_01.gif","images/menudiretoria_02.gif"]; //Array das imagens naturais
	tamprimeira = primeira.length;
	
	var segunda = new Array();
	segunda = ["images/menudiretoria_02.gif","images/menudiretoria_01.gif"]; //Array das imagens quando clicar no botão
	
	var botoes = new Array();
	botoes = ["bt1","bt2"];
	
	var caixas = new Array();
	caixas = ["v01","v02"];
	
	for(i = 0; i < tamprimeira; i++){
		valor = botoes[i];
		
		if(contBT == 0){
			if(botaoatual == valor){
				document.getElementById(valor).src = segunda[i];
				contBT = 1;
			}else{
				document.getElementById(valor).src = primeira[i];
				contBT = 0;
			}
		}else{
			if(botaoatual == valor){
				document.getElementById(valor).src = primeira[i];
				contBT = 0;
			}else{
				document.getElementById(valor).src = segunda[i];
				contBT = 1;
			}
		}
	}
}

// JavaScript Document
function flash(largura,altura,caminho){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="' + largura + '" height="' + altura + '">');
document.write('<param name="movie" value="' + caminho + '" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="transparent" />');
document.write('<embed src="' + caminho + '" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '" wmode="transparent"></embed>');
document.write('</object>');
}

function mostraEstado(estado){
	var valor = document.getElementById(estado).innerHTML;
	document.getElementById("escolhido").innerHTML = valor;
	location.href="#mapa";
	valor = "";
	/*var meu = new Array();
	meu = ["AM","GO","DF","AC","PA","AP","RO","RR","MS","MT","TO","SP","PR","RS","SC","RJ","ES","MG","BA","AL","SE","PE","RN","PB","MA","PI","CE","FENADVB","USA","PORTUGAL","JAPAO"];
	var tamanho = meu.length;
	
	for (i=0;i<tamanho;i++){
		if(meu[i] == estado){
			document.getElementById(meu[i]).style.display = '';
		} else {
			document.getElementById(meu[i]).style.display = 'none';
		}
	}*/
}