﻿/// <reference path="MicrosoftAjax.js" />
/// <reference path="jquery-1.3.2.js" />
/// <reference path="main.js" />

// Create the tooltips only on document load
$(function()
{
	// Use the each() method to gain access to each elements attributes
	$('img.context-tooltip').each(function()
	{
		var instance=$(this);
		instance.qtip(
            {
            content:
              {
              	// Set the text to an image HTML string with the correct src URL to the loading image you want to use
              	text: String.format('<img class="throbber" src="{0}/assets/images/spinner.gif" alt="Loading..." />', getApplicationURL()),
              	url: String.format('{0}/ContextHelpLinkResource.aspx?ResourceKey=' + instance.next('span').html(), getApplicationURL()),
              	title:
                  {
                  	text: instance.attr('title'), // Give the tooltip a title using each elements text
                  	button: 'Close' // Show a close link in the title
                  }
              },
            	position:
                {
                	corner:
                      {
                      	target: 'bottomMiddle', // Position the tooltip above the link
                      	tooltip: 'topMiddle'
                      },
                	adjust:
                      {
                      	screen: true // Keep the tooltip on-screen at all times
                      }
                },
            	show:
                  {
                      when: 'mouseover',
                  	solo: true // Only show one tooltip at a time
                  },
            	hide: 'unfocus',
            	style:
                  {
                  	tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
                  	border:
                      {
                      	width: 0,
                      	radius: 4
                      },
                  	name: 'light', // Use the default light style
                  	width: 570 // Set the tooltip width
                  }
            })
	});
});