(function($) {
          $(document).ready(function() {
             $('table.silvatable.datagrid td strong').each(function() {
               $(this).remove();
             });
             $("h6").each(function(index) {
               var current = $(this);
               $("#inr"+index).after("<span>"+$(this).text()+"</span>");
               $("h6").remove();
             });
             $("table.silvatable.datagrid colgroup").each(function (){
               $(this).children("col").each(function (index){
                 $(this).addClass("col"+index);
               });
             });
             $("table.silvatable.datagrid").each(function(){
               $(this).find("tr").first().addClass("header");
             });

             $("table.silvatable.datagrid tr.header").each(function(){
               $(this).children("td").each(function(index) {
                  $(this).addClass("nr"+index);
               });

             });

             $("table.silvatable.datagrid tr.header td").wrapInner("<p/>");

             $("table.silvatable.datagrid ul").each(function() {
               $(this).prev().addClass("folder");
               $(this).prev().removeClass("p");
               $(this).prev().click(function(e) {
                 e.preventDefault();
                 $(this).next().slideToggle();
               });
             });
             $("table.silvatable.datagrid p.folder").wrapInner("<a href='#'/>");
             $("table.silvatable.datagrid tr").each(function() {
               $(this).children("td").each(function(index) {
                 $(this).addClass("nr"+index);
               });
             });     
             //$("table.silvatable.datagrid a").attr("target", "_blank"); 
             //switch_tab();
             $("#overview-table input#inr0").click(function() {
               $("table.silvatable.datagrid").hide();
               $("table.silvatable.datagrid").eq(0).show();
             })
             $("#overview-table input#inr1").click(function() {
               $("table.silvatable.datagrid").hide();
               $("table.silvatable.datagrid").eq(1).show();
             })
             
             // setup table
             $("#inr0").attr("checked", "checked");
             $("table.silvatable.datagrid").last().hide();
          });
})(jwcd.jQuery);
