/*
 * Office Geography Tooltips
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip
 */
$(document).ready(function(){
    jQuery.fn.exists = function(){return jQuery(this).length>0;}
    //$('a.test').tooltip();
    
    // hide the node boundaries
    // we're doing this here as opposed to with css so that they are still
    // visible for people with js turned off
    $('table.tooltips li dl').hide();
    
    // temp: set size of first column
    // todo: remove this, it's really just for quickie demo   
    if ($('table.tooltips th').length != 4) {
        $('table.tooltips td:first').css('width', '35%');
    }
    
    // add the 'map' class to nodes that have boundaries (<dl>)
    $('table.tooltips li').find('dl').parent().addClass('map');
    //$('table li').find('dl').parent().append ('<span class="icon">[map]</span>');
    
    // add the tooltip function to show node boundaries (<dl)
    $('table.tooltips li').find('dl').parent().tooltip({
        bodyHandler: function() {
            var out = '<h3>' + $(this).html() + ' <span>[ Street Boundaries ]</span></h3>';
            var out = out + '<dl>' + $(this).find('dl').html() + '</dl>';
            return out;
        }, 
        track: true,
        delay: 0,
        showURL: false,
        fade: 400
    });   
});