QuoteTooltipHover = Class.create();
QuoteTooltipHover.prototype = {
	initialize: function(target, text, author, xrel, yrel) {
		
		this.xrel = xrel;
		if(this.xrel==null)
			this.xrel = 0;
			
		this.yrel = yrel;
		if(this.yrel==null)
			this.yrel = 0;
		
		this.target = target;
		this.text = text;
		this.author = author;

		this.createTip();

		Event.observe($(target), "mouseover", this.show.bind(this));		
		Event.observe($(target), "mouseout", this.hide.bind(this));		
		Event.observe($(target), "mousemove", this.move.bind(this));		
	},

	move: function(e) {
		this.tip.style.left = this.xrel + Event.pointerX(e) +"px";
		this.tip.style.top = this.yrel + Event.pointerY(e) +"px";
	},
	
	createTip : function() {
		this.tip = document.createElement("div");  
		document.body.appendChild(this.tip);  
		this.tip.setAttribute("id", this.target.id + "tip");  
		this.tip.className = "quotetip";

		var tiptop = document.createElement("div");  
		this.tip.appendChild(tiptop);  
		tiptop.setAttribute("id", this.target.id + "tiptop");  
		tiptop.className = "quotetiptop";

		var tiptext = document.createElement("div");  
		this.tip.appendChild(tiptext);  
		tiptext.setAttribute("id", this.target.id + "tiptext");  
		tiptext.className = "quotetiptext";
		tiptext.innerHTML = this.text;  

		var tipauthor = document.createElement("div");  
		this.tip.appendChild(tipauthor);  
		tipauthor.setAttribute("id", this.target.id + "tipauthor");  
		tipauthor.className = "quotetipauthor";
		tipauthor.innerHTML = this.author;  


		var tipbot = document.createElement("div");  
		this.tip.appendChild(tipbot);  
		tipbot.setAttribute("id", this.target.id  + "tipbot");  
		tipbot.className = "quotetipbot";
			
		this.tip.style.display="none";
		this.tip.style.zIndex = "410065408";  
		this.tip.style.position = "absolute";  
	},
	
	hide: function hide(event) {  
		new Effect.Opacity(this.tip, {duration:1.0, from:0.85, to:0});
		this.tip.style.display="none";
	},

	show: function show(event) {  
		this.tip.style.display = "block";
		new Effect.Opacity(this.tip, {duration:1.0, from:0.0, to:0.85});
	}
};