$(document).ready(function() {
	
    	$("#faded").faded({
	        speed: 1200,
	        crossfade: true,
	        bigtarget: true,
	        autoplay: false,
	        autorestart: 1200,
			autopagination: false
	    });
  
		$(".linkManagement").fancybox({
			'frameWidth': 537,   
	        'frameHeight': 340,
			'zoomOpacity': true,
			'zoomSpeedI': 500,
			'centerOnScroll': true,
			'overlayShow': true,
			'hideOnContentClick': false,
			'showNavArrows':false
		});  
		
		$(".linkNews").fancybox({
			'frameWidth': 870,   
            'frameHeight': 500,
			'zoomOpacity': true,
			'zoomSpeedI': 500,
			'centerOnScroll': true,
			'overlayShow': true,
			'hideOnContentClick': false,
			'titlePosition' : 'over',
			'resize' : false,
			'showNavArrows':false
		});
  
		$(".linkPrivacyEmail").fancybox({
			'frameWidth': 537,   
	        'frameHeight': 340,
			'zoomOpacity': true,
			'zoomSpeedI': 500,
			'centerOnScroll': true,
			'overlayShow': true,
			'hideOnContentClick': false,
			'showNavArrows':false
		});
		
		$("a[rel=cert_group]").fancybox({
			'frameWidth': 850,   
            'frameHeight': 400,
			'zoomOpacity': true,
			'zoomSpeedI': 500,
			'centerOnScroll': true,
			'overlayShow': true,
			'hideOnContentClick': false,
			'titlePosition' : 'over',
			'resize' : false,
			'showNavArrows':false
		});
		
		$("#impianto_fotovoltaico").click(function() {
			$.fancybox([
					'images/progetti/impianto_fotovoltaico/impianto_fotovoltaico_3.jpg',
					'images/progetti/impianto_fotovoltaico/impianto_fotovoltaico_1.jpg',
					'images/progetti/impianto_fotovoltaico/impianto_fotovoltaico_2.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#palacongressi_rimini").click(function() {
			$.fancybox([
					'images/progetti/palacongressi_rimini/palacongressi_rimini_5.jpg',
					'images/progetti/palacongressi_rimini/palacongressi_rimini_1.jpg',
					'images/progetti/palacongressi_rimini/palacongressi_rimini_2.jpg',
					'images/progetti/palacongressi_rimini/palacongressi_rimini_3.jpg',
					'images/progetti/palacongressi_rimini/palacongressi_rimini_4.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('palacongressi_rimini').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	} 
				});
		}); 
		
		$("#palacongressi_riccione").click(function() {
			$.fancybox([
					'images/progetti/palacongressi_riccione/palacongressi_riccione_1.jpg',
					'images/progetti/palacongressi_riccione/palacongressi_riccione_2.jpg',
					'images/progetti/palacongressi_riccione/palacongressi_riccione_3.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('palacongressi_riccione').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	} 
				});
		}); 
		
		$("#sala_consiliare_rimini").click(function() {
			$.fancybox([
					'images/progetti/sala_consiliare_rimini/sala_consiliare_rimini_1.jpg',
					'images/progetti/sala_consiliare_rimini/sala_consiliare_rimini_2.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#palazzo_turismo_rimini").click(function() {
			$.fancybox([
					'images/progetti/palazzo_turismo_rimini/palazzo_turismo_rimini_1.jpg',
					'images/progetti/palazzo_turismo_rimini/palazzo_turismo_rimini_2.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#lungomare_riccione").click(function() {
			$.fancybox([
					'images/progetti/lungomare_riccione/lungomare_riccione_1.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('lungomare_riccione').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	} 
				});
		}); 
		
		$("#nuova_sede_CNA").click(function() {
			$.fancybox([
					'images/progetti/nuova_sede_CNA/cna1.jpg',
					'images/progetti/nuova_sede_CNA/cna2.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('nuova_sede_CNA').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	}
				});
		}); 
		
		$("#3_corsia_A14").click(function() {
			$.fancybox([
					'images/progetti/3_corsia_A14/3_corsia_A14_1.jpg',
					'images/progetti/3_corsia_A14/3_corsia_A14_2.jpg',
					'images/progetti/3_corsia_A14/3_corsia_A14_3.jpg',
					'images/progetti/3_corsia_A14/3_corsia_A14_4.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('3_corsia_A14').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	}
				});
		}); 
		
		$("#scuola_elementare_toti").click(function() {
			$.fancybox([
					'images/progetti/scuola_elementare_toti/scuola_elementare_toti_1.jpg',
					'images/progetti/scuola_elementare_toti/scuola_elementare_toti_2.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#palazzo_sport_riccione").click(function() {
			$.fancybox([
					'images/progetti/palasport_riccione/palasport_riccione_1.jpg',
					'images/progetti/palasport_riccione/palasport_riccione_2.jpg',
					'images/progetti/palasport_riccione/palasport_riccione_3.jpg',
					'images/progetti/palasport_riccione/palasport_riccione_4.jpg',
					'images/progetti/palasport_riccione/palasport_riccione_5.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('palazzo_sport_riccione').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	} 
				});
		}); 
		
		$("#ospedale_maggiore_bologna").click(function() {
			$.fancybox([
					'images/progetti/ospedale_maggiore_bologna/ospedale_maggiore_bologna_1.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#bancaghiaccio_rimini_fiera").click(function() {
			$.fancybox([
					'images/progetti/bancaghiaccio_rimini_fiera/bancaghiaccio_4.jpg',
					'images/progetti/bancaghiaccio_rimini_fiera/bancaghiaccio_1.jpg',
					'images/progetti/bancaghiaccio_rimini_fiera/bancaghiaccio_2.jpg',
					/*'images/progetti/bancaghiaccio_rimini_fiera/bancaghiaccio_3.jpg'*/
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0
				});
		}); 
		
		$("#resort_tui_germany").click(function() {
			$.fancybox([
					'images/progetti/resort_tui_germany/resort_tui_germany1.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('resort_tui_germany').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	}
				});
		}); 

		
		$("#outlet_faenza_perle").click(function() {
			$.fancybox([
					'images/progetti/outlet_faenza_perle/perle_1.jpg',
					'images/progetti/outlet_faenza_perle/perle_2.jpg',
					'images/progetti/outlet_faenza_perle/perle_3.jpg',
					'images/progetti/outlet_faenza_perle/perle_5.jpg',
					'images/progetti/outlet_faenza_perle/perle_6.jpg',
					'images/progetti/outlet_faenza_perle/perle_7.jpg',
					'images/progetti/outlet_faenza_perle/perle_8.jpg',
					'images/progetti/outlet_faenza_perle/perle_9.jpg',
					'images/progetti/outlet_faenza_perle/perle_10.jpg',
					'images/progetti/outlet_faenza_perle/perle_11.jpg',
					'images/progetti/outlet_faenza_perle/perle_12.jpg'
					], {	
				'padding' : 0,
				'transitionIn' : 'none',
				'transitionOut' : 'none',
				'zoomOpacity': true,
				'type' : 'image',
				'changeFade' : 0,
                'titleShow' : true,
                'titlePosition' : 'over',
                'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
                		title = (title.length)? title : ' ' + document.getElementById('outlet_faenza_perle').title;
                        return '<span id="fancybox-title-over"><span id="fancybox-numbering"> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><span id="fancybox-inner-title">' + (title.length ? '' + title :'') + '</span></span>';
                	}
				});
		}); 

			
		$("#slider_news").easySlider({
		/*	auto: true, 
			continuous: true, */
			numeric: true
		});
}); 

function ControllaMail(EmailAddr) {
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
      return false;
      }
}

function invia_mail() {
	var msg = '';
	if(document.getElementById('mitt').value == '') {
		msg += '- indicare il nome del mittente<br>';
	}
	if(!ControllaMail(document.getElementById('email').value)) {
		msg += '- indicare un indirizzo mail valido<br>';
	}	
	if(document.getElementById('testo').value == '') {
		msg += '- scrivere il messaggio<br>';
	}
	if(!document.getElementById('accetta_dati').checked) {
		msg += '- E\' obbligatorio accettare il trattamento dei dati riservati<br>';
	}
	if(msg == '') {
		document.getElementById('ContactForm').submit();
	} else {
		document.getElementById('report_err').innerHTML = "<div class=\"div_error\">"+msg+"</div>";
	}
}

function cercaModIscr(txtSrc) {
	$.ajax({
	  type: 'POST',
	  url: "risorse/modulistica_per_consorziati.inc.php",
	  data: "&fromSrc=1&txtSrc="+txtSrc,
	  success: function(dataRet) {
	  	$("#tab_risultati").html(dataRet);
	  }
	});
}	
