function showVirtualKeyboard(){$("#VirtualKeyboard").show();$("#ShowKeyboardMessage").hide();$("#KeyboardOptionsShowVKBD").hide();$("#KeyboardOptionsHideVKBD").show();if(g_keyboardIsVisible!=null){$.post(g_basedir_with_lang+"/typing-tutor/preferences",{ShowKeyboard:"1"})}g_keyboardIsVisible=true}function hideVirtualKeyboard(){$("#VirtualKeyboard").hide();$("#ShowKeyboardMessage").show();$("#KeyboardOptionsShowVKBD").show();$("#KeyboardOptionsHideVKBD").hide();if(g_keyboardIsVisible!=null){$.post(g_basedir_with_lang+"/typing-tutor/preferences",{ShowKeyboard:"0"})}g_keyboardIsVisible=false}function displaySoundOptions(){if(g_soundEnabled){$("#KeyboardOptionsEnableSounds").hide();$("#KeyboardOptionsDisableSounds").show()}else{$("#KeyboardOptionsEnableSounds").show();$("#KeyboardOptionsDisableSounds").hide()}}function enableSounds(){saveSoundEnabled(1);displaySoundOptions()}function disableSounds(){saveSoundEnabled(0);displaySoundOptions()}function saveSoundEnabled(A){$.post(g_basedir_with_lang+"/typing-tutor/preferences",{EnableSound:A});g_soundEnabled=A}var lockGoExercise=false;function goExercise(exerciseStep){if(lockGoExercise){return}lockGoExercise=true;g_exerciseID+=exerciseStep;$.ajax({type:"POST",url:g_basedir_with_lang+"/typing-tutor/practice",data:{actionkey:"get-exercise-text",lesson:g_lessonID,exercise:g_exerciseID},async:true,cache:false,global:false,error:function(XMLHttpRequest,textStatus,errorThrown){lockGoExercise=false},success:function(data,textStatus){var jsText="";if(exerciseStep!=0){jsText=data;if(!jsText||!jsText.length||jsText=="reload"){var url="";if(exerciseStep==-1){url=g_prevExerciseLink}if(exerciseStep==+1){url=g_nextExerciseLink}location.href=url}eval(jsText)}resetExercise()}})}function resetExercise(){finished=g_exercise.isFinished();g_totalScore+=g_exercise.getStatistics().getScore();if(g_isGuestUser){g_totalScore=0}$("#ExerciseScoreTable").hide();$("#ExerciseScoreOptions").hide();$("#AdviceRepeatExerciseBox").hide();$("#WarningNotEnoughAccuracy").hide();$("#WarningNotEnoughSpeed").hide();$("#KeyboardOptions").show();if(g_keyboardIsVisible){showVirtualKeyboard()}else{hideVirtualKeyboard()}$("#ExerciseNumber").html(g_exerciseID);$("#StatisticsTotalScore").html(""+g_totalScore);if(finished){$("#StatisticsTotalScore").css({fontSize:"2em",opacity:"0.0"});$("#StatisticsTotalScore").animate({fontSize:"1em",opacity:"1.0"},1500)}$("#StatisticsCPM").html("0");$("#StatisticsAccuracy").html("0");$("#StatisticsTime").html("0");main();lockGoExercise=false};