function communityJoiner(community_id, user_id)
{
	viewPopuper('Выполняется изменение статуса', 1);
	var req = new JsHttpRequest();
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
        	if (req.responseJS.status)
        	{
				jQuery('#community_' + community_id + '_buttons > div').css('display', 'none');
				jQuery('#' + req.responseJS.status + '_' + community_id).css('display', 'block');
        		
        		timeout = false;
        	}

        	if (req.responseJS.aMessages) {
        		printMessages(req.responseJS.aMessages);
        	}
        	setTimeout('hidePopuper()', 1000);
        }
    }
    req.caching = false;
    req.open('POST', cfg_path_web+'/modules/community/loaders/community_joiner.loader.php', true);
    req.send( { community_id: community_id, user_id: user_id } );
}

function searchUser(login)
{
	jQuery('#search_user_button').attr("disabled", "disabled");
	viewPopuper('Поиск пользователя', 1);
	var req = new JsHttpRequest();
	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.responseJS.finded)
			{
				hidePopuper();
				jQuery('#invite_button').css({display: 'block'});
				jQuery('#invited_user').attr('value', login);
			}
			else {
				jQuery("#invite_button").css({display: 'none'});
				setTimeout("hidePopuper(); jQuery('#search_user_button').attr('disabled', false);", 1000);
			}

			if (req.responseJS.aMessages) {
				printMessages(req.responseJS.aMessages);
			}
			
		}
	}
	req.caching = false;
	req.open('POST', cfg_path_web+'/modules/community/loaders/search_user.loader.php', true);
	req.send( { login: login } );
}