//<![CDATA[
	function getMyPath() {
		var s = ''+location.href;
		var sa = s.split('/');
		var so = '';
		for(var si=0;si<sa.length-1;si++) {
			so += sa[si]+'/';
		}
		return so;
	}
	function getMyOffset(var_year) {
		var s = ''+location.href;
		var os = 0;
		if (s.indexOf('/'+var_year)>=0 && s.indexOf('.html')>=0) {
			var spl = s.split('/'+var_year);
			os = (spl[1].replace('.html',''))-0;
			if (isNaN(os)) {
				os = 0;
			}
		}
		return os;
	}

	/*var global_mouse_pos = {x:0,y:0};*/
	
	var global_is_animating = false;

	var global_lang = '_it';

	var global_timer;
	//jQuery.noConflict(); // non va con BT plugin

	function default_open_menu(liv1, liv2) {
		try {
			if (jQuery.trim(''+liv1) == '') {
				liv1 = 'programma_spettacoli';
			}
			jQuery('.header_box_menu_js').show();
			var this_first_level = jQuery('#'+liv1);
			jQuery('.first_level').css({'backgroundColor':'transparent','color':'#333'});
			jQuery('.sub_menu').css({'visibility':'hidden'});
			this_first_level.css({'backgroundColor':'#EAE7E4','color':'#00A8BF'});
			var ul = this_first_level.parent().find('.sub_menu');
			ul.css('visibility','visible');
			var this_second_level = jQuery('#'+liv2);
			this_second_level.css({'color':'#00A8BF'});
		}
		catch(e) {
		}
	}

