function rollover_home(id){
	var lista = document.getElementsByTagName('a');
	for(var i=0; i<lista.length; i++) {
		if(lista[i].id.indexOf('link_')==0) {
			lista[i].style.color='#623015';
		}
	}
	document.getElementById('link_'+id).style.color = '#FF6600';	
}

function rollout_home(id){
	document.getElementById('link_'+id).style.color = '#623015';
}
$(document).ready(function(){
	//create a bubble popup for each DOM element with class attribute as "text", "button" or "link" and LI, P, IMG elements.

	$('.popup_rates').CreateBubblePopup({
		selectable: true,
		position: 'top',
		align: 'center',
		innerHtml: '<img src="images/loading.gif" style="border:0px; vertical-align:middle; margin-right:10px; display:inline;" />loading!',
		innerHtmlStyle: { color:'#FFFFFF', 'text-align':'center' },
		themeName: 'azure',
		themePath: 'images/jquerybubblepopup-theme'
  	});
	
	$('.popup_rates').mouseenter(function(){
		var button = $(this);		
		$.get('http://www.tuktuktravel.it/clouds-CL'+$(this).attr("name").substr(8)+'.html', function(data) {
		//$.get('c', function(data) {
			var timer = null;
			var seconds_to_wait = 1;
			function pause(){
				if(timer != null){
					clearTimeout(timer);
					timer = null;
				}
				timer = setTimeout(function(){
					seconds_to_wait--;
					if(seconds_to_wait > 0){
						pause();
					}else{
						button.SetBubblePopupInnerHtml(data, false); //false -> it shows new innerHtml but doesn't save it, then the script is forced to load everytime the innerHtml... 
					};
				},1000);
			};pause();
		});
	}); //end mouseover event

});
