
	
	/*imgWidth = 1600;
	imgHeight = 1200;

	myWidth = $(window).width()
	myHeight = $(window).height()

	strecciaX = myWidth;
	strecciaY = myWidth*imgHeight/imgWidth;

	if (strecciaY<myHeight){
		strecciaY = myHeight;
		strecciaX = myHeight*imgWidth/imgHeight;
		topcss = 0;
		leftcss = (myWidth - strecciaX) /2;	
	} else {
		topcss = (myHeight - strecciaY) /2;
		leftcss = 0;
	}


	bgCSS = {left: leftcss, top: topcss};	
	
	$("#backstretch img").width(strecciaX).height(strecciaY).css(bgCSS);
	
	
	//$("div#backstretch div#img_contiene_1").fadeIn(500);	
	
	
	$(window).resize(function () {
		myWidth = $(window).width()
		myHeight = $(window).height()
		strecciaX = myWidth;
		strecciaY = myWidth*imgHeight/imgWidth;
		if (strecciaY<myHeight){
			strecciaY = myHeight;
			strecciaX = myHeight*imgWidth/imgHeight;
			topcss = 0;
			leftcss = (myWidth - strecciaX) /2;	
		} else {
			topcss = (myHeight - strecciaY) /2;
			leftcss = 0;
		}
		bgCSS = {left: leftcss, top: topcss};	
		$("#backstretch img").width( strecciaX ).height( strecciaY ).css(bgCSS);
	});

    //$("#draggable").draggable({ appendTo: 'div#container' });*/

	  /* ANIMAZIONE NEWS LEFT */
	  var timer3;
	  var total = $('#backstretch img').length;
	  
	  var rand = Math.ceil(Math.random()*total);
		if (rand==0){
			rand=1;
		}
	  $("div#backstretch div#img_contiene_"+rand).fadeIn(500);
	  
	  
	  	var x = rand;
		var y = 1;
		var divtot = total;
		
		if (divtot > 0){
			play_1 = setInterval('Play_1()',6000); //QUI SETTARE IL TEMPO PER L'INTERVALLO
		}
		
	  /*$("div.blocco_news a").mouseenter(function() {
		valoreid = $(this).attr("id");										 
		if ($("div#backstretch div#img_"+valoreid+"").length != 0) {

		   if(timer3) {
				clearTimeout(timer3);
				timer3 = null
			}	
			timer3 = setTimeout(function() {   
				$("div#backstretch div:not(#img_"+valoreid+")").fadeOut('fast');
				$("div#backstretch div#img_"+valoreid+"").fadeIn('fast');	
			}, 200);
		} else {
			$("div#backstretch div:not(#img_contiene_0)").fadeOut('fast');
		  	$("div#backstretch div#img_contiene_0").fadeIn(500);
		}
		
		
		
		
	  }).mouseleave(function() {
		if(timer3) {
			clearTimeout(timer3);
			timer3 = null
		}    
		
	  });
	 
	  $("div.pad_blocco_news").mouseleave(function() {
		  $("div#backstretch div:not(#img_contiene_0)").fadeOut('fast');
		  $("div#backstretch div#img_contiene_0").fadeIn(500);	
	  });*/
	 
	 
	function Play_1(){
		y = x+1;
		
		if (x > divtot){
			x = 1;
			y = x+1;
		}
		if (y > divtot){
			y = 1;
		} else {
			x = x;
			y = x+1;
		}
		$("div#backstretch div#img_contiene_"+x).fadeOut(1000);
		$("div#backstretch div#img_contiene_"+y).fadeIn(1000);
		x++;
	}

	
	  
