﻿



// INIZIO CODICE   //

/* ================================================= */
/* ================================================= */

var mainBgImgWidth;
var mainBgImgHeight;
var isIE;
var homeBilletsHeight = new Array();

window.onunload = function(){};

$(window).load(function(){
stretchMainBackground();
sfondoHomePage();
$(window).resize(function() { stretchMainBackground(); });

});


function stretchMainBackground() {


	$('#effeti').css('height', '0px');
	
	//alert($(window).height());
	//alert($('#effeti').height());
	
	if ($('#effeti').height() < $(window).height() - 150) {
	
		$('#effeti').height($(window).height() - 150);
	}
	
	//$('#effeti').height($(window).height() - 150);
	
	
	
	
}





function sfondoHomePage() {
	
	
	$('div.lista-elementi div.listino').each(function(i) {
		homeBilletsHeight[i] = $('div.stato-on', this).height();
		$(this).attr('innerId', i);
		
	});
	
	$('div.lista-elementi div.listino').hover(
		function() {
			var $initObj = $('div.stato-iniziale', this);
			var $hoverObj = $('div.stato-on', this);
			var id = parseInt($(this).attr('innerId'));
			$initObj.stop(true, true);
			$hoverObj.stop(true, true);
			$hoverObj.hide();
			if (isIE) {
				$initObj.hide();
				$hoverObj.height(80);
				//$hoverObj.show().animate({top:-(homeBilletsHeight[id] - 0) / 2, height:homeBilletsHeight[id]}, 200);
				$hoverObj.show().animate({top:-92, height:homeBilletsHeight[id]}, 200);
			} else {
				$initObj.fadeOut(200);
				$hoverObj.height(80).css('opacity', 0).show();
				//$hoverObj.animate({top:-(homeBilletsHeight[id] - 0) / 2, height:homeBilletsHeight[id], opacity:1}, 200);
				$hoverObj.animate({top:-92, height:homeBilletsHeight[id], opacity:1}, 200);
			}
			
			
		},
		function() {
			$('input', this).blur();
			var $initObj = $('div.stato-iniziale', this);
			var $hoverObj = $('div.stato-on', this);
			var id = parseInt($(this).attr('innerId'));
			if (isIE) {
				$initObj.show();
				$hoverObj.animate({top:0, height:80}, 100, function() {$(this).height(homeBilletsHeight[id]).hide();});
			} else {
				$initObj.fadeIn(200);
				$hoverObj.animate({top:0, height:80, opacity:0}, 100, function() {$(this).height(homeBilletsHeight[id]).hide();});
			}
		}
	);
}



