$(document).ready(function () { $(window).resize(function(){ $('#statisticCenterMiddle').jScrollPane(); }) $("#testStatistic td").click(function () { var currentQuestion = $("div", this); $.ajax({ url: "/include/pay_testing/get_statistic.asp", type: "GET", data: "questionNum=" + currentQuestion.attr("data-id").split("-")[1], // Get question number. Template: {questionId}-{answerId} dataType: "json", scriptCharset: "utf-8", success: function (data) { var err = data.errorText; if (err == 403) { // User unauth window.location.href = "/include/login_new.asp?returnUrl=" + window.location.pathname; } fillPopup(data, currentQuestion); $('#overlay').fadeIn(400); $("#currentTestStatistic").fadeIn(400, function() { $(currentQuestion).parent().addClass("visitedAnswer"); }).css('z-index','99999'); $('#statisticCenterMiddle').jScrollPane(); } }); }); /* Start Buttons Handlers */ $("#statisticLink").click(function () { $("#userStatisticPopUp").fadeIn(400).css('z-index','99999'); $('#overlay').fadeIn(400); $('.historySlider').jScrollPane(); }); $('#overlay').click(function (e) { $('#overlay').fadeOut(300, function () { $('#userStatisticPopUp').css('z-index', '1').fadeOut(300); $("#currentTestStatistic").css('z-index', '1').fadeOut(300); $("#simplePopUp").css('z-index', '1').fadeOut(300); $("#simplePopUp").css('z-index','1').fadeOut(300); $("#feedbackPopUp").css('z-index','1').fadeOut(300); }); }); $('#userStatisticPopUp .close').click(function (e) { $('#overlay').fadeOut(300, function () { $('#userStatisticPopUp').css('z-index', '1').fadeOut(300); }); }); $('#currentTestStatistic .close').click(function (e) { $('#overlay').fadeOut(300, function () { $('#currentTestStatistic').css('z-index', '1').fadeOut(300); }); }); $('#feedbackPopUp .close').click(function (e) { var answerBlock = $("#currentTestStatistic"); if(answerBlock.css("display") == "none" && answerBlock.css("z-index") != "99999"){ $('#overlay').fadeOut(300, function () { $('#feedbackPopUp').css('z-index', '1').fadeOut(300); }); } else { $('#feedbackPopUp').css('z-index', '1').fadeOut(300, function () { answerBlock.fadeIn(300); }); }; }); $("#confirm").click(function () { if (!$("input[name=answer]:checked").val()) { event.preventDefault(); $("#overlay").fadeIn(400); $("#approvePopUp").fadeIn(400).css('z-index','99999'); } }); $("#stopTest").click(function () { $("#overlay").fadeIn(400); $("#simplePopUp").fadeIn(400).css('z-index','99999'); }); $("#endTest").click(function () { location.href = '/'; }); $(".cancel").click(function () { $("#simplePopUp").css('z-index','1').fadeOut(300); $("#approvePopUp").css('z-index','1').fadeOut(300); $("#overlay").fadeOut(300); }); /* End Buttons Handlers */ /* Start Validation */ $("form[name='startForm']").submit(function () { var isValid = false; if ($("input[name=typeOfQuestion]:checked").val() && $("input[name=CountQuestion]:checked").val()) { isValid = true; } if (!isValid) { alert("Не выбраны параметры теста!"); event.preventDefault(); } }); /* End Validation */ }); function fillPopup(data, questionOnTable) { $("#questionNum").html("