/********************************************************************************************************************************************************************************/
	var zooming = {
		idx:				null,
		list:				null,
		z:					null,
		height_adj:			null,
		getScrolling:		function() {
								var obj = jQuery(window);
								return { top: obj.scrollTop()-0, left: obj.scrollLeft()-0 };
							},
		getObjectDims:		function(obj) {							
								return { width: obj.width()-0, height: obj.height()-0 };
							},
		getWindowDims:		function() {
								return zooming.getObjectDims(jQuery(window));
							},
		getDocumentDims:	function() {
								return zooming.getObjectDims(jQuery(document));
							},
		getBodyDims:		function() {
								return zooming.getObjectDims(jQuery('body'));
							},
		getZoomDims:		function(img) {
								var wind = zooming.getWindowDims();
								var ar = img.width / img.height;		
								if (img.width + 40 > wind.width) {
									img.width = wind.width - 60;
									img.height = Math.round(img.width / ar);
								}
								if (img.height + 80 > wind.height) {
									img.height = wind.height - 100;
									img.width = img.height * ar;
								}		
								return { width: img.width, height: img.height };
							},
		configNoImage:		function(z) {
								if (z.size || z.size != 'undefined') {
									z.width = 200;
									z.height = 140;
								}
								return z;
							},
		gallery:			function (idx, list) {			// ### called to show gallery ###
								zooming.background();
								zooming.image(idx, list);
							},
		resize_bg:			function(body, zct, zbg) {								
								zct.css({
											width:				body.width+'px',
											height:				body.height+'px',
											position:			'absolute',
											top:				'0px',
											left:				'0px',
											zIndex:				'999998',
											overflow:			'hidden'
										});
								zbg.css({
											width:				body.width+'px',
											height:				body.height+'px',
											backgroundColor:	'#000000',
											opacity:			'0.5',
											filter:				'alpha(opacity=50)',
											position:			'absolute',
											top:				'0px',
											left:				'0px',
											zIndex:				'999999'
										});
								setTimeout(function(){ //serve a sincronizzare correttamente IE
									var docu = zooming.getDocumentDims();
									if (docu.width != body.width) {
										zct.css({
												width:				docu.width+'px',
												height:				body.height+'px',
												position:			'absolute',
												top:				'0px',
												left:				'0px',
												zIndex:				'999998',
												overflow:			'hidden'
											});
										zbg.css({
												width:				docu.width+'px',
												height:				body.height+'px',
												backgroundColor:	'#000000',
												opacity:			'0.5',
												filter:				'alpha(opacity=50)',
												position:			'absolute',
												top:				'0px',
												left:				'0px',
												zIndex:				'999999'
											});
									}
								},1);
							},
		background:			function () {
								var zct = jQuery('<div class="zooming_dlg"></div>');			
								var zbg = jQuery('<div class="zooming_bgi"></div>');
								zooming.resize_bg(zooming.getBodyDims(), zct, zbg);
								jQuery('body').append(zct);
								jQuery('.zooming_dlg').append(zbg);
							},
		positionit:			function(dlg, z, height_adj) {
								if ((jQuery.browser.mozilla || jQuery.browser.safari) && (navigator.appVersion+'').indexOf('Chrome') < 0) {
									if (dlg.find('object').length > 0) {
										dlg.hide();
									}
								}
								var docu = zooming.getDocumentDims();
								var wind = zooming.getWindowDims();
								var scroll = zooming.getScrolling();							
								dlg.css({
											width:				docu.width + 'px',
											height:				docu.height + 'px',
											backgroundColor:	'transparent',
											position:			'absolute',
											top:				( scroll.top + Math.round((wind.height -z.height -height_adj) / 2) ) +'px',
											left:				'0px',
											zIndex:				'9999991'
										});
								dlg.stop(true);
								if ((jQuery.browser.mozilla || jQuery.browser.safari) && (navigator.appVersion+'').indexOf('Chrome') < 0) {
									if (dlg.find('object').length > 0) {
										dlg.show();
									}
								}
							},
		attach_events:		function(idx, list) {
								jQuery('.close_image_gal').click(function(){
									jQuery('.zooming_dlg').remove();
									jQuery(window).unbind('scroll', zooming.scroll_hook);
									jQuery(window).unbind('resize', zooming.resize_hook);
								});

								if (list.length > 1) {
									jQuery('.prev_image_gal').click(function(){
										if (jQuery(this).find('img').attr('src').indexOf('_dis') < 0) {
											jQuery('.zooming_img').remove();
											zooming.show(idx-1, list);
										}
									});
									jQuery('.next_image_gal').click(function(){
										if (jQuery(this).find('img').attr('src').indexOf('_dis') < 0) {
											jQuery('.zooming_img').remove();
											zooming.show(idx+1, list);
										}
									});
								}
							},
		resize_to:			function (z, ddim) {
								var asprat = z.width / z.height;
								if (z.width > ddim.width) {
									z.width = ddim.width;
									z.height = Math.round(z.width / asprat);
								}
								if (z.height > ddim.height) {
									z.height = ddim.height;
									z.width = Math.round(z.height * asprat);
								}
								return z;
							},
		resize_zoom:		function(z, height_adj) {
								var wd = zooming.getWindowDims();
								if (z.width > wd.width -40 || z.height > wd.height-(height_adj +40)) {
									z = zooming.resize_to(z,{ width: wd.width -40, height: wd.height-(height_adj +40) });
								}
								return z;
							},
		resize_tpl:			function(z, height_adj) {
								if (! z.isVideo) {
									z.width = z.original_width;
									z.height = z.original_height;
									z = zooming.resize_zoom(z, height_adj);
									jQuery('.zoomed_image').css({
																	width:  (z.width +22)+'px',
																	height: (z.height +height_adj)+'px'
																});
									var zp = jQuery('.zoomed_picture');
									zp.attr('width', z.width);
									zp.attr('height', z.height);
								}
							},
		show:				function(idx, list) {
								var isGallery = false;
								var height_adj = 50;
								if (list.length > 1) {
									isGallery = true;
									height_adj = 70;
								}

								var z = list[idx];
								z.original_width = z.width;
								z.original_height = z.height;

								zooming.z = z;
								zooming.height_adj = height_adj;
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
								var isImage = true;
								if (z.size) {
									isImage = false;
									z = zooming.configNoImage(z);									
								}
								else {
									z = zooming.resize_zoom(z, height_adj);
								}

								var isVideo = false;
								if (z.isVideo) {
									isVideo = true;
								}

								var dlg = jQuery('<div class="zooming_img" align="center"></div>');
								zooming.positionit(dlg, z, height_adj);
								var closebut = {
												'_it':	'CHIUDI',
												'_en':	'CLOSE'
											};

								var extra_style = '';
								if (isGallery) {								
									if (jQuery.browser.msie) {
										extra_style = ' style="margin-top:5px;"';
									}
								}
								else {
									extra_style = ' style="margin-top:10px;"';
									if (jQuery.browser.msie) {
										extra_style = ' style="margin-top:15px;"';
									}
								}

								if (isGallery) {
									var arrow_sx = 'foto_sx_dis';
									if (idx > 0) {
										arrow_sx = 'foto_sx';
									}
									var arrow_dx = 'foto_dx_dis';
									if (idx < list.length-1) {
										arrow_dx = 'foto_dx';
									}
								}

								var dialog = '';
								dialog += '<div class="zoomed_image" style="position:relative;top:0;left:0;background:#FFFFFF; border:1px solid #666; width:'+(z.width +22)+'px; height:'+(z.height +height_adj)+'px;">';
									dialog += '<div style="padding:10px 10px 50px 10px;">';
										if (isVideo) {
											dialog += '<object style="display:block;" width="'+z.width+'" height="'+z.height+'"><param name="movie" value="http://www.youtube.com/v/'+z.url+'&hl=it&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+z.url+'&hl=it&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+z.width+'" height="'+z.height+'" style="display:block;"></embed></object>';
										}
										else {
											if (isImage) {
												dialog += '<div style="position:relative">';
												dialog += '<img class="zoomed_picture" src="'+z.url+'" width="'+z.width+'" height="'+z.height+'" style="float:left;border:1px solid #C5C2BC;" />';
												if (z.didascalia!="")
												{
												//	pezzipezzi = z.didascalia.split("###");
												//	new_didasc = pezzipezzi.join("<br/>");
												//	temporaneo
													new_didasc = z.didascalia.replace("###","<br/>");
													pezzipezzi = new_didasc.split("###");
													new_didasc = pezzipezzi.join(" | ");
												//	----------
												/*	if (custom_OD.SERVER['REMOTE_ADDR']=="93.63.225.36") ginogino = "<br />gino gino";
													else */ginogino = "";
												//	if (custom_OD.SERVER['REMOTE_ADDR']=="93.63.225.36") alert(z.didascalia);
													dialog += '<div class="zoom_didascalia_bg" style="position:absolute;top:'+(z.height)+'px;left:1px;width:'+(z.width)+'px;height:0px;background-color:white;opacity:0.8;filter:alpha(opacity=80);overflow:hidden;">&nbsp;</div>';
													dialog += '<div class="zoom_didascalia_txt" style="position:absolute;top:'+(z.height)+'px;left:1px;width:'+(z.width)+'px;height:0px;color:black;overflow:hidden;"><div style="padding:5px;">' + new_didasc + ginogino + '</div></div>';
												}
												dialog += '</div>';
												dialog += '<div class="clear">&nbsp;</div>';
											}
											else {
												var ext = 'FILE';
												var arr = z.url.split('.');
												ext = (arr[arr.length-1]+'').toUpperCase();
												dialog += '<a href="'+z.url+'" style="text-decoration:none;">';
													dialog += '<img class="zoomed_picture" src="../../immagini/polaroid.png" width="'+z.width+'" height="'+z.height+'" />';
													dialog += '<div style="text-align:left; margin-left:70px; margin-top:-100px; font-size:1em; height:100px; color:#888; font-weight:bold;">'+ext+', '+Math.round(z.size/1024)+' KB</div>';
												dialog += '</a>';
											}
										}
										dialog += '<div align="center"'+extra_style+'>';
											if (isGallery) {
												dialog += '<div class="title_image_gal" style="font-size:0.9em; font-weight:bold; color:#0099D3; font-family:Arial,Helvetica,sans-serif;height:35px;overflow:hidden;text-align:left;">';
													dialog += '<table border="0" cellspacing="0" cellpadding="0" style="height:1.8em;"><tr><td style="vertical-align:middle;">';
													dialog += z.title;
													dialog += '</td></tr></table>';
												dialog += '</div>';
												dialog += '<div class="prev_image_gal" style="width:12px;float:left;cursor:pointer;"><img src="http://'+custom_OD.SERVER['SERVER_NAME']+'/ravennafestival2009'+'/immagini/'+arrow_sx+'.gif" /></div>';
												dialog += '<div class="next_image_gal" style="width:12px;float:right;cursor:pointer;"><img src="http://'+custom_OD.SERVER['SERVER_NAME']+'/ravennafestival2009'+'/immagini/'+arrow_dx+'.gif" /></div>';
											}
											dialog += '<div style="text-align:center;"><span class="close_image_gal" style="cursor:pointer;font-size:0.7em;">'+closebut[global_lang]+'</span></div>';
										dialog += '</div>';
									dialog += '</div>';
									if ( z.txtDownloadHR )
									{
										dialog += '<div class="downloadHR_bg" style="width:'+(z.width+10*2)+'px;">&nbsp;</div>';
										dialog += '<div class="downloadHR_txt" style="width:'+(z.width+10*2)+'px;"><a href="' + z.linkDownloadHR + '" ' + z.linkTargetHR + ' >' + z.txtDownloadHR + '</a></div>';
									}
								dialog += '</div>';
								jQuery('.zooming_dlg').append(dlg);
								jQuery('.zooming_img').append(dialog);							
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
								zooming.attach_events(idx,list);
								
								dida_setup();
							},
		scroll_hook:		function() {	//alert('scroll');
								zooming.positionit(jQuery('.zooming_img'), zooming.z, zooming.height_adj);
							},
		resize_hook:		function() {	//alert('resize');
								zooming.resize_bg(zooming.getBodyDims(), jQuery('.zooming_dlg'), jQuery('.zooming_bgi'));
								zooming.resize_tpl(zooming.z, zooming.height_adj);
								zooming.positionit(jQuery('.zooming_img'), zooming.z, zooming.height_adj);
							},
		image:				function (idx, list) {
								zooming.show(idx, list);

								jQuery(window).bind('scroll', zooming.scroll_hook);
								jQuery(window).bind('resize', zooming.resize_hook);
							}
	};
	
	function dida_setup() {
		if (jQuery('.zoomed_picture').length > 0) {
			jQuery('.zoomed_picture').hover(
				function(){
					var hei = (jQuery(this).closest('.zoomed_image').find('.zoomed_picture').css('height').replace('px',''))-0;
					var hei_d = 40;
					jQuery(this).closest('.zoomed_image').find('.zoom_didascalia_bg,.zoom_didascalia_txt').animate({
						top:			(hei - (hei_d-1))+2,
						height:			hei_d
					},
					{
						"duration":		500
					});
				},
				function(){
					var hei = (jQuery(this).closest('.zoomed_image').find('.zoomed_picture').css('height').replace('px',''))-0;
					jQuery(this).closest('.zoomed_image').find('.zoom_didascalia_bg,.zoom_didascalia_txt').animate({
						"top":			hei+2,
						"height":		0
					},
					{
						"duration":		500
					});
				}
			);
		}
	}
	
