// JavaScript Document
	var cur_notizia;
	var scroll_iniziato;
	var timer2;
	var attesa=3000;
	var tempo_scroll=1000;
	scroll_iniziato=0;
	
	jQuery.noConflict();
	jQuery(document).ready(function(){
	 	cur_notizia=1;
		timer2=jQuery.timer(attesa,function(){ scroll(); } );
		jQuery("div#dac_label_container div#dac_label_1" ).attr("class","dac_label_sel_1");

		jQuery("div#dcaScroll2_container").mouseout(function(){timer2.reset(attesa,function(){ scroll(); });});
 		jQuery("#dac_label_container div").mouseout(function(){timer2.reset(attesa,function(){ scroll(); });});
		
		jQuery("div.container_partenza").html("<div style='padding:0px'>" + jQuery("div#dac_news #n_1").html() +"</div>");
		jQuery("#dac_label_container div").mouseover( function() { imposta(jQuery(this).attr("id")); } );
		jQuery("#dac_label_container div").attr("style","text-align:center");
		

	});
	
	function imposta(id){
	 	timer2.stop();
	 	lista=id.split("_");
	 	if (cur_notizia!=lista[2]){
		 	cur_notizia=lista[2];	 	
		 	if(scroll_iniziato==1) {
				jQuery("div.container_arrivo").fadeOut("fast", function() { jQuery("div.container_arrivo").html("<div style='padding:0px'>" + jQuery("div#dac_news #n_"+cur_notizia).html() +"</div>" ).fadeIn("fast"); });
			} else { 
			 	jQuery("div.container_partenza").fadeOut("fast", function() { jQuery("div.container_partenza").html( "<div style='padding:0px'>" + jQuery("div#dac_news #n_"+cur_notizia).html() + "</div>").fadeIn("fast"); });
			}
	
			colora_tab(cur_notizia);		
		 	timer2.reset(attesa,function(){ scroll(); });
		}
	} 

	function colora_tab(nTab){		
		jQuery("div#dac_label_container div#dac_label_1").attr("class","dac_label_1");
		jQuery("div#dac_label_container div#dac_label_2").attr("class","dac_label_2");
		jQuery("div#dac_label_container div#dac_label_3").attr("class","dac_label_3");
		jQuery("div#dac_label_container div#dac_label_4").attr("class","dac_label_4");
		jQuery("div#dac_label_container div#dac_label_" + nTab).attr("class","dac_label_sel_" + nTab);
	} 
	
function scroll(){
 	scroll_iniziato=1;
 	timer2.stop();
 	cur_notizia ++;
	if(cur_notizia> 4) cur_notizia=1;
	prev=cur_notizia-1;
	if(prev==0) prev=4;	
	colora_tab(cur_notizia);			

	jQuery("div.container_partenza").html("<div style='padding:0px'>" + jQuery("div#dac_news #n_"+prev).html() + "</div>");
	jQuery("div.container_arrivo").html( "<div style='padding:0px'>" +  jQuery("div#dac_news #n_"+cur_notizia).html() +"</div>" );
	jQuery("div#dcaScroll2_container").css("left","0px");
	jQuery("div#dcaScroll2_container").css("top","0px");
	jQuery("div#dcaScroll2_container").animate({left:-(jQuery("div#scroll2Panel").width()) },tempo_scroll).end();
	timer2.reset(attesa,function(){ scroll(); });
}

function canviaImatge(obj,font)
{
	
	document.getElementById(obj).src=font;
}
