// Habilitar Central
 function habCentral (acao)
 {
    var idCentral = document.getElementById('divCentral');
    if (acao == "abrir")
       idCentral.style.display = "";
    else
       idCentral.style.display = "none";
 }

// Habilitar Senha
 function habSenha (acao)
 {
    var idSenha = document.getElementById('senhaSite');
    if (acao == "abrir")
       idSenha.style.display = "inline";
    else
       idSenha.style.display = "none";
 }

 // Habilitar Senha Assinatura
 function habSenhaAss (acao)
 {
    var idSenhaAss = document.getElementById('senhaAss');
    if (acao == "abrir")
       idSenhaAss.style.display = "inline";
    else
       idSenhaAss.style.display = "none";
 }

// Imprime
 function ImprimePagina() {
	var mac = (navigator.userAgent.indexOf("Mac") != -1);
	var doc = (document.all) ? 1 : 0;
	var ie_ns = (window.print) ? 1 : 0;

	if (ie_ns){				// Se for netscape 4 ou ie5
    	window.print();
  	}else if (doc && !mac){		// Se for ie4
    	vbPrintPage()
	}else{     				// Outros
    	alert("Por favor, selecione a opção Arquivo / Imprimir do menu superior para imprimir esse cupom.");
	}
 }

// Carrega .fla
 function carregaFlash(caminho,largura,altura)
  {
   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,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('<param name="menu" value="false">');
   document.write('<embed src="'+caminho+'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed>');
   document.write('</object>');
  }


// Abre Chat
function AbreChat(theURL,winName,features) {
		 window.open(theURL,winName,features);
}

// Opine
function enviardados(){

if (document.dados.nome.value=="")
{
alert( "Por favor, informe seu Nome." );
document.dados.nome.focus();
return false;
}

if( document.dados.email.value=="" || document.dados.email.value.indexOf('@')==-1 || document.dados.email.value.indexOf('.')==-1 )
{
alert( "Por favor, informe seu E-mail corretamente." );
document.dados.email.focus();
return false;
}

if(document.dados.dominio.value=="" || document.dados.dominio.value.length < 6)
{
alert( "Por favor, informe seu Domínio." );
document.dados.dominio.focus();
return false;
}

return true;
}

function byId(id)
{
	return document.getElementById(id);
}

// Validar Central
function valCentral()
{
	 if(byId('usuario').value.length < 4)
	 {
		 alert('Por favor, verifique o nome de usuário ou e-mail digitado.');
		 byId('usuario').focus();
		 return false;
	 }

	 if(byId('senha').value.length < 6)
	 {
		 alert('Por favor, verifique a senha digitada.');
		 byId('senha').focus();
		 return false;
	 }

	 return true;
}

function lembreteDeSenha()
{

   var xmlhttp = null;

   try
   {
       xmlhttp = new XMLHttpRequest();
   }
   catch(e1)
   {
      try
      {
          xmlhttp = new ActiveXObject('Ms2xml.XMLHTTP');
      }
      catch(e2)
      {
         try
         {
            xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
         }
         catch(e3)
         {
            xmlhttp = null;
         }
      }
   }

   if(xmlhttp == null)
   {
       alert('Ocorreu um erro durante o processamento da informação. Tente novamente!');
   }
   else
   {      byId('resultado').innerHTML = 'Processando...';
      xmlhttp.open("GET", "funcoes/php/lembrete.php?usuario=" + byId('lembreteUsuario').value, true);

      xmlhttp.onreadystatechange=function()
      {
         if (xmlhttp.readyState == 4)
         {
            if (xmlhttp.status == 200)
            {
                byId('resultado').innerHTML = 'Concluído.';
                alert(xmlhttp.responseText);
                // Zerar valores
                byId('lembreteUsuario').value = '';
                byId('senhaSite').style.display = 'none';
                byId('divCentral').style.display = 'none';
                byId('resultado').innerHTML = '';
            }
            else
            {
                  alert('Não foi possível processar a sua solicitação. Tente novamente!');
            }
         }
      }

      xmlhttp.send(null);
   }
}

function lembreteDeSenha2()
{

   var xmlhttp = null;

   try
   {
       xmlhttp = new XMLHttpRequest();
   }
   catch(e1)
   {
      try
      {
          xmlhttp = new ActiveXObject('Ms2xml.XMLHTTP');
      }
      catch(e2)
      {
         try
         {
            xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
         }
         catch(e3)
         {
            xmlhttp = null;
         }
      }
   }

   if(xmlhttp == null)
   {
       alert('Ocorreu um erro durante o processamento da informação. Tente novamente!');
   }
   else
   {
      byId('resultado3').innerHTML = 'Processando...';
      xmlhttp.open("GET", "funcoes/php/lembrete.php?usuario=" + byId('lembreteUsuario2').value, true);

      xmlhttp.onreadystatechange=function()
      {
         if (xmlhttp.readyState == 4)
         {
            if (xmlhttp.status == 200)
            {
                byId('resultado3').innerHTML = 'Concluído.';
                alert(xmlhttp.responseText);
                // Zerar valores
                byId('lembreteUsuario2').value = '';
                byId('senhaAss').style.display = 'none';
                byId('resultado3').innerHTML = '';
            }
            else
            {
                  alert('Não foi possível processar a sua solicitação. Tente novamente!');
            }
         }
      }

      xmlhttp.send(null);
   }
}

function destaque(botao)
{
	for (i = 1; i <= 7; i++)
	{
		if (i == botao)
		{
			byId('conteudo' + botao).style.display = 'block';
			byId('botao' + botao).className = 'active';
		}
		else
		{
			byId('conteudo' + i).style.display= 'none';
			if (i < 7)
			{
				byId('botao' + i).className = 'menufaq';
			}

		}
	}
}
