﻿$(document).ready(function() {
    $("#motclef").attr(
        {
            placeholder: "Mot(s) clé(s)"
        });
    $("#ville").attr(
        {
            placeholder: "Ville, département ou CP"
        });   
    $("li.action").each(
        function() {
            var id = $(this).attr('id');
            $(this).children('a').bind("click", function(evt) {
                $("li.action").each(
                    function() {
                        if ($(this).attr('id') === id)
                            $(this).removeClass("a_off").addClass("a_on");
                        else
                            $(this).removeClass("a_on").addClass("a_off");
                    }
                );
                $("li.boite").each(
                    function() {
                        if ($(this).attr('id') === id + 'Open')
                            $(this).show();
                        else
                            $(this).hide();
                    }
                );
            });
        }
    );

    $('#ltDomaine').children('select').bind("change", function(evt) {
        document.location = 'annuaire.aspx?public=0&dom=' + $(this).val();
    }
    );

    $("#ville").autocomplete("/ajax/ville.aspx",
        {
            max: 10,
            minChars: 2,
            width: 250,
            cacheLength: 20,
            delay: 100,
            selectFirst: true,
            extraParams: { noreg: 1 }
        });


});
 
