function includeCSS(p_file) { var v_css = document.createElement('link'); v_css.rel = 'stylesheet' v_css.type = 'text/css'; v_css.href = p_file; document.getElementsByTagName('head')[0].appendChild(v_css); } $(document).ready(function(){ includeCSS('./fileadmin/templates/styles/style_js.css'); $("ul.onglets li").click(function () { $("ul.onglets li").removeClass("courant"); $("div.part").hide(); $('.'+$(this).attr("class").substring($(this).attr("class").indexOf("_",0)+1,$(this).attr("class").length)).show(); $(this).addClass("courant"); }); $(".minimizer").click(function () { if($("#formations_zone_recherche").is(":hidden")){ $("#formations_zone_recherche").slideDown('slow'); } else{ $("#formations_zone_recherche").slideUp('slow'); } if ($(this).hasClass('minimized')){ $(this).removeClass('minimized'); } else{ $(this).addClass('minimized'); } }); $("div.tx-icsformations-pi1 div.fetapes ul li.act").each(function () { $(this).parent("ul").children("li").hide(); //alert('hide'); $(this).parents("div").children("h3").addClass("act"); $(this).show(); //alert('show li act'); }); $("div.tx-icsformations-pi1 div.fetapes h3").click(function () { if (($(this).hasClass('act'))){ $(this).removeClass('act'); $(this).parent("div.fetapes").children("ul").children("li").show(); $(this).parent("div.fetapes").children("ul").children("li").removeClass('shown'); } else{ $(this).parent("div.fetapes").children("ul").children("li").show(); $(this).parent("div.fetapes").children("ul").children("li").addClass('shown'); $(this).parent("div.fetapes").children("ul").children("li").hide(); $(this).parent("div.fetapes").children("ul").children("li.act").show(); $(this).parent("div.fetapes").children("ul").children("li.act").removeClass('shown'); $(this).addClass('act'); } }); $("div.tx-icsformations-pi2 form input.checkbox").each(function () { if(typeof($('#'+$(this).attr("id")+':checked').val())!='undefined'){ $('#'+$(this).attr("id")+' + label').addClass("checked"); } }); $("div.tx-icsformations-pi2 form label.checkbox").click(function () { if($(this).hasClass("checked")){ $(this).removeClass("checked"); } else{ $(this).addClass("checked"); } }); $("div.tx-icsformations-pi2 form fieldset.col3 input.radio").each(function () { if(typeof($('#'+$(this).attr("id")+':checked').val())!='undefined'){ $('#'+$(this).attr("id")+' + label').addClass("checked"); } }); $("div.tx-icsformations-pi2 form fieldset.col3 label.radio").click(function () { $("div.tx-icsformations-pi2 form fieldset.col3 label.radio").removeClass("checked"); $(this).addClass("checked"); }); var first_month = $.cookie('ics_formations_recherche_month'); if (parseInt(first_month)>1){ $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(first_month)).addClass('prev'); } else{ first_month=1; } if((parseInt(first_month)+3)<9){ $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+3)).addClass('next'); } $("div.tx-icsformations-pi2 table.formations_resultats th.dates").each(function (){ var mois=$(this).attr("class").substring($(this).attr("class").indexOf("mois_",0)+5,$(this).attr("class").indexOf("mois_",0)+7); mois.replace(' ',''); var last_mois=parseInt(first_month)+parseInt(3); if (parseInt(mois)>parseInt(last_mois)){ $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+mois).hide(); } else{ if (parseInt(mois)1){ first_month=parseInt(first_month)-parseInt(1); $.cookie('ics_formations_recherche_month', first_month, { expires: 30 }); $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(first_month)).addClass('prev'); $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+first_month).show(); $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+1)).removeClass('prev'); if (parseInt(first_month)<9){ $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+3)).addClass('next'); } $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+(parseInt(first_month)+3)).show(); $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+4)).removeClass('next'); $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+(parseInt(first_month)+4)).hide(); } } if ($(this).hasClass('next')){ if (parseInt(first_month)<9){ first_month=parseInt(first_month)+parseInt(1); $.cookie('ics_formations_recherche_month', first_month, { expires: 30 }); $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+(parseInt(first_month)-1)).hide(); $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)-1)).removeClass('prev'); $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+first_month).show(); if (parseInt(first_month)>1){ $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(first_month)).addClass('prev'); } $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+2)).removeClass('next'); $("div.tx-icsformations-pi2 table.formations_resultats .mois_"+(parseInt(first_month)+3)).show(); $("div.tx-icsformations-pi2 table.formations_resultats th.mois_"+(parseInt(first_month)+3)).addClass('next'); } } }); });