// JavaScript Document


/*gestione dimensioni sito*/
$(document).ready(
            function(){     
                setContentPosition();
				randomHp();
				firstOpenPopHp();
            });

$(window).resize(
            function(){     
                setContentPosition();         
            });	        

function setContentPosition(){
		var iNewHeight = $(window).height();
		if (iNewHeight <= 590) {
			$('.general').css({ height: '590px' });
			$('.container').css({ display: 'block' });
		
		} else {
			$('.general').css({ height: iNewHeight + 'px' });
			$('.container').css({ display: 'block' });
		}
	}

function randomHp(){
		if($('.imageHp'))
		{
			bgImageTotal=5;
			randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1;
			imgPath=('Images/hp/bgHp_'+randomNumber+'.jpg');
			$('.imageHp').css('background-image', ('url("'+imgPath+'")'));
		}
	}

function contentTall(){
		if($('.contentTall'))
		{
			var iNewHeightTall = $(window).height();
			$('.contentTall').css({ height: 'iNewHeightTall' });
		}
	}


function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}


function firstOpenPopHp(){
		if($('.popupHp'))
		{
			$('.popupHp').delay(1200).animate({ height:'455px' }, 1000, "easeOutQuad");
		}
	}

function openPopHp(){
		$('.popupHp').animate({ height:'455px' }, 1000, "easeOutQuad");
		$('.popupHp .img').animate({ height:'342px' }, 1000, "easeOutQuad");
		$('.popupHp .open').css({ display:'none' });
		$('.popupHp .close').css({ display:'block' });
	}
function closePopHp(){
		$('.popupHp').animate({ height:'115px' }, 1000, "easeOutQuad");
		$('.popupHp .img').animate({ height:'0px' }, 1000, "easeOutQuad");
		$('.popupHp .open').css({ display:'block' });
		$('.popupHp .close').css({ display:'none' });
	}


