PP.Sp = (function(){
	var User;
	
	return {
		init: function(user){
			User = user;
		},		
		is: function(callback){
			var url = 'http://fuwu.paipai.com/auth/spRegister.xhtml';
			$.ajax({
				url: url,
				cache: false,
				success: function(data){
					if(data.indexOf('topMenuCssChange(\'myfuwuMenu\')') != -1){
						callback(true);
					}else{
						callback(false);
					}
				},
				error: function(){}
			});
		},
		register: function(callback){
			var self = this,
				url = 'http://fuwu.paipai.com/auth/addSpRegInfo.xhtml';
				
			$.ajax({
				url: url,
				cache: false,
				data: {
					uin: User.uin,
					orgType: 0,
					name: User.name || User.nickName,
					phone: User.phone || User.mobile || '',
					email: User.email || User.uin + '@qq.com',
					address: User.address || ''
				},
				success: function(data){
					self.is(function(is){
						if(is){
							callback && callback(true);
						}else{
							callback(false);
						}
					});
				},
				error: function(){
					
				}
			});
		}	
	}
})();