function seeAllNew(that) {

var selected = $(that).closest("div");
var topic_class = $(that).attr("id"); 
var topic = $("."+topic_class).html();

$(".rowitem:hidden").css("display","block");

$(that).css("display","none");

var newTable = "<h3>"+topic+"</h3><table class=\"fileTable\"><thead><tr><th>Type</th><th>Name</th><th>Date</th><th>Size</th></tr></thead><tbody>";

$(selected).children('.rowitem').each(function(index) {

    newTable = newTable +"<tr><td><img src=\"" + $(this).eq(0).contents().eq(0).attr("src") + "\" /></td>";  
    newTable = newTable + "<td> <a "+ "onClick=\""+ $(this).eq(0).contents().eq(1).attr('onClick') + "\"" +"href=" + $(this).eq(0).contents().eq(1).attr('href')+"\">" + $(this).eq(0).contents().eq(1).html() + "</a></td>";  
    newTable = newTable + "<td>" + $(this).eq(0).contents().eq(2).html() + "</td>";  
    newTable = newTable + "<td>" + $(this).eq(0).contents().eq(4).html() + "</td></tr>";  

  });

  newTable = newTable + "</tbody></table><div id=\"pager\" class=\"pager\"><form><img src=\"/files/capman/icons/first.png\" title=\"first\" class=\"first\"/><img src=\"/files/capman/icons/prev.png\" title=\"prev\" class=\"prev\"/><input type=\"text\" disabled=\"disabled\" style=\"border: 0 none;\" class=\"pagedisplay\"/><img src=\"/files/capman/icons/next.png\" title=\"next\" class=\"next\"/><img src=\"/files/capman/icons/last.png\" title=\"last\" class=\"last\"/><select class=\"pagesize\"><option selected=\"selected\"  value=\"20\">20</option><option value=\"50\">50</option><option value=\"100\">100</option><option  value=\"100000\">All</option></select></form><span style=\"font-size: 11px;\"><a href=\"?\">Back to fund document list &raquo;</a></span><br/></div>";
  newTalbe = newTable + "</div>";
  $(selected).attr("class", "cm-filelist-table");
  $(selected).html(newTable);
  $(".fileTable").tablesorter( { sortList: [[1,0]] } );
  $(".cm-filelist").remove();
  $("body").removeClass("has-secondary-content");
  $("#primary p").remove();
  $("#secondary").remove();
  $(".fileTable").tablesorterPager({container: $("#pager")})


};

function seeAll(that) {

var selected = $(that).closest("div");
var topic_class = $(that).attr("id"); 
var topic = $("."+topic_class).html();

$(".rowitem:hidden").css("display","block");

$(that).css("display","none");

var newTable = "<h3>"+topic+"</h3><table class=\"fileTable\"><thead><tr><th>Type</th><th>Name</th><th>Date</th><th>Size</th></tr></thead><tbody>";

$(selected).children('.rowitem').each(function(index) {

    newTable = newTable +"<tr><td><img src=\"" + $(this).eq(0).contents().eq(0).attr("src") + "\" /></td>";  
    newTable = newTable + "<td> <a "+ "onClick=\""+ $(this).eq(0).contents().eq(1).attr('onClick') + "\"" +"href=" + $(this).eq(0).contents().eq(1).attr('href')+"\">" + $(this).eq(0).contents().eq(1).html() + "</a></td>";  
    newTable = newTable + "<td>" + $(this).eq(0).contents().eq(2).html() + "</td>";  
    newTable = newTable + "<td>" + $(this).eq(0).contents().eq(4).html() + "</td></tr>";  

  });

  newTable = newTable + "</tbody></table><br><span style=\"font-size: 11px;\"><a href=\"?\">Back to fund document list &raquo;</a></span>";
  $(selected).attr("class", "cm-filelist-table");
  $(selected).html(newTable);
  $(".fileTable").tablesorter( { sortList: [[1,0]] } ); 
  $(".cm-filelist").remove();
  $("body").removeClass("has-secondary-content");
  $("#primary p").remove();
  $("#secondary").remove();



};


$('.see-all').live('click', function() {

seeAll(this);

});

$('.see-all-new').live('click', function() {

seeAllNew(this);

});


(function($) {

	$(function() {
		$('input.focus-on-load').focus();
	});
	
})(jQuery);

   $('input, textarea').live('valid invalid', function(e) {
        $(this)
            .removeClass('error')
            .removeClass('valid')
            .nextAll('.validation-marker')
                .remove()
                .end()
            .closest('label', this.form)
                .removeClass('error')
                .removeClass('valid');
        if (e.type === 'valid') {
            if ($(this).val() === '') {
                $(this).after($('<span />', {
                        'class': 'validation-marker validation-marker-valid'
                    }))
                    .addClass('valid')
                    .closest('label', this.form)
                        .addClass('valid');
            }
        }
        else {
            $(this).after($('<span />', {
                    'class': 'validation-marker validation-marker-error',
                    'title': $(this).attr('title')
                }))
                .addClass('error')
                .closest('label', this.form)
                    .addClass('error');
        }
    });
