var Login = {

	//BIND PAGE EVENTS
	'bindEvents' : function() {
	    $('#createaccount-form').livequery('submit', this.checkForm);
        $('#login-form').livequery('submit', this.updateRemembersCookie);
	},

    //CHECK CREATE ACCOUNT FORM
    'checkForm': function() {
        if ($('#password').val() == '' || $('#confirm-password').val() == '' || $('#email').val() == '') {
            alert('Please be sure that Password, Confirm Password and Email all are not empty');
            return false;
        }

        if ($('#password').val() != $('#confirm-password').val()) {
            alert('Passwords don\'t match');
            return false;
        }
    },
    
    //DELETE COOKIE IF CHECKBOX IS UNCHECKED
    'updateRemembersCookie': function() {
         $.cookie('auth', null, { path: '/' });  
    }
    
};	

$(document).ready(function(){
	Login.bindEvents();
    if ($.cookie('auth'))
        $('#remember-me-login').attr('checked', true);
});
