//	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);
	}
}
//	fine funzioni di debug
function $j(argument)
{
	var result = jQuery(argument);
	if (result.length == 0) return null;
	else return result;
}



jQuery(document).ready(function()

{
		
	jQuery('#upper-menu ul li:last-child a').addClass('lastchild');	
	jQuery.ui.dialog.defaults.bgiframe = true;
	
	jQuery('#privacy').click(function() {
      			
			return showDialog('#privacyUi', '');
		});	
/*	jQuery('#download').click(function() {
      			
			return showDialog('#downloadUi', '');
		});			


	jQuery("#upper-menu ul li:last a").each(function(){
	
		var _ID= jQuery(this).attr('href').split("_")[1].split(".")[0]; // ricavo l'id della pagina
		
		jQuery(this).removeAttr('href'); // rimuovo link
      	jQuery(this).click(function() {
      			
			// return	showDialog('#videoUi', _ID);
			return	showDialog('#downloadUi', _ID);			
		});

	});
	
*/

	
	
	jQuery("#privacyUi").dialog({
			autoOpen:false,
			resizable: false,
			width: 461,
			height: 455,			
			bgiframe: true, 
			buttons: {
				Chiudi: function() {
					jQuery(this).dialog('close');

				}
			}
		});	
	
	jQuery("#downloadUi").dialog({
			autoOpen:false,
			resizable: false,
			width: 402,
			height: 416,			
			bgiframe: true, 
			buttons: {
				Chiudi: function() {
					jQuery(this).dialog('close');

				}
			}
		});	
/*
	jQuery("#videoUi").dialog({
			autoOpen:false,
			resizable: false,
			width: 402,
			height: 416,			
			bgiframe: true, 
			buttons: {
				Chiudi: function() {
					jQuery(this).dialog('close');

				}
			}
		});
*/


    //if($j('#camping-spot')) $('#camping-spot .spot').each(function(){$(this).allclick();});
    if($j('#bottoni')) $('#bottoni > div').each(function(){$(this).allclick();});
	jQuery('.thumbnail a').lightBox();
	

	// FORMATTAZIONE TABELLA

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

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

jQuery(window).load(function()
{
	tableFormat();
    playHiddenBox();
    if (jQuery('#scroller_content'))jQuery('#scroller_content').slideContent();
    positionMainElements();
});






