﻿//<![CDATA[
(function($) {
    $.fn.LoadingInit = function() {
        $('#contact_coord').hide();
        $('#lien_contacter').addClass('on');
        $('#centre_annuaire_formation_centre').hide();
        $('#centre_annuaire_formation_intra').hide();
        $('#centre_annuaire_formation_dist').hide();
        this.initOnglet($('#lien_contacter'), $('#formulaire'));
        this.initOnglet($('#lien_coordonees'), $('#contact_coord'));
        this.initOnglet2($('#ong_presentation'), $('#annuaire_formation_presentation'));
        this.initOnglet2($('#ong_formcentre'), $('#centre_annuaire_formation_centre'));
        this.initOnglet2($('#ong_formintra'), $('#centre_annuaire_formation_intra'));
        this.initOnglet2($('#ong_formdist'), $('#centre_annuaire_formation_dist'));
        initStatutOnglet();
        if ($('#ong_presentation').is(":visible")) {
            $('#ong_presentation').addClass('on');
        } else if ($('#ong_formcentre').is(":visible")) {
            $('#ong_formcentre').addClass('on');
            $('#centre_annuaire_formation_centre').show();
        } else if ($('#ong_formintra').is(":visible")) {
            $('#ong_formintra').addClass('on');
            $('#centre_annuaire_formation_intra').show();
        } else if ($('#ong_formdist').is(":visible")) {
            $('#ong_formdist').addClass('on');
            $('#centre_annuaire_formation_dist').show();
        }
        manPanier();
    };

    $.fn.initOnglet = function(ong, bloc) {
        ong.href = "javascript:;";
        ong.bind('click', function() { activeOnglet(ong, bloc) });
    };

    $.fn.initOnglet2 = function(ong, bloc) {
        ong.href = "javascript:;";
        ong.bind('click', function() { activeOnglet2(ong, bloc) });
    };

    function resetOnglet() {
        $('#onglets a').each(function() { $(this).removeClass('on') });
        $('#formulaire').hide();
        $('#contact_coord').hide();
    };

    function resetOnglet2() {
        $('#onglets2 a').each(function() { $(this).removeClass('on') });
        $('#annuaire_formation_presentation').hide();
        $('#centre_annuaire_formation_centre').hide();
        $('#centre_annuaire_formation_intra').hide();
        $('#centre_annuaire_formation_dist').hide();
    };
    function activeOnglet(a, o) {
        resetOnglet();
        a.addClass('on');
        o.show();
    };
    function activeOnglet2(a, o) {
        resetOnglet2();
        a.addClass('on');
        o.show();
    };
})(jQuery)

$(function() {
$("form").LoadingInit();
$("#onglets a").click(function() {
    $(this).find("a").attr("href"); return false;
});
$("#onglets2 a").click(function() {
    $(this).find("a").attr("href"); return false;
});
$("#onglets3 a").click(function() {
    $(this).find("a").attr("href"); return false;
});
});

function startLytebox(id, title, data, width, height) {
    var el = document.getElementById(id);
    el.href = data;
    el.title = title;
    el.rel = "lyteframe";
    el.rev = "width: " + width + "; height: " + height + "; "
    myLytebox = null;
    initLytebox();
    myLytebox.start(el, false, true);
}

//]]>

