function initPagination(cible) {
        var num_entries = $(cible).length;
        var entries_by_page = 15;
        $("#Pagination").pagination(num_entries, {
                items_per_page: entries_by_page, callback:
        function (page_index, jq) {
                var items_per_page = entries_by_page;
                var offset = page_index * entries_by_page;
                var new_content = $(cible).slice(offset, offset + entries_by_page).clone();
                $('#depositaires').empty().append(new_content);
                return false;
        } 
        });
}
function filter() {
        var eachClass = '';
        if ($("select[name=type]").val() != 0) { eachClass+= '.' + $("select[name=type]").val(); }
        if ($("select[name=departement]").val() != 0) { eachClass+= '.' + $("select[name=departement]").val(); }
        initPagination('#hiddenresult div' + eachClass);
}
$(document).ready(function () {
    Cufon.replace('#logo,h1.titre', { fontFamily: "Helvetica LT Std", hover: true });
    Cufon.replace('div.optavisContact span', { fontFamily: "Bauhaus Md BT", hover: true });
    $("#entete .listbox").hide();
    $(".selectbox").click(function () {
        $(".listbox").toggle();
    });
    $(".listbox").find("a").click(function () {
        $(".listbox").fadeTo("fast", 0);
    });
    $("input[type=text],input[type=password],textarea").each(function () {
        $(this).focus(function () {
            if ($(this).val() == this.defaultValue) $(this).val("");
        });
        $(this).blur(function () {
            if ($(this).val() == "") $(this).val(this.defaultValue);
        });
    });
    initPagination('#hiddenresult div');

    // cataloge pages
    //$('div#page').width($('div#page img.image-page').width() * $('div#page img.image-page').size());
    if ($('div#page img.image-page').size() == 2) {
        $('div#page').css({ 'margin-left': '50px' });
    } else {
        if ($('div#page img.image-page').size() == 1) {
            $('div#page').css({ 'margin-left': '260px' });
        }
    }
    $('div#contenuHtml .conteneurTexte').css({ 'margin-left': '75px' });

});

