  function confClan(act, clanname, url)
  {
	var mes;
	if (act)
	{
		mes = 'Послать запрос на присоединение к чату \'' + clanname + '\'?';
	}
	else
	{
		mes = 'Вы действительно хотите выйти из чата \'' + clanname + '\'?';
	}
  
	if (confirm(mes)) command(url);
  }
  
  function confInviteToClan(act, username, clanname, url)
  {
	var mes;
	if (act)
	{
		mes = 'Послать приглашение участнику \''+username+'\' на присоединение к чату \'' + clanname + '\'?';
	}
	else
	{
		mes = 'Исключить участника \''+username+'\' из чата \'' + clanname + '\'?';
	}
  
	if (confirm(mes)) command(url);
  }
  
  function confModerator(act, username, clanname, url)
  {
	var mes;
	if (act)
	{
		mes = 'Назначить участника \''+username+'\' модератором чата \'' + clanname + '\'?';
	}
	else
	{
		mes = 'Исключить участника \''+username+'\' из модераторов чата \'' + clanname + '\'?';
	}
  
	if (confirm(mes)) command(url);
  }
  
  function confFriend(act, username,url)
  {
	var mes;
	if (act)
	{
		mes = 'Послать участнику \'' + username + '\' предложение стать вашим другом?';
	}
	else
	{
		mes = 'Удалить участника \'' + username + '\' из списка ваших друзей?';
	}
  
	if (confirm(mes)) command(url);
  }
  function confTeacher(act, username,url)
  {
	var mes;
	if (act)
	{
		mes = 'Послать участнику \'' + username + '\' запрос на получение торговых сигналов?';
	}
	else
	{
		mes = 'Отписаться от подписки на торговые сигналы участника \'' + username + '\'?';
	}
  
	if (confirm(mes)) command(url);
  }
  
  function delStudent(username,url)
  {
	var mes = 'Отписать участника \'' + username + '\' от получения торговых сигналов?';
	  
	if (confirm(mes)) command(url);
  }


  function confCommun(act, communname, url)
  {
	var mes;
	if (act)
	{
		mes = 'Послать запрос на вступление в сообщество \'' + communname + '\'?';
	}
	else
	{
		mes = 'Вы действительно хотите выйти из сообщества \'' + communname + '\'?';
	}
  
	if (confirm(mes)) command(url);
  }

  
  function command(url)
  {
	self.location.href = (url);
  }


function openGlobalIM(userID)
{
    openIMWindow(userID, '/IM/?userid='+ userID);
}

function openGlobalHistoryIM(userID) {

    openIMWindow(userID, '/IM/history.aspx?userid=' + userID);
}
  
function openIMWindow(userID, relativeLink)
{
    var windowWidth = 800;
    var windowHeight = 600;
    var leftValue = screen.width ? parseInt(screen.width / 2 - (windowWidth / 2)) : 200;
    var topValue = screen.height ? parseInt(screen.height / 2 - (windowHeight / 2)) : 200;
    var newWindow = window.open(relativeLink, 'IM' + userID, "width=" + windowWidth + ",height=" + windowHeight + ",left=" + leftValue + ",top=" + topValue + ",resizable=yes,toolbar=0,location=0,status=no,menubar=0,directories=0,scrollbars=yes");
    if (!newWindow) {
        alert('В броузере включена блокировка всплывающих окон.');
        return
    }

    if (newWindow.focus)
        newWindow.focus()
}
