$(document).ready(function() {

    var current_gauche = null;

    $('#nav_principale_gauche/a').each(function() {

        var id = $(this).attr('id');

        $('.'+id).hide();

        $(this).mouseover(function() {

            if(current_gauche != null) {

                $('.'+current_gauche).hide();

            }

            $('.'+id).show();

            current_gauche = id;

        });

    });

    var current_droite = null;

    $('#nav_principale_droite/a').each(function() {

        var id = $(this).attr('id');

        $('.'+id).hide();

        $(this).mouseover(function() {

            if(current_droite != null) {

                $('.'+current_droite).hide();

            }

            $('.'+id).show();

            current_droite = id;

        });

    });
    


});

$(document).ready(function() {

    
    $(this)
        .find('form')
            .submit(function() { // validation des champs obligatoires
                var nb_error = 0;
                $(this)
                    .find('.oblig')
                        .each(function() {
                            var data = $(this).val();
                            
                            //if(data.trim() == '') { // champ vide
                            if(jQuery.trim(data) == '') { // champ vide
                            
                                $(this)
                                    .addClass('error')
                                    .focus(function() { $(this).removeClass('error'); });   
                                nb_error++;
                            }
                        })
                    .end();

                                            
                    var data = $('textarea.oblig').val();
                    
                    
                    $('textarea.oblig').each(function() {
		                    var data = $(this).val();                            
	                    	if(jQuery.trim(data) =='Merci d\'indiquer le lieu et la date de l\'évènement auquel vous avez participé.') 
                            { 
                            $(this)                                    
                                    .focus(function() { $(this).val('') ; });   
                            }
                            
                            if(jQuery.trim(data) == '' || jQuery.trim(data) =='Merci d\'indiquer le lieu et la date de l\'évènement auquel vous avez participé.') { // champ vide
                        
                            $(this)
                                .addClass('error')
                                .focus(function() { $(this).removeClass('error'); });   
                            nb_error++;
                            }
                        })
                    .end();
                    
                                    
                if(nb_error != 0) {
                    alert('Veuillez remplir le(les) champ(s) marqué(s) d\'une étoile');
                    scrollTo(0,0);
                    return false;
                }
                return true;
            })
        .end();
        

            
        
});

/*var ocontainer;

var ocontent;

var spaceToScroll;

$(document).ready(function () { 

    ocontainer = $('div.container');

    ocontent = $('div.content');

    

    containerSize = jQuery.iUtil.getSize(ocontainer.get(0));

    containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));

    containerInner = jQuery.iUtil.getClient(ocontainer.get(0));

    

    contentSize = jQuery.iUtil.getSize(ocontent.get(0));

    

    $('div.slider')

        .css('top', containerPosition.y + 'px')

        .css('left', containerPosition.x + containerSize.wb + 'px')

        .css('height', containerSize.hb + 'px');

    

    spaceToScroll = contentSize.hb - containerInner.h;

    

    $('div.indicator')

        .css('height', containerInner.h * containerSize.hb / contentSize.hb + 'px')

    

    $('.slider').Slider({

        accept: '.indicator',

        onSlide: function( cordx, cordy, x , y) {

            ocontent.css('top', - spaceToScroll * cordy / 100 + 'px');

        }

    });

});*/