function menuOnclick(e) {
    var link = $(e).find('a');
    var href = $.trim(link.attr("href"));
    var text = $.trim(link.attr("title"));

    try {
        if (pageTracker) {
            pageTracker._trackEvent(text, text, window.location.href);
        }
    } catch (err) {
    }
    if (text == "vol")
        window.open(href);
    else
        window.location.href = href;

}

$(document).ready(function() {
    //script tracking outgoing page
    $(".selectionpremium a.decouvrir").live("click", function() {
        var text = $.trim($(this).text());
        var href = $.trim($(this).attr("href"));

        if (href.length > 3 && text.length > 3) {
            text = text.replace(/\s+/gi, " ");
            try {
                if (pageTracker) {
                    pageTracker._trackEvent("SelectionPremium", text, window.location.href);
                }
            } catch (err) {
            }
        }
    });

    $(".commentyaller a.decouvrir").live("click", function() {
        var text = $.trim($(this).text());

        var href = $.trim($(this).attr("href"));
        if (href.length > 3 && text.length > 3) {
            text = text.replace(/\s+/gi, " ");
            try {
                if (pageTracker) {
                    pageTracker._trackEvent("CommentYAller", text, window.location.href);
                }
            } catch (err) {
            }
        }
    });


    $(".selectionpremium a:not(.decouvrir)").live("click", function() {
        var text = $.trim($(this).text());
        if (text == "")
            text = $.trim($(this).attr("title"));

        var href = $.trim($(this).attr("href"));
        if (href.length > 3 && text.length > 3) {
            text = text.replace(/\s+/gi, " ");

            try {
                if (pageTracker) {
                    pageTracker._trackEvent("SelectionPremium", "Produits", text);
                }
            } catch (err) {

            }
        }
    });

    $(".commentyaller a:not(.decouvrir)").live("click", function() {
        var text = $.trim($(this).text());
        if (text == "")
            text = $.trim($(this).attr("title"));

        var href = $.trim($(this).attr("href"));
        if (href.length > 3 && text.length > 3) {
            text = text.replace(/\s+/gi, " ");

            try {
                if (pageTracker) {
                    pageTracker._trackEvent("CommentYAller", "Produits", text);
                }
            } catch (err) {

            }
        }
    });

    $("#conteneur_menu ul li ul li a").click(function() {
        var text1 = $.trim($(this).parent().parent().prev('a').text());
        var text2 = $.trim($(this).text());

        var href = $.trim($(this).attr("href"));
        if (href.length > 3 && text.length > 3) {
            text = text.replace(/\s+/gi, " ");

            try {
                if (pageTracker) {
                    pageTracker._trackEvent(text1, text2, window.location.href);
                }
            } catch (err) {

            }
        }
    });

});
