

function video_articolo(id_div, percorso) {
	  flowplayer(id_div, {src: "/include/flowplayer/flowplayer.commercial-3.2.5.swf", wmode: 'transparent'}, { 
			key: '#$e21679626322f760ad1',
			logo: {
				url: ''
			},
			playlist: [
				{
					autoBuffering: true,
					autoPlay: true,
					url: percorso,
					scaling: "scale"
				}
			 ],
			plugins: { 
			  controls: { 
				url: 'flowplayer.controls-3.2.3.swf', 
				scrubberBarHeightRatio: '0.1', //altezza barra tempo 
				backgroundColor: '#18171A', 
				backgroundGradient: 'none', 
				fontColor: '#ffffff',
				timeColor: '#ffffff' ,
				progressColor: '#ffffff',
				bufferColor: '#cccccc',
				buttonColor: '#ffffff',
				play:true, 
				volume:true, 
				mute:true, 
				time:true, 
				stop:false, 
				playlist:false, 
				fullscreen:true,
				left: 0,
				bottom: 0,
				height: 20
			  }
			},
			canvas: {
				backgroundGradient: 'none'	
			}
	  });
}

/*function formatTitle_video(title, currentArray, currentIndex, currentOpts) {
			var output = '<div id="contenuto_titolo_fb">';
			output += title;
			output += '	<div id="utility_fb">';
			//output += '		<a href="/utility/download.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_salva.png" /></a>';
			//output += '		<a href="/utility/stampa.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_print.png"" /></a>';
			output += '		<a href="javascript:;" onclick="$.fancybox.close();"><img src="/immagini_layout/fb_chiudi.png" /></a>';
			output += '	</div>';
			output += '</div>';
			return output;
	}*/

function fancybox_video_popup (file, didascalia) {
	var formatTitle_video = function (title, currentArray, currentIndex, currentOpts) {
		var output = '<div id="contenuto_titolo_fb">';
		output += title;
		output += '	<div id="utility_fb">';
		//output += '		<a href="/utility/download.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_salva.png" /></a>';
		//output += '		<a href="/utility/stampa.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_print.png"" /></a>';
		output += '		<a href="javascript:;" onclick="$.fancybox.close();"><img src="/immagini_layout/fb_chiudi.png" /></a>';
		output += '	</div>';
		output += '</div>';
		return output;
	}
	
	
	$.fancybox({
		padding: 10,
		content: '<div id="video_player" style="width: 500px; height: 400px;"></div>',
		scrolling: 'hidden',
		showCloseButton: false,
		overlayOpacity: 0.8,
		overlayColor: "#000000",
		customClass: "video_popup",
		//title: didascalia,
		titlePosition: 'inside',
		titleFormat: formatTitle_video,
		onComplete: function () {
			$f("video_player", "/include/flowplayer/flowplayer.commercial-3.2.5.swf", {
				key: '#$e21679626322f760ad1',
				logo: {
						url: ''
				},
				clip: {
					autoPlay: true,
					autoBuffer: true,
					url: file,
					scaling: 'fit'
				},
				canvas: {
					backgroundGradient: 'none'
				},
				plugins: { 
					  controls: { 
						url: 'flowplayer.controls-3.2.3.swf', 
						scrubberBarHeightRatio: '0.1', //altezza barra tempo 
						backgroundColor: '#18171A', 
						backgroundGradient: 'none', 
						fontColor: '#ffffff',
						timeColor: '#ffffff' ,
						progressColor: '#',
						bufferColor: '#cccccc',
						buttonColor: '#ffffff',
						play:true, 
						volume:true, 
						mute:true, 
						time:true, 
						stop:false, 
						playlist:false, 
						fullscreen:false,
						//top: 0,
						left: 0,
						bottom: 0,
						height: 20,
						width: 500
						/*autoHide: {
						  enabled: true,
						  hideDelay: 1000,
						  fullscreenOnly: false
						}*/
					  }
				   }
			});
		}
	});
	
	return false;	
}


function formatTitle_fb(title, currentArray, currentIndex, currentOpts) {
	
	$("#fancybox-close").hide();
	
	var output = '<div id="contenuto_titolo_fb">'+(currentIndex + 1) + ' / ' + currentArray.length + '<br />';
	output += title;
	output += '	<div id="utility_fb">';
	output += '		<a href="/utility/download.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_salva.png" /></a>';
	output += '		<a href="/utility/stampa.php?file='+currentArray[currentIndex].href+'" target="_blank"><img src="/immagini_layout/fb_print.png"" /></a>';
	output += '		<a href="javascript:;" onclick="$.fancybox.close();"><img src="/immagini_layout/fb_chiudi.png" /></a>';
	output += '	</div>';
	output += '</div>';
	return output;
}

function formatTitle_fb_2(title, currentArray, currentIndex, currentOpts) {
	var output = '<div id="contenuto_titolo_fb">';
	output += currentArray[currentIndex].title;
	output += '	<div id="utility_fb">';
	output += '		<a href="javascript:;" onclick="$.fancybox.close();"><img src="/immagini_layout/fb_chiudi.png" /></a>';
	output += '	</div>';
	output += '</div>';
	return output;
}

function fancybox_gallery_aj(el) {
	
	url = el.href;
	
	$.ajax ({
		url: url,
		//data: 'id_voce='+id_voce+'&tabella='+tabella,
		dataType: 'text',
		beforeSend: function () {
			$.fancybox.showActivity();
		},
		success: function (result) {
			if (result) {
				code = "$.fancybox(["+result+"], {padding: 10, titlePosition: 'inside', overlayColor: '#000000', overlayOpacity: 0.8, showCloseButton: false, titleFormat: formatTitle_fb})";
				eval(code);
			} else {
				$.fancybox.hideActivity();
			}
		},
		error: function (a,b) {
			alert(b);
		}
	});
	
	
	return false;
 }
 
 

 
 
