function TPmap(TPs, reg, day, time)
{
			// alert("TPs = " + TPs + " reg = " + reg + " day = " + day + " time = " + time);
			// Remove any Old Maps
			try{
				oldMaps = document.getElementById("Mapstuff");
				oldMaps.removeChild(Maps) ; // Old Stuff
			}
			catch(E) {
				;	// Catch Exception - Ignore: there were NO Old Maps!
			}

			// Make some new Maps
			Maps = document.createElement("div");
			document.getElementById("Mapstuff").appendChild(Maps);


			TPlatlon = new Array();
			TPij = new Array();

			for(i = 0; i < TPs.length; i++){
				TPlatlon[i] = latlo[ tpn.indexOf(TPs[i]) ];
			}

			// Determine appropriate Resolution
			var resn;
			if(reg == "uk%2b0")   resn = "4km";
			else if(reg == "UK12")    resn = "12km";
			else if(reg == "uk%2b1")	resn = "5.1km";
			else if(reg == "uk%2b2")	resn = "12km";
			else if(reg == "uk%2b3")	resn = "12km";
			else if(reg == "uk%2b4")	resn = "12km";
			else if(reg == "uk%2b5")	resn = "12km";
			else if(reg == "uk%2b6")	resn = "12km";
			else                      resn = "4km";   // ARCHIVE CASE

			// Find Img ij for all TurnPoints
			for(i = 0; i < TPs.length; i++){
				var tmp;

				tmp = TPlatlon[i].split(",");
				T1 = (latlon2ij(Number(tmp[0]), Number(tmp[1]), resn)).split(",");

				arr = new Array(Math.round(Number(T1[0])), Math.round(Number(T1[1])));
				TPij[i] = arr;
			}

			// Find Max & Min ij and CofG 
			maxI = 0;
			minI = 9999;
			maxJ = 0;
			minJ = 9999;

			for(i = 0; i < TPs.length; i++){
				if(TPij[i][0] > maxI)		maxI = TPij[i][0];
				if(TPij[i][1] > maxJ)		maxJ = TPij[i][1];
				if(TPij[i][0] < minI)		minI = TPij[i][0];
				if(TPij[i][1] < minJ)		minJ = TPij[i][1];
			}

			CGi = 0;
			CGj = 0;

			for(i = 0; i < TPs.length; i++){
				CGi += TPij[i][0];
				CGj += TPij[i][1];
			}
			CGi = Math.round(CGi / TPij.length);
			CGj = Math.round(CGj / TPij.length);


			// alert("TPs = " + TPs + "\nTPij = " + TPij + "\nminI = " + minI + " minJ = " + minJ + "\nmaxI = " + maxI + " maxJ = " + maxJ + "\nCGi = " + CGi + " CGj = " + CGj);


			wid = maxI - minI + 100;
			hgt = maxJ - minJ + 100;
			imgleft = -(minI - 50);
			imgtop  = -(minJ - 50);
			// alert("wid = " + wid + " left = " + imgleft + "\nhgt = " + hgt + " imgtop = " + imgtop);
			addMap(TPs, reg, day, time, "wstar",  0, imgleft, imgtop);
			addMap(TPs, reg, day, time, "blwind", 1, imgleft, imgtop);
			addMap(TPs, reg, day, time, "hwcrit", 2, imgleft, imgtop);

			document.body.bottomMargin = Number(document.body.bottomMargin) + hgt + 100;
}

function addMap(TPs, reg, day, time, map, posn, imgleft, imgtop)
{
				sect = document.createElement("div");
				sect.style.position = "relative";
				Maps.appendChild(sect);

				pane = document.createElement("div");
				pane.style.width    = (wid + "px");
				pane.style.height   = (hgt + "px");
				pane.style.left     = posn * (wid + 50) + "px";
				pane.style.overflow = "hidden";
				pane.style.position = "absolute";
				sect.appendChild(pane);

				theImg = document.createElement("img");
				if(day == 0){
					theImg.src = "http://rasp.inn.leedsmet.ac.uk/" + reg + "/FCST/" + map + ".curr." + time + "lst.d2.png";
				}
				else{
					var dat = day.split('-', 3);
					theImg.src = "http://rasp.inn.leedsmet.ac.uk/" + "ARCHIVE/UK%2b0" + "/" + dat[0] + "/" + dat[0] + dat[1] + dat[2] + "/" + map + ".curr." + time + "lst.d2.png";
				}
				// alert(theImg.src)
				theImg.style.position="absolute";
				theImg.style.left = String(imgleft);
				theImg.style.top  = imgtop;
				pane.appendChild(theImg);

				for(i = 0; i < TPs.length; i++){
					TP(TPij[i][0] + imgleft, TPij[i][1] + imgtop, CGi + imgleft, CGj + imgtop, TPs[i], pane);
				}

				txt = document.createElement("h2");
				txt.innerHTML = map;
				sect.appendChild(txt);
				txt.style.position="absolute";
				txt.style.top = hgt + "px";
				txt.style.left = posn * (wid + 50) + 50 + "px";
				txt.style.color="black";
}


function TP(posX, posY, CGx, CGy, txt, place)
{
				blob = document.createElement("div"); 
				place.appendChild(blob);
				// NB: top-left of blob is at X,Y
				txtStyle =
					"position: absolute;" +
					"font-size: 0pt;" +
					"border: 4px solid white;" +
					"left: " + (posX - 4) + ";" +
					"top: "  + (posY - 4) + ";" +
					"z-index: 100;" +
					"background-color: transparent;";

				blob.style.cssText = txtStyle;

				box = document.createElement("div"); 
				place.appendChild(box);
				box.innerHTML = txt;

				var posnX = ((posX > CGx) ? ("left: " + (posX)) : ("right: " + (wid - posX))) ;
				var posnY = ((posY > CGy) ? ("top: " + (posY)) : ("bottom: " + (hgt - posY))) ;

				txtStyle =
					"border: 1px solid white;" +
					"color: red;" +
					"font-size: 10pt;" +
					"font-weight: bold;" +
					"font-family: sans-serif;" +
					"z-index: 100;" +
					"background-color: transparent;" +
					"position: absolute;" +
					posnX + ";" +
					posnY + ";" ;
				box.style.cssText = txtStyle;

				return box;
}

