jQuery(document).ready(function($) {
    // replace these default settings with your own
    $.querySort = {
        path_to_template: 'http://www.gingenious.com/cms/wp-content/themes/videoelements/',
        number_of_posts: 5,
        default_category: ''
    }
 
    // do the initial load.
    $("#querySort").load($.querySort.path_to_template + 'querySort.php' + '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category);
 
    //functions for the sorter
    $("#queryMenu a").click(function(){
        var thecat = $(this).attr("id");
        if (thecat == 'reset') {
            var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + $.querySort.default_category;
        } else {
            var query = '?query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + thecat;
        }
        $("#querySort").animate({opacity: 0}, function() {
            $("#querySort").load($.querySort.path_to_template + 'querySort.php' + query, function() {
                height = $("#queryContainer").height() + 'px';
                $("#querySort").animate({opacity: 1, height:height});
            });
        });
        return false;
    });
});
