$(document).ready(function(){
   $('.news-entry li a.tooltip').each(function()
   {
	  //alert($('#'+ $(this).attr('id')+' p').html());
      $(this).qtip(
      {
         content: {	  	
            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
    	  	text: $('#d-'+ $(this).attr('id')).html(),
            //url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
            title: {
               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: { 
            solo: true // Only show one tooltip at a time
         },
         hide: 'mouseout',
         style: {
            tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
            border: {
               width: 0,
               radius: 4
            },
            name: 'dark',// Use the default light style
            width: 300	
         }
      })
   });
   
   $('.news-entry li a.sharelink').each(function(){
	   $(this).qtip(
		      {
		         content: {
		            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
		            text: '<img class="throbber" src="images/loading.gif" alt="Loading..." />',
		            url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
		            title: {
		               button: 'Close' // Show a close link in the title
		            }
		         },
		         position: {
		            corner: {
		               target: 'leftMiddle', // Position the tooltip above the link
		               tooltip: 'rightMiddle'
		            },
		            adjust: {
		               screen: true // Keep the tooltip on-screen at all times
		            }
		         },
		         show: { 
		        	when:'click', 
		            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: 150
		         }
		      })
	}); 
   
   $('#banner-nav-pages a.sharelink').each(function(){
	   $(this).qtip(
		      {
		         content: {
		            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
		            text: '<img class="throbber" src="images/loading.gif" alt="Loading..." />',
		            url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
		            title: {
		               button: 'Close' // Show a close link in the title
		            }
		         },
		         position: {
		            corner: {
		               target: 'bottomMiddle', // Position the tooltip above the link
		               tooltip: 'bottomMiddle'
		            },
		            adjust: {
		               screen: true // Keep the tooltip on-screen at all times
		            }
		         },
		         show: { 
		        	when:'click', 
		            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: 150
		         }
		      })
	});   
	
	$(function(){
		$("#popular ul li").quickpaginate({ perpage: 20, showcounter: true, pager : $(".pagination") });
	});
	
});