﻿function setUserInfo(objid)
{
  var obj=document.getElementById(objid);
  var name=getCookie('userinfo');
  if(name!=null)
  {
	obj.innerHTML="Hi, <a href='http://blog.bitcomet.com/" + name.split('|')[0] +"'>"+name.split('|')[1]+"</a> | <a href='http://passport.bitcomet.com/client/logout/?l=en-us&continue=" + encodeURIComponent(location.href) + "'>Sign Out</a>"; 
  }
  else
  {
	obj.innerHTML="<a href='http://passport.bitcomet.com/client/login/?l=en-us&continue="+encodeURIComponent(location.href)+"' >Sign In</a> | <a href='http://passport.bitcomet.com/client/register/?l=en-us&continue="+encodeURIComponent(location.href)+"' >Sign Up</a>";
  }
}

function getCookie(sName) 
{
    var sRE = "(?:; )?" + sName + "=([^;]*);?";
    var oRE = new RegExp(sRE);
    if (oRE.test(document.cookie)) {
        return decodeURIComponent(RegExp["$1"]);
    } 
    else 
    {
        return null;
    }
}