!!# Si les librairies Jquery sont chargees, on affiche un double curseur.
!!! copy form search.proc- useful when going from "insertion of an exercise in a sheet"
!!! to sheet gestion.
!set s2dir=!replace internal sessions/ by s2/ in $wims_sesdir
!set s2dir=!translate internal _ to $ $ in $s2dir
!set s2dir=!word 1 of $s2dir
!if $wims_class!=$empty
  !set fromtodir=log/classes/$wims_class
!else
  !set fromtodir=$s2dir
!endif
!default search_level_from=!getdef search_level_from in wimshome/$fromtodir/home_search2
!default search_level_to=!getdef search_level_to in wimshome/$fromtodir/home_search2
!!!

!if $search_level_to$search_level_from=$empty and $wims_class!=$empty
  !set Listlevel=$wims_listlevel
  !set cl=!positionof item $wims_class_level in $Listlevel
  !set search_level_from=$[max(1,$cl-1)]
  !set search_level_to=$[$cl+1]
!endif
!default search_level_from=1
!default search_level_to=$search_levelcnt
!!<fieldset class="property_fields blockcenter">
!! <legend>name_bounded_search$name_bounded_search</legend>
<input type="hidden" id="search_level_from" name="search_level_from" value="$search_level_from">
<input type="hidden" id="search_level_to" name="search_level_to" value="$search_level_to">
<div class="slider" id="slider_level" style="margin-right:auto;margin-left:auto"></div>
!if $wims_class!=$empty
  <div class="formHelp center">$name_search_level_class_help</div>
!endif
!!</fieldset>

<script src="scripts/js/external/jquery-ui-slider-pips/jquery-ui-slider-pips.min.js"></script>
<link rel="stylesheet" href="scripts/js/external/jquery-ui-slider-pips/jquery-ui-slider-pips.min.css">
<link rel="stylesheet" href="themes/_css/jquery-ui-slider-pips.custom.css">
<style>
  #slider_level .ui-slider-range {background: $wims_ref_bgcolor;}
  .ui-slider-pips .ui-slider-pip-selected-1, .ui-slider-pips .ui-slider-pip-selected-2
    {color: $wims_ref_bgcolor;}
</style>
<script>
/*<![CDATA[*/ jQuery(function(jq){
  var niveaux = new Array($search_levelcnt);
  !set niveaucnt=!itemcnt $search_levels
  !for i=1 to $niveaucnt
    !ifval $(search_levels[$i+1])-$(search_levels[$i])>1
  niveaux[$(search_levels[$i])]='$(name_wims_levels[$i])&rarr;';
    !else
  niveaux[$(search_levels[$i])]='$(name_wims_levels[$i])';
    !endif
  !next
  jq('#slider_level')
    .slider({min: 1,
             max: niveaux.length-1,
             range: true,
             values: [ jq( "#search_level_from" ).val(), jq( "#search_level_to" ).val() ],
             slide: function( event, ui ) {
        jq( "#search_level_from" ).val(ui.values[0]);
        jq( "#search_level_to" ).val(ui.values[1]);
      }
    })
    .slider('pips',
           {rest: "label",
           labels: niveaux});
  });/*]]>*/
</script>
