var ChatRelation = function(){
    return {
    	becomeMember: function () {
    		if (!CurrentUser.IsRegistred) {
    			alert(locStrings["error_must_register"]);
    			return false;
    		}
    		
    		var conn = new Ext.data.Connection();
				conn.on('requestcomplete', function(trans, response, options) {
					var result = Ext.decode(response.responseText);
					if (result.success) {
						alert(locStrings["member_success_message"]);
					}
					else
						ChatApp.showErrors(result.errors);
						//alert(result.errors[0].name);
				});
				
				conn.on('requestexception', function() {alert("Ajax error")});
				conn.request({method : 'POST', url : '/pages/channel/_json.become_member.php', params: {chatId: currentChat.id}}); 
    	},
    	
    	moderatorRequest: function() {
    		if (!CurrentUser.IsRegistred) {
    			alert(locStrings["error_must_register"]);
    			return false;
    		}
    		
    		location.href = "http://chatium.com/my/moderator_request.html?chatId=" + currentChat.id;
    	}
    }        
}();