function showLogin(prefix){var username='';var password='';var perpetual=0;$('a#loginbutton').click(function(a){a.preventDefault();$('#container').prepend('<div id="darkmask"></div><div id="loginentry" class="slab_login_form"></div>');loginEntry(prefix);});}
function loginEntry(prefix){$('#loginentry').load('/common/login/3.x/form.php',{'prefix':prefix},function(){$('#darkmask').click(function(){$('#darkmask,#loginentry').remove();});$('#memberLogin').submit(function(s){s.preventDefault();$('#loginentry .feedback').hide();username=$('#loginentry .username').val();password=$('#loginentry .password').val();perpetual=$('#loginentry .perpetual').val();$('#loginentry .feedback').load('/common/login/3.x/process.php',{'prefix':prefix,'username':username,'password':password,'perpetual':perpetual},function(l){$('#loginentry .feedback').fadeIn();if(l.search('success')>-1){$('#loginentry .moreoptions').hide();$('#memberLogin').hide();location.reload(true);}else{$('#loginentry input').blur();$('#loginentry input').focus(function(){$('#loginentry .feedback').hide();});}});});newAccount(prefix);lostPw(prefix);$('#loginentry .closewindow').click(function(){$('#darkmask,#loginentry').remove();location.reload(true);});});}
function newAccount(prefix){var pwstring;$('#loginentry .newaccount').click(function(){$('#loginentry').load('/common/login/3.x/account.php',{'prefix':prefix,'process':0},function(){$('#username').keyup(function(){var usernameval=$('#username').val();usernameval=usernameval.replace(/[^\w\-]/,'');$('#username').val(usernameval);});$('#password').keyup(function(){pwstring=$('#password').val();$('#pwstr').load('/common/login/3.x/pwstrength.php',{'pwstring':pwstring});});$('#createAccountForm').submit(function(s){s.preventDefault();var newmemberinfo=$(this).serialize();$('#loginentry .feedback').load('/common/login/3.x/account.php',newmemberinfo,function(a){$('#loginentry .feedback').show();if(a.search('success')>-1){$('#create_account_envelope').hide();}
$('#loginentry .closeWindow').click(function(){$('#loginentry,#darkmask').remove();location.reload('true');});});});$('#loginentry .login').click(function(){loginEntry(prefix);});$('#loginentry .closewindow').click(function(){$('#loginentry,#darkmask').remove();location.reload(true);});});});}
function lostPw(prefix){var process;var email_address;$('#loginentry .lostpw').click(function(){$('#loginentry').load('/common/login/3.x/lostpw.php',{'prefix':prefix},function(){$('#lostpw').submit(function(f){f.preventDefault();email_address=$('#email_address').val();$('#loginentry .feedback').load('/common/login/3.x/lostpw.php',{'prefix':prefix,'email_address':email_address,'process':'true'},function(s){$('#loginentry .feedback').show();if(s.search('success')!=-1){$('#lostpw').hide();}});});$('#loginentry .login').click(function(){loginEntry(prefix);});$('#loginentry .closewindow').click(function(){$('#loginentry,#darkmask').remove();location.reload(true);});});});}
function resetPw(prefix,token){var new_password;var password_confirm;var pwstring;var cfstring;$('#container').prepend('<div id="darkmask"></div><div id="loginentry" class="slab_login_form"></div>');$('#loginentry').load('/common/login/3.x/changepw.php',{'prefix':prefix,'token':token},function(c){if(c.search('gohome')!=-1){window.location.replace('/');}else{$('#new_password').keyup(function(){pwstring=$('#new_password').val();$('#pwstr').load('/common/login/3.x/pwstrength.php',{'pwstring':pwstring});});$('#password_confirm').keyup(function(){pwstring=$('#new_password').val();cfstring=$('#password_confirm').val();if(pwstring==cfstring){$('#pwmatch').html('<p style="font-size: .8em; color:green; text-align: left;">confirmed</p>');}else{$('#pwmatch').html('<p style="font-size: .8em; color:red; text-align: left;">passwords do not match</p>');}});$('#resetpw').submit(function(s){s.preventDefault();new_password=$('#new_password').val();password_confirm=$('#password_confirm').val();$('#loginentry .feedback').load('/common/login/3.x/changepw.php',{'prefix':prefix,'token':token,'new_password':new_password,'password_confirm':password_confirm,'reset':'true'},function(e){$('#loginentry .feedback').show();if(e.search('success')!=-1){$('#resetpw').hide();}});});$('#reset_password').click(function(){lostPw(prefix);});$('#loginentry .login').click(function(){loginEntry(prefix);});$('#loginentry .closewindow').click(function(){$('#loginentry,#darkmask').remove();location.reload(true);});}});}
function activateAccount(prefix,token){$('#container').prepend('<div id="darkmask"></div><div id="loginentry" class="slab_login_form"></div>');$('#loginentry').load('/common/login/3.x/account.php',{'prefix':prefix,'token':token,'activate':1},function(c){if(c.search('gohome')!=-1){window.location.replace('/');}
$('#loginentry .login').click(function(){loginEntry(prefix);});$('#loginentry .closewindow').click(function(){$('#loginentry,#darkmask').remove();location.reload(true);});});}
function cookieNotice(prefix){$('#container').append('<div id="cookienoticewrap"></div>');$('#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();});});});}
function cookieNoticeTest(prefix){$('body').append('<div id="cookienoticewrap"></div>');$('#cookienoticewrap').load('/common/cookies/index.php',{'prefix':prefix,'test':1},function(){$('#cookiebutton').click(function(){$('#cookienoticewrap').remove();});$('#nocookiebutton').click(function(){$('#cookienoticewrap').remove();});});}