function busca(src) {


conteudo =  "<table id='Frevo' width='100%'  border='0' cellspacing='0' cellpadding='0'>";
conteudo =  conteudo +  "<tr bgcolor='#006699'>";
conteudo =  conteudo +  "<td width='60%' height='33' align='center' bgcolor='#006699'><input name='texto_procura' type='text' class='txt' size='35'></td>";
conteudo =  conteudo +  "<td width='31%' align='center'><select name='opcao_procura' class='txt'>";

if (src == "Entrevista")
{
   conteudo =  conteudo + "<option value='entrevistado'>entrevistado</option>";
   conteudo =  conteudo + "<option value='data'>data (dd/mm/aaaa)</option>";
   document.form_busca.tabela.value = "entrevista";
teste =   "<table width='340'  border='0' cellpadding='0' cellspacing='0'>";
teste = teste +   "<tr>";
teste = teste +   "<td width='19%' height='19' class='txt2'>&nbsp;&nbsp;B U S C A</td>";
teste = teste +   "<td width='7%'>&nbsp;</td>";
teste = teste +   "<td width='14%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Evento') class='txt2'>Evento</a></td>";
teste = teste +   "<td width='18%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Notícia') class='txt2'>Not&iacute;cia</a></td>";
teste = teste +   "<td width='20%' align='center' class='txt2' style='cursor:hand;'  ><a href=javascript:busca('Anúncio') class='txt2'>An&uacute;ncio</a></td>";
teste = teste +   "<td width='22%' align='center' class='txt2' style='cursor:hand;' bgcolor='#006699' ><a href=javascript:busca('Entrevista') class='txt2'>Entrevista</a></td>";
teste = teste +   "</tr>";
teste = teste +  "</table>";
}
if (src == "Evento")
{
   conteudo =  conteudo + "<option value='nome'>evento</option>";
   conteudo =  conteudo + "<option value='data'>data (dd/mm/aaaa)</option>";
   conteudo =  conteudo + "<option value='banda'>banda</option>";
   conteudo =  conteudo + "<option value='local'>local</option>";
   document.form_busca.tabela.value = "festa";
teste =   "<table width='340'  border='0' cellpadding='0' cellspacing='0'>";
teste = teste +   "<tr>";
teste = teste +   "<td width='19%' height='19' class='txt2'>  B U S C A</td>";
teste = teste +   "<td width='7%'>&nbsp;</td>";
teste = teste +   "<td width='14%' align='center' bgcolor='#006699' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Evento') class='txt2'>Evento</a></td>";
teste = teste +   "<td width='18%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Notícia') class='txt2'>Notícia</a></td>";
teste = teste +   "<td width='20%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Anúncio') class='txt2'>Anúncio</a></td>";
teste = teste +   "<td width='22%' align='center' class='txt2' style='cursor:hand;'><a href=javascript:busca('Entrevista') class='txt2'>Entrevista</a></td>";
teste = teste +   "</tr>";
teste = teste +  "</table>";
}
if (src == "Notícia")
{
   conteudo =  conteudo + "<option value='assunto'>noticia</option>";
   conteudo =  conteudo + "<option value='data'>data (dd/mm/aaaa)</option>";
   document.form_busca.tabela.value = "noticia";
teste =   "<table width='340'  border='0' cellpadding='0' cellspacing='0'>";
teste = teste +   "<tr>";
teste = teste +   "<td width='19%' height='19' class='txt2'>  B U S C A</td>";
teste = teste +   "<td width='7%'>&nbsp;</td>";
teste = teste +   "<td width='14%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Evento') class='txt2'>Evento</a></td>";
teste = teste +   "<td width='18%' align='center' class='txt2' style='cursor:hand;' bgcolor='#006699' ><a href=javascript:busca('Notícia') class='txt2'>Notícia</a></td>";
teste = teste +   "<td width='20%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Anúncio') class='txt2'>Anúncio</a></td>";
teste = teste +   "<td width='22%' align='center' class='txt2' style='cursor:hand;'  ><a href=javascript:busca('Entrevista') class='txt2'>Entrevista</a></td>";
teste = teste +   "</tr>";
teste = teste +  "</table>";
}
if (src == "Anúncio")
{
   conteudo =  conteudo + "<option value='1'>compra</option>";
   conteudo =  conteudo + "<option value='0'>venda</option>";
   document.form_busca.tabela.value = "classificado";
teste =   "<table width='340'  border='0' cellpadding='0' cellspacing='0'>";
teste = teste +   "<tr>";
teste = teste +   "<td width='19%' height='19' class='txt2'>  B U S C A</td>";
teste = teste +   "<td width='7%'>&nbsp;</td>";
teste = teste +   "<td width='14%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Evento') class='txt2'>Evento</a></td>";
teste = teste +   "<td width='18%' align='center' class='txt2' style='cursor:hand;' ><a href=javascript:busca('Notícia') class='txt2'>Notícia</a></td>";
teste = teste +   "<td width='20%' align='center' class='txt2' style='cursor:hand;' bgcolor='#006699' ><a href=javascript:busca('Anúncio') class='txt2'>Anúncio</a></td>";
teste = teste +   "<td width='22%' align='center' class='txt2' style='cursor:hand;'  ><a href=javascript:busca('Entrevista') class='txt2'>Entrevista</a></td>";
teste = teste +   "</tr>";
teste = teste +  "</table>";
}
//alert(src);
document.form_busca.quemcor.value = src;

conteudo =  conteudo +  "</select></td>";
conteudo =  conteudo +  "<td width='9%' align='center'><input name='Submit' type='submit' class='frmFale2' value='ok' style='width:20px'></td>";
conteudo =  conteudo +  "</tr>";
conteudo =  conteudo +  "</table>";

document.getElementById("tabela_procura").innerHTML = conteudo;
document.getElementById("novoteste").innerHTML = teste;

}


