window.addEvent('domready', function() {

	var ab_stat = 0;
	var cn_stat = 0;

  $('ab_toggler').addEvent('click',function(){
		
		if(ab_stat==1){
			$('about').morph({'opacity':[.9,0]});
			$('foto_profilo').morph({
				'opacity':[1,0],
				'z-index': [5,-5]
			});
			ab_stat=0;
		} else {
			$('about').morph({'opacity':[0,.9]});
			$('foto_profilo').setStyle('z-index','5');
			$('foto_profilo').morph({'opacity':[0,1]});
			ab_stat=1;
		}
		
		if(cn_stat==1){
			$('contact').morph({'opacity':[.9,0]});
			cn_stat=0;
		}
	});
	
  $('ab_closer').addEvent('click',function(){
		$('about').morph({'opacity':[.9,0]});
		$('foto_profilo').morph({
			'opacity':[1,0],
			'z-index': [5,-5]
		});
		ab_stat=0;
	});
	
	$('cn_toggler').addEvent('click',function(){
		if(cn_stat==1){
			$('contact').morph({'opacity':[.9,0]});
			cn_stat=0;
		} else {
			$('contact').morph({'opacity':[0,.9]});
			cn_stat=1;
		}
		
		if(ab_stat==1){
			$('about').morph({'opacity':[.9,0]});
			$('foto_profilo').morph({
				'opacity':[1,0],
				'z-index': [5,-5]
			});
			ab_stat=0;
		}
	});
	
  $('cn_closer').addEvent('click',function(){
		$('contact').morph({'opacity':[.9,0]});
		cn_stat=0;
	});	
});
