$$('.mapreg').hide();
var heights = new Array();
var minheight = 100;
$$('.bloc').each( function(el, i) {
	heights[i] = el.getSize().y.toInt();
	el.setStyles( {
		'overflow' : 'hidden',
		'height' : minheight
	});
	el.getNext('.small_bloc_bottom').addEvent('click', function() {
		if( el.getStyle('height').toInt()!=minheight) {
			el.tween('height', minheight);
			el.getNext('.small_bloc_bottom').getElement('small').set('text', 'Lire la suite');
		} else {
			el.tween('height', heights[i]);
			el.getNext('.small_bloc_bottom').getElement('small').set('html', 'Reduire la fen&ecirc;tre');
		}
	});
});

var fx = $('mapLegend').get('reveal');
var fxdpt;
var mapSize = $('mapfr').getSize().y.toInt();
function show_region(nb) {
	toHide = (fxdpt) ? fxdpt : fx;
	toHide.dissolve().chain( function() {
		if( $('mapreg_'+nb) ) {
			fxdpt = $('mapreg_'+nb).get('reveal');
			fxdpt.reveal().chain( function() {
				resizeBloc( );
			});
		}
	});
}
function show_infos(nb, reg) {
	$$('#mapreg_'+reg+' .regmap div').hide();
	$('info_'+nb).reveal();
	$('info_'+nb).get('reveal').chain( function() {
		resizeBloc( );
	});
}
function show_map() {
	fxdpt.dissolve().chain( function() {
		//$E('#blocReseau .blocTitre').innerHTML = 'Notre réseau national à votre écoute';
		fx.reveal( ).chain( function() {
			resizeBloc( );
		});
		fxdpt = null;
	});
	
}

function resizeBloc() {
	int = $('mapRight').getSize().y.toInt();
	el = $('mapfr').getParent('.bloc');
	if ( int + 55 > heights[1] ) {
		el.tween('height', int + 55 );
	} else 
		el.tween('height', heights[1] );
}
