/********************************************************************/
/* FLASH 															*/
/********************************************************************/

$(document).ready(function(){
 	$(document).pngFix();
	/* slide news in home */
	var ticker = function() {
		setTimeout(function(){
			$('#ticker li:first').animate( {marginTop: '-145px'}, 1000, function() {
				$(this).detach().appendTo('ul#ticker').removeAttr('style');
			});
		ticker();
		}, 4123);
	};
	ticker();
	/* slide eventi in home */
	var tickerEvents = function() {
		setTimeout(function(){
			$('#tickerevents li:first').animate( {marginTop: '-145px'}, 1000, function() {
				$(this).detach().appendTo('ul#tickerevents').removeAttr('style');
			});
		tickerEvents();
		}, 6321);
	};
	tickerEvents();
});

/* slide fade homepage */
function slideSwitch() {
	var $active = $('#slideshow div.active');
	if ( $active.length == 0 ) $active = $('#slideshow div:last');
	// use this to pull the divs in the order they appear in the markup
	var $next =  $active.next().length ? $active.next() : $('#slideshow div:first');
	$active.addClass('last-active');
	$next.css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 1000, function() {
		$active.removeClass('active last-active');
	});
}
$(function() {
	setInterval( "slideSwitch()", 5000 );
});



/* video player */
function videoPlayer(linkurl,w,h,auto_play,img) {
	var flashvars = {
		videoUrl: linkurl,
		autoPlay: 'start',
		videoImg: img
	};
	var params = {
		allowScriptAccess: 'sameDomain',
		allowFullScreen: 'true',
		scale: 'exactfit',
		wmode: 'transparent'
	};
	var attributes = {
		id: 'video-player',
		name: 'video-player'
	};
	
	swfobject.embedSWF(movie_dir+'/video-player.swf', 'video-player', w, h, '9.0.0', false, flashvars, params, attributes);
}

function banner(nomebanner, contenitore, dimx, dimy) {
	var params = {
		allowScriptAcess: "always",
		allowFullScreen: "true",
		wmode: 'transparent'
		
	};
	var attributes = {
		id: contenitore,
		name: "banner"
	};
	swfobject.embedSWF(nomebanner, contenitore, dimx, dimy, "9.0.0", false, false, params, attributes);
}


