function showLogin(message,target,returl){var query='&prefix=sakiyama&warnings='+message+'&eid=0';$.ajax({ type: 'POST', data: query, url: 'http://www.sachikoakiyama.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=sakiyama');});$('#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" : "sakiyama", "username" : username, "password" : password, "perpetual" : perpetual };$.ajax({ type: 'POST', data: jsonvar, url: 'http://www.sachikoakiyama.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=sakiyama&warnings='+message+'&eid=0'; $.ajax({ type: 'POST', data: query, url: 'http://www.sachikoakiyama.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.sachikoakiyama.com/common/login/accountForm.php', success: function(data) {$(target).html(data);$('#createAccountForm').submit(function(){var query='&prefix=sakiyama&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.sachikoakiyama.com/common/login/accountProcess.php', success: function(data) {$(target).html(data);$('#goBackCreateAccount').submit(function(){var query='&prefix=sakiyama&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=sakiyama'; $.ajax({ type: 'POST', data: query, url: 'http://www.sachikoakiyama.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=sakiyama&email_address='+email_address+'&eid=1'; $.ajax({ type: 'POST', data: query, url: 'http://www.sachikoakiyama.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 mainboxHeight(factor){var cHi = $(document).height();var hHi = $('#header').height();var fHi = $('#footer').innerHeight();var nHi = cHi-hHi-fHi-factor;$('#mainbox').css('height',nHi+'px');var mbhi = $('#mainbox').innerHeight();return mbhi;}function mainHeight(factor){var cHi = $(document).height();var hHi = $('#header').height();var fHi = $('#footer').innerHeight();var nHi = cHi-hHi-fHi-factor;$('#main').css('height',nHi+'px');}function moveMenubox(){var dWi = $(document).width();var cWi = $('#container').width();var sideW = Math.round((dWi-cWi)/2)-2;$('#container #usermenu').css('right',(0-sideW)+'px');}function quickChangeState(table_prefix,themodule,buttonclass,thefield,blabel,theid){$('#controlbarextra'+theid+' a.'+buttonclass).css('opacity',0.25);$('#controlbarextra'+theid+' a.'+buttonclass).load('http://www.sachikoakiyama.com/common/multi/changestate.php', {'prefix' : table_prefix,'module' : themodule,'thefield' : thefield,'blabel' : blabel,'theid' : theid}, function(v){$(this).css('opacity',1);var valarr = v.split(':');var nextvalue = valarr[0];$(this).html(valarr[1]);if(nextvalue == 0){$('#entry'+theid).removeClass('draft');}if(nextvalue == 9){$('#entry'+theid).addClass('draft');}if(blabel == 'undelete'){$(window).reload();}});}function quickChangeOrder(table_prefix,themodule,family,category,numval,theid){$('#displayorderselect'+theid).css('opacity',0.25);$.get('http://www.sachikoakiyama.com/common/multi/changeorder.php', {'prefix' : table_prefix,'module' : themodule,'family' : family,'category' : category,'numval' : numval,'theid' : theid});}$(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);});});