function vota()
{
enquete = document.form_enquete.enquete.value;
voto ="";
teste = 0;
for (i=0; i< document.form_enquete.voto.length; i++ )
{
   if(document.form_enquete.voto[i].checked)
   {
      voto = document.form_enquete.voto[i].value;
	  teste = i;
   }  
}
if (voto != "")
{
  pag = "efetua_voto.php?enquete=" + enquete + "&voto=" + voto;
  window.open(pag, "efetua_voto","location = no, toolbar = no, status=no, menubar=no, height = 300, width = 450, left=50, top=90");
  document.form_enquete.voto[teste].checked = false;
  
}
}

function verifica_login()
{
   if (document.form_login.email.value == "")
   {
      document.form_login.email.focus();
      return false;
   }
   if (document.form_login.senha.value == "")
   {
      document.form_login.senha.focus();
	  return false;
   }
   return true;	  
}

function trim2(tx) { 
  s = tx; 
  while (s.substring(0,1) == ' ') { 
    s = s.substring(1,s.length); 
  } 
  while (s.substring(s.length-1,s.length) == ' ') { 
    s = s.substring(0,s.length-1); 
  } 
  return s; 
}

function ehnumero(e)
{
if(e.length != 10)
   return false;
for (i=0; i < e.length; i++)
{
  if (!((e.charAt(i) >= 0) && (e.charAt(i) <= 9))) // numeros de 0 a 9
	return false;
}
return true;
}

function resize_iframe()
{

document.getElementById("meio").height = null; // required for Moz bug, value can be "", null, or integer
//alert(window.frames["meio"].document.body.scrollHeight);
//if(window.frames["meio"].document.body.scrollHeight < 784)
  // document.getElementById("meio").height = 784;
//else   
  document.getElementById("meio").height = window.frames["meio"].document.body.scrollHeight;
 
//document.getElementById("meio").width = 500;
 
}

