function fFeedBack(o,x,y) {
    var altura;
    var largura;
    var local;

	//local = document.all.corpo;
	local = document.getElementById('container');

    var div = new criarDivFeedBack(local);
    div.mostrarDiv(); 
    
    var box = document.getElementById('boxAlerta');
    
    if(o==0) {
        //
        //    Efeito de transição
        //
        div.moverDiv(x,y);
    }
    
    if(o==1) {
        //
        //    Efeito de escurecimento
        //
        div.escurecerDiv(x,y);
    }
    
    //box.onclick = function() {
       // div.removerDiv();
   // }
   document.getElementById("divFeedBack").style.display = "block";

}
function criarDivFeedBack(local) {

    //
    // Definição dos atributos da div
    //
    var div;

    //
    // Método construtor
    //
    function construirDiv(local) {

        div = document.getElementById('boxAlerta');

        //
        // Pega os estilos da div
        //
        var estilo = div.style;

        //
        // Aplicando os estilos
        //
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
        estilo.position = "absolute";
        estilo.top = 0;
        estilo.left = 0;
        estilo.height = yScroll + "px";
        estilo.width = xScroll + "px";
        //estilo.border = "solid 1px #000000";
        estilo.background = "#000000";
        //estilo.filter = "alpha(opacity=75)"; //Serve só para IE
		estilo.opacity = "0.75"
		estilo.display = "block";
    }
    
    //
    // Exibe a div
    //
    this.mostrarDiv = function() {
        local.appendChild(div);
    }

    //
    // Remove a div do local
    //
    this.removerDiv = function() {
        try{
            local.removeChild(div);
			document.getElementById("divFeedBack").style.display = "none";
        }
        catch(e){}
    }

    //
    // Atualiza a div
    //
    function atualizarDiv() {
        removerDiv();
        mostrarDiv();
    }

    //
    // Redimensiona a Div
    //
    function redimensionarDiv(largura,altura) {
		
	    div.style.height = altura;
        div.style.width = largura;
    }
    
    //
    // Escurece a div
    //
    this.escurecerDiv = function(velocidade,opacidade) {
        div.style.filter = "alpha(opacity=0)";
        
        while(velocidade <= opacidade) {
            velocidade += velocidade;
            div.style.filter = "alpha(opacity="+velocidade+")";
        }
        div.style.filter = "alpha(opacity="+opacidade+")";
    }
    
    //
    // Move a div
    //
    this.moverDiv = function(velocidade,opacidade) {
        div.style.filter = "alpha(opacity="+opacidade+")";
        var valor = div.offsetWidth;
        var posicao = -valor;
        div.style.left = posicao;
    
        while(posicao <= 0) {
            posicao += velocidade;
            div.style.left = posicao;
        }
        div.style.left = 0;
    }
    construirDiv(local);
}
function fFechaFeedBack()
{
	document.getElementById("divFeedBack").style.display = "none";
	document.getElementById("boxAlerta").style.display = "none";
}

function fFechaAbaFeedBack()
{
	document.getElementById("feedback_site_tab").style.display = "none";
}


function fmostradetalhes(obj,sImg)
{
	hideAll();
	//alert(obj);
	document.getElementById(obj).style.display='block';
	//document.getElementById('menu_produtos').src='../imagens/menu_produtos_'+ sImg +'.jpg';
}
function hideAll() {
		document.getElementById('rico_verdade').style.display='none';
		document.getElementById('pegadas').style.display='none';
		document.getElementById('metanoia').style.display='none';
		document.getElementById('ndp').style.display='none';
		document.getElementById('cma').style.display='none';
		// document.getElementById('livroricodeverdade').style.border='none 0px';
		
		
		// padding:5px;border-color: #000000'
		
}

