/**
 * Carabo Cursor Class
 *
 * @copyright  2007 Carabo Project
 * Created  on  2007/04/15
*/

var CrbCursor = Class.create();
CrbCursor.offset = {x : 15, y : 20};

CrbCursor.prototype = {
	initialize : function(id)
	{
		this.id = id;
	},

	run : function(item)
	{
		$(this.id).innerHTML = item;
		Event.observe(document, 'mousemove', this._follow.bindAsEventListener(this), false);
	},

	clear : function()
	{
		Event.stopObserving(document, 'mousemove', this._follow.bindAsEventListener(this), false);
		$(this.id).innerHTML = "";
	},

	_follow : function(event)
	{
		Element.setStyle(this.id, {
				"left" : CrbCursor.offset.x + Event.pointerX(event) + "px",
				"top"  : CrbCursor.offset.y + Event.pointerY(event) + "px"
		});
	}
}
