function getJSON(text){var json=eval('({"error":""})');if(text.substr(0,1)=="{"){try{var json=eval("("+text+")")}catch(error){}}return json}function displayError(A){$("#errorContainer").fadeOut("normal",function(){$(this).html(A).fadeIn();$.scrollTo("#content",{duration:"slow"})})}function submitForgotPass(){var A={mode:"forgotPassSubmit"};$.post("index.php",$.param(A)+"&"+$("#forgotPassForm").serialize(),function(C){var B=getJSON(C);if(B&&B.error){displayError(B.error)}else{$("#ajaxContent").fadeOut("normal",function(){$(this).html(C).fadeIn()})}})}function doLogin(A){var B={mode:"login"};$("#errorContainer").fadeOut();$.post("index.php",$.param(B)+"&"+$("#loginForm").serialize(),function(D){var C=getJSON(D);if(C&&C.error){displayError(C.error)}else{$("#ajaxContent").fadeOut("normal",function(){if(A){window.location="index.php"}else{window.history.go(0)}})}})}function doLogout(){var A={mode:"logout"};$.post("index.php",A,function(){window.history.go(0)})}function reloadPage(){window.history.go(0)};