function onKeyDownHandler(inNativeEvent) {var key = getKey(inNativeEvent);if (key == System.key.enter) {login();}}function changeToRegisterForgotPassword() {window.location.href = "register.html";}function changeToContact() {window.location.href = "contact.html";}function changeToHelp() {window.location.href = "help.html";}function changeToProjects(inType) {if (inType == 1) {window.location.href = "octavus.html";} else {window.location.href = "project.html";}}function changeToPreferences() {window.location.href = "preferences.html";}/*** User interaction section*/function login() {var loginData = new Object();loginData.username = dojo.byId("usernameText").value;loginData.password = dojo.byId("passwordText").value;dojo.xhrPost({url: "action/login",handleAs: "json",headers: { "Content-Type": "application/json"},postData: dojo.toJson(loginData),handle: function(data, args) {var status = data.status;if (status == Status.ok) {changeMenuToUserLogin();if (document.getElementById("radTypeOctave").checked == true) {window.location.href = "octavus.html";} else {window.location.href = "project.html";}} else if (status == Status.login.missingField) {alert(languageNavigation.alertFillAllFields);} else if (status == Status.login.invalidCredentials) {alert(languageNavigation.alertInvalidCredentials);} else if (status == Status.login.inactive) {alert(languageNavigation.alertUserDeactivated);}}});}function logout() {dojo.xhrPost({url: "action/logout",handleAs: "json",headers: { "Content-Type": "application/json"},handle: function(data, args) {changeMenuToUserLogout();window.location.href = System.welcomeFile;}});}/** Hides all login and register fields and buttons and shows the 'project' and 'logout' button*/function changeMenuToUserLogin() {dojo.byId("changeLoginRegisterButton").style.display = "none";dojo.byId("usernameDiv").style.display = "none";dojo.byId("usernameText").style.display = "none";dojo.byId("passwordDiv").style.display = "none";dojo.byId("passwordText").style.display = "none";dojo.byId("loginButton").style.display = "none";dojo.byId("forgotPasswordHref").style.display = "none";dojo.byId("divTypeLaTeX").style.display = "none";dojo.byId("divTypeOctave").style.display = "none";dojo.byId("spanProjectType").style.display = "inline";dojo.byId("preferencesBtn").style.display = "inline";dojo.byId("logoutBtn").style.display = "inline";}function changeMenuToUserLogout() {dojo.byId("changeLoginRegisterButton").style.display = "inline";dojo.byId("usernameDiv").style.display = "inline";dojo.byId("usernameText").style.display = "inline";dojo.byId("passwordDiv").style.display = "inline";dojo.byId("passwordText").style.display = "inline";dojo.byId("loginButton").style.display = "inline";dojo.byId("forgotPasswordHref").style.display = "inline";dojo.byId("divTypeLaTeX").style.display = "inline";dojo.byId("divTypeOctave").style.display = "inline";dojo.byId("spanProjectType").style.display = "none";dojo.byId("preferencesBtn").style.display = "none";dojo.byId("logoutBtn").style.display = "none";}
