var localLogin = {
	commitLogout: function() {
		var email = jQuery('#mcext-email').val();
		var password = jQuery('#mcext-pass').val();
		jQuery.post(
			'/media/plugins/ardent-mailchimp-ext/logout.php',
			{ },
			function(json) {
				location.href = '/';
				return;
			},'json'
		);
		
		return;
	},
	
	promptPassChange: function() {
		jQuery('#mcext-tools-sidebar').fadeOut('fast').queue(function(){
			jQuery(this).dequeue();
			jQuery('#mcext-passchange-sidebar').fadeIn('fast');
		});
		return;
	},
	
	cancelPassChange: function() {
		for(a = 1; a <= 3; a++) jQuery('#mcext-passchange-sidebar-pass' + a).val('');

		jQuery('#mcext-passchange-sidebar').fadeOut('fast').queue(function(){
			jQuery(this).dequeue();
			jQuery('#mcext-tools-sidebar').fadeIn('fast');
		});
		
		return;
	},
	
	commitPassChange: function() {
		var pass = new Array(3);
		for(a = 1; a <= 3; a++) pass[(a-1)] = jQuery('#mcext-passchange-sidebar-pass' + a).val();

		jQuery.post(
			'/media/plugins/ardent-mailchimp-ext/passwd.php',
			{ 'pass1':pass[0],'pass2':pass[1],'pass3':pass[2] },
			function(json) {
				if(!json.valid) alert('We were unable to change your password. Please ensure that your old one is correct, that you have confirmed your new one correctly, and that the new one is four or more characters long.');
				else localLogin.cancelPassChange();
				return;
			},'json'
		);
	
		return;
	}
};
