<!-- 
Event.observe(window, 'load', function(){
	var leftch = $('content_left').getHeight();
	var rightch = $('content_right').getHeight();
	if(leftch > rightch){
		leftch = leftch.toString() + 'px';
		$('content_right').setStyle('min-height:', leftch);
	}
	$('submenu').observe('click', activize);
});

function inviaMail(){
	var response = $('mailingresponse');
	var form = $('mailinglist');
	var datas = form.serialize();
	form.disable();
	new Ajax.Request('inviamail.php',{
		method: 'post',
		parameters: datas,
		onSuccess: function(transport){
			response.update(transport.responseText);
			form.enable();
		},
		onFailure: function(transport){
			response.update('<div class="no">Richiesta di iscrizione fallita! Contattare via mail <a href="mailto:info@pantarei-cea.it">info@pantarei-cea.it</a></div>');
			form.enable();
		},
		onLoading: function(){
			response.update('<img src="img/mailwait.gif"/>');
			fotoscreen.fade({from:1.0, to:0.0, duration:0.5, queue:'front'});
		}
	});
}

function showDir(dirId){
	var list = $(dirId);
	if(!list.visible())
		Effect.BlindDown(list,{duration:0.3});
	else
		Effect.BlindUp(list,{duration:0.3});
}
function showAFoto(event){
	var felement = Event.element(event);
	var targetfdiv = felement.readAttribute('title');
	var ftohide = $('aFoto').childElements();
	ftohide.each(function(ef){
		if(ef!=$(targetfdiv)){
			ef.hide();
		}
	});
	$(targetfdiv).appear({duration:0.5});
}
function show_vt(capitolo){
	$('vt_layer').appear({to:0.4,duration:0.5});
	$('vt_container').appear({duration:0.5});
	$(capitolo).show();
}
function close_vt(capitolo){
	$('vt_container').fade({duration:0.5});
	$(capitolo).fade({duration:0.5});
	$('vt_layer').fade({duration:0.5});
}

function gotoArchivio(){
	window.location='archivio.php?gta=go';
}

function activize(event){
	var element = event.element();
	if(element.hasClassName('blog')){
		window.location='http://www.pantarei-cea.it/blog';
	}
	else{
		var toremove = $$('#submenu li.active');
		toremove.each(function(e){
			e.removeClassName('active');
			e.addClassName('notactive');
		});
		if(element.hasClassName('notactive')){
			element.removeClassName('notactive');
		}
		element.addClassName('active');
		var targetdiv = element.readAttribute('title');
		var tohide = $('content_right').childElements();
		tohide.each(function(e2){
			if(e2!=$(targetdiv)){
				e2.hide();
			}
		});
		$(targetdiv).appear({duration:0.5});
		if(element.hasClassName('active')&&element.readAttribute('title')=='lidea'){
			fotoshow();
		}
	}
}

function fotoshow(fotoscreen){
	var menuelement = $('submenuitem');
	var fotoscreendiv = $('fotoscreendiv');
	var fotoscreen = $('fotoscreenimg');
	var loader = $('imgloader');
	var num = fotoscreen.readAttribute('alt');
	var fotoshow = new PeriodicalExecuter(function(pe){
		if(menuelement.hasClassName('active')&&menuelement.readAttribute('title')=='panta'){
			ajaxRequest('scripts/fotoshow.php','post','?number='+num,fotoscreendiv);
			pe.stop();
		}
		else{
			pe.stop();
		}
	},5);
}

function fotoscreenloaded(){
	$('imgloader').remove();
	$('fotoscreenimg').appear({from:0.0, to:1.0, duration:0.5});
	fotoshow();
}

function ajaxRequest(url, type, param, resp){
	var response = $(resp);
	new Ajax.Request(url,{
		method: type,
		parameters: param,
		onSuccess: function(transport){
			response.update(transport.responseText);
			response.insert('<img id="imgloader" class="imgloader" src="img/loading.gif"/>');
		},
		onFailure: function(transport){
			response.update('<img class="error" src="img/error.gif"/>');
		},
		onLoading: function(){
			var fotoscreen = $('fotoscreenimg');
			fotoscreen.fade({from:1.0, to:0.0, duration:0.5, queue:'front'});
			response.insert('<img id="imgloader" class="imgloader" src="img/loading.gif" style="display:none;"/>');
			$('imgloader').appear({from:0.0, to:0.6, duration:0.3, queue:'end'});
		}
	});
}
// -->