/**
* Inline Tooltip Shared Code
*
* @package js
* @author Tim Carr
* @version 1
* @copyright n7 Studios 2009
*/ 
$(document).ready(function() {
    $('li.tooltip a').hover(
        function () {
            // Mouseover
            // Position and show Tooltip
            title = $(this).attr('title');
            $(this).attr('title', ''); // Blank title attribute, so it doesn't conflict with tooltip
            toolTipPosition = $(this).offset(); // Get this button's position, so we can position popup next to it
            $('#tooltipMain').html('<p>'+title+'</p>');
            $('#tooltip').css('top', (toolTipPosition.top+41)+'px'); // Position vertically
            $('#tooltip').css('left', (toolTipPosition.left-($('#tooltip').width()/4))+'px'); // Position horizontally
            $('#tooltip').show(); // Show positioned tooltip
        },
        function () {
            // Mouseleave
            // Restore default tooltip from view
            $(this).attr('title', title); // Set title attribute, so we can use it again later + ensure accessibility
            title = '';
            toolTipPosition = '';
            $('#tooltipMain').html('');
            $('#tooltip').hide();
        }
    );
});
