var oldNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
var newNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5);
var hilitedZoom = "none";
var xmlDoc = null;
var t = 90; // interval in seconds
     
function Startmap()
{ 
   // alert("test");
	var imagVMSMAP = "http://images.wsdot.wa.gov/nwflow/flowmaps/vmsmap_seattle.gif";
	var vmsimg = document.images["VMSImage"].src;
	var t =  60 // interval in seconds
	tmpmap = new Date();
	tmpmap = "?"+tmpmap.getTime(); 
	document.images["VMSMap"].src = imagVMSMAP+tmpmap;
	document.images["VMSImage"].src = vmsimg+tmpmap;
	setTimeout("Startmap()", t*1000)
} 

function loadXML(imgsrc,imgheight,imgwidth,imgalt,VMSlabel){
    document.images["VMSImage"].width = imgwidth;
	document.images["VMSImage"].height = imgheight;
	document.images["VMSImage"].alt = imgalt;
	document.images["VMSImage"].src = imgsrc;
	document.getElementById('ImgHeader').innerHTML = VMSlabel;
}


function loadXMLOld(vmsno)
{
	if(xmlDoc == null)
	{
		if (document.implementation && document.implementation.createDocument)
		{
			xmlDoc = document.implementation.createDocument("", "", null);
			xmlDoc.async=false;
		
			var loaded = xmlDoc.load("XMLImage.xml");
			if (loaded) 
			{
				updateVMS(vmsno);
			}
		}
		else if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.onreadystatechange = function () {
				if (xmlDoc.readyState == 4) updateVMS(vmsno);
			};
			
			xmlDoc.load("XMLImage.xml");
 		}
		else
		{
			alert('Your browser can\'t handle this script');
			return;
		}
	}
	else
	{
		updateVMS(vmsno);
	}
}

function updateVMS(vmsno)
{
	var x = xmlDoc.getElementsByTagName('vmsimage');
	
	document.images["VMSImage"].width = x[vmsno].getAttribute("width");
	document.images["VMSImage"].height = x[vmsno].getAttribute("height");
	document.images["VMSImage"].alt = x[vmsno].getAttribute("VMSID");
	document.images["VMSImage"].src = x[vmsno].getAttribute("src");
	
	document.getElementById('ImgHeader').innerHTML = x[vmsno].firstChild.nodeValue;
	//location.href ="#top";
	//TODO: ImgHeader
}
/* Show an object  */
function showObject(object)
	{
	if (newNS == true)
		{
		toshow = document.getElementById(object);
		toshow.style.visibility = "visible";
		}
	else
		{
		var changeVis = ((oldNS == true) ? "document." + object + ".visibility = 'show';" : "document.all." + object + ".style.visibility = 'visible';");
		eval(changeVis);
		}
	}

/* Hide an object */
function hideObject(object)
	{
	if (newNS == true)
		{
		toshow = document.getElementById(object);
		toshow.style.visibility = "hidden";
		}
	else
		{
		var changeVis = ((oldNS == true) ? "document." + object + ".visibility = 'hide';" : "document.all." + object + ".style.visibility = 'hidden';");
		eval(changeVis);
		}
	}