var Tooltip = function(id) {
	this.title = "";
	this.thumbnail = "";
	this.desc = "";
	this.genre = "";
	this.position = [0, 0];
	
	this.show = function() {
		if (this.title.length > 30)
			this.title = "<span class=\"longtitle\">" + this.title + "</span>";
		
		$(id).find(".title")[0].innerHTML = this.title;
		$(id).find(".desc")[0].innerHTML = this.desc;
		$(id).find(".image")[0].style.backgroundImage = "url('" + this.thumbnail + "')";
		$(id).find(".genre .name")[0].innerHTML = this.genre;
		$(id)[0].style.left = this.position[0] + "px";
		$(id)[0].style.top = this.position[1] + "px";
		
		// Preload thumbnail image before showing tooltip
		var image = new Image();
		image.src = this.thumbnail;
		
		this.showTimer = setTimeout(function() {
			if ($.browser.msie && $.browser.version <= 7)
				/* Fadein for transparent tooltip bg causes display issues in IE 6/7
				(thick black halo around the edges), so don't use it with those browsers */
				$(id).show();
			else
				$(id).fadeIn("fast");
		}, 500);
	};
	
	this.hide = function() {
		clearTimeout(this.showTimer);
		$(id).hide();
	};
};

