function linkVisibility(vis) {
	
	if (vis == true) {
		var TweenFx = new Fx.Tween('linkfoto');
		TweenFx.set('display', 'inline');
		var TweenFx = new Fx.Tween('linkmostre');
		TweenFx.set('display', 'inline');
		var TweenFx = new Fx.Tween('linkvideo');
		TweenFx.set('display', 'inline');
		var TweenFx = new Fx.Tween('linkwiki');
		TweenFx.set('display', 'inline');
		var TweenFx = new Fx.Tween('linkcontatti');
		TweenFx.set('display', 'inline');
		var TweenFx = new Fx.Tween('linkhome');
		TweenFx.set('display', 'none');
	} else {
		var TweenFx = new Fx.Tween('linkfoto');
		TweenFx.set('display', 'none');
		var TweenFx = new Fx.Tween('linkmostre');
		TweenFx.set('display', 'none');
		var TweenFx = new Fx.Tween('linkvideo');
		TweenFx.set('display', 'none');
		var TweenFx = new Fx.Tween('linkwiki');
		TweenFx.set('display', 'none');
		var TweenFx = new Fx.Tween('linkcontatti');
		TweenFx.set('display', 'none');
		var TweenFx = new Fx.Tween('linkhome');
		TweenFx.set('display', 'inline');
	}
}

  window.addEvent('domready', function(){
  // Load your images here
	var data = {
		"img01.jpg": { caption: 'Via Camerone — Foto: <a href="http://www.flickr.com/photos/poluz/">poluz</a>' },
		"img02.jpg": { caption: 'Tanto da raccontare — Foto: <a href="http://www.flickr.com/photos/mattiatortellino/">mattia tortellino</a>' },
		"img03.jpg": { caption: 'Dopo la tempesta — Foto: <a href="http://www.flickr.com/photos/pierluigi-ricci/">pierluigi.ricci</a>' },
		"img04.jpg": { caption: 'Senza titolo — Foto: <a href="http://www.flickr.com/photos/ferro86/">ezio stimato</a>' },
		"img05.jpg": { caption: '«Ballini» — Foto: <a href="http://www.flickr.com/photos/balbotta/">balbotta</a>' },
		"img06.jpg": { caption: 'Time to work — Foto: <a href="http://www.flickr.com/photos/ankhesenamon/">sabrina</a>' },
		"img07.jpg": { caption: 'Il radiotelescopio scruta nell\'oscurità — Foto: <a href="http://www.flickr.com/photos/castefoto/">castefoto</a>' },
		"img08.jpg": { caption: 'Saltimpalo — Foto: <a href="http://www.flickr.com/photos/quinlan75/">quinlan75</a>' },
		"img09.jpg": { caption: 'Facendo i tortelloni — Foto: <a href="http://www.flickr.com/photos/kiki-follettosa/">kiki follettosa</a>' },
		"img10.jpg": { caption: 'Minaccia — Foto: <a href="http://www.flickr.com/photos/guarda51/">guarda</a>' },
		"img11.jpg": { caption: 'Via degli Aceri — Foto: <a href="http://www.flickr.com/photos/18045516@N00/">alexxxandrobis</a>' },
		"img12.jpg": { caption: 'Maggio — Foto: <a href="http://www.flickr.com/photos/79416436@N00/">koala sorridente</a>' },
		"img13.jpg": { caption: 'Trebbiatura — Foto: <a href="http://www.flickr.com/photos/mikedangel/">mikedangel</a>' },
		"img14.jpg": { caption: 'Stanco di scegliere — Foto: <a href="http://www.flickr.com/photos/bastiart/">bastiart</a>' }
	};
	// Initialize the Slideshow instance
	var myShow = new Slideshow('show', data, { captions: true, thumbnails: true, controller: true, delay: 4000, height: 350, hu: 'img/', width: 500 });
	
	// carico home
	var hRequest = new Request.HTML({
		url: 'home.html',
		onSuccess: function(html) {
			$('subsarea').set('text', '');
			$('subsarea').adopt(html);
		}
	});
		
		hRequest.send();
	
	// Inizializzo visualizzazioni
	var slideshowFx = new Fx.Slide('maincontent');
	fotoTweenVisible = false;
	
	// in mostre
	$('linkmostre').addEvent('click', function (event) {
		slideshowFx.slideOut();
		linkVisibility(false)
	
		var hRequest = new Request.HTML({
			url: 'mostre.html',
			onSuccess: function(html) {
				$('subsarea').set('text', '');
				$('subsarea').adopt(html);
			}
		});
		
		hRequest.send();
		event.stop();
	});
	
	// in video
	$('linkvideo').addEvent('click', function (event) {
		slideshowFx.slideOut();
		linkVisibility(false);
		
		var hRequest = new Request.HTML({
			url: 'video.html',
			onSuccess: function(html) {
				$('subsarea').set('text', '');
				$('subsarea').adopt(html);
			}
		});
		
		hRequest.send();
		event.stop();
	});
	
	// in home
	$('linkhome').addEvent('click', function (event) {
		slideshowFx.slideIn();
		linkVisibility(true);
		
		var hRequest = new Request.HTML({
			url: 'home.html',
			onSuccess: function(html) {
				$('subsarea').set('text', '');
				$('subsarea').adopt(html);
			}
		});
		
		hRequest.send();
		event.stop();
	});
	
	// in contatti
	$('linkcontatti').addEvent('click', function (event) {
		slideshowFx.slideOut();
		linkVisibility(false);
		
		var hRequest = new Request.HTML({
			url: 'contatti.html',
			onSuccess: function(html) {
				$('subsarea').set('text', '');
				$('subsarea').adopt(html);
			}
		});
		
		hRequest.send();
		event.stop();
	});
});
