
// Extends the MooTools "Tips" class
var IconTips = new Class(
{
	Extends: Tips,
		
	position: function(position)
	{
		position = position.page;
		this.tip.setStyles(
		{
			top: ((position.y - this.tip.getHeight()) + this.options.offsets.y) + "px",
			left: (position.x + this.options.offsets.x) + "px"
		});
	}
});


window.addEvent('domready', function()
{
	var ie6 = (typeof document.addEventListener != 'function');		
	function mouseOver() { this.addClass('hover'); }
	function mouseOut() { this.removeClass('hover'); }	
	$$(".highlights .icon span").each(function(element)
	{
		element.store('tip:title', element.innerHTML);
		if(ie6)
		{
			element.onmouseover = mouseOver;
			element.onmouseout = mouseOut;
		}		
	});	
	
	new IconTips($$(".highlights .icon span"), 
	{ 		
		className: "tooltip",
		fixed: true,
		offsets: { x: 15, y: -5 }
	});
	
	// now fix the PNG backgrounds in IE6
	if(ie6)
	$$(".tooltip .tip-top", ".tooltip .tip-bottom").each(function(element)
	{	
		var path = element.getStyle("backgroundImage");
		if(path.indexOf('.png') == -1) { return; }
		path = path.replace(/^url\(['"]?/, '').replace(/['"]?\)$/, '');
		element.setStyles(
		{
			'background-image': 'none',
			'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', src=\'' + 
				path + '\', sizingMethod=\'scale\')'
		});
	});
});

