function new_blog()
{
	left=Math.round(getClientWidth()/2)-423;
	document.getElementById('new_blog').style.left=left+'px';
	
}
function moz_ask()
{
        if (navigator.appName.indexOf('Netscape')!=-1)
        {
                document.getElementById('profile_top1').className='left_1';
                document.getElementById('profile_bot1').className='left_1';
                document.getElementById('blog_top1').className='left_1';
                document.getElementById('blog_bot1').className='left_1';
                document.getElementById('write_top1').className='left_1';
                document.getElementById('write_bot1').className='left_1';
        }
        else
        {
                document.getElementById('profile_top2').className='left1';
                document.getElementById('profile_bot2').className='left1';
                if (navigator.userAgent.indexOf('Opera')!=-1)
                {
                        document.getElementById('blog_top2').className='left1';
                        document.getElementById('blog_bot2').className='left1';
                        document.getElementById('write_top2').className='left1';
                        document.getElementById('write_bot2').className='left1';
                }
        }
}


function user_write(obj,action)
{
        if (action=='on')
        {
                obj.style.color='#FFF';
                obj.style.backgroundColor='#4BB200';
        }
        else
        {
                obj.style.color='#73BB2C';
                obj.style.backgroundColor='#FFF';
        }
}




function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function new_blog()
{
        left=Math.round(getClientWidth()/2)-423;
        document.getElementById('new_blog').style.left=left+'px';
}
//------------------------------------------------------------------------
function user_groups(id_usr)
{
  this.id_usr=id_usr
  this.mark_friend=function(id_rel)
  {
    var req = new Subsys_JsHttpRequest_Js();
    req.onreadystatechange = function()
    {
      if (req.readyState == 4)
      {
        if (this.readyState == 4)
        {
//              alert(this.responseText);
          if(typeof(this.responseJS)=='object' && this.responseText=='')
          {
						return true;
          }
					else
						return false;
        }
      }
    }
    req.caching = false;
    req.open('POST', 'user.gate', true);
    req.send({ task:'user2group', id_usr:this.id_usr, id_rel:id_rel,group:'friend' });
						return true;		
  }

  this.mark_enemy=function(id_rel)
  {
    var req = new Subsys_JsHttpRequest_Js();
    req.onreadystatechange = function()
    {
      if (req.readyState == 4)
      {
        if (this.readyState == 4)
        {
//              alert(this.responseText);
          if(typeof(this.responseJS)=='object' && this.responseText=='')
          {
//            alert(this.responseJS.test)
						return true;						
          }
					else
						return false;
					
        }
      }
    }
    req.caching = false;
    req.open('POST', 'user.gate', true);
    req.send({ task:'user2group', id_usr:this.id_usr, id_rel:id_rel, group:'enemy' });
						return true;		
  }

  this.del_from_group=function(id_rel)
  {
    var req = new Subsys_JsHttpRequest_Js();
    req.onreadystatechange = function()
    {
      if (req.readyState == 4)
      {
        if (this.readyState == 4)
        {
//        alert(this.responseText);
          if(typeof(this.responseJS)=='object')
          {
//          alert(this.responseJS.res)
            el=document.getElementById('user_in_contacts_'+id_rel)
            el.parentNode.removeChild(el)
          }
        }
      }
    }
    req.caching = false;
    req.open('POST', 'user.gate', true);
    req.send({ task:'del_from_group', id_usr:this.id_usr, id_rel:id_rel });
  }
}
