$(document).ready(function(){

		$('li .button').CreateBubblePopup({
										position: 'top',
										align: 'center',
										innerHtml: '<img src="/images/loading.gif" style="border:0px; vertical-align:middle; margin:10px; display:inline;" />',
										innerHtmlStyle: { color:'#FFFFFF', 'text-align':'center' },
										themeName: 'all-grey',
										themePath: '/images/jquerybubblepopup-theme'
								  	  });


		$('.button').mouseover(function(){
				var button = $(this);
				$.get('/includes/test.php',{name:$(this).attr('rel')}, function(data) {
					var seconds_to_wait = 1;
					function pause(){
						var timer = setTimeout(function(){
							seconds_to_wait--;
							if(seconds_to_wait > 0){
								pause();
							}else{
								button.SetBubblePopupInnerHtml(data, true); //false -> it shows new innerHtml but doesn't save it, then the script is forced to load everytime the innerHtml... 
							};
						},1000);
					};pause();
				}); 
		});
});

