var _SideBar = function() {
	this.mb_idx = null;
	this.mb_id = null;
	this.container = null;

	this.init();
};
_SideBar.prototype.init = function() {
	var container = document.createElement('div');
	container.className = 'sidebar';
	container.innerHTML = '<ul><li><a href="#" onclick="SideBar.showProfile();return false">프로필 보기</a></li><li><a href="#" onclick="SideBar.sendMemo();return false">쪽지 보내기</a></li></ul>';

	this.container = container;
};
_SideBar.prototype.show = function(object, mb_idx, mb_id) {
	if(this.mb_idx == mb_idx) { this.hide(); return; }
	if(this.mb_idx != null) { this.hide(); }

	this.mb_idx = mb_idx;
	this.mb_id = mb_id;

	var position = $(object).position();
	position.left += 30;
	position.top += 10;

	this.container.style.left = Math.round(position.left) + 'px';
	this.container.style.top = Math.round(position.top) + 'px';

	document.body.appendChild(this.container);
};
_SideBar.prototype.hide = function() {
	this.mb_idx = null;
	this.mb_id = null;
	document.body.removeChild(this.container);
};

_SideBar.prototype.showProfile = function() {
	win_profile(this.mb_id);
	this.hide();
}
_SideBar.prototype.sendMemo = function() {
	win_memo('/comm/bbs/memo_form.php?me_recv_mb_id='+this.mb_id);
	this.hide();
}

var SideBar = new _SideBar();