//Função que faz o pré-carregamento das imagens listadas no BODY
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 AbreGaleria(URL) {
  var width = 717;
  var height = 510;
  var left = 50;
  var top = 10
  window.open(URL, 'ema3', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}
//Escreve o Flash
function flash(largura, altura, arquivo){
	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="transparent" />');
	//document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+arquivo+'" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><embed src="'+arquivo+'" wmode="transparent" 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>');
}
//EXPAND
function Expand(id){
	document.getElementById(id).style.display = "";
}
//OUTEXPAND
function OutExpand(id){
	document.getElementById(id).style.display = "none";
}
//Valida Mural
function validaMural(){
	if (document.mural.nome.value.length<3){
      alert("Por favor, informe o seu nome");
      document.mural.nome.focus();
      return false;
    }
	else if (document.mural.email1.value.length<5 || document.mural.email1.value.indexOf("@")<=0 || document.mural.email1.value.indexOf(".")<=0){
	  alert ("Por favor, informe seu e-mail válido!");
	  document.mural.email1.focus();
	  return false;
	}
	if (document.mural.mensagem.value.length<5){
      alert("Por favor, informe sua mensagem");
      document.mural.mensagem.focus();
      return false;
    }
    else return true;
}
//Valida BOletim
function validaBoletim(){
	if (document.boletim.nome.value.length<3){
      alert("Por favor, informe o seu nome");
      document.boletim.nome.focus();
      return false;
    }
	else if (document.boletim.email1.value.length<5 || document.boletim.email1.value.indexOf("@")<=0 || document.boletim.email1.value.indexOf(".")<=0){
	  alert ("Por favor, informe seu e-mail válido!");
	  document.boletim.email1.focus();
	  return false;
	}
    else return true;
}
//Valida Oração
function validaOracao(){
	if (document.oracao.nome.value.length<3){
      alert("Por favor, informe o seu nome");
      document.oracao.nome.focus();
      return false;
    }
	else if (document.oracao.email1.value.length<5 || document.oracao.email1.value.indexOf("@")<=0 || document.oracao.email1.value.indexOf(".")<=0){
	  alert ("Por favor, informe seu e-mail válido!");
	  document.oracao.email1.focus();
	  return false;
	}
	else if (document.oracao.cidade.value.length<3){
      alert("Por favor, informe sua cidade");
      document.oracao.cidade.focus();
      return false;
    }
	else if (document.oracao.uf.value==""){
      alert("Por favor, informe o estado onde mora");
      document.oracao.uf.focus();
      return false;
    }
	else if (document.oracao.pedido.value.length<5){
      alert("Por favor, informe seu Pedido de Oração");
      document.oracao.pedido.focus();
      return false;
    }
    else return true;
}
//Valida Contato
function validaContato(){
	if (document.contato.nome.value.length<3){
      alert("Por favor, informe o seu nome");
      document.contato.nome.focus();
      return false;
    }
	else if (document.contato.email1.value.length<5 || document.contato.email1.value.indexOf("@")<=0 || document.contato.email1.value.indexOf(".")<=0){
	  alert ("Por favor, informe seu e-mail válido!");
	  document.contato.email1.focus();
	  return false;
	}
	else if (document.contato.ddd.value==""){
      alert("Por favor, informe seu DDD");
      document.contato.ddd.focus();
      return false;
    }
	else if (document.contato.fone.value==""){
      alert("Por favor, informe o seu telefone");
      document.contato.fone.focus();
      return false;
    }
	else if (document.contato.cidade.value.length<3){
      alert("Por favor, informe sua cidade");
      document.contato.nome.focus();
      return false;
    }
	else if (document.contato.uf.value==""){
      alert("Por favor, informe o estado onde mora");
      document.contato.uf.focus();
      return false;
    }
	else if (document.contato.assunto.value.length<3){
      alert("Por favor, informe o assunto da sua mensagem");
      document.contato.assunto.focus();
      return false;
    }
	else if (document.contato.mensagem.value.length<5){
      alert("Por favor, informe sua mensagem");
      document.contato.mensagem.focus();
      return false;
    }
    else return true;
}