// JavaScript Document
Cufon.set('fontFamily', 'sfont');

Cufon.replace('h1, h2, h3, h4, h5, .sfont, a, .titles, .star_list', {
			  hover: true
			  });


function ticker(){
	$(document).ready(function()
	{
		var ticker_holder = $('.ticker-holder').get(0);
		var ticker_text = $('.ticker').get(0);
		var ticker_pos = ticker_text.parentNode.offsetWidth;
	
		var ticker_data = $(ticker_holder).html();
		$(ticker_text).parent().html('<marquee scrollamount="1" scrolldelay="40">'  + ticker_data + '</marquee>');
	
		$('.ticker-holder').hover
		(
			function() { $('marquee', this).get(0).stop();  },
			function() { $('marquee', this).get(0).start(); }
		);
	});
}

var to_t = 0;
function timer(){
	$(document).ready(function()
	{
		var tot_w = $(".timer").width();
		$(".timer .bar").animate({ width: tot_w+"px"}, 7000, 'linear');
		var href = $(".timer a").attr('href');
		setInterval(function(){ window.location = window.location }, 7000);
	})
}

$(document).ready(function(){
		$('body').pngFix( );
		$('.ticker').each(function(){
								   ticker();
								   });
		$('.timer').each(function(){
								   timer();
								   });
});


// JavaScript Document
function countdown() {
	var iniData = new Date("October 23, 2010 15:00:00 GMT+0200");
	var oggi= new Date();
	oggi = oggi.toUTCString();
	oggi = new Date(oggi);
	var milDif=(iniData-oggi);
	var giorni=parseInt(milDif/86400000);
	milDif = milDif-(giorni*86400000);
	var ore=parseInt(milDif/3600000);
	milDif = milDif-(ore*3600000);
	var minuti=parseInt(milDif/60000);
	milDif = milDif-(minuti*60000);
	var secondi=parseInt(milDif/1000);
	milDif = milDif-(secondi*1000);
	if (giorni > "0" || ore > "0" || minuti > "0" || secondi > "0"){
		$('#count .days span').text(giorni);
		$('#count .hours span').text(ore);
		$('#count .minutes span').text(minuti);
		$('#count .seconds span').text(secondi);
	}else{
		$('#count .days span').text('00');
		$('#count .hours span').text('00');
		$('#count .minutes span').text('00');
		$('#count .seconds span').text('00');
	}
	Cufon.replace('#count span', {
		  hover: true
		  });
	Cufon.now();
}
setInterval("countdown()",1000);


/* VIDEO */
$(document).ready(function(){
	var vid_w = 588;
	var vid_h = 373;
	$(".youtubevideo").each(function(){
		var code = $(".code", this).html();
		$(this).html('<object width="'+vid_w+'" height="'+vid_h+'"><param name="movie" value="http://www.youtube.com/v/'+code+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+code+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+vid_w+'" height="'+vid_h+'"></embed></object>');
	})
	$(".vimeovideo").each(function(){
		var code = $(".code", this).html();
		$(this).html('<object width="'+vid_w+'" height="'+vid_h+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='+code+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id='+code+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+vid_w+'" height="'+vid_h+'"></embed></object>');
	})
})

$(document).ready(function() {  
	$(".lightBox a").lightBox();
})