/********************************************************************************************************************************************************************************/
	
	// parte dialog per ZOOM [begin] ---------------------------------------------------------------------------------------------
	function zoomin(obj) {
		var gidx = jQuery(obj.target).closest('.z_thumb').attr('id').replace('ztidx_','')-0;
		var ggal = eval(jQuery(obj.target).closest('.galleria_elenco').find('.zoom_gallery').text());

		zooming.gallery(gidx, ggal);

		return false;
	}
	// parte dialog per ZOOM [end] ---------------------------------------------------------------------------------------------
	
	// galleria foto [begin]
	function closeGallery(me, url) {
		jQuery(me).css('cursor','progress');
	/*	if (custom_OD.SERVER['REMOTE_ADDR']=="93.63.225.36")
			var content = me.closest('.gallery_list').find('.galleria_foto_content');
		else */
			var content = me.next('.galleria_foto_content');
		var url = content.attr('url');
		var img = me.find('img');
		var img_src = img.attr('src');
		if (img_src.indexOf('open') >= 0) {
			content.load(url,null,function(responseText, textStatus, XMLHttpRequest){ 	//alert(responseText+"\n"+textStatus+"\n"+XMLHttpRequest);									
				jQuery(me).css('cursor','default');
				content.slideDown();
				img.attr('src', img_src.replace('open','close'));
				var zoom = content.find('.zoom_me');	//jQuery('.zoom_me');
				zoom.css({'cursor':'pointer'});
				zoom.attr('title','ZOOM');
				zoom.click(zoomin);

				jQuery('.gallery_left').each(function(){
					jQuery(this).css('cursor','pointer');
					jQuery(this).click(function(){
					  if (! global_is_animating) {
						var other_src = jQuery(this).closest('.galleria_foto_content').find('.gallery_right').attr('src');
						other_src = other_src.replace('_dis.gif','.gif');
						jQuery(this).closest('.galleria_foto_content').find('.gallery_right').attr('src', other_src);
						
						var scroller = jQuery(this).closest('.galleria_elenco').find('.galleria_scroller');
						var newMarginLeft = (scroller.css('marginLeft').replace('px','')-0 +135);
						var img_src = jQuery(this).attr('src');
						if (newMarginLeft >= 0) {
							newMarginLeft = 0;
							if (img_src.indexOf('_dis.gif')<0)
								img_src = img_src.replace('.gif','_dis.gif');
						}
						else {
							img_src = img_src.replace('_dis.gif','.gif');
						}						
						newMarginLeft = newMarginLeft+'px';
						if (newMarginLeft != scroller.css('marginLeft')) {
							jQuery(this).attr('src', img_src);
							global_is_animating = true;
							scroller.animate({'marginLeft':newMarginLeft},{duration:500,queue:true, complete:function(){ global_is_animating = false; } });
						}
					  }
					});
				});
				jQuery('.gallery_right').each(function(){
					jQuery(this).css('cursor','pointer');
					jQuery(this).click(function(){
					  if (! global_is_animating) {
						var other_src = jQuery(this).closest('.galleria_foto_content').find('.gallery_left').attr('src');
						other_src = other_src.replace('_dis.gif','.gif');
						jQuery(this).closest('.galleria_foto_content').find('.gallery_left').attr('src', other_src);
						var scroller = jQuery(this).closest('.galleria_elenco').find('.galleria_scroller');
						if (scroller.css('marginLeft') == 'auto') { // patch per IE
							scroller.css('marginLeft','0px');
						}
						var newMarginLeft = (scroller.css('marginLeft').replace('px','') -135);
						var img_src = jQuery(this).attr('src');
						if (newMarginLeft <= -(scroller.width()-(135*4))) {
							newMarginLeft = -(scroller.width()-(135*4));
							if (img_src.indexOf('_dis.gif')<0)
								img_src = img_src.replace('.gif','_dis.gif');
						}
						else {
							img_src = img_src.replace('_dis.gif','.gif');
						}										  
						newMarginLeft = newMarginLeft+'px'; 
						if (newMarginLeft != scroller.css('marginLeft')) {
							jQuery(this).attr('src', img_src);
							global_is_animating = true;
							scroller.animate({'marginLeft':newMarginLeft},{duration:500,queue:true, complete:function(){ global_is_animating = false; } });
						}
					  }
					});
				});
			});
		}
		else {
			jQuery(me).css('cursor','default');
			content.slideUp();
			img.attr('src', img_src.replace('close','open'));
		}
	}
	function load_page(me, url) {
		jQuery(me).closest('div.ui-tabs-panel').load(url, null, function(responseText, textStatus, XMLHttpRequest){ 	//alert(responseText+"\n"+textStatus+"\n"+XMLHttpRequest);
			if (textStatus.toLowerCase() == 'success') {
				jQuery('.galleria_foto_opener').css({'cursor':'pointer'});
				jQuery('.galleria_foto_opener').click(function(){
					closeGallery(jQuery(this));
				});
				//jQuery(document).scrollTop(0);
			}
		});
	}
	// galleria foto [end]

//	if (OD_filter == 'undefined') {
		OD_filter = {
						dal:				20100609,//20090614,				// ##################################### DATA INIZIO FESTIVAL
						al:					20100713,//20090718,				// ##################################### DATA FINE FESTIVAL
						opera:				'',	
						concerti:			'',
						eventi_speciali:	'',
						teatro_danza:		'',
						liturgie_domenicali:'',
						alle_7_della_sera:	'',
						titolo:				'',
						dettagli:			'',
						sede:				'-',
						nessun_risultato:	{
												'_it':	'Nessun risultato per i criteri selezionati',
												'_en':	'No results'
											}
					};
		OD_filter_as = {	//archivio_spettacoli
						termini:			'', 
						anno:				'',
						genere:				'',
						tipo:				'',	
						non_eseguito:		'',	
						nessun_risultato:	{
												'_it':	'Nessun risultato per i criteri selezionati',
												'_en':	'No results'
											}
					};				
