function PasswordReset(n){n.message.trim()=="success"?(document.getElementById("paswordSent").style.display="block",document.getElementById("forgotPassword").style.display="none"):document.getElementById("errorMessage").innerHTML="Error: "+n.message.trim()}function DisplayForgotPassword(){var n=$.ajax({url:"/Ajax/DisplayForgotPassword",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){document.getElementById("forgotPasswordInnerPanel").innerHTML=n;$("#forgot-modal").modal("show")})}function displayAddSchoolForm(){var n=$.ajax({url:"/Ajax/DisplayAddSchoolForm",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){document.getElementById("addSchoolInnerForm").innerHTML=n;$("#addSchool-modal").modal("show")})}function ShowConfirm(n,t,i,r,u){var f=$(this).closest(".item");return $.confirm({title:n,message:t,buttons:{OkBtnCaption:{"class":"blue",action:function(){$("#"+u).prop("onclick",null).off("click");$("#"+u).click()},id:"okBtn",value:"I'm NOT a robot",text:"I'm NOT a robot"},CancelBtnCaption:{"class":"gray",action:function(){},id:"cancelBtn",value:"I'm a robot",text:"I'm a robot"}}}),!1}function openTeacherLinkedModal(){displayLinkedTeacherForm()}function openTutorLinkedModal(){var n=$.ajax({url:"/Ajax/DisplayLinkedTutorForm",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){document.getElementById("linkedTutorInnerForm").innerHTML=n;$("#tutor_linkedModal").modal("show")})}function hideDropdown(){$('[data-toggle="dropdown"]').parent().removeClass("open")}function closeOptionModal(n){$("#optionRegister-modal").modal("hide");showModal(n)}function checkIfVerifyOrLogin(){var n=$.ajax({url:"/VerifyEmail/CheckIfUserLoginOrVerify",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){n=="notLoggedIn"?$("#login-modal").modal("show"):"false"&&$("#verifyEmail-modal").modal("show")})}function disableButton(n){return document.getElementById(n)&&(document.getElementById(n).disabled=!0),!0}function checkUserSchoolPicked(){var n=$.ajax({url:"/General/CheckUserSchoolPicked",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){n!=""&&((n.type=="School"||n.type=="Teacher")&&n.hasSchool.toLowerCase()=="false"?displayLinkedTeacherForm():n.type=="Tutor"&&n.hasSchool.toLowerCase()=="false"?openTutorLinkedModal():window.location.href="/StagingUserarea/CheckType")})}function displayLinkedTeacherForm(){var n=$.ajax({url:"/Ajax/DisplayLinkedTeacherForm",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){document.getElementById("linkedTeacherInnerForm").innerHTML=n;$("#teacher_linkedModal").modal("show");document.getElementById("changeSchoolTutorCloseX")&&(document.getElementById("changeSchoolTutorCloseX").style.display="none")})}function closeTutorCentreModal(){$("#tutor_linkedModal").modal("hide");DisplayAddTutorCentreModal()}function closeSchoolModal(){$("#teacher_linkedModal").modal("hide");displayAddSchoolForm()}function verifyChangeConfirmEmail(){var n=$.ajax({url:"/VerifyEmail/GetUsersAttempts",type:"GET"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){n!="null"&&(document.getElementById("emailCodeAttempts_hidden").value=n,n=="0"?document.getElementById("attempts_verifyEmail").style.display="none":(document.getElementById("attempts_verifyEmail").style.color="#c0392b",document.getElementById("attempts_verifyEmail").innerText="You have attempted "+n+"/3 times.",document.getElementById("attempts_verifyEmail").style.display="block"))})}function setLinkedTeacherFix(){if(document.getElementById("teacher_linked_lbl").value="1",checkFilledIn("teacher"))setToLinkedTeacher("teacher");else return!1;return!0}function setLinkedTutorFix(){if(document.getElementById("tutor_linked_lbl").value="1",checkFilledIn("tutor"))setToLinkedTutor("tutor");else return!1;return!0}function checkFilledInWithCallback(n,t,i){return checkFilledIn(n)?i(t):!1}function checkFilledIn(n){return document.getElementById(n+"ReceiveNewsletterChk")&&document.getElementById(n+"ReceiveNewsletterChk").checked?check(n):document.getElementById(n+"DontReceiveNewsletterChk")&&document.getElementById(n+"DontReceiveNewsletterChk").checked?check(n):(alert("You need to select your newsletter preference!"),!1)}function check(n){n=="parent"&&(isParent=!0);try{var i=document.getElementById(n+"_firstNumber").value,r=document.getElementById(n+"_secondNumber").value,t=Number(i)+Number(r),u=parseInt(document.getElementById(n+"_question").value);if(document.getElementById(n+"_question").value=="")document.getElementById(n+"_answer_msg2").style.display="none";else if(u!=t)document.getElementById(n+"_answer_msg2").style.display="block",t<10?document.getElementById(n+"_question").value="":document.getElementById(n+"_question").value.length>1&&(document.getElementById(n+"_question").value="");else return document.getElementById(n+"_answer_msg2").style.display="none",!0}catch(f){return!0}}function changeNavigationLink(n){n&&(document.getElementById("starATag")&&document.getElementById("starATag").setAttribute("href","/Home#reviewSection"),document.getElementById("productsATag")&&document.getElementById("productsATag").setAttribute("href","/Home#topPage"))}function closeLoginOpenForgot(){$("#login-modal").modal("hide");DisplayForgotPassword()}function closeForgotOpenLogin(){$("#forgot-modal").modal("hide");$("#login-modal").modal("show")}function closeBoth(){$("#forgot-modal").modal("hide");$("#login-modal").modal("hide")}function OpenOrCloseModal(n){if(n.redirectURL!=null){$("#login-modal").modal("hide");var t=$.ajax({url:"/General/CheckUsersEmailVerified",type:"POST"});t.fail(function(n,t){alert("Request failed: "+t+n.responseText)});t.done(function(t){t=="verified"||n.redirectURL.toLowerCase().indexOf("desk")>=0?n.redirectURL.toLowerCase()=="/staginguserarea"?CheckTypeSchoolNoSchool():RedirectUserJSON(n):(document.getElementById("verify_emailModal").style.display="block",getVerificationAttempts(),$("#verifyEmail-modal").modal("show"))})}else location.pathname=="/Cart/ShoppingCartLogin"&&(document.getElementById("shoppingLogin_feedback").style.display="block")}function CheckTypeSchoolNoSchool(){var n=$.ajax({url:"/General/CheckTypeSchoolNoSchool",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t+n.responseText)});n.done(function(n){if(n!="False")RedirectUserJSON(n);else{$("#schoolTable").on("click","td",function(){var n=$(this).closest("tr").attr("id");registerUserToSchool(n)});CheckTypeOfUser()}})}function CheckTypeOfUser(){var n=$.ajax({url:"/General/GetUsersCType",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){if(n!="null")if(n=="/UserArea")RedirectUserJSON("/UserArea");else{var t=$.ajax({url:"/Ajax/DisplayLinkedTeacherForm",type:"POST"});t.fail(function(n,t){alert("Request failed: "+t)});t.done(function(n){document.getElementById("linkedTeacherInnerForm").innerHTML=n;$("#teacher_linkedModal").modal("show")})}})}function RedirectUserJSON(n){var t=$.ajax({url:"/Ajax/ShowGDPRStatus",type:"POST"});t.fail(function(){completeRedirect(n)});t.done(function(t){t=="yes"?showGDPRBox(n):completeRedirect(n)})}function SetMarketingPreference(n){var t=$.ajax({url:"/Ajax/SetMarketingPreference",type:"POST",data:{result:n}});t.fail(function(){completeRedirect(result)});t.done(function(){completeRedirect(redirectResultStore)})}function showGDPRBox(n){redirectResultStore=n;$("#GDPRGeneral-modal").modal("show")}function completeRedirect(n){n.redirectURL!=null?window.location.href=n.redirectURL:n.length>0&&(window.location.href=n)}function changeNavigationImage(n,t){var i;switch(t){case"green":i="#2ecb71";break;case"blue":i="#40A6C1";break;case"purple":i="#8B8BE4";break;case"pink":i="#d787af"}document.getElementById(n+"IMG").src="/images/"+n+t+".png";document.getElementById(n+"ATag").style.color=i}function originalNavigationImage(n){document.getElementById(n+"IMG").src="/images/"+n+".png";document.getElementById(n+"ATag").style.color="#bebebe"}function showModal(n){var t=$.ajax({url:"/Ajax/DisplayRegisterForm",type:"POST"});t.fail(function(n,t){alert("Request failed: "+t)});t.done(function(t){document.getElementById("registerModalInnerBox").innerHTML=t;var i=document.getElementById("tutor_register"),r=document.getElementById("teacher_register"),u=document.getElementById("parent_register");switch(n){case"teacher":i.style.display="none";u.style.display="none";r.style.display="block";break;case"parent":i.style.display="none";u.style.display="block";r.style.display="none";break;case"tutor":i.style.display="block";u.style.display="none";r.style.display="none"}$("#register-modal").modal("show")})}function registerUser(){var n;document.getElementById("tutor_register").style.display=="block"?n="tutor":document.getElementById("teacher_register").style.display=="block"?n="teacher":document.getElementById("parent_register").style.display=="block"&&(n="parent");document.getElementById("register_form").setAttribute("action","/Register/RegisterUser?id="+n)}function showForgotPassword(){}function getUsersCType(){var n=$.ajax({url:"/General/GetUsersCType",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){n!="null"&&RedirectUserJSON(n)})}function openModal(n){n=="login-modal"&&(document.getElementById("navigationBar").setAttribute("class","navbar-collapse dropdownMenu collapse"),document.getElementById("navBarNavToggle").setAttribute("class","navbar-toggle collapsed"))}function closeAllModals(n){for(var i=["#login-modal","#optionRegister-modal","#register-modal","#review-modal","#editPersonalDetails-modal","#resetPassword-modal","#allTutors-modal","#tutorDetails-modal"],t=0;t<8;t++)i[t]=="#"+n?$("#"+n).modal("show"):$(i[t]).modal("hide")}function DisplayAddTutorCentreModal(){var n=$.ajax({url:"/Ajax/DisplayAddTutorCentre",type:"POST"});n.fail(function(n,t){alert("Request failed: "+t)});n.done(function(n){document.getElementById("addTutorCentreInnerFormA").innerHTML=n;$("#addTutorCentre-modal").modal("show")})}var review=0,quote=0,redirectResultStore,numberOfVoucherTextBox=1,numberOfLoginVoucherTextBox=1,teacherOpenOrClose="close",tutorOpenOrClose="close",teacherLinked=!1,tutorLinked=!1,alreadyUpdatedUser=!1,isParent=!1,isParentVoucher=!1,voucherJson="",currentIndex=1,currentTutorPageIndex=1,tutorCurrentJsonIndex=0,tutorNextJsonIndex=10,tutorJson="",tutorJsonCount=0