' +
						'| ' + this.col_time_on + '' +
						' | ' + this.col_call + '' +
						' | ' + this.col_band + '' +
						' | ' + mode + '' +
						' | ' + this.col_rst_sent + '' +
						' | ' + this.col_rst_rcvd + '' +
						' | ' + this.col_stx_string + '' +
						' | ' + this.col_srx_string + '' +
						' | ' + this.col_stx + '' +
						' | ' + this.col_srx + '' +
						' | ' + this.col_gridsquare + '' +
						' | ' + this.col_vucc_grids + '' +
						' | 
');
				});
				if (!$.fn.DataTable.isDataTable('.qsotable')) {
					$.fn.dataTable.moment('DD-MM-YYYY HH:mm:ss');
					$('.qsotable').DataTable({
						"stateSave": true,
						"pageLength": 25,
						responsive: false,
						"scrollY": "400px",
						"scrollCollapse": true,
						"paging": false,
						"scrollX": true,
						"language": {
							url: getDataTablesLanguageUrl(),
						},
						order: [0, 'desc'],
						"columnDefs": [
							{
								"render": function (data, type, row) {
									return pad(row[8], 3);
								},
								"targets": 8
							},
							{
								"render": function (data, type, row) {
									return pad(row[9], 3);
								},
								"targets": 9
							}
						]
					});
				}
			}
		});
	} else {
		// Runs when no session is set usually when its a clean contest
		var selectElement = document.getElementById('contestname');
		var selected_contest_id = selectElement.options[selectElement.selectedIndex].value;
		$.ajax({
			url: base_url + 'index.php/contesting/getSessionFreshQsos',
			type: 'post',
			data: { 'contest_id': selected_contest_id },
			success: function (html) {
				var mode = '';
				$(".contest_qso_table_contents").empty();
				$.each(html, function () {
					if (this.col_submode == null || this.col_submode == '') {
						mode = this.col_mode;
					} else {
						mode = this.col_submode;
					}
					$(".qsotable tbody").prepend('' +
						'| ' + this.col_time_on + '' +
						' | ' + this.col_call + '' +
						' | ' + this.col_band + '' +
						' | ' + mode + '' +
						' | ' + this.col_rst_sent + '' +
						' | ' + this.col_rst_rcvd + '' +
						' | ' + this.col_stx_string + '' +
						' | ' + this.col_srx_string + '' +
						' | ' + this.col_stx + '' +
						' | ' + this.col_srx + '' +
						' | ' + this.col_gridsquare + '' +
						' | ' + this.col_vucc_grids + '' +
						' | 
');
				});
				if (!$.fn.DataTable.isDataTable('.qsotable')) {
					$.fn.dataTable.moment('DD-MM-YYYY HH:mm:ss');
					$('.qsotable').DataTable({
						"stateSave": true,
						"pageLength": 25,
						responsive: false,
						"scrollY": "400px",
						"scrollCollapse": true,
						"paging": false,
						"scrollX": true,
						"language": {
							url: getDataTablesLanguageUrl(),
						},
						order: [0, 'desc'],
						"columnDefs": [
							{
								"render": function (data, type, row) {
									return pad(row[8], 3);
								},
								"targets": 8
							},
							{
								"render": function (data, type, row) {
									return pad(row[9], 3);
								},
								"targets": 9
							}
						]
					});
				}
			}
		});
	}
}
function pad(str, max) {
	str = str.toString();
	return str.length < max ? pad("0" + str, max) : str;
}
function getUTCTimeStamp(el) {
	var now = new Date();
	var localTime = now.getTime();
	var utc = localTime + (now.getTimezoneOffset() * 60000);
	$(el).attr('value', ("0" + now.getUTCHours()).slice(-2) + ':' + ("0" + now.getUTCMinutes()).slice(-2) + ':' + ("0" + now.getUTCSeconds()).slice(-2));
}
function getUTCDateStamp(el) {
	var now = new Date();
	var localTime = now.getTime();
	var utc = localTime + (now.getTimezoneOffset() * 60000);
	$(el).attr('value', ("0" + now.getUTCDate()).slice(-2) + '-' + ("0" + (now.getUTCMonth() + 1)).slice(-2) + '-' + now.getUTCFullYear());
}