
$(document).ready(function(){
	 /* ANIMAZIONE TOP */
	  var timer;
	  $("div.cont_frase_h").mouseenter(function() {
		if(timer) {
			clearTimeout(timer);
			timer = null
		}	
		timer = setTimeout(function() {   
			$('div.contiene_top_h').animate({
				 height: 410
			}, 500);
			$('div.cont_frase_h').animate({
				 height: 212
			}, 500);
		}, 200);
	  }).mouseleave(function() {
		if(timer) {
			clearTimeout(timer);
			timer = null
		}    
		$('div.contiene_top_h').animate({
			 height: 335
		}, 500);
		$('div.cont_frase_h').animate({
			 height: 116
		}, 500);
	  });

 	/* LARGHEZZA FASCIA NERA */
	$("div.cont_logo_h").css('width', function() {
	  valore = $(window).width();
	  return (valore-998)/2+254;
	}); 
	$(window).resize(function () {
	  $("div.cont_logo_h").css('width', function() {
		  valore = $(window).width();
		  return (valore-998)/2+254;
		}); 
	});
	
 	/* LARGHEZZA FASCIA BIANCA */
	$("div.cont_frase_h").css('width', function() {
	  valore = $(window).width();
	  return (valore-998)/2+464;
	}); 
	$(window).resize(function () {
	  $("div.cont_frase_h").css('width', function() {
		  valore = $(window).width();
		  return (valore-998)/2+464;
		}); 
	});
	/* ANIMAZIONE NEWS LEFT */
	  var timer3;
	  $("div.cont_news_left").mouseenter(function() {
		valoreid = $(this).attr("id");
		if(timer3) {
			clearTimeout(timer3);
			timer3 = null
		}	
		timer3 = setTimeout(function() {   
			$("div#"+valoreid +" div.animazione_jpg").animate({
				 right: 299
			}, 500);
		}, 200);
	  }).mouseleave(function() {
		if(timer3) {
			clearTimeout(timer3);
			timer3 = null
		}    
		$("div#"+valoreid +" div.animazione_jpg").animate({
			 right: 0
		}, 500);
	  });
	  
	  /* ANIMAZIONE NEWS RIGHT */
	  var timer4;
	  $("div.cont_news_right").mouseenter(function() {
		valoreid2 = $(this).attr("id");
		if(timer4) {
			clearTimeout(timer4);
			timer4 = null
		}	
		timer4 = setTimeout(function() {   
			$("div#"+valoreid2 +" div.animazione_jpg").animate({
				 left: 299
			}, 500);
		}, 200);
	  }).mouseleave(function() {
		if(timer4) {
			clearTimeout(timer4);
			timer4 = null
		}    
		$("div#"+valoreid2 +" div.animazione_jpg").animate({
			 left: 0
		}, 500);
	  });
	
});