//	}
	
	function fixDateShow() {
		jQuery('.spettacolo_dettagli').hide(); //,.vai_pagina_evento
		var prev_date = '-';
		var count = 0;
		jQuery('.calendario_eventi tbody tr').each(function(i){						
			if (jQuery(this).css('display') != 'none') {
				var data =  jQuery(this).find('.giorno_spettacolo');
				if (data.html() == prev_date) {
					data.addClass('nascosto');
					jQuery(this).find('td').css('borderTop','0px');
				}
				else {
					data.removeClass('nascosto');
					if (count==0) {
						jQuery(this).find('td').addClass('cella_top');
					}
					else if (count>0) {
						jQuery(this).before('<tr class="separatore_giorni"><td colspan="6" class="cella_separatore"><div class="separatore">&nbsp;</div></td></tr>');
					}
					count++;
				}
				prev_date = data.html();								
			}
		});
		jQuery('.calendario_eventi tbody tr:visible:first td').addClass('cella_top');
		jQuery('.calendario_eventi tbody tr:visible:first td').css('borderTop','2px solid #CECECC');
		jQuery('.calendario_eventi tbody tr:visible:last td').addClass('cella_bottom');
		jQuery('.calendario_eventi tbody tr:visible:last td').css('borderBottom','2px solid #CECECC');
	}
	
	function fixDateShow_archivio_spettacoli() {
		jQuery('.spettacolo_dettagli').hide();
		jQuery('.spettacolo_titolo').each(function(){
			if (jQuery.trim(jQuery(this).text()) == '') {
				jQuery(this).next('.spettacolo_dettagli').show();
			}
		});
		var prev_date = '-';
		var count = 0;
		jQuery('.separatore_giorni').remove();
		jQuery('.archivio_spettacoli tbody tr').each(function(i){						
			if (jQuery(this).css('display') != 'none') {
				var data = jQuery(this).find('.spettacolo_info');
				if (data.html() == prev_date) {
					data.addClass('nascosto');
					jQuery(this).find('td').css('borderTop','0px');
				}
				else {
					data.removeClass('nascosto');
					if (count==0) {
						jQuery(this).find('td').addClass('cella_top');
					}
					else if (count>0) {
						jQuery(this).before('<tr class="separatore_giorni"><td colspan="6" class="cella_separatore"><div class="separatore">&nbsp;</div></td></tr>');
					}
					count++;
				}
				prev_date = data.html();								
			}
		});
		jQuery('.archivio_spettacoli tbody tr:visible:first td').addClass('cella_top');
		jQuery('.archivio_spettacoli tbody tr:visible:first td').css('borderTop','2px solid #CECECC');
		jQuery('.archivio_spettacoli tbody tr:visible:last td').addClass('cella_bottom');
		jQuery('.archivio_spettacoli tbody tr:visible:last td').css('borderBottom','2px solid #CECECC');
	}
	
	function filtra_tutto(){ 			//var s='';for(var i in OD_filter)s+=i+": "+OD_filter[i]+"\n";alert(s);
		jQuery('body').css('cursor','wait');
		if (jQuery('.archivio_spettacoli').lenght==0)
		{
			jQuery('.separatore_giorni').remove();
			jQuery('.cella_top').removeClass('cella_top');
			jQuery('.cella_bottom').removeClass('cella_bottom');
		}
		
		//alert(jQuery('.calendario_eventi tbody tr').length);
		var shownum = 0;
		jQuery('.calendario_eventi tbody tr').each(function(i){
			var show_row = true;						

			var day = jQuery(this).attr('id').replace('day_','') -0; //alert(day);
			if (day < OD_filter.dal || day > OD_filter.al) {
				show_row = false;
			}

			var genere = '/'+jQuery.trim(jQuery(this).find('.spettacolo_genere').text())+'/'; //alert(genere);
			var has_genere = false;
			if (OD_filter.opera!='' && genere.indexOf('/'+OD_filter.opera+'/')>=0) {
				has_genere = true;
			}
			if (OD_filter.concerti!='' && genere.indexOf('/'+OD_filter.concerti+'/')>=0) {
				has_genere = true;
			}
			if (OD_filter.eventi_speciali!='' && genere.indexOf('/'+OD_filter.eventi_speciali+'/')>=0) {
				has_genere = true;
			}
			if (OD_filter.teatro_danza!='' && genere.indexOf('/'+OD_filter.teatro_danza+'/')>=0) {
				has_genere = true;
			}
			if (OD_filter.liturgie_domenicali!='' && genere.indexOf('/'+OD_filter.liturgie_domenicali+'/')>=0) {
				has_genere = true;
			}
			if (OD_filter.alle_7_della_sera!='' && genere.indexOf('/'+OD_filter.alle_7_della_sera+'/')>=0) {
				has_genere = true;
			}
			if ( ! has_genere ) {
				show_row = false;
			}

			if (jQuery.trim(OD_filter.termini) != '') {
				var informazioni_spettacolo = jQuery(this).find('.spettacolo_info').text().toLowerCase();
				var termini_cercati = OD_filter.termini.toLowerCase().split(' ');
				var termini_cercati_new = [];
				for(var t=0; t<termini_cercati.length; t++) {
					termini_cercati[t] = jQuery.trim(termini_cercati[t]);
					if (termini_cercati[t] != '') {
						termini_cercati_new.push(termini_cercati[t]);
					}
				}				
				var term_found = false;
				for(var t=0; t<termini_cercati_new.length; t++) {
					if (informazioni_spettacolo.indexOf(termini_cercati_new[t]) >= 0) {
						term_found = true;
						break;
					}
				}
				if ( ! term_found) {
					show_row = false;
				}
			}
		
			if (OD_filter.sede != '-') {
				if (jQuery.trim(jQuery(this).find('.spettacolo_sede').html()) != jQuery.trim(OD_filter.sede)) {
					show_row = false;
				}
			}

			/* --- Visualizzazione riga --- */
			if (show_row) {
				jQuery(this).show();
				shownum++;
			}
			else {
				jQuery(this).hide();
			}
		});

		fixDateShow();

		if (shownum==0) {
			jQuery('.calendario_eventi tbody').append('<tr class="separatore_giorni"><td colspan="6" class="cella cella_left cella_right aligncenter"><div class="nessun_risultato">'+OD_filter.nessun_risultato[global_lang]+'</div></td></tr>');
		}
		jQuery('body').css('cursor','default');
	}
	
