﻿; (function($) {
    $.extend({
        user: {
            register: function(email, password, remember, handler) {
                $.jmsajax({
                    url: "/WebServices/User.asmx/RegisterUser",
                    data: { email: email, password: password, remember: remember },
                    success: function(d) {
                        if (handler) handler(d);
                    }
                });
            },
            exist: function(email, handler) {
                $.jmsajax({
                    url: "/WebServices/User.asmx/Exists",
                    data: { email: email },
                    success: function(d) {
                        if (handler) handler(d);
                    }
                });
            },
            existSync: function(email) {
                $.jmsajax({
                    url: "/WebServices/User.asmx/Exists",
                    data: { email: email },
                    success: function(d) {
                        if (handler) handler(d);
                    },
                    async: false
                });
            },
            login: function(email, password, remember, handler) {
                $.jmsajax({
                    url: "/WebServices/User.asmx/LoginUser",
                    data: { email: email, password: password, remember: remember },
                    success: function(d) {
                        if (handler) handler(d);
                    }
                });
            },
            check: function(email, password) {
                $.jmsajax({

            });
        },
        logout: function(handler) {
            $.jmsajax({
                url: "/WebServices/User.asmx/LogoutUser",
                success: function(d) {
                    if (handler) handler(d);
                }
            });
        },

        remind: function(email, handler) {
            $.jmsajax({
                url: "/WebServices/User.asmx/RemindPassword",
                data: { email: email },
                success: function(d) {
                    if (handler) handler(d);
                }
            });
        }
    }
});
})(jQuery);
