var toolTipShow = function( obj, topCoord, leftCoord )
{
	$$( '.tooltipSource' ).each( function( item, index ) {
		if ( item.getAttribute( 'rel' ) == obj.getAttribute( 'rel' ) )
		{
			item.setStyles( {
				display: 'block',
				top: topCoord,
				left: leftCoord,
				height: 'auto',
				overflow: 'visible'
			} );
		}
	} );
}

var toolTipHide = function( obj )
{	
	$$( '.tooltipSource' ).each( function( item, index ) {
		item.setStyles( {
			display: 'none',
			top: '-1000',
			left: '-1000',
			height: '0',
			overflow: 'hidden'
		} );
						
	} );

}

var ttInit = function() {
	$$( '.tooltipKeyword' ).each( function( item, index ) {
		var coords    = item.getCoordinates();
		var topCoord  = coords.top;
		var leftCoord = coords.left;
		item.addEvents( {
			'mouseenter': function() {
				toolTipShow( this, topCoord + 15, leftCoord );
			},
			'mouseleave': function() {
				toolTipHide( this );
			}
		} );
	} );
}

window.addEvent( 'domready', ttInit );