// archivio_spettacoli util [begin]
	function filtra_tutto_archivio_spettacoli(){
		if (OD_filter_as.anno != OD_filter_as.anno_prec || OD_filter_as.anno == '0000') {
			jQuery('.form_programma').submit();
			return true;
		}
		jQuery('body').css('cursor','wait');
		if (jQuery('.archivio_spettacoli').lenght==0)
		{
			jQuery('.separatore_giorni').remove();
			jQuery('.cella_top').removeClass('cella_top');
			jQuery('.cella_bottom').removeClass('cella_bottom');
		}

		var shownum = 0;
		jQuery('.archivio_spettacoli tbody tr').each(function(i){
			var show_row = true;						

			if (jQuery.trim(OD_filter_as.termini) != '') {
				var informazioni_spettacolo = jQuery(this).find('.spettacolo_info').text().toLowerCase();
				var termini_cercati = OD_filter_as.termini.toLowerCase().split(' ');
				var termini_cercati_new = [];
				for(var t=0; t<termini_cercati.length; t++) {
					termini_cercati[t] = jQuery.trim(termini_cercati[t]);
					if (termini_cercati[t] != '') {
						termini_cercati_new.push(termini_cercati[t]);
					}
				}				
				var term_found = false;
				for(var t=0; t<termini_cercati_new.length; t++) {
					if (informazioni_spettacolo.indexOf(termini_cercati_new[t]) >= 0) {
						term_found = true;
						break;
					}
				}
				if ( ! term_found) {
					show_row = false;
				}
			}

			if (jQuery.trim(OD_filter_as.genere) != '') {
				var generi = '/'+jQuery.trim(jQuery(this).find('.spettacolo_genere_ref').text())+'/';
				var genere_found = false;
				if (generi.indexOf('/'+OD_filter_as.genere+'/')>=0) {
					genere_found = true;
				}
				if ( ! genere_found) {
					show_row = false;
				}
			}

			if (jQuery.trim(OD_filter_as.tipo) != '') {
				var tipo = jQuery.trim(jQuery(this).find('.spettacolo_tipo').text());
				if (tipo != OD_filter_as.tipo) {
					show_row = false;
				}
			}

			if (jQuery.trim(OD_filter_as.non_eseguito) != '' && OD_filter_as.non_eseguito != 0) {
				var non_eseguito = jQuery.trim(jQuery(this).find('.spettacolo_non_eseguito').text());
				if (non_eseguito != OD_filter_as.non_eseguito) {
					show_row = false;
				}				
			}

			/* --- Visualizzazione riga --- */
			if (show_row) {
				jQuery(this).show();
				shownum++;
			}
			else {
				jQuery(this).hide();
			}
		});

		fixDateShow_archivio_spettacoli();

		if (shownum==0) {
			jQuery('.archivio_spettacoli tbody').append('<tr class="separatore_giorni"><td colspan="6" class="cella cella_left cella_right aligncenter"><div class="nessun_risultato">'+OD_filter.nessun_risultato[global_lang]+'</div></td></tr>');
		}
		jQuery('body').css('cursor','default');

		return false;
	}
