//Reorder columns
$(function(){jQuery.each($("table tr"), function() {$(this).children(".LESSONNAME").before($(this).children(".TIMESTART"));
jQuery.each($("table tr"), function() {$(this).children(".LESSONNAME").before($(this).children(".TIMEEND"))})
})});

//Format times from extended time format to short time
$(function(){
$("table td.TIMESTART").text(function(index, text){str = dateFormat("isoDate") + 'T' + text.slice(0,-8); return dateFormat(str, "shortTime");});
$("table td.TIMEEND").text(function(index, text){str = dateFormat("isoDate") + 'T' + text.slice(0,-8); return dateFormat(str, "shortTime");});
//Rename columns
$("table th.TIMESTART").text("Start");
$("table th.TIMEEND").text("End");
$("table th.LESSONNAME").text("Name");
$("table th.LESSONINTRO").text("Introduction");
$("table th.LESSONDEV").text("Development");
$("table th.LESSONCLOSE").text("Closure");
$("table th.LESSONRESOURCE").text("Resources");
$("table th.LESSONREFLECT").text("Reflection");
//Add a class identity to table
$('table').addClass("Data");
});

//Create some one-off fields before the table
$(function(){
$('table').before('<table class="Today"><tr><td><span>Date:</span>&nbsp;' + dateFormat($("table td.DATESTART").last().text(),"fullDate") + '</td><td>Classmaker Daily Summary Report</td></tr></table><p></p>');
});

