function addFlash (URL, WIDTH, HEIGHT, TRANSPARENT)
{
	document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
	document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
	document.write (' <param name="movie" value="'+ URL +'" />');
	document.write (' <param name="quality" value="best" />');

	if ( TRANSPARENT ) {
	  document.write (' <param name="Wmode" value="Transparent" />');
	}

	document.write (' <embed src="'+ URL +'" quality="best" ');

	if ( TRANSPARENT ) {
	document.write (' Wmode = "transparent" ');
	}

	document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
	document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
	document.write (' </object>');

}

//====================================================================


function setaNomeIntegrante(nome){
	document.getElementById('nomeIntegrante').innerHTML = nome;
}


//=====================================================================

function exibeForm(){
if(document.getElementById("formulario").style.display == "none"){
	document.getElementById("formulario").style.display = "block";
	document.getElementById("formulario").style.clear = "both";
	document.getElementById("formulario").style.height = "250px";
	document.getElementById("linkformulario").innerHTML = "ESCONDER FORMULÁRIO";
}
else
{
	document.getElementById("formulario").style.display = "none";
	document.getElementById("formulario").style.height = "0";
	document.getElementById("linkformulario").innerHTML = "ENVIAR RECADO";
}
}

function exibeFormAlo(){
if(document.getElementById("formulario").style.display == "none"){
	document.getElementById("formulario").style.display = "block";
	document.getElementById("formulario").style.clear = "both";
	document.getElementById("formulario").style.height = "250px";
	document.getElementById("linkformulario").innerHTML = "ESCONDER FORMULÁRIO";
}
else
{
	document.getElementById("formulario").style.display = "none";
	document.getElementById("formulario").style.height = "0";
	document.getElementById("linkformulario").innerHTML = "PEDIR ALÔ";
}
}

function exibeFormQuem(){
if(document.getElementById("formulario").style.display == "none"){
	document.getElementById("formulario").style.display = "block";
	document.getElementById("formulario").style.clear = "both";
	document.getElementById("formulario").style.height = "250px";
	document.getElementById("linkformulario").innerHTML = "ESCONDER FORMULÁRIO";
}
else
{
	document.getElementById("formulario").style.display = "none";
	document.getElementById("formulario").style.height = "0";
	document.getElementById("linkformulario").innerHTML = "INSERIR";
}
}

//======================================================================


//---------- Função: "getPaginacao"  - Inicio ----------//
var req;

function loadXMLDoc3(url,valor,paginacao)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange3;
        req.open("GET", url+"?pagina="+valor+"&idGal="+paginacao, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange3;
            req.open("GET", url+"?pagina="+valor+"&idGal="+paginacao, true);
            req.send();
        }
    }
}

function processReqChange3()
{
    // apenas quando o estado for "completado"
    document.getElementById('resultado').innerHTML = "<span style=\"font-family: verdana; font-size: 12px; \">&nbsp;&nbsp;<b>Carregando paginação...</b>&nbsp;&nbsp;</span>";
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // procura pela div id="resultado" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById('resultado').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}

function pag(valor,paginacao)
{
//alert(valor);
loadXMLDoc3("minis2.php",valor,paginacao);
}

//---------- Função: "getPaginacao"  - Fim ----------//






//---------- Função: "EXIBE FOTOS"  - Inicio ----------//
var req;

function loadXMLDoc2(url,valor,galeria)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange2;
        req.open("GET", url+"?f="+valor+"&idGal="+galeria, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange2;
            req.open("GET", url+"?f="+valor+"&idGal="+galeria, true);
            req.send();
        }
    }
}

function processReqChange2()
{
    // apenas quando o estado for "completado"
    document.getElementById('fotos').innerHTML = "<span style=\"font-family: verdana; font-size: 12px; \">&nbsp;&nbsp;<b>Carregando...</b>&nbsp;&nbsp;</span>";
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // procura pela div id="resultado" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById('fotos').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}

function fotos(valor,galeria)
{
//alert(valor);
loadXMLDoc2("foto.php",valor,galeria);
}

//---------- Função: "EXIBE FOTOS"  - Fim ----------//







//---------- Função: "PAGINACAO GALERIAS"  - Inicio ----------//
var req;

function loadXMLDoc33(url,valor,paginacao)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange33;
        req.open("GET", url+"?pagina="+valor+"&idGal="+paginacao, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange33;
            req.open("GET", url+"?pagina="+valor+"&idGal="+paginacao, true);
            req.send();
        }
    }
}

