// Load Marine wind thumbnail image
function loadThumbnail() {

var url	="/fwo/IDY00061/IDYMA005.aus.datetimes.js";

	var xmlHttp = getXMLHttpObject();
	xmlHttp.onreadystatechange = function() {
		// 0 - not initialized;    1 - request has been set up;    2 - sent;    3 - in process;    4 - complete
		if(xmlHttp.readyState==4) {
			// read in HTTP response
			eval(xmlHttp.responseText);
			var timeStamp=IDYMA005LoopDisplay[0];
			//change to appendChild 
			var theHtml = "<a href=\"/jsp/marine/wind/index.jsp\">  <img src=\"/fwo/IDY00061/IDYMA005.aus." + IDYMA005LoopDateTimes[0] + "_thumb.png\" alt=\"Preview image of forecast wind\"  title=\"Preview image of forecast wind for today\"/></a><p class=\"annotation\">Forecast for " + timeStamp + "</p>";
			if(document.getElementById('forecast-wind-i')){
			document.getElementById('forecast-wind-i').innerHTML= theHtml;
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function getXMLHttpObject() {
	var xmlHttp = null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your web browser appears to be too old to display these pages. Please update your browser.");
				return false;
			}
		}
	}
	return xmlHttp;
}

window.onLoad=addEvent(window, 'load', loadThumbnail);

function addEvent(obj,evt,fn){
if(obj.addEventListener)
	obj.addEventListener(evt, fn, false);
	else if(obj.attachEvent)
		obj.attachEvent('on' + evt,fn);
}