// JavaScript Document

//setup all vars for data processing
	var FileName = "http://www.vafinancials.com/map/markers.xml";
	var ImagesLocation = "http://www.vafinancials.com/beta/";
	var RedImgs;
	var UPDATERATE = 30; //update rate set to 30 seconds
	var c = UPDATERATE-1;
	var bgclr = "";
	var barclr = "";
	var rcls = "rowb";
	var x;
	var xm;
	var am = 0;
	var map;
	var allrows = "";
	var img = "";
	//var ptable = "";
	var prow = [];
	var gmarks = [];
	var phtmls = [];
	var vpres = [];
	var imgs = [];
	var csigns = [];
	var tails = [];
	var acids = [];
	var aclds = [];
	var flnms = [];
	var deics = [];
	var arics = [];
	var souls = [];
	var cargs = [];
	var ftims = [];
	var lats = [];
	var lons = [];
	var hdgs = [];
	var attds = [];
	var iasps = [];
	var tasps = [];
	var gspds = [];
	var machs = [];
	var emils = [];
	var mflws = [];
	var status = [];
	var i = 0;
	var xi = 0;
	var displayedMarkers = new Array();
	var displayedPolylines = new Array();
	var polyAirports = new Array();
	var currentMarker;
	
	//timer to refresh marker data
	function timedCount() {
		c = c + 1;
		if(c == UPDATERATE) {
			loadMapData(FileName);
			c = 0;
		};
		x = UPDATERATE-c;
	   	window.document.getElementById("nupdate").innerHTML =  "MAP WILL REFRESH IN " + String(x) + " SECONDS" ;
	   	t=setTimeout("timedCount()",1000);
	};
	
	//removes the map overlays except the weather overlay
	function removeMarkers(map, arrayName)
	{
		// Get the map data
		try {
			var markers = eval(arrayName);
			if (!markers) return false;
		} catch (err) {
			return false;
		}
		
		// Remove the map data, either an array or a single element
		if (isNaN(markers.length))
			map.removeOverlay(markers);
		else if (markers.length > 0) {
			for (var x = 0; x < markers.length; x++)
				map.removeOverlay(markers[x]);
		}
			
		displayedMarkers[arrayName] = false;
		//displayedPolylines[arrayName] = false;
		//polyAirports[arrayName] = false;
		return true;
	}
	
	//loads the map and sets up the controls
	function loadMap(){
		if (GBrowserIsCompatible()) {        
    		map = new GMap2(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
    		map.setCenter(new GLatLng(15.000000, 0.000000), 2);
    		map.enableDoubleClickZoom();
			map.enableContinuousZoom();
			map.setMapType(G_SATELLITE_MAP);
    		timedCount();
    	}
    }
	
	var myOverlay = function(marker, html) {
		this.marker = marker;
		this.html = html;
	}
	
	myOverlay.prototype = new GOverlay();
	
	myOverlay.prototype.initialize = function(map) {
		var div = document.createElement("div");
		div.className = "infobox";
		div.innerHTML = this.html;
		
		offsetX = 5;
		offsetY = 175;
		
		div.style.top = (map.fromLatLngToDivPixel(this.marker.getPoint()).y - offsetY) + 'px';
  		div.style.left = (map.fromLatLngToDivPixel(this.marker.getPoint()).x + offsetX) + 'px';

  		div.onclick = closeOverlay;

  		this._map = map;
  		this._div = div;

  		map.getPane(G_MAP_FLOAT_PANE).appendChild(div);  
	}
	
	myOverlay.prototype.remove = function() {
		this._div.parentNode.removeChild(this._div);
	}
	
	myOverlay.prototype.redraw = function() {
		//no need yet
	}
	
	function closeOverlay() {
  		if (currentMarker) {
   			map.removeOverlay(currentMarker.overlay);
    		//currentMarker.show();
  		}
	}
	
	//creates all the markers and html for the pop up windows
	function createMarker(point, index, pophtml, vp, im, cs, tn, ac, ar, fn, di, dt, dn, ai, at, an, so, ca, ft, lt, ln, hd, al, ia, ta, gs, ma, em, mf, st) {
		var icon = new GIcon();
		var nhdg = Number(hd);
		var myalt = Number(al);
		
		//decide which color to use for the icon
		//if(st == "Climbing"){
		//	RedImgs = "red/";
		//}else if(st == "Decending"){
		//	RedImgs = "green/";
		//}else if(st == "Cruising"){
		//	RedImgs = "orange/";
		//}else{
		//	RedImgs = "black/";
		//}
		
		RedImgs = "orange/";
		
		//decide which pic to use for the icon
		if(nhdg >= 355){
				icon.image = ImagesLocation + RedImgs + "355359.png";
		}else if(nhdg >= 350){
				icon.image = ImagesLocation + RedImgs + "350354.png";
		}else if(nhdg >= 345){
				icon.image = ImagesLocation + RedImgs + "345349.png";
		}else if(nhdg >= 340){
				icon.image = ImagesLocation + RedImgs + "340344.png";
		}else if(nhdg >= 335){
				icon.image = ImagesLocation + RedImgs + "335339.png";
		}else if(nhdg >= 330){
				icon.image = ImagesLocation + RedImgs + "330334.png";
		}else if(nhdg >= 325){
				icon.image = ImagesLocation + RedImgs + "325329.png";
		}else if(nhdg >= 320){
				icon.image = ImagesLocation + RedImgs + "320324.png";
		}else if(nhdg >= 315){
				icon.image = ImagesLocation + RedImgs + "315319.png";
		}else if(nhdg >= 310){
				icon.image = ImagesLocation + RedImgs + "310314.png";
		}else if(nhdg >= 305){
				icon.image = ImagesLocation + RedImgs + "305309.png";
		}else if(nhdg >= 300){
				icon.image = ImagesLocation + RedImgs + "300304.png";
		}else if(nhdg >= 295){
				icon.image = ImagesLocation + RedImgs + "295299.png";
		}else if(nhdg >= 290){
				icon.image = ImagesLocation + RedImgs + "290294.png";
		}else if(nhdg >= 285){
				icon.image = ImagesLocation + RedImgs + "285289.png";
		}else if(nhdg >= 280){
				icon.image = ImagesLocation + RedImgs + "280284.png";
		}else if(nhdg >= 275){
				icon.image = ImagesLocation + RedImgs + "275279.png";
		}else if(nhdg >= 270){
				icon.image = ImagesLocation + RedImgs + "270274.png";
		}else if(nhdg >= 265){
				icon.image = ImagesLocation + RedImgs + "265269.png";
		}else if(nhdg >= 260){
				icon.image = ImagesLocation + RedImgs + "260264.png";
		}else if(nhdg >= 255){
				icon.image = ImagesLocation + RedImgs + "255259.png";
		}else if(nhdg >= 250){
				icon.image = ImagesLocation + RedImgs + "250254.png";
		}else if(nhdg >= 245){
				icon.image = ImagesLocation + RedImgs + "245249.png";
		}else if(nhdg >= 240){
				icon.image = ImagesLocation + RedImgs + "240244.png";
		}else if(nhdg >= 235){
				icon.image = ImagesLocation + RedImgs + "235239.png";
		}else if(nhdg >= 230){
				icon.image = ImagesLocation + RedImgs + "230234.png";
		}else if(nhdg >= 225){
				icon.image = ImagesLocation + RedImgs + "225229.png";
		}else if(nhdg >= 220){
				icon.image = ImagesLocation + RedImgs + "220224.png";
		}else if(nhdg >= 215){
				icon.image = ImagesLocation + RedImgs + "215219.png";
		}else if(nhdg >= 210){
				icon.image = ImagesLocation + RedImgs + "210214.png";
		}else if(nhdg >= 205){
				icon.image = ImagesLocation + RedImgs + "205209.png";
		}else if(nhdg >= 200){
				icon.image = ImagesLocation + RedImgs + "200204.png";
		}else if(nhdg >= 195){
				icon.image = ImagesLocation + RedImgs + "195199.png";
		}else if(nhdg >= 190){
				icon.image = ImagesLocation + RedImgs + "190194.png";
		}else if(nhdg >= 185){
				icon.image = ImagesLocation + RedImgs + "185189.png";
		}else if(nhdg >= 180){
				icon.image = ImagesLocation + RedImgs + "180184.png";
		}else if(nhdg >= 175){
				icon.image = ImagesLocation + RedImgs + "175179.png";
		}else if(nhdg >= 170){
				icon.image = ImagesLocation + RedImgs + "170174.png";
		}else if(nhdg >= 165){
				icon.image = ImagesLocation + RedImgs + "165169.png";
		}else if(nhdg >= 160){
				icon.image = ImagesLocation + RedImgs + "160164.png";
		}else if(nhdg >= 155){
				icon.image = ImagesLocation + RedImgs + "155159.png";
		}else if(nhdg >= 150){
				icon.image = ImagesLocation + RedImgs + "150154.png";
		}else if(nhdg >= 145){
				icon.image = ImagesLocation + RedImgs + "145149.png";
		}else if(nhdg >= 140){
				icon.image = ImagesLocation + RedImgs + "140144.png";
		}else if(nhdg >= 135){
				icon.image = ImagesLocation + RedImgs + "135139.png";
		}else if(nhdg >= 130){
				icon.image = ImagesLocation + RedImgs + "130134.png";
		}else if(nhdg >= 125){
				icon.image = ImagesLocation + RedImgs + "125129.png";
		}else if(nhdg >= 120){
				icon.image = ImagesLocation + RedImgs + "120124.png";
		}else if(nhdg >= 115){
				icon.image = ImagesLocation + RedImgs + "115119.png";
		}else if(nhdg >= 110){
				icon.image = ImagesLocation + RedImgs + "110114.png";
		}else if(nhdg >= 105){
				icon.image = ImagesLocation + RedImgs + "105109.png";
		}else if(nhdg >= 100){
				icon.image = ImagesLocation + RedImgs + "100104.png";
		}else if(nhdg >= 95){
				icon.image = ImagesLocation + RedImgs + "095099.png";
		}else if(nhdg >= 90){
				icon.image = ImagesLocation + RedImgs + "090094.png";
		}else if(nhdg >= 85){
				icon.image = ImagesLocation + RedImgs + "085089.png";
		}else if(nhdg >= 80){
				icon.image = ImagesLocation + RedImgs + "080084.png";
		}else if(nhdg >= 75){
				icon.image = ImagesLocation + RedImgs + "075079.png";
		}else if(nhdg >= 70){
				icon.image = ImagesLocation + RedImgs + "070074.png";
		}else if(nhdg >= 65){
				icon.image = ImagesLocation + RedImgs + "065069.png";
		}else if(nhdg >= 60){
				icon.image = ImagesLocation + RedImgs + "060064.png";
		}else if(nhdg >= 55){
				icon.image = ImagesLocation + RedImgs + "055059.png";
		}else if(nhdg >= 50){
				icon.image = ImagesLocation + RedImgs + "050054.png";
		}else if(nhdg >= 45){
				icon.image = ImagesLocation + RedImgs + "045049.png";
		}else if(nhdg >= 40){
				icon.image = ImagesLocation + RedImgs + "040044.png";
		}else if(nhdg >= 35){
				icon.image = ImagesLocation + RedImgs + "035039.png";
		}else if(nhdg >= 30){
				icon.image = ImagesLocation + RedImgs + "030034.png";
		}else if(nhdg >= 25){
				icon.image = ImagesLocation + RedImgs + "025029.png";
		}else if(nhdg >= 20){
				icon.image = ImagesLocation + RedImgs + "020024.png";
		}else if(nhdg >= 15){
				icon.image = ImagesLocation + RedImgs + "015019.png";
		}else if(nhdg >= 10){
				icon.image = ImagesLocation + RedImgs + "010014.png";
		}else if(nhdg >= 5){
				icon.image = ImagesLocation + RedImgs + "005009.png";
		}else if(nhdg >= 0){
				icon.image = ImagesLocation + RedImgs + "000004.png";
		}

		icon.iconSize = new GSize(19, 19);
		icon.iconAnchor = new GPoint(9, 9);
		icon.infoWindowAnchor = new GPoint(9, 16);
		
		var marker = new GMarker(point, icon);
		
		//GEvent.addListener(marker, "click", function() { 
		//	marker.openInfoWindowHtml(pophtml);
		//});
		
		GEvent.addListener(marker, "click", function() {
			var depolyline = GPolyline();
			var arpolyline = GPolyline();
			var icona = new GIcon();
			var iconb = new GIcon();
			
			icona.image = "http://www.vafinancials.com/beta/icon57.png";
			icona.iconSize = new GSize(19, 19);
			icona.iconAnchor = new GPoint(9, 9);
			icona.infoWindowAnchor = new GPoint(9, 16);
			
			iconb.image = "http://www.vafinancials.com/beta/icon58.png";
			iconb.iconSize = new GSize(19, 19);
			iconb.iconAnchor = new GPoint(9, 9);
			iconb.infoWindowAnchor = new GPoint(9, 16);
		
			// setup bounds to autozoom map between two points
			var bounds = new GLatLngBounds();
			bounds.extend(new GLatLng(dt, dn));
			bounds.extend(new GLatLng(at, an));
			map.setZoom(map.getBoundsZoomLevel(bounds) - 1);
			map.setCenter(bounds.getCenter());
			//set center of map
			//map.setCenter(new GLatLng(lats[i], lons[i]));		
		
			var depoint = [
				new GLatLng(dt, dn), point
				];
			var arpoint = [
				point, new GLatLng(at, an)
				];
		
			var dpoint = new GLatLng(dt, dn);
			var apoint = new GLatLng(at, an);
		
			var dmarker = new GMarker(dpoint, icona);
			var amarker = new GMarker(apoint, iconb);
		
			depolyline = new GPolyline(depoint, '#FFFFFF', 1, 0.7);
			arpolyline = new GPolyline(arpoint, '#00FF00', 1, 0.7);
			
			if (typeof myOverlay !== 'undefined') {
    			if (currentMarker) {
      				closeOverlay();
    			}
    			if (!this.overlay) {
      				// just recording this for use in the closeOverlay function
      				this.overlay = new myOverlay(marker, pophtml);
    			}
    			currentMarker = marker;
    			map.panTo(new GLatLng(this.getPoint().lat(), this.getPoint().lng()));
    			map.addOverlay(this.overlay);
    			//this.hide();
  			} else {
    			marker.openInfoWindowHtml(pophtml);
  			}
		
			map.addOverlay(depolyline);
			map.addOverlay(arpolyline);
			map.addOverlay(dmarker);
			map.addOverlay(amarker);
		});

		gmarks[xm] = marker;
		phtmls[xm] = pophtml;
		vpres[xm] = vp;
		imgs[xm] = im;
		csigns[xm] = cs;
		tails[xm] = tn;
		acids[xm] = ac;
		aclds[xm] = ar;
		flnms[xm] = fn;
		deics[xm] = di;
		delat[xm] = dt;
		delon[xm] = dn;
		arics[xm] = ai;
		arlat[xm] = at;
		arlon[xm] = an;
		souls[xm] = so;
		cargs[xm] = ca;
		ftims[xm] = ft;
		lats[xm] = lt;
		lons[xm] = ln;
		hdgs[xm] = hd;
		attds[xm] = al;
		iasps[xm] = ia;
		tasps[xm] = ta;
		gspds[xm] = gs;
		machs[xm] = ma;
		emils[xm] = em;
		mflws[xm] = mf;
		status[xm] = st;
		displayedMarkers[xm] = marker;
		xm++;
		am++;
		return marker;
	}
	
	function resetAllVars(){
		vpres = [];
		imgs = [];
		csigns = [];
		tails = [];
		acids = [];
		aclds = [];
		flnms = [];
		deics = [];
		delat = [];
		delon = [];
		arics = [];
		arlat = [];
		arlon = [];
		souls = [];
		cargs = [];
		ftims = [];
		lats = [];
		lons = [];
		hdgs = [];
		attds = [];
		iasps = [];
		tasps = [];
		gspds = [];
		machs = [];
		emils = [];
		mflws = [];
		status = [];
		x = 0;
		xm = 0;
		i = 0;
	}
	
	// This function picks up the click and opens the corresponding info window and centers the map on the marker
	function tclick(i) {
		var ge = new GEvent.trigger(gmarks[i], "click");
		return ge;
	};
	
	//refresh the markers and data for the map and table
	function loadMapData(fName){
		map.clearOverlays();
		//removeMarkers(map, 'displayedMarkers');
		//removeMarkers(map, 'displayedPolylines');
		//removeMarkers(map, 'polyAirports');
		resetAllVars();
		
		GDownloadUrl(fName, function(data, responseCode) {  
			var xml = GXml.parse(data);  
			var markers = xml.documentElement.getElementsByTagName("marker");
			
			//sets up the markers and the table rows 
			for (var i = 0; i < markers.length; i++) {    
				var point = new GLatLng(parseFloat(markers[i].getAttribute("lt")), parseFloat(markers[i].getAttribute("ln")));
				
				if(markers[i].getAttribute("im") == "0"){
					img = markers[i].getAttribute("vp");
					smi = "<img src=\"../newsite/vamedia/noimg.png\" width=\"36\" height=\"18\">";
				}else{
					img = "<img class=\"vaimg\" src=\"../newsite/vamedia/" + markers[i].getAttribute("im") + "\" width=\"128\" height=\"28\" />";
					smi = "<img src=\"../newsite/vamedia/sm_" + markers[i].getAttribute("vp") + ".png\" width=\"36\" height=\"18\">";
				}
				
				//popup html code
				pophtml = "<a href=\"javascript:closeOverlay()\" border=\"0\"><img class=\"close\" src=\"./box/close.png\" width=\"13\" height=\"13\" border=\"0\" /></a>";
    			pophtml += "<table class=\"popup\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
  				pophtml += "<tr>";
  				pophtml += "<td colspan=\"2\" class=\"vaimg\">" + img + "</td>";
    			pophtml += "<td colspan=\"2\" class=\"csign\" valign=\"top\">" + markers[i].getAttribute("cs") + "</td>";
    			pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">Aircraft:</td>";
    			pophtml += "<td class=\"albl\" colspan=\"3\">" + markers[i].getAttribute("ar") + "</td>";
				pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">Souls:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("so") + "</td>";
    			pophtml += "<td class=\"phdr\">Cargo:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("ca") + " lbs</td>";
				pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">F. Time:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("ft") + " hrs</td>";
    			pophtml += "<td class=\"phdr\">HDG:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("hd") + "</td>";
				pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">Altitude:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("al") + " ft</td>";
    			pophtml += "<td class=\"phdr\">IAS:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("ia") + " kts</td>";
				pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">Mach:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("ma") + "</td>";
    			pophtml += "<td class=\"phdr\">GSpd:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("gs") + " kts</td>";
				pophtml += "</tr><tr>";
  				pophtml += "<td class=\"phdr\">E. Miles:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("em") + "</td>";
    			pophtml += "<td class=\"phdr\">Flown:</td>";
    			pophtml += "<td class=\"albl\">" + markers[i].getAttribute("mf") + "</td>";
				pophtml += "</tr><tr>";
    			pophtml += "<td class=\"phdr\">Status:</td>";
    			pophtml += "<td class=\"clbl\" colspan=\"3\">" + markers[i].getAttribute("st") + "</td>";
    			pophtml += "</tr></table>";
				
				var marker = createMarker(
					point, 
					i, 
					pophtml,
					markers[i].getAttribute("vp"),
					markers[i].getAttribute("im"),
					markers[i].getAttribute("cs"), 
					markers[i].getAttribute("tn"), 
					markers[i].getAttribute("ac"), 
					markers[i].getAttribute("ar"),
					markers[i].getAttribute("fn"), 
					markers[i].getAttribute("di"),
					markers[i].getAttribute("dt"),
					markers[i].getAttribute("dn"),
					markers[i].getAttribute("ai"),
					markers[i].getAttribute("at"),
					markers[i].getAttribute("an"),
					markers[i].getAttribute("so"),
					markers[i].getAttribute("ca"),
					markers[i].getAttribute("ft"),
					markers[i].getAttribute("lt"),
					markers[i].getAttribute("ln"),
					markers[i].getAttribute("hd"),
					markers[i].getAttribute("al"),
					markers[i].getAttribute("ia"),
					markers[i].getAttribute("ta"),
					markers[i].getAttribute("gs"),
					markers[i].getAttribute("ma"),
					markers[i].getAttribute("em"),
					markers[i].getAttribute("mf"),
					markers[i].getAttribute("st")
				);
				
				map.addOverlay(marker);
				
				if(rcls == "rowb"){
					rcls = "rowa";
				}else{
					rcls = "rowb";
				}
				
				prow[i] = "<tr class=\"" + rcls + "\" onmouseover=\"this.className='hvr'\" onmouseout=\"this.className='" + rcls + "'\" onclick=\"tclick(" + i + ")\">";
				prow[i] += "<td width=\"36\" align=\"center\">" + smi + "</td>";
      			prow[i] += "<td width=\"25\" align=\"center\">" + markers[i].getAttribute("vp") + "</td>";
      			prow[i] += "<td width=\"67\" align=\"center\">" + markers[i].getAttribute("ac") + "</td>";
      			prow[i] += "<td width=\"67\" align=\"left\">" + markers[i].getAttribute("fn") + "</td>";
      			prow[i] += "<td width=\"67\" align=\"left\">" + markers[i].getAttribute("cs") + "</td>";
      			prow[i] += "<td width=\"60\" align=\"left\"><img src=\"http://www.vafinancials.com/beta/icon57.png\" align=\"absmiddle\" ";
				prow[i] += "width=\"17\" height=\"17\">" + markers[i].getAttribute("di") + "</td>";
      			prow[i] += "<td width=\"61\" align=\"left\"><img src=\"http://www.vafinancials.com/beta/icon58.png\" align=\"absmiddle\" ";
				prow[i] += "width=\"17\" height=\"17\">" + markers[i].getAttribute("ai") + "</td>";
      			prow[i] += "<td width=\"66\" align=\"center\">" + markers[i].getAttribute("em") + "</td>";
				prow[i] += "<td width=\"66\" align=\"center\">" + markers[i].getAttribute("mf") + "</td>"; 
      			prow[i] += "<td width=\"66\" align=\"center\">" + markers[i].getAttribute("hd") + "</td>";
      			prow[i] += "<td width=\"66\" align=\"center\">" + markers[i].getAttribute("gs") + "</td>";
      			prow[i] += "<td width=\"66\" align=\"center\">" + markers[i].getAttribute("al") + "</td>";
      			prow[i] += "<td width=\"87\" align=\"right\"><div align=\"center\">" + markers[i].getAttribute("st") + "</div></td></tr>";
				
				allrows += prow[i];
			}
			
			var ptable = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">";
    			ptable += "<tr class=\"hdr\">";
				ptable += "<td width=\"36\" align=\"center\">&nbsp;</td>";
      			ptable += "<td width=\"25\" align=\"center\">VA</td>";
      			ptable += "<td width=\"67\" align=\"center\">AC</td>";
      			ptable += "<td width=\"67\" align=\"left\">FLT#</td>";
      			ptable += "<td width=\"67\" align=\"left\">PILOT</td>";
      			ptable += "<td width=\"60\" align=\"center\">DEPART</td>";
      			ptable += "<td width=\"61\" align=\"center\">ARRIVE</td>";
      			ptable += "<td width=\"66\" align=\"center\">E.MILES</td>";
				ptable += "<td width=\"66\" align=\"center\">M.FLOWN</td>";
      			ptable += "<td width=\"66\" align=\"center\">HDG</td>";
      			ptable += "<td width=\"66\" align=\"center\">G.SPD</td>";
      			ptable += "<td width=\"66\" align=\"center\">ALT.</td>";
      			ptable += "<td width=\"87\" align=\"right\"><div align=\"center\">STATUS</div></td></tr>";
			
			window.document.getElementById("ptab").innerHTML = ptable + allrows + "</table>";
			
			ptable = "";
			allrows = "";
			
		});
	}