/* $Id: search.js 21759 2011-12-21 16:26:01Z mwall $ */

/*
 * search.js
 *
 * Search page jquery bindings
 */
$(function() {
    $("#more").click(function() {
        // reset content height
        $("#content").height('auto');

        // toggle detailed description info
        $('#description p:first').nextAll('p, h2').toggle();

        // fix content height if it's less then the sidebar
        var sidebar_height = $("#sidebar_content").height();
        var content_height = $("#content").height();
        if (sidebar_height > content_height)
            $("#content").height(sidebar_height);

        // update more link text
        if ($('#description p:first').next().is(':visible')) {
            $('#more').text('[Read Less]');
        } else {
            $('#more').text('[Read More]');
        }
    });
    $("#items_per_page").change(function() {
        var ipp = $("#items_per_page").val();
        $.post('/ajax/itemsperpage/format/json', {ipp: ipp},function() {
            window.location.reload(true);
        }, 'json');
        
    });
});

