// Read tooltips from web

function parseTooltipData(data, status) {
    var tooltips = eval("(" + data + ")");

    for (idx = 0; idx < tooltips.length; idx++) {
        var element = $("[rel='" + tooltips[idx].Id + "']");

        element.attr('rel', tooltips[idx].Text);
        element.tooltip(
        {
            showURL: false,
            bodyHandler: function() {
                return $(this).attr('rel');
             }
        }
        );
    }

    // displaying filter tooltips
    $("[class*='GlossaryIcon']").each(function() {
        $(this)[0].style.display = "block";
    });
}

function requestToolTips() {
    var pagepath = location.pathname;

    $.ajax(
    {
        type: "GET",
        url: "/ajax/lazytooltips.aspx",
        data: "path=" + escape(pagepath),
        success: parseTooltipData
    }
    );
}

$(document).ready(requestToolTips);