// archivio_spettacoli util [end]
	
	
	jQuery(document).ready(function() {			/* DOCUMENT -> READY HERE! ***************************************************************/		

		if (jQuery('#language_selected')) {
			global_lang = jQuery.trim(jQuery('#language_selected').text());
		}
/*
		jQuery().mousemove(function(e){
			global_mouse_pos.x = e.pageX;
			global_mouse_pos.y = e.pageY;
		});
*/
		// top menu
		jQuery('.header_box_menu_js .first_level').each(function(){
			jQuery(this).hover(
				function(){
					if (jQuery(this).css('color') == 'rgb(51, 51, 51)' || jQuery(this).css('color') == '#333' || jQuery(this).css('color') == '#333333') {
						jQuery(this).css('color','#fff');
					}
				},
				function(){
					if (jQuery(this).css('color') == 'rgb(255, 255, 255)' || jQuery(this).css('color') == '#fff' || jQuery(this).css('color') == '#ffffff') {
						jQuery(this).css('color','#333');
					}
				}
			);
			jQuery(this).click(function(){
				jQuery('.first_level').css({'backgroundColor':'transparent','color':'#333'});
				jQuery('.sub_menu').css({'visibility':'hidden'});
				jQuery(this).css({'backgroundColor':'#EAE7E4','color':'#00A8BF'});
				var ul = jQuery(this).parent().find('.sub_menu');
				ul.css('visibility','visible');
			});
		});
		jQuery('.second_level').each(function(){
			jQuery(this).hover(
				function(){
					if (jQuery(this).css('color') == 'rgb(51, 51, 51)' || jQuery(this).css('color') == '#333' || jQuery(this).css('color') == '#333333') {
						jQuery(this).css('color','#00A8BE');
					}
				},
				function(){
					if (jQuery(this).css('color') == 'rgb(0, 168, 190)' || jQuery(this).css('color') == '#00A8BE' || jQuery(this).css('color') == '#00a8be') {
						jQuery(this).css('color','#333');
					}
				}
			);
		});

		// slide --- [begin]
		var slideshow=false;
		try {
			if (slide_array.length>1) {
				slideshow=true;
			}
		}
		catch(e) {
			slideshow=false;
		}
		if (slideshow) {
			var global_autostart;
			var global_interval;
			var slide_index = 0;
			var tempo_crossfade_slideshow = 1000; // ### PARAMETRO DI TEMPORIZZAZIONE CROSSFADE (PERSONALIZZABILE)
			var tempo_permanenza_slideshow = 4000; // ### PARAMETRO DI TEMPORIZZAZIONE PERMANENZA (PERSONALIZZABILE)

			function attrManage(slide_array,slide_index) {
				jQuery('#slide_img_link').attr('href', slide_array[slide_index][1]);
				jQuery('#slide_shown').attr('alt', slide_array[slide_index][2]);
				jQuery('#slide_shown').attr('title', slide_array[slide_index][2]);
				var link_ = slide_array[slide_index][1];
				if (link_.indexOf("sviluppo")==-1 && link_.indexOf("anteprime")==-1) {
					jQuery('#slide_img_link').click(function(){
						jQuery(this).attr('target','blank');
					});
					jQuery('#slide_img_link').keypress(function(){
						jQuery(this).attr('target','blank');
					});
				} else {
					jQuery('#slide_img_link').click(function(){
						jQuery(this).removeAttr('target');
					});
					jQuery('#slide_img_link').keypress(function(){
						jQuery(this).removeAttr('target');
					});
				}
			}

			function OD_start_slide() {
				if (slide_array.length > 1) {
					jQuery('.ticket_btn').fadeIn(10, function(){
						jQuery('.ticket_btn').fadeOut(10);
					});
					setTimeout(function(){
						jQuery('.ticket_btn:eq(0)').fadeIn(10);
					},30);
					global_interval = setInterval(function(){
						var shown = jQuery('#slide_shown');

						slide_index++;
						if (slide_index >= slide_array.length) {
							slide_index = 0;
						}

						setTimeout(function(){
							jQuery('.slide_button').css({backgroundColor:'#000', color:'#fff'});
							jQuery('#slide_'+(slide_index +1)).css({backgroundColor:'#fff', color:'#000'});
						},tempo_crossfade_slideshow/2);

						if (jQuery('.ticket_btn:visible').length > 0){
							jQuery('#slide_html_'+(slide_index)).fadeOut(tempo_crossfade_slideshow, function(){
								jQuery('#slide_html_'+(slide_index +1)).fadeIn();
							});
						}
						else {
							jQuery('#slide_html_'+(slide_index +1)).fadeIn(tempo_crossfade_slideshow);
						}
						shown.fadeOut(tempo_crossfade_slideshow, function(){
							shown.attr('src', slide_array[slide_index][0]);
							shown.show();							

							var next = slide_index +1;
							if (next >= slide_array.length) {
								next = 0;
							}
							jQuery('#slide_next').css('backgroundImage', 'url('+slide_array[next][0]+')');
							
							attrManage(slide_array,slide_index);
						});
					}, tempo_permanenza_slideshow);
					
					jQuery('.slide_button').click(function(){						
						clearInterval(global_interval);
						clearTimeout(global_autostart);													
						var slide_index = jQuery(this).attr('id').replace('slide_','') -1;
						jQuery('#slide_next').css('backgroundImage', 'url('+slide_array[slide_index][0]+')');
						var shown = jQuery('#slide_shown');
						shown.stop(false,true);
						
						setTimeout(function(){
							jQuery('.slide_button').css({backgroundColor:'#000', color:'#fff'});
							jQuery('#slide_'+(slide_index +1)).css({backgroundColor:'#fff', color:'#000'});
						},tempo_crossfade_slideshow/4);
						
						if (jQuery('.ticket_btn:visible').length > 0){
							jQuery('#slide_html_'+(slide_index)).fadeOut(tempo_crossfade_slideshow/2, function(){
								jQuery('#slide_html_'+(slide_index +1)).fadeIn();
							});
						}
						else {
							jQuery('#slide_html_'+(slide_index +1)).fadeIn(tempo_crossfade_slideshow/2);
						}
						shown.fadeOut(tempo_crossfade_slideshow/2, function(){
							shown.attr('src', slide_array[slide_index][0]);
							shown.show();

							attrManage(slide_array,slide_index);
						});
					});
				}
			}
			
			OD_start_slide();
			var tempo_avvio_slideshow = 10000; // ### PARAMETRO PERSONALIZZABILE
			function OD_autostart() {
				global_autostart = setTimeout(function(){
												OD_start_slide();
											}, tempo_avvio_slideshow);
			}
		}
		// slide --- [end]

		// tooltip --- [begin]
		var tip_timeout = 300; // ### PARAMETRO PERSONALIZZABILE
		var tip_timein = 750; // ### PARAMETRO PERSONALIZZABILE
		bt_tip_shown = false;
		bt_show_timer = null;
		bt_hide_timer = null;
		
		function showTip(me) {
			clearTimeout(bt_show_timer);
			bt_show_timer = setTimeout(function(){
											me.btOn();
										}
										, tip_timein);
		}
		
		function hideTip(me) {
			bt_hide_timer = setTimeout(function(){
										me.btOff();
									}, tip_timeout);
		}

		jQuery('.jq_agenda_tooltip table').mouseout(function(){
			clearTimeout(bt_show_timer);
		});

		jQuery('.jq_agenda_tooltip a').wrap('<div></div>').parent().addClass('jq_tooltip');
		
		jQuery('.jq_tooltip').each(function(){
			var me = jQuery(this);
			
			me.bt({
				ajaxPath: ["jQuery(this).find('a').attr('href').replace('.html','-291.html')",'.jq_tooltip_content'],
				ajaxError: "<strong>ERROR!</strong><br/>Message: <em>%error</em>.",
				//ajaxLoading:"Loading...",
				cssStyles:{width:'240px', lineHeight:'1.2', border:'0px'},
				fill:'#FCF9EA',
				cornerRadius:0,
				strokeWidth:1,
				strokeStyle:'#CDCECD',
				spikeLength:20,
				spikeGirth:30,
				centerPointX:0,
				trigger:'none',
				closeWhenOthersOpen: true,
//				preShow: function() {
//					clearTimeout(bt_hide_timer);
//				},
				postShow: function() {
							jQuery('.bt-wrapper').append('<div class="bt-sensor" style="opacity:0.01;filter:alpha(opacity=1);background-color:white;position:absolute;z-index:99999;"></div>');
							jQuery('.bt-sensor').offset().top = jQuery('.bt-wrapper').offset().top;
							jQuery('.bt-sensor').offset().left = jQuery('.bt-wrapper').offset().left;
							jQuery('.bt-sensor').css({'width':'280px','height':(jQuery('.bt-content').height()+22)+'px'});
							jQuery('.bt-sensor').mouseover(function(){
								clearTimeout(bt_hide_timer);
							});
							jQuery('.bt-sensor').mouseout(function(){
								hideTip(me);
							});
							jQuery('.bt-sensor').append(jQuery('.bt-content').clone());
						}
			});
			
			me.mouseover(function(){showTip(me);});
			me.mouseout(function(){hideTip(me);});
		});
		// tooltip --- [end]

		jQuery('.mappa_ravenna div').addClass('jq_tooltip_map');
		jQuery('.jq_tooltip_map').each(function(){
			var me = jQuery(this);
			var id = ''+me.attr('id');
			if (id!='') {
				me.bt({
					contentSelector:  "jQuery('#'+jQuery(this).attr('id')+'_tip').html()",
					/*cssStyles:{width:'240px', lineHeight:'1.2', border:'0px'},*/
					fill:'#FCF9EA',
					cornerRadius:0,
					strokeWidth:1,
					strokeStyle:'#CDCECD',
					spikeLength:20,
					spikeGirth:30,
					trigger:'none',
					/*centerPointX:0,*/

					closeWhenOthersOpen: true,
					postShow: function() {
							jQuery('.bt-wrapper').append('<div class="bt-sensor" style="opacity:0.01;filter:alpha(opacity=1);background-color:white;position:absolute;z-index:99999;"></div>');
							jQuery('.bt-sensor').offset().top = jQuery('.bt-wrapper').offset().top;
							jQuery('.bt-sensor').offset().left = jQuery('.bt-wrapper').offset().left;
							jQuery('.bt-sensor').css({'width':'280px','height':(jQuery('.bt-content').height()+22)+'px'});
							jQuery('.bt-sensor').mouseover(function(){
								clearTimeout(bt_hide_timer);
							});
							jQuery('.bt-sensor').mouseout(function(){
								hideTip(me);
							});
							jQuery('.bt-sensor').append(jQuery('.bt-content').clone());
						}
				});
				me.mouseover(function(){showTip(me);});
				me.mouseout(function(){hideTip(me);});
			}
		});

		// video [begin]
		jQuery('.banner_video:eq(0) a').each(function(){
			jQuery(this).click(function(){
				var video_id = jQuery(this).attr('href').replace('http://www.youtube.com/watch?v=','');
				zoom_video(video_id);
				return false;
			});
		});
		// video [end]

		// calendario --- [begin]
		jQuery('.opzioni_vista').show();

		var click_detail = {
								show:	{
											'_it':	'Clicca per vedere i dettagli',
											'_en':	'Click to open details'
										},
								hide:	{
											'_it':	'Clicca per nascondere i dettagli',
											'_en':	'Click to close details'
										}
							};
		var tempo_chiusura_dettagli_evento = 750;		// ### PARAMETRO DI TEMPORIZZAZIONE DETTAGLI EVENTO (PERSONALIZZABILE)
		var tempo_apertura_dettagli_evento = 750;		// ### PARAMETRO DI TEMPORIZZAZIONE DETTAGLI EVENTO (PERSONALIZZABILE)		
		jQuery('.calendario_eventi .spettacolo_titolo').each(function(){
			jQuery(this).attr('title',click_detail.show[global_lang]);
			jQuery(this).click(function(){
				var spettacolo_info = jQuery(this).closest('.spettacolo_info');
				var dett = spettacolo_info.find('.spettacolo_dettagli');				
				if (dett.css('display') == 'none') {
					var my_width = jQuery('.calendario_eventi td:eq(1)').width() -80;
					//dett.css('width', my_width+'px');
					jQuery(this).attr('title',click_detail.hide[global_lang]);
					jQuery('.spettacolo_dettagli').slideUp(tempo_chiusura_dettagli_evento);
					dett.slideDown(tempo_apertura_dettagli_evento, function(){
						var this_offset = Math.round(jQuery(this).offset().top);
						if ( this_offset < jQuery(document).scrollTop()) {
							var offs = this_offset -30;
							if (offs < 0)
								offs = 0;
							jQuery(document).scrollTop(offs);
						}
					});
				}
				else {
					jQuery(this).attr('title',click_detail.show[global_lang]);
					jQuery('.spettacolo_dettagli').slideUp(tempo_chiusura_dettagli_evento);
				}
				return false;
			});
		});

		/*var OD_filter = {
							dal:				20090614,
							al:					20090718,
							opera:				'',							
							concerti:			'',
							eventi_speciali:	'',
							teatro_danza:		'',
							termini:				'',
							sede:				'-'
						};*/
		jQuery('.opzioni_generi :checkbox').each(function(){ // init del filtro
			var name = jQuery(this).attr('name');
			var value = jQuery(this).attr('value');
			if (OD_filter[name] !== false) {
				OD_filter[name] = value;
			}
			else {
				OD_filter[name] = '';
			}
		});

		jQuery('.opzioni_vista :input').each(function(){
			if ( ! jQuery(this).hasClass('filter_button')) {
				var event_sel = 'click';
				if (jQuery(this).attr('type') == 'text') {
					event_sel = 'blur';
				}
				else if(jQuery(this).attr('type')=='select-one') {
					event_sel = 'change';					
				}
				jQuery(this)[event_sel](function(){
					var name = jQuery(this).attr('name');
					if (jQuery(this).attr('type') == 'checkbox') {
						if (jQuery(this).attr('checked')) {
							OD_filter[name] = jQuery(this).val();
							if ( ! jQuery(this).attr('checked')) {
								OD_filter[name] = '';
							}
						}
						else {
							OD_filter[name] = '';
						}
					}
					else {
						OD_filter[name] = jQuery(this).val();
					}
				});
			}
		});

		jQuery('.filter_button').click(filtra_tutto);
		//fixDateShow();
		filtra_tutto();
		// calendario --- [end]

		// archivio_spettacoli [begin]
		jQuery('.opzioni_vista_as').show();
	
		jQuery('.archivio_spettacoli .spettacolo_titolo').each(function(){
			jQuery(this).attr('title',click_detail.show[global_lang]);
			var spettacolo_info = jQuery(this).closest('.spettacolo_info');
			if (jQuery.trim(jQuery(this).text()) != '') {			
				jQuery(this).click(function(){
					var dett = spettacolo_info.find('.spettacolo_dettagli');
					if (dett.css('display') == 'none') {
						var my_width = jQuery('.archivio_spettacoli td:eq(0)').width() -80;
						//dett.css('width', my_width+'px');
						jQuery(this).attr('title',click_detail.hide[global_lang]);
						jQuery('.spettacolo_dettagli').slideUp(tempo_chiusura_dettagli_evento);
						spettacolo_info.find('.spettacolo_dettagli').slideDown(tempo_apertura_dettagli_evento, function(){
							var this_offset = Math.round(spettacolo_info.offset().top);
							if ( this_offset < jQuery(document).scrollTop()) {
								var offs = this_offset -30;
								if (offs < 0)
									offs = 0;
								jQuery(document).scrollTop(offs);
							}
						});
					}
					else {
						jQuery(this).attr('title',click_detail.show[global_lang]);
						jQuery('.spettacolo_dettagli').slideUp(tempo_chiusura_dettagli_evento);
					}
					return false;
				});
			}
			else {
				jQuery(this).removeAttr('title');				
				spettacolo_info.find('.spettacolo_dettagli').css({'display':'block'});
				spettacolo_info.find('.spettacolo_dettagli').removeClass('spettacolo_dettagli');
			}
		});


		jQuery('.opzioni_vista_as :checkbox').each(function(){ // init del filtro
			var name = jQuery(this).attr('name');
			var value = jQuery(this).attr('value');
			if (OD_filter_as[name] !== false) {
				OD_filter_as[name] = value;
				if ( ! jQuery(this).attr('checked')) {
					OD_filter_as[name] = '';
				}
			}
			else {
				OD_filter_as[name] = '';
			}
		});

		jQuery('.opzioni_vista_as :input').each(function(){
			if ( ! jQuery(this).hasClass('filter_button_archivio_spettacoli')) {
				var event_sel = 'click';
				if (jQuery(this).attr('type') == 'text') {
					event_sel = 'blur';
				}
				else if(jQuery(this).attr('type')=='select-one') {
					event_sel = 'change';
					if (jQuery(this).attr('name') == 'anno') { // inzizializzazione anno precedentemente selezionato
						OD_filter_as['anno_prec'] = OD_filter_as['anno'];
					}
				}
				jQuery(this)[event_sel](function(){
					var name = jQuery(this).attr('name');
					if (jQuery(this).attr('type') == 'checkbox') {
						if (jQuery(this).attr('checked')) {
							OD_filter_as[name] = jQuery(this).val();
						}
						else {
							OD_filter_as[name] = '';
						}
					}
					else {
						if (name == 'anno') { // devo salvarmi il vecchio valore dell'anno
							OD_filter_as['anno_prec'] = OD_filter_as['anno'];
						}
						OD_filter_as[name] = jQuery(this).val();
					}
				});
			}
		});

		jQuery('.filter_button_archivio_spettacoli').click(filtra_tutto_archivio_spettacoli);
		//fixDateShow_archivio_spettacoli();
		if (OD_filter_as.anno != '0000') {
			filtra_tutto_archivio_spettacoli();
		}
		// archivio_spettacoli [end]

		// galleria fotografica --- [begin]		
		jQuery('#tabs').tabs({ ajaxOptions: {success: function (data, textStatus) {	// data could be xmlDoc, jsonObj, html, text, etc...
			jQuery('.mytab').find('a').css('cursor','default');															
			jQuery('.galleria_foto_opener').css({'cursor':'pointer'});
			jQuery('.galleria_foto_opener').click(function(){
				closeGallery(jQuery(this));
			});
			// frecce per muoversi nei tab anni
			if (jQuery('.tab_arrow').length == 0 && jQuery('.canArrows').length > 0) {
				buildYearTabNav('photo','canLeft','sx','yearnext','first',-1);
				buildYearTabNav('photo','canRight','dx','yearprev','last',1);
			}
		}}});
		jQuery('.mytab').each(function(){
			jQuery(this).find('a').click(function(){
									jQuery(this).css('cursor','progress');
								});
		});
		// galleria fotografica --- [end]

		// galleria video --- [begin]		
		jQuery('#tabs_video').tabs({ ajaxOptions: {success: function (data, textStatus) {	// data could be xmlDoc, jsonObj, html, text, etc...
			jQuery('.mytab').find('a').css('cursor','default');															
			jQuery('.galleria_foto_opener').css({'cursor':'pointer'});
			jQuery('.galleria_foto_opener').click(function(){
				closeGallery(jQuery(this));
			});
			// frecce per muoversi nei tab anni
			if (jQuery('.tab_arrow').length == 0 && jQuery('.canArrows').length > 0) {
				buildYearTabNav('video','canLeft','sx','yearnext','first',-1);
				buildYearTabNav('video','canRight','dx','yearprev','last',1);
			}
		}}});
		// galleria video --- [end]
		
		// archivio comunicati [begin]
		jQuery('#tabs_arc_comm').tabs({ ajaxOptions: {success: function (data, textStatus) {	// data could be xmlDoc, jsonObj, html, text, etc...
															jQuery('.mytab').find('a').css('cursor','default');
										}}});
		// archivio comunicati [end]
		
		// archivio video [begin]
		jQuery('#tabs_video').tabs({ ajaxOptions: {success: function (data, textStatus) {	// data could be xmlDoc, jsonObj, html, text, etc...
															jQuery('.mytab').find('a').css('cursor','default');
															//applyZoom();
										}}});
		// archivio video [end]
	});

	function buildYearTabNav(type_gal,arrClass,arrDir,navClass,nodeBefore,dir) {
		var li_open = '<li class="mytab tab_arrow" style="padding-left:0px;padding-right:0px; background:white;">';
		var li_close = '</li>';
		
		var canArrow = false;
		if (jQuery('.'+arrClass).length>0) {
			canArrow = true;
		}
		var list_sx = '';
		list_sx += li_open;
		var posFix = '_dis';
		if (canArrow) {
			posFix = '';
		}
		list_sx += '<img src="../../immagini/freccia_'+arrDir+posFix+'.gif" style="margin-bottom:-2px;" class="'+navClass+posFix+'" />';
		list_sx += li_close;
		jQuery('.tab_container').find('li:'+nodeBefore).before(list_sx);
		jQuery('.'+navClass).click(function(){
					jQuery(this).css({cursor:'wait'});					
					setTimeout(function(){
						jQuery('.'+navClass).css({cursor:'default'});
						if (type_gal=='photo') var_year = 35;
						else var_year = 36;
						location.href = getMyPath()+var_year+(getMyOffset(var_year)+dir)+'.html';
					},150);
				});
	}
	
	function zoom_video(zoom_yt_id) {
		zooming.gallery(0, [{url:zoom_yt_id, width:425, height:344, isVideo:1}] );
	}

