/* 
Questo documento css è valido per tutte le pagine dell'index (home.php, registrati.php, staff.php, contatta.php, bp.php, progetto.php)

Impostare larghezza precisa al momento dell'apertura della pagina registrazione
*/
$(document).ready(function() {
	
	
	$('#backgroundContact').width($('#backgroundHv').width()-40);
	$('#backgroundContact').height($('#backgroundHv').height()-190);
	$('#backgroundBio').width($('#backgroundHv').width()-130);
	$('#backgroundBio').height($('#backgroundHv').height()-230);
	$('#backgroundEvent').height($('#backgroundHv').height()-180);
	$('#backgroundEventCont').width($('#backgroundHv').width()-410);
	$('#backgroundEventCont').height($('#backgroundHv').height()-180);
	$('#backgroundPhoto').width($('#backgroundHv').width()-120);
	$('#backgroundPhotoDesc').width($('#backgroundHv').width()-120);
	$('#backgroundAnimal').width($('#backgroundHv').width()-120);
	var heightPhoto = $('#backgroundHv').height()-120;
	if(heightPhoto<500) {
		 $('#backgroundPhoto').height($('#backgroundHv').height()-120);
		 $('#backgroundAnimal').height($('#backgroundHv').height()-120);
		 $('.contentPhotoImg').height($('#backgroundHv').height()-120);
		 $('.hoverPhotoImg').height($('#backgroundHv').height()-120);
		 $('.hoverPhotoImg').css({'marginTop' : '-'+($('#backgroundHv').height()-120)+'px'});
		 $('.contentAnimalImg').height($('#backgroundHv').height()-120);
		 $('#photoDescImg').height($('#backgroundHv').height()-120);
	}
	else  {
		 var marginTop = ($('#backgroundHv').height()-620)/2;
		 $('#backgroundPhoto').css({'marginTop' : marginTop+'px'});
		 $('#backgroundPhoto').height(500);
		 $('#backgroundAnimal').css({'marginTop' : marginTop+'px'});
		 $('#backgroundAnimal').height(500);
		 $('.contentPhotoImg').height(500);
		 $('.hoverPhotoImg').height(500);
		 $('.hoverPhotoImg').css({'marginTop' : '-500px'});
		 $('.contentAnimalImg').height(500);
		 $('#photoDescImg').height(500);
	}
	$('#backgroundBuy').width($('#backgroundHv').width()-120);
	$('#backgroundBuy').height($('#backgroundHv').height()-190);
	$('#backgroundArticles').width($('#backgroundHv').width()-480);
	$('#backgroundArticles').height($('#backgroundHv').height()-80);
	$('#backgroundArticles_1').height($('#backgroundHv').height()-200);
	$('#backgroundPhotoTable').height($('#backgroundPhoto').height());
	$('#titleWorks').width($('#backgroundHv').width()-410);
	$('#fraseWorks').width($('#backgroundHv').width()-100);
	var heightWorks = $('#backgroundHv').height()-70;
	if(heightWorks<450) {
		$('.contentWorksImg').height($('#backgroundHv').height()-150);
		$('#contentWorks').height($('#backgroundHv').height()-150);
		$('#backgroundWorksIndex').height($('#backgroundHv').height()-150);
		$('.contentWorksImgWrapper').height($('#backgroundHv').height()-150);
		$('#fraseWorks').css({'marginTop' : '50px'});
	}
	else  {
		var marginTop = ($('#backgroundHv').height()-620)/2;
		$('#contentWorks').css({'marginTop' : marginTop+'px'});
		$('#backgroundWorksIndex').css({'marginTop' : marginTop+'px'});
		$('.contentWorksImg').height(450);
		$('#contentWorks').height(450);
		$('#backgroundWorksIndex').height(450);
		$('.contentWorksImgWrapper').height(450);
		$('#fraseWorks').css({'marginTop' : (marginTop+50)+'px'});
	}
	$('#contentWorks').width($('#backgroundHv').width()-120);
	$('#backgroundWorksIndex').width($('#backgroundHv').width()-120);
	$('.contentWorksImgWrapper').width($('#backgroundHv').width()-120);
	$('#titleAnteprimaRoom').width($('#backgroundHv').width()-120);
	$('#slideAnteprimaRoom').width($('#backgroundHv').width()-120);
	$('.backgroundPhotoimg').height($('#backgroundPhoto').height());
	$('#contentComment').width($('#backgroundHv').width()-480);
	$('#contentComment').height($('#backgroundHv').height()-80);
	
$('.linkmenu').mouseover(function() {$('#puntatore').fadeIn(1)});
$('.linkmenu').mouseout(function() {$('#puntatore').fadeOut(1)});

$('#linkhome').mouseover(function() {
  $('#puntatore').animate({marginLeft: '75px', width: '100px', backgroundColor: '#060'}, 200, function() { /*animazione completata*/ });
});
$('#linkcontact').mouseover(function() {
  $('#puntatore').animate({marginLeft: '775px', width: '140px', backgroundColor: '#cc0000'}, 200, function() { /*animazione completata*/ });
});
$('#linkbio').mouseover(function() {
  $('#puntatore').animate({marginLeft: '190px', width: '50px', backgroundColor: 'yellow'}, 200, function() { /*animazione completata*/ });
});
$('#linkwork').mouseover(function() {
  $('#puntatore').animate({marginLeft: '265px', width: '100px', backgroundColor: 'purple'}, 200, function() { /*animazione completata*/ });
});
$('#linkarticles').mouseover(function() {
  $('#puntatore').animate({marginLeft: '715px', width: '130px', backgroundColor: 'white'}, 200, function() { /*animazione completata*/ });
});
$('#linkevents').mouseover(function() {
  $('#puntatore').animate({marginLeft: '660px', width: '120px', backgroundColor: '#06f'}, 200, function() { /*animazione completata*/ });
});
$('#linkbuy').mouseover(function() {
  $('#puntatore').animate({marginLeft: '373px', width: '165px', backgroundColor: '#555'}, 200, function() { /*animazione completata*/ });
});
$('#linkphoto').mouseover(function() {
  $('#puntatore').animate({marginLeft: '550px', width: '100px', backgroundColor: 'black'}, 200, function() { /*animazione completata*/ });
});
$('#linkfacebook').mouseover(function() {
  $('#puntatore').animate({marginLeft: '1000px', width: '50px', backgroundColor: 'blue'}, 200, function() { /*animazione completata*/ });
});
$('#linkbe').mouseover(function() {
  $('#puntatore').animate({marginLeft: '1050px', width: '50px', backgroundColor: 'blue'}, 200, function() { /*animazione completata*/ });
});
$('#linkcomment').mouseover(function() {
  $('#puntatore').animate({marginLeft: '1100px', width: '50px', backgroundColor: 'blue'}, 200, function() { /*animazione completata*/ });
});


$('#linkhome').click(function() {
  $('#comment').fadeOut();
  $('#menu').animate({top: '300px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '350px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '300px'}, 500, function() { /*animazione completata*/ });

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Articoli
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundArticles')",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkcontact').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("getURL('ajax/contact.php','backgroundContact')",400);

  //Quando il contenuto perde "focus"
  	//Contatti (Vuoto)
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Articoli
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundArticles')",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkbio').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("getURL('ajax/bio.php','pbackgroundBio')",500);

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia (Vuoto)
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Articoli
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundArticles')",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkwork').click(function() {
    $('#comment').fadeOut();
	$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("$('.contentWorksImgWrapper').css({'height':'0px'})",500);
  setTimeout("$('#backgroundWorksIndex').fadeIn(1000)",500);
  

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works (vuoto)
	//Articoli
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundArticles')",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkarticles').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("getURL('ajax/link.php','pbackgroundArticles')",500);

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Articoli (Vuoto)
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkevents').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
	  setTimeout("getURL('ajax/events_title.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/events_content.php','pbackgroundEventCont')",500);

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Eventi (Vuoto)
	//Buy
	   setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkbuy').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("$('.contentAnimalImg').fadeIn(2000)",500);
  
  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy (Vuoto)
	//Photo
	  setTimeout("$('.contentPhotoImg').fadeOut(1)",500);
});
$('#linkphoto').click(function() {
    $('#comment').fadeOut();
$('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  setTimeout("$('.contentPhotoImg').fadeIn(2000)",500);

  //Quando il contenuto perde "focus"
  	//Contatti
	  setTimeout("getURL('ajax/vuoto.php','backgroundContact')",500);
	//Biografia
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundBio')",500);
	//Works
	  setTimeout("$('#backgroundWorksIndex').fadeOut(0)",500);
	  setTimeout("$('.contentWorksImg').fadeOut(1)",500);
	//Eventi
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEvent')",500);
	  setTimeout("getURL('ajax/vuoto.php','pbackgroundEventCont')",500);
	//Buy
	  setTimeout("$('.contentAnimalImg').fadeOut(1)",500);
	//Photo (Vuoto)
});

$('#linkcomment').click(function() {
  document.getElementById('fb').innerHTML="Loading in progress..."
  $('#comment').fadeIn();
  $('#menu').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
  $('#puntatore').animate({top: '50px'}, 500, function() { /*animazione completata*/ });
  $('.social').animate({top: '0px'}, 500, function() { /*animazione completata*/ });
});

});

function Anchor(id){
	var offset = $("#"+id).offset().top;
	if(offset!=null)
	$('html,body').animate({scrollTop: offset },500);
}

function mapsEvento(id){
	document.getElementById('contenutoEvento'+id).innerHTML = '<iframe class="iframeMaps" src="maps/maps.php" frameborder="0" scrolling="no"></iframe>';
}

function imageDesc(foto){
	document.getElementById('photoDescImg').innerHTML='<img src="'+foto+'" width="450" style="margin:0; max-height:500px" />';
	document.getElementById('fb').innerHTML='<iframe src="fb/like.php" frameborder="0" scrolling="no" width="425" height="27" style="float:left"></iframe>';
	setTimeout("$('#fb').fadeIn(100)",1000);
	setTimeout("$('#backgroundPhotoDesc').fadeIn(1)",500);
}

