$(document).ready(function() { $("a[filter]").click(function() { FilterQuestions($(this).attr("filter")); }); }); function ClearFilters() { $("a[filter]").attr("style", "font-weight:normal"); } function FilterQuestions(filter) { var questionsContainer = $("#questionsContainer"); questionsContainer.find("table[status]").hide(); if (filter != "all") { questionsContainer.find("table[status='" + filter + "']").show(); questionsContainer.find("table[profileType = '" + filter + "']").show(); } else { $("table[status]").show(); } ClearFilters(); $("a[filter='"+ filter +"']").attr("style", "font-weight: bolder"); } function ShowReply(questionId, btn) { $(btn).hide(); $("table[contains='question'][questionId='" + questionId + "']").fadeIn("slow"); } function Cancel(questionId) { $("table[btn='showReply'][questionId='" + questionId + "']").show(); $("table[contains='question'][questionId='" + questionId + "']").hide(); } function Reply(questionId, btn) { var answer = $(":input[questionId='" + questionId + "']").val(); if (answer != "") { var replyContainer = $(btn).parents("div[contains='reply']"); var questionContainer = replyContainer.next(); replyContainer.hide(); questionContainer.text(answer); questionContainer.fadeIn(); var img = $("img[questionId='" + questionId + "']"); img.attr("src", img.attr("src").replace("gray", "orange")); $("div[contains='replyDate'][questionId='" + questionId + "']").fadeIn(); $("div[contains='answerDate'][questionId='" + questionId + "']").fadeIn(); $.post("http://eshops.licenciasonline.com/argentina/Servicios/Mi-Perfil", { action: "ReplyQuestion", questionId: questionId, answer: answer }); } else { var message = $(btn).parents("div[contains='reply']").find(":input").next().html(); } } function GoToQuestion() { $.scrollTo('#gotoQuestion', 500); $("#txtQuestion").focus(); } function SendQuestion(btn) { $.post("http://eshops.licenciasonline.com/argentina/Servicios/Mi-Perfil", { action: "AddQuestion", question: $("#txtQuestion").val(), etailerId: $(btn).attr("etailerId"), membershipId: $(btn).attr("membershipId") }, function() { $.post("http://eshops.licenciasonline.com/argentina/Servicios/Mi-Perfil", { action: "BuildQuestion", question: $("#txtQuestion").val() }, function(htmlQuestion) { $("div[contains='topQuestion']").prepend(htmlQuestion).fadeIn(); $("#txtQuestion").val(""); }); }); }