t=49;
z=101;

t2=49;
z2=101;

cur_message=1;
			var mc=1;

$(function(){
	$('header ul li').not('.active').hover(

		function(){
					z=101;
			switch ($(this).attr('id')){
				case 'h':
					t="50px";
					
					break;
				case 's':
					t="49px";
					break;
				case 'p':
					t="18px";
					z=99;
					break;
				case 'c':
					t="45px"
					break;
			}
			$(this).css('z-index',z);
			$(this).stop().animate({
				top:t
			},500);
		},
		function(){
			$(this).css('z-index',99);
			$(this).stop().animate({
				top:'0'
			},500);
		})
		
		$('footer ul li').not('.active').hover(

			function(){
						z2=101;
				switch ($(this).attr('id')){
					case 'cat_g':
						t2="-49px";
						break;
					case 'cat_b':
						t2="-31px";
						break;
					case 'cat_p':
						t2="-45px";
						break;
					case 'cat_a':
						t2="-48px"
						break;
					case 'cat_w':
						t2="-48px"
						break;
				}
				$(this).css('z-index',z2);
				$(this).find('a').stop().animate({
					top:t2
				},500);
			},
			function(){
				$(this).css('z-index',99);
				$(this).find('a').stop().animate({
					top:'0'
				},500);
			})

			
			
			$(window).load(function(){
				
				var cont=$('#contatti');
				thish=cont.innerHeight();

				thist=($(document).height()-thish)/2;
				if(thist<210)thist=210;
				cont.css({
					top:thist+"px"
				});
							cm=1;
				$('.message').each(function(){
					thish=$(this).innerHeight();
					thist=($(document).height()-thish)/2;
					$(this).css({
						top:thist+"px",
						left:($(document).width()*(cm-1))+"px"
					});
					cm++;
				})


			});

			$(window).resize(function(){

				cm=mc;

				c=0;
				$('.message').each(function(){
					thish=$(this).innerHeight();
					thist=($(document).height()-thish)/2;
					
					$(this).css({
						top:thist+"px",
						left:-(((cm-c-1)*$(window).width()))+"px"
					});
					//cm++;
					c++;
				})
				
				var cont=$('#contatti');
				thish=cont.innerHeight();
				
				thist=($(document).height()-400)/2;
				if(thist<210)thist=210;
				cont.css({
					top:thist+"px"
				});
			})
			
		
});