function movimenta_direita()
{
   document.getElementById("flyer").style.pixelTop = document.getElementById("flyer").style.pixelTop + 2;
   document.getElementById("flyer").style.pixelLeft = document.getElementById("flyer").style.pixelLeft + 1;
   if(document.getElementById("flyer").style.pixelTop < 490 && document.getElementById("flyer").style.pixelLeft < 690)
      setTimeout("movimenta_direita()",20);  
   else
   {
	  if(document.getElementById("flyer").style.pixelLeft >= 690)
	    movimenta_esquerda();
	  else
		setTimeout("esconde()",1200);
	}
}

function movimenta_esquerda()
{
  document.getElementById("flyer").style.pixelTop = document.getElementById("flyer").style.pixelTop + 2;
  document.getElementById("flyer").style.pixelLeft = document.getElementById("flyer").style.pixelLeft - 1;
  if(document.getElementById("flyer").style.pixelTop < 490 && document.getElementById("flyer").style.pixelLeft > 661)
     setTimeout("movimenta_esquerda()",20);  
  else
  {
	  if(document.getElementById("flyer").style.pixelLeft <= 661)
	     movimenta_direita();
	  else
	   setTimeout("esconde()",1200);
  }
}

function esconde()
{
	 document.getElementById("flyer").style.display = "none";
}

function movimenta()
{
  document.getElementById("flyer").style.display = "inline";
  setTimeout("movimenta_direita()",800);
}

function efetua_login(user)
{

teste = " <a href='cadastro1.php' class='txt2' target='meio'>cadastre-se</a> <span class='txt2'>| esqueceu a senha</span>";
 teste = teste +   "<table border='1' style='border-collapse:collapse; border-bottom-color:#000000; border-right-color:#000000; border-left-color:#999999; border-top-color:#999999'>";
 teste = teste + "<tr>";
 teste =teste + "<td width='161' height='50'>";
 teste =teste +	"<table width='159' height='47' border='0' cellpadding='0' cellspacing='0' style='border-bottom-color:#000000 '>";
 teste = teste + "<form name='form_login' method='post' action='../efetua_login.php' target='meio' onSubmit='return verifica_login();'>";
 teste =  teste +   "<tr>";
 teste =teste + "<td class='txt2' align='center'>";
 teste =teste +"  Bem Vindo <font color='#FF0000'>" + user +"</font> !!!";
 teste =teste + "   <input name='Submit' type='submit' class='login' value='  sair  '> </td>";
 teste =  teste +   "</tr>";
 teste = teste + "</form>";
 teste =  teste +  "</table>";
 teste = teste +  "</td></tr></table>";
 teste = teste +  "</form>";

 document.getElementById("formulario_login").innerHTML = teste;

}

function desconecta()
{
teste = " <a href='cadastro1.php' target='meio' class='txt2'>cadastre-se</a> <span class='txt2'>| </span><a href='esqueci.php' target='meio' class='txt2'>esqueceu a senha</a>";
  teste = teste + "<table border='1' style='border-collapse:collapse; border-bottom-color:#000000; border-right-color:#000000; border-left-color:#999999; border-top-color:#999999;'>";
  teste = teste + "<tr>";
  teste = teste + "<td width='160' height='50' align='center'>";
  teste = teste + "<table width='159' height='47' border='0' cellpadding='0' cellspacing='0'>";
  teste = teste + "<form name='form_login' method='post' action='../efetua_login.php' target='meio' onSubmit='return verifica_login();'>";
  teste = teste + "<tr>";
  teste = teste + "<td width='39' height='25' align='right' class='txt2'>EMAIL:</td>";
  teste = teste + "<td width='120'><input name='email' id='email' type='text' class='txt'></td>";
  teste = teste + "</tr>";
  teste = teste + "<tr>";
  teste = teste + "<td height='25' align='right' class='txt2'>SENHA:</td>";
  teste = teste + "<td><input name='senha' id='senha' type='password' class='txt' style='width:82px'>";
  teste = teste + " <input name='Submit' type='submit' class='frmFale2' value='ok' style='width:20px'></td>";
  teste = teste + "</tr>";
  teste = teste + "</form>";
  teste = teste + "</table>";
  teste = teste + "</td></tr></table>";

 document.getElementById("formulario_login").innerHTML = teste; 	
	
}