function fmostradetalhes1(obj,sImg)
{
	hideAll1();
	//alert(obj);
	document.getElementById(obj).style.display='block';
	//document.getElementById('menu_produtos').src='../imagens/menu_produtos_'+ sImg +'.jpg';
}
function hideAll1() {
		document.getElementById('metanoia').style.display='none';
		document.getElementById('LAV').style.display='none';
		document.getElementById('guinada').style.display='none';
		document.getElementById('provocacao').style.display='none';
		
}


function fValidaBuscaArtigos()
{
	//Verifica se selecionou algum filtro
	if (frmArtigos.txt_Busca.value == " Palavra-chave...")
	{
		alert("Entre com uma palavra-chave para sua pesquisa.");
		frmArtigos.txt_Busca.focus();
		return (false);
	}

	//Verifica se digou alguma palavra-chave...
	if (frmArtigos.txt_Busca.value != " Palavra-chave..." && frmArtigos.txt_Busca.value.length < 3)
	{
		alert("Sua pesquisa deve ter no mínimo 3 caracteres.");
		frmArtigos.txt_Busca.focus();
		return (false);
	}
}

function addEvent(obj, evt, func) {
  if (obj.attachEvent) {
    return obj.attachEvent(("on"+evt), func);
  } else if (obj.addEventListener) {
    obj.addEventListener(evt, func, true);
    return true;
  }
  return false;
}


function XMLHTTPRequest() {
  try {
    return new XMLHttpRequest(); // FF, Safari, Konqueror, Opera, ...
  } catch(ee) {
    try {
      return new ActiveXObject("Msxml2.XMLHTTP"); // activeX (IE5.5+/MSXML2+)
    } catch(e) {
      try {
        return new ActiveXObject("Microsoft.XMLHTTP"); // activeX (IE5+/MSXML1)
      } catch(E) {
        return false; // doesn't support
      }
    }
  }
}

function buscarEndereco() {
  var campos = {
    tCEP: document.getElementById("tCEP"),
    tEndereco: document.getElementById("tEndereco"),
    tBairro: document.getElementById("tBairro"),
    tCidade: document.getElementById("tCidade"),
    tEstado: document.getElementById("tEstado")
  };
  var ajax = XMLHTTPRequest();
  ajax.open("GET", ("cep/leitor.asp?tCEP=" + campos.tCEP.value.replace(/[^\d]*/, "")), true);
  ajax.onreadystatechange = function() {
    if (ajax.readyState == 1) {
      campos.tEndereco.disabled = true;
      campos.tBairro.disabled = true;
      campos.tCidade.disabled = true;
      campos.tEstado.disabled = true;
      campos.tEndereco.value = "carregando...";
      campos.tBairro.value = "carregando...";
      campos.tCidade.value = "carregando...";
      //campos.Estado.value = "carregando...";
    } else if (ajax.readyState == 4) {
      var r = ajax.responseText, i, tEndereco, tBairro, tCidade, tEstado;
      tEndereco = r.substring(0, (i = r.indexOf(',')));
      r = r.substring(++i);
      tBairro = r.substring(0, (i = r.indexOf(',')));
      r = r.substring(++i);
      tCidade = r.substring(0, (i = r.indexOf(',')));
      r = r.substring(++i);
      tEstado = r.substring(0, (i = r.indexOf(',')));
      //r = r.substring(++i);
      campos.tEndereco.disabled = false;
      campos.tBairro.disabled = false;
      campos.tCidade.disabled = false;
      campos.tEstado.disabled = false;
      campos.tEndereco.value = tEndereco;
      campos.tBairro.value = tBairro;
      campos.tCidade.value = tCidade;
      //campos.tEstado.value = tEstado;

      i = campos.tEstado.options.length;
      while (i--) {
       if (campos.tEstado.options[i].getAttribute("value") == tEstado) {
          break;
        }
      }
      campos.tEstado.selectedIndex = i;
    }
  };
  ajax.send(null);
}

function refreshCaptcha(){
document.getElementById('txt_key').value='';
document.getElementById('captchaImage').src="captcha.asp?_rnd=" + Math.random();
}





