// JavaScript Document

// Self Label
if (Object.isUndefined(Axent)) { var Axent = { } }
Axent.SelfLabeledInput = Class.create({
	initialize: function() {
		var labelSelector = arguments[0] || 'label';
		$$(labelSelector).findAll(function(l) {return (l.readAttribute('for') !== null)}).each(function(l){
			l.hide();
			$(l.readAttribute('for'))._value = l.innerHTML;
			if ($(l.readAttribute('for')).value.empty()) {
				$(l.readAttribute('for')).value = $(l.readAttribute('for'))._value
			}
			$(l.readAttribute('for')).observe('blur',function(e){if(Event.element(e).value == '') Event.element(e).value = l.innerHTML;});
			$(l.readAttribute('for')).observe('focus',function(e){if(Event.element(e).value == l.innerHTML) Event.element(e).value = '';});
		});
	}
	});

	Event.observe(window, 'load', function() {	
										   										   	 
	 	// Gestion de la hauteur d'écran
		resizePrincipale();
		
		Event.observe(document.onresize ? document : window, "resize", resizePrincipale);

	});
	
	function resizePrincipale() {
		var height = document.viewport.getHeight();
		var top_height = $('header').getHeight();
		var page_height = $('content').getHeight();
		var bottom_height = $('footer').getHeight();
		var total_height = parseInt(top_height)+parseInt(page_height)+parseInt(bottom_height);
		var height_ideal = parseInt(height-total_height-75+page_height);
		
		if(total_height < height) $('content').setStyle({ minHeight : height_ideal+'px' });
	}
