diff --git a/public_html/script.js b/public_html/script.js
index 2617acb..1838629 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -198,7 +198,12 @@ function refreshSelected() {
if (selected.squawk == 7700) {
html += '
Squawking: Emergancy | '
}
- html += '
Altitude: ' + selected.altitude + ' | Squawk: ' + selected.squawk + ' |
';
+ html += 'Altitude: ' + selected.altitude + ' | ';
+ if (selected.squawk != '0000') {
+ html += 'Squawk: ' + selected.squawk + ' |
';
+ } else {
+ html += 'Squawk: n/a | ';
+ }
html += 'Track: ' + selected.track + ' (' + normalizeTrack(selected.track, selected.vTrack)[1] +') | ICAO (hex): ' + selected.icao + ' |
';
html += 'Lat/Long: ' + selected.latitude + ', ' + selected.longitude + ' |
';
html += '';
@@ -284,13 +289,20 @@ function refreshTableInfo() {
if (tableplane.squawk == 7700) {
specialStyle += " squawk7700";
}
- if (tableplane.vPosition == true)
+
+ if (tableplane.vPosition == true) {
html += '';
- else
+ } else {
html += '
';
+ }
+
html += '' + tableplane.icao + ' | ';
html += '' + tableplane.flight + ' | ';
- html += '' + tableplane.squawk + ' | ';
+ if (tableplane.squawk != '0000' ) {
+ html += '' + tableplane.squawk + ' | ';
+ } else {
+ html += ' | ';
+ }
html += '' + tableplane.altitude + ' | ';
html += '' + tableplane.speed + ' | ';
html += '' + normalizeTrack(tableplane.track, tableplane.vTrack)[2] + ' (' + normalizeTrack(tableplane.track, tableplane.vTrack)[1] + ') | ';
@@ -341,14 +353,20 @@ function sortTable(szTableID,iCol) {
var aStore=[];
//If supplied col # is greater than the actual number of cols, set sel col = to last col
- if (oTbl.rows[0].cells.length<=iCol)
+ if (typeof oTbl.rows[0] !== 'undefined' && oTbl.rows[0].cells.length <= iCol) {
iCol=(oTbl.rows[0].cells.length-1);
+ }
//store the col #
iSortCol=iCol;
//determine if we are delaing with numerical, or alphanumeric content
- bNumeric=!isNaN(parseFloat(oTbl.rows[0].cells[iSortCol].textContent||oTbl.rows[0].cells[iSortCol].innerText))?true:false;
+ var bNumeric = false;
+ if ((typeof oTbl.rows[0] !== 'undefined') &&
+ (!isNaN(parseFloat(oTbl.rows[0].cells[iSortCol].textContent ||
+ oTbl.rows[0].cells[iSortCol].innerText)))) {
+ bNumeric = true;
+ }
//loop through the rows, storing each one inro aStore
for (var i=0,iLen=oTbl.rows.length;i