function reporting(repAjax) {
    var oThis = this;
    this.repAjax = repAjax;
    this.show = function() {
        $('#reportingMsg').fadeOut('normal', function() {
            $(this).empty();
        });
        $('#footer_nav').fadeOut('normal', function() { ;
            oThis.oldHeight = $('#footer').css('height');
            oThis.oldMargin = $('#page').css('margin-bottom');
            window.scrollBy(0,800);
            $('#reportingForm').fadeIn('normal', function() { $('#reportingTexte').focus(); });
        });
    }
    this.hide = function() {
        $('#reportingForm').fadeOut('normal', function() {
             $('#reportingTexte').val('');
             $('#footer_nav').fadeIn('high');
             $('#reportingMsg').fadeIn('slow');
        });
    }
}



$(document).ready(function() {

    // cache le formulaire
    $('#reportingForm').hide();
    $('#reportingMsg').hide();

    // bind la touche annuler pour cacher le formulaire
    $('#report_btn_annuler')
        .click(function() {
            oReporting.hide();
        });

    // bind le span problème pour afficher le formulaire dans le cas d'un problème
    $('#btn_probleme')
        .click(function() {
            oReporting.show();
            $('#reportingForm')
                .find('p').html("Veuillez indiquer le problème que vous avez rencontré;").end()
                .attr('action', oReporting.repAjax+'reporting/reporting_probleme_ajout.php');
            $('#report_btn_valid')
                .unbind('click')
                .click(function() {
                    oReporting.hide();
                    $('#reportingMsg').fadeIn('normal');
                });
        })
        .mouseover(function() { $(this).css("text-decoration", "underline"); })
        .mouseout(function()  { $(this).css("text-decoration", "none"); })
        .css("cursor", "pointer");

    // bind le span demande pour afficher le formulaire dans le cas d'une demande
    $('#btn_demande')
        .click(function() {
            oReporting.show();
            $('#reportingForm')
                .find('p').html("Veuillez indiquer ce que vous souhaitez voir ajouté").end()
                .attr('action', oReporting.repAjax+'reporting/reporting_demande_ajout.php');
            $('#report_btn_valid')
                .unbind('click')
                .click(function() {
                    oReporting.hide();
                });
        })
        .mouseover(function() { $(this).css("text-decoration", "underline"); })
        .mouseout(function()  { $(this).css("text-decoration", "none"); })
        .css("cursor", "pointer");

    // prépare le formulaire de reporting aux requetes AJAX
    $('#reportingForm').ajaxForm({
        target: "#reportingMsg"
    });
});
