function showLogin(message,target,returl){var query='&prefix=wbeasley_saxmeditations&warnings='+message+'&eid=0';$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/loginForm.php', success: function(data) {$(target).html(data);$('#memberLogin').submit(function(){var uname = encodeURI($('#memberLogin input#myusername').val());var pword = encodeURI($('#memberLogin input#mypassword').val());var perpetual = encodeURI($('#memberLogin input#perpetual').val());processLogin(uname,pword,perpetual,returl,'#loginentry');});$('#createAccountButton').click(function(){showCreateAccount(target,'&prefix=wbeasley_saxmeditations');});$('#lostPasswordButton').click(function(){showLostpw(target);});$('#closeWindow,#darkmask').click(function(){$(target).fadeOut('fast');});}});$(target).fadeIn('fast');return false;}function processLogin(username,password,perpetual,returl,target){var jsonvar = { "prefix" : "wbeasley_saxmeditations", "username" : username, "password" : password, "perpetual" : perpetual };$.ajax({type: 'POST', data: jsonvar, url: 'http://www.saxmeditations.com/common/login/loginProcess.php', success: function(data) {$(target).html(data);var st = setTimeout(function(){ $('#loginentry,#darkmask').fadeOut(); location.reload(); },5000);$('#continueButton').click(function(){ $('#loginentry,#darkmask').fadeOut(); location.reload(); });$('#goBack').click(function(){var message = encodeURI('enter your username and password.');showLogin(message,target,returl);clearTimeout(st);});$('#darkmask,#closeWindow').click(function(){ $('#loginentry,#darkmask').fadeOut(); });}});}function showLogOut(message,target,returl){var query='&prefix=wbeasley_saxmeditations&warnings='+message+'&eid=0';$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/logOutProcess.php', success: function(data) {$(target).html(data);$('#closeWindow,#darkmask').click(function(){$('#loginWindow').fadeOut('fast');});}});$(target).animate({'fadeIn': '100%'}, 'fast');}function showCreateAccount(target,query){$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/accountForm.php', success: function(data) {$(target).html(data);$('#createAccountForm').submit(function(){var query='&prefix=wbeasley_saxmeditations&first_name='+encodeURI($('#first_name').val())+'&username='+encodeURI($('#username').val())+'&email_address='+encodeURI($('#email_address').val())+'¬ify='+encodeURI($('#notify').val())+'&level_seven_request='+encodeURI($('#level_seven_request').val())+'&recaptcha_challenge_field='+encodeURI($('#recaptcha_challenge_field').val())+'&recaptcha_response_field='+encodeURI($('#recaptcha_response_field').val())+'';processNewAccount(query,'#loginentry');});$('#membersLoginButton').click(function(){var message = encodeURI('enter your username and password.');showLogin(message,'#loginWindow',returl);});$('#darkmask,#closeWindow').click(function(){$(target).fadeOut('fast');});}});$(target).fadeIn('fast');}function processNewAccount(query,target){$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/accountProcess.php', success: function(data) {$(target).html(data);$('#goBackCreateAccount').submit(function(){var query='&prefix=wbeasley_saxmeditations&first_name='+encodeURI($('#first_name').val())+'&username='+encodeURI($('#username').val())+'&email_address='+encodeURI($('#email_address').val())+'¬ify='+encodeURI($('#notify').val())+'';showCreateAccount('#loginWindow',query);$('#darkmask,#closeWindow').click(function(){location.reload(true);});});$('#darkmask,#closeWindow').click(function(){$(target).fadeOut('fast');});}});$(target).fadeIn('fast');}function showLostpw(target){var query='&prefix=wbeasley_saxmeditations';$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/lostpwForm.php', success: function(data) {$(target).html(data);$('#lostpw').submit(function(){var email_address_val = encodeURI($('#lostpw #email_address').val());processLostpw(email_address_val,'#loginentry');});$('#memberLogin').click(function(){var message = encodeURI('enter your username and password.');showLogin(message,'#loginWindow',returl);});$('#darkmask').click(function(){$(target).fadeOut(300);});}});$(target).fadeIn('fast');}function processLostpw(email_address,target){var query='&prefix=wbeasley_saxmeditations&email_address='+email_address+'&eid=1';$.ajax({type: 'POST', data: query, url: 'http://www.saxmeditations.com/common/login/lostpwProcess.php', success: function(data) {$(target).html(data);$('#goBack').click(function(){showLostpw(target);});$('#memberLogin').click(function(){var message = encodeURI('enter your username and password.');showLogin(message,'#loginWindow',returl);});$('#closeWindow').click(function(){location.reload(true);});$('#darkmask').click(function(){location.reload(true);});}});$(target).fadeIn('fast');}function cookieNotice(prefix){$('#container').append('
');$('#cookienoticewrap').load('/common/cookies/index.php', {'prefix' : prefix }, function(){$('#cookiebutton').click( function(){$('#cookienotice').load('/common/cookies/index.php', {'cookie_okay' : 1, 'prefix' : prefix }, function(){$('#cookienoticewrap').remove();location.reload();});});$('#nocookiebutton').click( function(){$('#cookienotice').load('/common/cookies/index.php', {'cookie_not_okay' : 1, 'prefix' : prefix }, function(){$('#cookienoticewrap').remove();location.reload();});});});}$(document).ready( function(){$('#loginbutton').html('admin');$('a#loginbutton').css('cursor','pointer');$('a#loginbutton').click(function(e){e.preventDefault();var returl = $('#slab_returl').html();var message = encodeURI('Please enter your username and password. If you would like to create a new account, click the appropriate button below.');showLogin(message,'#loginWindow',returl);});});