
jQuery.fn.customInput=function(){jQuery(this).each(function(i){if(jQuery(this).is('[type=checkbox],[type=radio]')){var input=jQuery(this);var label=jQuery('label[for='+input.attr('id')+']');var inputType=(input.is('[type=checkbox]'))?'checkbox':'radio';jQuery('<div class="custom-'+inputType+'"></div>').insertBefore(input).append(input,label);var allInputs=jQuery('input[name="'+input.attr('name')+'"]');label.hover(function(){jQuery(this).addClass('hover');if(inputType=='checkbox'&&input.is(':checked')){jQuery(this).addClass('checkedHover');}},function(){jQuery(this).removeClass('hover checkedHover');});input.bind('updateState',function(){if(input.is(':checked')){if(input.is(':radio')){allInputs.each(function(){jQuery('label[for='+jQuery(this).attr('id')+']').removeClass('checked');});};label.addClass('checked');}
else{label.removeClass('checked checkedHover checkedFocus');}}).trigger('updateState').click(function(){jQuery(this).trigger('updateState');}).focus(function(){label.addClass('focus');if(inputType=='checkbox'&&input.is(':checked')){jQuery(this).addClass('checkedFocus');}}).blur(function(){label.removeClass('focus checkedFocus');});}});};$(document).ready(function(){jQuery('.impression').click(function(){jQuery(".impression").not(jQuery(this)).attr("checked",false);jQuery(".impression_label").not(jQuery(this).next()).removeClass("checked");});jQuery('.duree').click(function(){jQuery(".duree").not(jQuery(this)).attr("checked",false);jQuery(".duree_label").not(jQuery(this).next()).removeClass("checked");});jQuery('.securite').click(function(){jQuery(".securite").not(jQuery(this)).attr("checked",false);jQuery(".securite_label").not(jQuery(this).next()).removeClass("checked");});jQuery('.nombre').click(function(){jQuery(".nombre").not(jQuery(this)).attr("checked",false);jQuery(".nombre_label").not(jQuery(this).next()).removeClass("checked");});jQuery('#selector_form input').click(function(){jQuery(".loading img").show();filter_products(jQuery('#selector_form').serialize());});if(jQuery('#selector_form').length){jQuery.post("/selector/filter",function(data){jQuery(".loading img").hide();if(data['ids']){if(data['ids'].length){jQuery(".new_gamme_box").addClass("gamme_not_available");jQuery.each(data['ids'],function(key,val){jQuery("#node_"+val).removeClass("gamme_not_available");});}else
jQuery(".new_gamme_box").addClass("gamme_not_available");}
if(data['criterias']&&data['criterias'].length){jQuery.each(data['criterias'],function(key,val){if(jQuery.isArray(val)){jQuery.each(val,function(idx,value){jQuery("."+value+" input").attr("checked",true);jQuery("."+value+" label").addClass("checked");});}
else{jQuery("."+val+" input").attr("checked",true);jQuery("."+val+" label").addClass("checked");}});}},"json");}
jQuery('.with_hint').hover(function(){jQuery(this).next().fadeIn(100);},function(){jQuery(this).next().hide();});jQuery('.with_hint').next().hover(function(){jQuery(this).hide();});jQuery('input').customInput();jQuery('.referer .popup_help_icon1').hover(function(){jQuery('.new_help_popup_1').fadeIn(200);},function(){jQuery('.new_help_popup_1').hide();});jQuery('.referer .popup_help_icon2').hover(function(){jQuery('.new_help_popup_2').fadeIn(200);},function(){jQuery('.new_help_popup_2').hide();});jQuery('.referer .popup_help_icon3').hover(function(){jQuery('.new_help_popup_3').fadeIn(200);},function(){jQuery('.new_help_popup_3').hide();});jQuery('.referer .popup_help_icon4').hover(function(){jQuery('.new_help_popup_4').fadeIn(200);},function(){jQuery('.new_help_popup_4').hide();});jQuery('.referer .popup_help_icon5').hover(function(){jQuery('.new_help_popup_5').fadeIn(200);},function(){jQuery('.new_help_popup_5').hide();});});function filter_products(choices){jQuery.post("/selector/filter",{'choices':choices},function(data){jQuery(".loading img").hide();jQuery(".new_gamme_box").removeClass("gamme_not_available");if(data['ids']){if(data['ids'].length){jQuery(".new_gamme_box").addClass("gamme_not_available");jQuery.each(data['ids'],function(key,val){jQuery("#node_"+val).removeClass("gamme_not_available");});}else
jQuery(".new_gamme_box").addClass("gamme_not_available");}},"json");}
