ShowTooltipOnline = function(e)
{
    var text = $(this).next('.show-tooltip-text-online');
    if (text.attr('class') != 'show-tooltip-text-online')
        return false;

    text.fadeIn()
        .css('top', e.pageY)
        .css('left', e.pageX+20);

    return false;
}
HideTooltipOnline = function(e)
{
    var text = $(this).next('.show-tooltip-text-online');
    if (text.attr('class') != 'show-tooltip-text-online')
        return false;

    text.fadeOut();
}

SetupTooltipsOnline = function()
{
    $('.show-tooltip-online')
        .each(function(){
            $(this)
                .after($('<span/>')
                    .attr('class', 'show-tooltip-text-online')
                    .html($(this).attr('title')))
                .attr('title', '');
        })
        .hover(ShowTooltipOnline, HideTooltipOnline);
}

ShowTooltipOffline = function(e)
{
    var text = $(this).next('.show-tooltip-text-offline');
    if (text.attr('class') != 'show-tooltip-text-offline')
        return false;

    text.fadeIn()
        .css('top', e.pageY)
        .css('left', e.pageX+20);

    return false;
}
HideTooltipOffline = function(e)
{
    var text = $(this).next('.show-tooltip-text-offline');
    if (text.attr('class') != 'show-tooltip-text-offline')
        return false;

    text.fadeOut();
}

SetupTooltipsOffline = function()
{
    $('.show-tooltip-offline')
        .each(function(){
            $(this)
                .after($('<span/>')
                    .attr('class', 'show-tooltip-text-offline')
                    .html($(this).attr('title')))
                .attr('title', '');
        })
        .hover(ShowTooltipOffline, HideTooltipOffline);
}

//AJAX


AjaxSetupTooltipsOnline = function()
{
    $('.ajax-show-tooltip-online')
        .each(function(){
            $(this)
                .after($('<span/>')
                    .attr('class', 'show-tooltip-text-online')
                    .html($(this).attr('title')))
                .attr('title', '');
        })
        .hover(ShowTooltipOnline, HideTooltipOnline);
}

AjaxSetupTooltipsOffline = function()
{
    $('.ajax-show-tooltip-offline')
        .each(function(){
            $(this)
                .after($('<span/>')
                    .attr('class', 'show-tooltip-text-offline')
                    .html($(this).attr('title')))
                .attr('title', '');
        })
        .hover(ShowTooltipOffline, HideTooltipOffline);
}

$(document).ready(function() {
    SetupTooltipsOnline();
    SetupTooltipsOffline();
});
