var press = new function(){

    var pageselectCallback = function(page_index, jq){
        
        var new_content = $('#hiddenresult div.result:eq('+page_index+')').clone();
        $('#Searchresult').empty().append(new_content);
        return false;
    }
    
    /** 
    * Callback function for the AJAX content loader.
    */
    var initPagination = function() {
        $("#hiddenresult").css({display:"none"});
        var num_entries = $('#hiddenresult div.result').length;
        $(".scrollArea").jScrollPaneRemove();
        // Create pagination element
        $("#Pagination").pagination(num_entries, {
            num_edge_entries: 0,
            num_display_entries: 0,
            callback: pageselectCallback,
            items_per_page:1,
            next_text:"Next >>",
            prev_text:"<< Prev"
        });
        $("#Pagination1").pagination(num_entries, {
            num_edge_entries: 0,
            num_display_entries: 0,
            callback: pageselectCallback,
            items_per_page:1,
            next_text:"Next >>",
            prev_text:"<< Prev"
        });
        newHeight = $(window).height() - $('#header').height() - $('#footer').height() - $('#content .header').height() - 43;
        $('.scrollArea').css({height:newHeight+"px"});
        $(".scrollArea").jScrollPane();
    }
             
    return {
        init:function(){
            initPagination();
        }
    }
}
$(document).ready(press.init);
