//Qtip fucntion to display tool tips, online info can be found at http://craigsworks.com/projects/qtip

// Create the tooltips only on document load
$(document).ready(function() 
{
   // Use the each() method to gain access to each elements attributes
   $('.toolTip img').each(function()
   {
      $(this).qtip(
      {
         content: {
					// Passing dynamic record data into p elements inside a hidden span and grabbing that info to display in the tool tip. 
					text: '<img class="tool_tip_image" src="http://www.internationalfoodclub.com' + $(this).attr('rel') + '"/><span class="tool_tip_p"><p>' + $(this).siblings('span').children('p.price').text() + '</p><p>' + $(this).siblings('span').children('p.description').text() + '</p><p>' + $(this).siblings('span').children('p.brand').text() + '</p><p>' + $(this).siblings('span').children('p.size').text() + '</p><p>' + $(this).siblings('span').children('p.country').text() + '</p></span>',
					 title: {
					   text: $(this).attr('alt')
					 }
				 },
			   style: {
				    background: '#F5F3DF',
						border: {
							color: '#435A25'
						},
				    tip: true
			   },
			   position: {
			      target: 'mouse',
					  adjust: { 
						   mouse: true, 
						   screen: true 
						}
         }       
      })
   });
});