//****************************************************************************
// BubbleWindow code from http://jqueryfordesigners.com/demo/coda-bubble.html
//
// Assumes: div class of bubbleInfo: the div containing a single image and popup info
//          img class of trigger: the image that when moused over, invokes the popup
//          popup: the table containing the popup info.
//          
//****************************************************************************
function InitBubbleWindow()
{
$('.bubbleInfo').each(function () {
            var distance = 10;
            var time = 50;				// time needed to show popup
            var hideDelay = 50;			// time after mouseout to remove the poup

            var hideDelayTimer = null;

            var beingShown = false;		// in the process of animation?
            var shown = false;			// is currently being shown?
			
            var trigger = $('.trigger', this);					// trigger: name given for the image
            var info = $('.popup', this).css('opacity', 1);  	// info: name given for the 'popup' contents

			// set the parent td class so it shows a border, etc
			$(this).parent().addClass("triggerframe");
			
			
			// with BOTH the trigger and popup objects, set the MOUSE OVER function
            $([trigger.get(0), info.get(0)]).mouseover(function () {
				
                if (hideDelayTimer) clearTimeout(hideDelayTimer);  // if timer active, kill it.
                
				// if we're currently being shown, just let that process continue
				if (beingShown || shown) {
                    return; // don't re-trigger the animation again
                } else {
                    // init: reset position of info box
                    beingShown = true;

					// set the position of the popup box
                    info.css({
                        top: -121,   // -90
                        left: -10,   // -33
                        display: 'block'
						// now animate the popup to a position 'distance' away from initial position
                    }).fadeIn(100, function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;  // return FALSE from the mouse over
				// with BOTH the trigger and popup objects, set the MOUSE OUT function
            }).mouseout(function () {
				
                if (hideDelayTimer) clearTimeout(hideDelayTimer); // if timer active, kill it.
               	// wait 'hideDelay' then invoke the following function:
				hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
					// now animate the popup to a position 'distance' away from initial position
                    info.fadeOut(100, function () {
                        shown = false;
						// turn off the display of the popup
                        info.css('display', 'none');
                    });

                }, hideDelay);

				// return FALSE from the mouse out
                return false;
            });
        });
}