$(function(){
  
	showHideFaq();

        $("#fldBuscaFaq").keyup(function(){
            if ($(this).val().length > 3){
                query = $(this).val();

                $.ajax({
                    url: $("#fldRootPath2").val() + "/ajax/faq/"+ query +"/",
                    cache: true,
                    success: function(html){
                        $("#faq_conteudo").html(html);
                        showHideFaq();
                    }
                });
            }
            else {
                query = 'NULL';
            }
        });

});

function showHideFaq(){
    $("div.faq_min").click(function(){
        obj = $(this).find("div.resposta");

	if (obj.css('display') == 'none'){
		$(this).find("p.icone").html("<p>-</p>");
		obj.slideDown("slow");
		return (false);
	}
	else {
		$(this).find("p.icone").html("<p>+</p>");
		obj.slideUp("slow");
		return (false);
	}

    }).mouseover(function(){
	$(this).css('cursor','pointer');
    });
}
