<!--

var sst = "sst"; wind_11 = "wind_11"; wind_37 = "wind_37"; vapor = "vapor"; liquid = "liquid"; rain = "rain";


function pad(n) {
	if (n < 10) return ("0" + n);
	return "" + n;
}

function small_img(p) {
	tag = "<IMG ALT='Click now to view this image in full size' SRC=" + rootSmall + get_gif(p) + " NAME="
	if (p == "l") tag += "cloud"
	if (p == "r") tag += "rain"
	if (p == "v") tag += "vapor"
	if (p == "w") tag += "wind"
	if (p == "s") tag += "sst"
	if (p == "z") tag += "windz"
	tag += " HEIGHT=110 WIDTH=400 border=0>"

	return tag
}


function get_imgFile(fileName) {
	if ( data_may_need_refreshing() ) {
		now = new Date(); qStr = now.getTime();
		fileName += "?" + qStr;
	}
	url = "tmi_image_view.html?" + fileName;
	spawn_window(url,"landscape");
}


function view_large_image(param) {
	url = "tmi_image_view.html?";
	url += "&time=" + time_frame;
//	url += "&sat=" + satelliteDir;
	switch (time_frame) {
	case "week": url += "&week=" + week; break;
	default:
		url += "&year=" + year;
		url += "&month=" + month;
		if (time_frame != "month") { url += "&day=" + day; }
		if (time_frame == "day") { url += "&pass=" + pass; }
	}
	url += "&product=" + param;

//	alert(url);
	spawn_window(url,"landscape");
}

function download_binary_data() {
	if (valid_select()) { 
		///fyl = rootDir + satelliteDir + "/bmaps_v03/y" + year + "/m" + pad(month) + "/";
		fyl = "../data/tmi/bmaps_v04/";
		fyl += "y" + year + "/m" + pad(month) + "/";
		fyl += "TMI_" + year + pad(month) + pad(day)
		
		status = get_data_status()
		switch (status) {
		case "nrt": // fyl += "rt"; break;
			msg = "The data you have requested is not final.\n\n"
			msg += "The most recent TMI data (within about 4 days of current time) is called near-real time (NRT). The NRT images are continuously being updated (improved geolocaton and sensor/algorithm calibration) and become a final product after about 4 days. Graphic images of the NRT data are available, but the binary data files are only available for the final product.\n\n"
			msg += "If you want the binary data for the NRT products please contact smith@remss.com"
			alert(msg); break;
			
		case "final": fyl += "v4"; break;
		}
		
		switch (time_frame) {
		case "day3": fyl += "_d3d"; break;
		}
		
		fyl += ".gz";
		
		switch (status) {
		case "nrt": break;
		case "final": window.location = fyl; break;
		}
	}
}

function get_data_status() {
	if (year * 10000 + month * 100 + day <= yearEnd_final * 10000 + monthEnd_final * 100 + dayEnd_final) return("final");
	return("nrt");
}

function exist_data() {
	if (within_range()) return true
	return false
}


function img_table(p_time) {

str = "<TABLE BORDER='4' cellpadding='6'>"

str += "<tr>"
str += "<td colspan='2'>"
str += "Images currently shown:&nbsp&nbsp<INPUT TYPE=text NAME=output SIZE=36>"
str += "</td>"
str += "</tr>"

str += "<tr>"

str += "<td align='center'>"
str += "<p class='small'>Sea Surface Temperature (degree C)<br>"
str += "<img src='img/key/sst.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(sst)'>" + small_img("s") + "</a>"
str += "</td>"

str += "<td align='center'>"
str += "<p class='small'>Atmospheric Water Vapor (mm)<br>"
str += "<img src='img/key/vapor.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(vapor)'>" + small_img("v") + "</a>"
str += "</td>"

str += "</tr>"


str += "<tr>"

str += "<td align='center'>"
str += "<p class='small'>Surface Wind Speed using 11 Ghz channel (m/s)<br>"
str += "<img src='img/key/" + p_time + "/wind.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(wind_11)'>" + small_img("z") + "</a>"
str += "</td>"

str += "<td align='center'>"
str += "<p class='small'>Cloud Liquid Water (mm)<br>"
str += "<img src='img/key/" + p_time + "/cloud.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(liquid)'>" + small_img("l") + "</a>"
str += "</td>"

str += "</tr>"


str += "<tr>"

str += "<td align='center'>"
str += "<p class='small'>Surface Wind Speed using 37 Ghz channel (m/s)<br>"
str += "<img src='img/key/" + p_time + "/wind.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(wind_37)'>" + small_img("w") + "</a>"
str += "</td>"

str += "<td align='center'>"
str += "<p class='small'>Rain Rate (mm/hr)<br>"
str += "<img src='img/key/" + p_time + "/rain.gif' width='400' height='14' vspace='2'><br>"
str += "<a href='JavaScript: view_large_image(rain)'>" + small_img("r") + "</a>"
str += "</td>"

str += "</tr>"

str += "</table>"

str += "</form>"

return str
}	


// -->
