//	inizio funzioni di debug
debug_msg = false;
function toDebug(string)
{
	if (debug_msg)
	{
		if((typeof window.console=="undefined")) {
		//	alert(string);
		}else {
			console.error();
			console.group(string);
			console.trace();
			console.groupEnd();
		}
	}
}
function toConsole(string)
{
	if((typeof window.console=="undefined")) {
	//alert(string);
	}else {
	console.log(string);
	}
}


jQuery(document).ready(function()
{
	
	if($j('.albergo_wrapper')) $('.offerta').shuffle();
	
	$('a[rel*=lightbox]').lightBox();
	
	/*
	jQuery('.a').lightBox();
	*/
	
	// FORMATTAZIONE TABELLA

   	jQuery(".mceContentBody table.tipo1 tbody tr:even").addClass("even");
	jQuery(".mceContentBody table.tipo1 tbody tr:odd").addClass("odd");

	var lang = jQuery('body').attr('class');	
	

	var ID_newsletter = 6;		
	var ID_contatti = 7;
	var ID_guestbook = 224;

	var WForm = 860;		
	var HForm = 570;		

	jQuery('#choose').hide(); // nascondo pulsante 

/*
	jQuery('#choose').click(function() {
		jQuery(this).fadeOut();
		jQuery('#booking').html('<div class="bookloading"></div>'); // attacco loading
		jQuery("#booking").delay(1000,function(){
			jQuery('.bookloading').fadeOut().delay(200,function(){
				jQuery("#booking").load("formbooking/form_"+lang+".htm"); // carico contenuto		
				});		
		});

		jQuery('#booking').fadeIn();
	});
*/
	
	jQuery('.newsletter-ui').click(function() {
		jQuery('.newsletter-ui a').removeAttr('href');
		
		jQuery("#newsletterUi").dialog({

			resizable: false,
			height: HForm,
			width: WForm,
			bgiframe: true, 
			overlay: {opacity: 0.8, background: "black"},
			modal: true,
			open: function() {
				jQuery("#newsletterUi").html('<div class="Generaloading"></div>'); // attacco loading
				jQuery('.Generaloading').css('display', 'block');	
				jQuery("#newsletterUi").load("index.php?l="+lang+"&option=content&id="+ID_newsletter+"&noheader=1&nofooter=1"); // carico contenuto
			}
		});
	
	});	
			
	jQuery('.contatti-ui').click(function() {
	
		jQuery("#contattiUi").dialog({

			resizable: false,
			height: HForm,
			width: WForm,
			bgiframe: true, 
			overlay: {opacity: 0.8, background: "black"},
			modal: true,
			open: function() {
				jQuery("#contattiUi").html('<div class="Generaloading"></div>'); // attacco loading
				jQuery('.Generaloading').css('display', 'block');	
				jQuery("#contattiUi").load("index.php?l="+lang+"&option=content&id="+ID_contatti+"&noheader=1&nofooter=1"); // carico contenuto
			}
				
		});
	});	
	
	jQuery('.guestbook-ui').click(function() {
	
		jQuery("#guestbookUi").dialog({

			resizable: false,
			height: HForm,
			width: WForm,
			bgiframe: true, 
			overlay: {opacity: 0.8, background: "black"},
			modal: true,
			open: function() {
				jQuery("#guestbookUi").html('<div class="Generaloading"></div>'); // attacco loading
				jQuery('.Generaloading').css('display', 'block');	
				jQuery("#guestbookUi").load("index.php?l="+lang+"&option=content&id="+ID_guestbook+"&noheader=1&nofooter=1"); // carico contenuto
			}
				
		});
	});		
});

jQuery(window).load(function()
{
	//jQuery('.chatonline').chatOnLine({user:'paramChat'});
	
	
	mainHeight();
});





