//<![CDATA[
function getOffsetTop(obj)
{ return obj ? obj.offsetTop + getOffsetTop(obj.offsetParent) : 0; }

function getOffsetLeft(obj)
{ return obj ? obj.offsetLeft + getOffsetLeft(obj.offsetParent) : 0; }

var textcubeFootnote = {
	notes: {},

	add: function(entryId, noteId, content) {
		this.notes[entryId + '_' + noteId] = content;
	},

	show: function(anchor, entryId, noteId) {
		var layer = document.createElement('div');
		layer.id = 'textcubeFootnoteLayer_' + entryId + '_' + noteId;
		layer.style.font = '11px/1 Dotum, Sans-serif';
		layer.style.width = '304px';
		layer.style.position = 'absolute';
		layer.style.left = (getOffsetLeft(anchor) - 86) + 'px';
		layer.style.top = '0px';
		layer.style.zIndex = '810302';
		if(new RegExp('MSIE [1-6]\\.').test(navigator.userAgent)) {
			layer.innerHTML =
			'<div style="height: 6px; overflow: hidden; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://cfs.tistory.com/static/admin/editor/footnotes_01.png\', sizingMethod=\'crop\')"></div><div style="width: 304px; padding: 6px 0; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://cfs.tistory.com/static/admin/editor/footnotes_02.png\', sizingMethod=\'scale\')"><div style="padding-bottom: 6px; border-bottom: 1px solid #f2f1be; font-weight: bold; margin: 0 15px 9px 15px">잠깐만 ' + noteId + '</div><div style="margin: 0 15px; line-height: 1.5; text-align: justify">' +
				this.notes[entryId + '_' + noteId] +
			'</div></div><div style="height: 15px; overflow: hidden; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://cfs.tistory.com/static/admin/editor/footnotes_03.png\', sizingMethod=\'crop\')"></div>';
		}
		else {
			layer.innerHTML =
			'<div style="height: 6px; overflow: hidden; background-image: url(http://cfs.tistory.com/static/admin/editor/footnotes_01.png)"></div><div style="width: 304; padding: 6px 0; background-image: url(http://cfs.tistory.com/static/admin/editor/footnotes_02.png)"><div style="padding-bottom: 6px; border-bottom: 1px solid #f2f1be; font-weight: bold; margin: 0 15px 9px 15px">잠깐만 ' + noteId + '</div><div style="margin: 0 15px; line-height: 1.5; overflow: hidden; text-align: justify">' +
				this.notes[entryId + '_' + noteId] +
			'</div></div><div style="height: 15px; overflow: hidden; background-image: url(http://cfs.tistory.com/static/admin/editor/footnotes_03.png)"></div>';
		}
		document.body.appendChild(layer);
		layer.style.top = (getOffsetTop(anchor) - layer.offsetHeight) + 'px';
	},

	hide: function(entryId, noteId) {
		var layer = document.getElementById('textcubeFootnoteLayer_' + entryId + '_' + noteId);
		layer.parentNode.removeChild(layer);
	}
};
//]]>
