// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
Ajax.Responders.register({
	onCreate: function() {
		if (Ajax.activeRequestCount > 0)
			Element.show('spinner');
		},
		onComplete: function() {
			if (Ajax.activeRequestCount == 0)
				Element.hide('spinner');
			}
});
function fichier_end() {
	new Ajax.Request('/inscri/photos_modify', {asynchronous:true, evalScripts:true}); return false;
}
function fichier_end2() {
	new Ajax.Request('/inscri/photos_create', {asynchronous:true, evalScripts:true}); return false;
}
function showphoto(element) {
	var width = document.viewport.getWidth();
	var height = document.viewport.getHeight();
	var left = document.viewport.getScrollOffsets()[0];
	var top = document.viewport.getScrollOffsets()[1];
	$('mask').setStyle({top: 1 * top + 'px', left: 1 * left + 'px', width: 1 * width + 'px', height: 1 * height + 'px', opacity: 0});
	$('mask').show();
	$('mask').morph('opacity: 0.7');
	$(element).setStyle({width: 0.8 * width + 'px', height: 0.8 * height + 'px',left : (0.1 * width + left) + 'px', top: (0.1 * height + top) + 'px'});
	var img = $$('div#' + element + ' img').first();
	img.setStyle('max-width: ' + 0.7 * width + 'px; height: ' + 0.7 * height + 'px; margin: ' + 0.05 * height + 'px ' + 0.05 * width + 'px' );
	new Effect.SlideDown(element, { delay: 1.5 });
}
function hidephoto(element) {
	new Effect.SlideUp(element);
	new Effect.Puff('mask', { delay: 1 });
}
function changephoto(element) {
	var width = document.viewport.getWidth();
	var height = document.viewport.getHeight();
	var img = $$('div#' + element + ' img').first();
	img.setStyle('max-width: ' + 0.7 * width + 'px; height: ' + 0.7 * height + 'px; margin: ' + 0.05 * height + 'px ' + 0.05 * width + 'px' );
	new Effect.Appear('showphoto-contents');
}