//	-------------------------- galleria evento [begin] --- (replica modificata della navigazione gallery multi dell'archivio)
	GLOBAL_jq_gal_evento_timer = null;
	GLOBAL_jq_gal_evento_timer = setInterval(function(){ // sistema di attesa caricamento...
		if (jQuery('.jq_gal_evento').length>0) {
			clearInterval(GLOBAL_jq_gal_evento_timer); // se entro è caricato, quindi annullo il ciclo di check
			var content = jQuery('.jq_gal_evento .galleria_scroll');
			if (jQuery('.gf_progr').length > 0)
			{
				content.css({
					width:	810 // multiplo di 135
				});
			}
			if (jQuery('.gf_friend').length > 0)
			{
				content.css({
					width:	405 // multiplo di 135
				});
			}

			var zoom = content.find('.zoom_me');	//jQuery('.zoom_me');			
			zoom.css({'cursor':'pointer'});
			zoom.attr('title','ZOOM');
			zoom.click(zoomin);

			jQuery('.gallery_left').each(function(){
				jQuery(this).css('cursor','pointer');
				jQuery(this).click(function(){
				  if (! global_is_animating) {
					var other_src = jQuery(this).closest('.galleria_foto_content').find('.gallery_right').attr('src');
					other_src = other_src.replace('_dis.gif','.gif');
					jQuery(this).closest('.galleria_foto_content').find('.gallery_right').attr('src', other_src);
					
					var scroller = jQuery(this).closest('.galleria_elenco').find('.galleria_scroller');
					var newMarginLeft = (scroller.css('marginLeft').replace('px','')-0 +135);
					var img_src = jQuery(this).attr('src');
					if (newMarginLeft >= 0) {
						newMarginLeft = 0;
						if (img_src.indexOf('_dis.gif')<0)
							img_src = img_src.replace('.gif','_dis.gif');
					}
					else {
						img_src = img_src.replace('_dis.gif','.gif');
					}						
					newMarginLeft = newMarginLeft+'px';
					if (newMarginLeft != scroller.css('marginLeft')) {
						jQuery(this).attr('src', img_src);
						global_is_animating = true;
						scroller.animate({'marginLeft':newMarginLeft},{duration:500,queue:true, complete:function(){ global_is_animating = false; } });
					}
				  }
				});
			});
			jQuery('.gallery_right').each(function(){
				jQuery(this).css('cursor','pointer');
				jQuery(this).click(function(){
				  if (! global_is_animating) {
					var other_src = jQuery(this).closest('.galleria_foto_content').find('.gallery_left').attr('src');
					other_src = other_src.replace('_dis.gif','.gif');
					jQuery(this).closest('.galleria_foto_content').find('.gallery_left').attr('src', other_src);
					var scroller = jQuery(this).closest('.galleria_elenco').find('.galleria_scroller');
					if (scroller.css('marginLeft') == 'auto') { // patch per IE
						scroller.css('marginLeft','0px');
					}
					var newMarginLeft = (scroller.css('marginLeft').replace('px','') -135);
					var img_src = jQuery(this).attr('src');
					if (newMarginLeft <= -(scroller.width()-(135*6))) {
						newMarginLeft = -(scroller.width()-(135*6));
						if (img_src.indexOf('_dis.gif')<0)
							img_src = img_src.replace('.gif','_dis.gif');
					}
					else {
						img_src = img_src.replace('_dis.gif','.gif');
					}										  
					newMarginLeft = newMarginLeft+'px'; 
					if (newMarginLeft != scroller.css('marginLeft')) {
						jQuery(this).attr('src', img_src);
						global_is_animating = true;
						scroller.animate({'marginLeft':newMarginLeft},{duration:500,queue:true, complete:function(){ global_is_animating = false; } });
					}
				  }
				});
			});
			
			
		}
	},100);
//	-------------------------- galleria evento [end]
//]]>