﻿$(document).ready(function () {
    var classToAdd = "";
    if ($.browser.msie) {
        classToAdd += "IE"
        if (jQuery.browser.version === "7.0") {
            classToAdd += " IE7";
        } else if (jQuery.browser.version === "8.0") {
            classToAdd += " IE8";
        } else if (jQuery.browser.version === "9.0") {
            classToAdd += " IE9";
        }
    } else if ($.browser.webkit) {
        classToAdd += "webkit"
    } else if ($.browser.opera) {
        classToAdd += "opera"
    } else if ($.browser.mozilla) {
        classToAdd += "mozilla"
    }

    $("body").addClass(classToAdd);
    $(".customers.box .box-content div").jCarouselLite({
        auto: 1000,
        visible: 4,
        speed: 2000
    });
    var maxh = 0;
    $(".colx3 .col").each(function () {
        if ($(this).height() > maxh)
            maxh = $(this).height();
    });
    $(".colx3 .col").height(maxh);
    $(".content ul li").each(function () {
        $(this).html("<span>" + $(this).html() + "</span>").addClass("colored");
    });
    if ($(".columnable .colbreak").size() > 0) {
        $(".columnable").each(function () {
            var content = $(this).html();
            $(this).html("");
            var myreg = /<div[^>]*colbreak[^>]*?>[^<]*?<\/div>/i
            // var myreg = /<hr[^>]*>/i
            var cols = content.split(myreg);
            var nCol = $(cols).size();
            var cc = this;
            $(cols).each(function (i, v) {
                var elem = $("<div></div>");
                $(elem).addClass("contentCol col" + i);
                $(elem).html(v);
                if (i == 0)
                    elem.addClass("colFirst");
                if (i == nCol - 1)
                    elem.addClass("colLast");
                $(cc).append(elem).addClass("columnized colx" + nCol);
            });
            $(this).append("<div style=\"clear:both\"></div>");
        })
    }
    /*IE7*/
    if ($("body").hasClass("IE7")) {
        $("#menu a").hover(function () { $(this).addClass("hover").siblings("a").removeClass("hover"); }, function () { $(this).removeClass("hover"); });
        $("#boutons a").hover(function () { $(this).addClass("hover").siblings("a").removeClass("hover"); }, function () { $(this).removeClass("hover"); });
    }
    if ($("body").hasClass("IE7") || $("body").hasClass("IE8")) {
        $("a").each(function () {
            var file = $(this).attr("href");
            var reg = /[^\>]*.pdf/i;
            if (file != undefined)
                if (file.match(reg))
                    $(this).addClass("pdfFile");
        });
    }
    $(".Submenu a").each(function () {
        var n = window.location.pathname;
        var lien = $(this).attr("href");
        if (lien.indexOf(n) >= 0)
            $(this).addClass("current");

    });
});



