function handleEventList(){
	// initialisation
	$('.event-content').hide();
	
	
	// bindings
	$('.menu-secondaire li a').bind('click', function(){
		$('.menu-secondaire li.active').removeClass('active');
		$(this).parent().addClass('active');
		
		$('.event-content').hide();
		$('#event_' + $(this).attr('name')).show();
		
		$('#titre-section-evenement').html($(this).html());
		
		return false;
	});
	
	$('.menu-secondaire li:eq(0) a').trigger('click');
}

function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

function validerCourriel(val){
	var reg =/^[_a-zA-Z0-9.\-]*@[a-zA-Z0-9]([_a-zA-Z0-9\-]+\.)+([a-zA-Z]{2,10})$/;
	if(val.match(reg)) {
		return true;
	} else {
		return false;
	}
}

function bindEmailTextBox(){
	var defaultText = $('#email_ml').attr('title');
	var inactiveTextColor = '#777';
	var activeTextColor = '#000';
	
	$('#email_ml').bind('focus', function(){
		if($(this).val() == defaultText){
			$(this).css('color', activeTextColor);
			$(this).val('');
		}
	});
	
	$('#email_ml').bind('blur', function(){
		if($(this).val() == ''){
			$(this).css('color', inactiveTextColor);
			$(this).val(defaultText);
		} else if($(this).val() == defaultText){
			$(this).css('color', inactiveTextColor);	
		}
	});	
}

function bindFormSubscribeNewsletter(){
	var confirmation = false;
	
	$('#subscribe_newsletter').bind('submit', function(){
		if(validerCourriel($(this).find('.courriel').val()) != false){
			confirmation = true;
			
			
			$.post('/assets/ajax/model_insert_maillinglist.php', {email_ml: $('#email_ml').val(), lang_ml: $('#lang_ml').val()}, function(data){
				$('#email_ml').val('')
				$('#email_ml').trigger('blur');
			})
			//evenement d'ajout a la bd (mailing list)
		}
		
		return false;
	});
}
