current.User = Class.create({
	initialize : function ()
	{
		this._ip = getCookieValue(current.Cookies.IP);
		this._name = getCookieValue(current.Cookies.USERNAME);
		this._id = getCookieValue(current.Cookies.USER_ID);
		var locale = getCookieValue(current.Cookies.LOCALE);
		this._locale = (locale == null) ? 'en_US' : locale;
		this._country = this._locale.substring(3, 6).toLowerCase();
		this._language = this._locale.substring(0, 2).toLowerCase();
		this._sessionId = this._getSessionCookie();
		this._isGroupAdminWrite = false;
		this._isItemAdminWrite = false;
		this._isTagAdminWrite = false;
		this._isUserAdminWrite = false;
		this._recommendItems = false;
		this._recommendComments = false;
		this._loggedIn = document.__li;
		deleteCookie('username');
	},
	_getSessionCookie : function ()
	{
		var sessionId = getCookieValue(current.Cookies.SESSION_ID);
		if (sessionId == null)
		{
			sessionId = Math.round(Math.random()*2147483647) + '' + new Date().getTime();
			setTimedCookie(current.Cookies.SESSION_ID, sessionId, current.Cookies.DISTANT_EXPIRE);
		}
		return sessionId;
	},
	getIp : function ()
	{
		return this._ip;
	},
	getName : function()
	{
		return this._name;
	},
	getUsername : function ()
	{
		return this._name;
	},
	getId : function ()
	{
		return this._id;
	},
	getLocale : function ()
	{
		return this._locale;
	},
	getCountry : function ()
	{
		return this._country;
	},
	getLanguage : function ()
	{
		return this._language;
	},
	isEmailVerified : function ()
	{
		return ((document.__isVerified__) ? true : false);
	},
	isGroupAdminWrite : function ()
	{
		return ((document.__isGroupAdminWrite__) ? true : false);
	},
	setGroupAdminWrite : function (isGroupAdminWrite)
	{
		this._isGroupAdminWrite = isGroupAdminWrite;
	},
	isItemAdminWrite : function ()
	{
		return ((document.__isItemAdminWrite__) ? true : false);
	},
	setItemAdminWrite : function (isItemAdminWrite)
	{
		this._isItemAdminWrite = isItemAdminWrite;
	},
	isTagAdminWrite : function ()
	{
		return ((document.__isTagAdminWrite__) ? true : false);
	},
	setTagAdminWrite : function (isTagAdminWrite)
	{
		this._isTagAdminWrite = isTagAdminWrite;
	},
	isUserAdminWrite : function ()
	{
		return ((document.__isUserAdminWrite__) ? true : false);
	},
	setUserAdminWrite : function (isUserAdminWrite)
	{
		this._isUserAdminWrite = isUserAdminWrite;
	},
	getUnreadMessages : function () {},
	getInvites : function () {},
	isLoggedIn : function ()
	{
		return this._loggedIn;
	},
	setRecommendComments: function (recommendComments)
	{
		this._recommendComments = recommendComments;
	},
	canRecommendComments : function ()
	{
		return this._recommendComments;
	},
	setRecommendItems : function (recommendItems)
	{
		this._recommendItems = recommendItems;
	},
	canRecommendItems : function ()
	{
		return this._recommendItems;
	},
	getSessionId : function ()
	{
		return this._sessionId;
	},
	getFacebookId : function ()
	{
		return ((document.__facebookId__) ? document.__facebookId__ : false);
	},
	isFacebookOnly : function ()
	{
		return ((document.__facebookOnly__) ? document.__facebookOnly__ : false)
	}
});
current.User.getInstance = function() {
	if (!document.__currentUser__)
	{
		document.__currentUser__ = new current.User();
	}
	return document.__currentUser__;
};