function processReqChange33()
{
    // apenas quando o estado for "completado"
    document.getElementById('listaGal').innerHTML = "<span style=\"font-family: verdana; font-size: 12px; \">&nbsp;&nbsp;<b>Carregando paginação...</b>&nbsp;&nbsp;</span>";
    if (req.readyState == 4) {
        // apenas se o servidor retornar "OK"
        if (req.status == 200) {
            // procura pela div id="resultado" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById('listaGal').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}

function galeria(valor,paginacao)
{
//alert(valor);
loadXMLDoc33("listaGal.php",valor,paginacao);
}

//---------- Função: "PAGINACAO GALERIAS"  - Fim ----------//






function Dados(valor) {
      //verifica se o browser tem suporte a ajax
	  try {
         ajax = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajax = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
               ajax = new XMLHttpRequest();
            }
	        catch(exc) {
               alert("Esse browser não tem recursos para uso do Ajax");
               ajax = null;
            }
         }
      }
	  //se tiver suporte ajax
	  if(ajax) {
	     //deixa apenas o elemento 1 no option, os outros são excluídos
		 document.forms[0].listCidades.options.length = 1;
	     
		 idOpcao  = document.getElementById("opcoes");
		 
	     ajax.open("POST", "cidades.php", true);
		 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		 
		 ajax.onreadystatechange = function() {
            //enquanto estiver processando...emite a msg de carregando
			if(ajax.readyState == 1) {
			   idOpcao.innerHTML = "Carregando...!";   
	        }
			//após ser processado - chama função processXML que vai varrer os dados
            if(ajax.readyState == 4 ) {
			   if(ajax.responseXML) {
			      processXML(ajax.responseXML);
			   }
			   else {
			       //caso não seja um arquivo XML emite a mensagem abaixo
				   idOpcao.innerHTML = "--Primeiro selecione o estado--";
			   }
            }
         }
		 //passa o código do estado escolhido
	     var params = "estado="+valor;
         ajax.send(params);
      }
   }
   
   function processXML(obj){
      //pega a tag cidade
      var dataArray   = obj.getElementsByTagName("cidade");
      
	  //total de elementos contidos na tag cidade
	  if(dataArray.length > 0) {
	     //percorre o arquivo XML paara extrair os dados
         for(var i = 0 ; i < dataArray.length ; i++) {
            var item = dataArray[i];
			//contéudo dos campos no arquivo XML
			var codigo    =  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
			var descricao =  item.getElementsByTagName("descricao")[0].firstChild.nodeValue;
			
	        idOpcao.innerHTML = "--Selecione uma das opções abaixo--";
			
			//cria um novo option dinamicamente  
			var novo = document.createElement("option");
			    //atribui um ID a esse elemento
			    novo.setAttribute("id", "opcoes");
				//atribui um valor
			    novo.value = codigo;
				//atribui um texto
			    novo.text  = descricao;
				//finalmente adiciona o novo elemento
				document.forms[0].listCidades.options.add(novo);
		 }
	  }
	  else {
	    //caso o XML volte vazio, printa a mensagem abaixo
		idOpcao.innerHTML = "--Primeiro selecione o estado--";
	  }	  
   }



function testFields(){
var teste = 0;
	if(document.getElementById('nome').value == "")
		{
			teste = 1;
			alert("Digite seu nome");
			document.getElementById('nome').focus();
			return false;
		}
		
	if(document.getElementById('email').value == "")
		{
			teste = 1;
			alert("Digite seu email");
			document.getElementById('email').focus();
			return false;
		}
		
	if(document.getElementById('endereco').value == "")
		{
			teste = 1;
			alert("Digite seu endereço");
			document.getElementById('endereco').focus();
			return false;
		}
		
	
		
	if((document.getElementById('cep').value).length < 9)
		{
			teste = 1;
			alert("Digite o CEP \n no Formato: 99999-999");
			document.getElementById('cep').focus();
			return false;
		}
	
	if((document.getElementById('dt_nasc').value).length < 10)
		{
			teste = 1;
			alert("Digite sua data de Nascimento \n no Formato: dd/mm/aaaa");
			document.getElementById('dt_nasc').focus();
			return false;
		}
		
		if(teste != 1){
			document.getElementById('f').submit();
		}
}