var History = null;

Event.observe(window, "load", function()
	{
	History = new function()
		{
		this.graphHeight = 1 * $("historygraph").getStyle("height").substring(0, $("historygraph").getStyle("height").length - 2);
		this.active = null;
		this.activeDot = $("historygraph_active");
		this.activeDotHalfWidth = (this.activeDot.width > 0 ? 1 * this.activeDot.width : 1 * this.activeDot.getStyle("width").substring(0, this.activeDot.getStyle("width").length - 2)) / 2;

		this.hide = function()
			{
			if(this.active)
				{
				this.active.hide();
				this.activeDot.hide();
				this.active = null;
				}
			}

		this.over = function(event, index, x, y)
			{
			Event.stop(event);

			if(this.active && this.active != $("bubble_" + index))
				this.active.hide();

			$("bubble_" + index).setStyle({left: x + "px", bottom: (this.graphHeight - y) + "px"}).show();
			this.activeDot.setStyle({left: (x - this.activeDotHalfWidth) + "px", top: (y - this.activeDotHalfWidth) + "px"}).show();
			this.active = $("bubble_" + index);
			}

		this.out = function(event)
			{
			this.activeDot.hide();

			if(this.active)
				this.active.hide();

			this.active = null;
			}

		this.block = function(event, object)
			{
			Event.stop(event);
			}
		
		Event.observe($("historygraph"), "mouseover", function(event) {History.out(event);});
		}
	});