function closeEditor(){
	if (confirm('Sei sicuro di voler chiudere l\' editor?')){
		return true;
	} else {
  		return false;
  }
}

$(window).load(function() {
	//
	$('.slider').nivoSlider({
		directionNav:true,
		directionNavHide:false,
		controlNav:false
	});
	//
	$(".editor").fancybox({
		'hideOnOverlayClick' : false,
		'showCloseButton' : true,
		'onCleanup' : closeEditor,
		'width' : 1000,
		'height' : 600,
		'autoDimensions' : false,
		'autoScale' : false,
		'enableEscapeButton': false,
		'ajax' : {
			type : "POST",
			data : null
		}
	});
		//
	$(".fancy").fancybox({
		'width' : 1000,
		'height' : 600,
		'autoDimensions' : false,
		'autoScale' : false,
	});
	
	$(".imageswap")
	.mouseover(function() { 
		var src = $(this).attr("src").replace(".jpg", "2.jpg");
		$(this).attr("src", src);
	})
	.mouseout(function() {
		var src = $(this).attr("src").replace("2.jpg", ".jpg");
		$(this).attr("src", src);
	});
});

