///////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////   for animation    //////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
var myimages=new Array()
ImgIdx	= -1
var delay=1500

function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

function loopimg_start()
{
	loopimg()
}

function loopimg_stop()
{
	ImgIdx	= -1	// reset index
	clearTimeout(tmr_id)
	document.imgchart.src = oldsrc
}

function loopimg(){
	
	ImgIdx	= ImgIdx + 1
	
	if (ImgIdx >= myimages.length){
		ImgIdx = 0
	}
	
	document.imgchart.src = myimages[ImgIdx].src
	
	tmr_id = setTimeout("loopimg()", delay);
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////


function newPressure(fchour){
	document.the_form.Product.selectedIndex=0;
	setForm(fchour);
}

function newProduct(fchour){
	var productIndex = document.the_form.Product.selectedIndex;
	var ProductElement = new String(document.the_form.Product.options[productIndex].value);	
//	document.the_form.Pressure.selectedIndex=0;
	setForm(fchour);
}

function setForm(fchour){
	var pressureIndex = document.the_form.Pressure.selectedIndex;
	var PressureElement	= new String(document.the_form.Pressure.options[pressureIndex].value);
	productForm = document.the_form.Product;
//	productIndex = document.the_form.Product.selectedIndex;
//	ProductElement = new String(document.the_form.Product.options[productIndex].value);

	if (fchour == "00"){
		if (PressureElement=="850"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="vt+streamline";
			productForm.options[1].text="Vorticity & Streamline";
		}else if (PressureElement=="700"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="RH+streamline";
			productForm.options[1].text="Relative Humidity & Streamline";
		}else if (PressureElement=="500"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="height";
			productForm.options[1].text="Geopotential Height";
		}else if (PressureElement=="200"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="isotech+streamline";
			productForm.options[1].text="Jet Stream & Streamline";
		}else if (PressureElement=="sfc"){
			productForm.options.length=3;
			productForm.options[0].value="temp";
			productForm.options[0].text="Temperature";
			productForm.options[1].value="mslp";
			productForm.options[1].text="Mean Sea Level Pressure";
			productForm.options[2].value="wind";
			productForm.options[2].text="Wind Speed & Wind Direction";
		}
	} else {
		if (PressureElement=="850"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="vt+streamline";
			productForm.options[1].text="Vorticity & Streamline";
		}else if (PressureElement=="700"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="RH+streamline";
			productForm.options[1].text="Relative Humidity & Streamline";
		}else if (PressureElement=="500"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="height";
			productForm.options[1].text="Geopotential Height";
		}else if (PressureElement=="200"){
			productForm.options.length=2;
			productForm.options[0].value="wind";
			productForm.options[0].text="Wind Speed & Wind Direction";
			productForm.options[1].value="isotech+streamline";
			productForm.options[1].text="Jet Stream & Streamline";
		}else if (PressureElement=="sfc"){
			productForm.options.length=4;
			productForm.options[0].value="weather";
			productForm.options[0].text="Weather";
			productForm.options[1].value="temp";
			productForm.options[1].text="Temperature";
			productForm.options[2].value="mslp";
			productForm.options[2].text="Mean Sea Level Pressure";
			productForm.options[3].value="wind";
			productForm.options[3].text="Wind Speed & Wind Direction";
		}
	}
	
	var productIndex = document.the_form.Product.selectedIndex;
	var ProductElement = new String(document.the_form.Product.options[productIndex].value);
}

function changeChart(fchour){
	var pressureIndex=document.the_form.Pressure.selectedIndex;
	var PressureElement = new String(document.the_form.Pressure.options[pressureIndex].value)
	var productIndex = document.the_form.Product.selectedIndex;
	var ProductElement = new String(document.the_form.Product.options[productIndex].value);

	if (fchour == "00"){
		if (PressureElement=="850"){
			if (ProductElement=="wind"){
				document.location="nwp850wd"+fchour+"e.htm";
			} else if (ProductElement=="vt+streamline"){
				document.location="nwp850vt"+fchour+"e.htm";
			}
		} else if (PressureElement=="700"){
			if (ProductElement=="wind"){
				document.location="nwp700wd"+fchour+"e.htm";
			} else if (ProductElement=="RH+streamline"){
				document.location="nwp700rh"+fchour+"e.htm";
			}
		} else if (PressureElement=="500"){
			if (ProductElement=="wind"){
				document.location="nwp500wd"+fchour+"e.htm";
			} else if (ProductElement=="height"){
				document.location="nwp500hh"+fchour+"e.htm";
			}
		} else if (PressureElement=="200"){
			if (ProductElement=="wind"){
				document.location="nwp200wd"+fchour+"e.htm";
			} else if (ProductElement=="isotech+streamline"){
				document.location="nwp200is"+fchour+"e.htm";
			}
		} else if (PressureElement=="sfc"){
			if (ProductElement=="temp"){
				document.location="nwpsfctt"+fchour+"e.htm";
			} else if (ProductElement=="mslp"){
				document.location="nwpsfcpp"+fchour+"e.htm";
			} else if (ProductElement=="wind"){
				document.location="nwpsfcwd"+fchour+"e.htm";
			}
		}
	} else {
		if (PressureElement=="850"){
			if (ProductElement=="wind"){
				document.location="nwp850wd"+fchour+"e.htm";
			} else if (ProductElement=="vt+streamline"){
				document.location="nwp850vt"+fchour+"e.htm";
			}
		} else if (PressureElement=="700"){
			if (ProductElement=="wind"){
				document.location="nwp700wd"+fchour+"e.htm";
			} else if (ProductElement=="RH+streamline"){
				document.location="nwp700rh"+fchour+"e.htm";
			}
		} else if (PressureElement=="500"){
			if (ProductElement=="wind"){
				document.location="nwp500wd"+fchour+"e.htm";
			} else if (ProductElement=="height"){
				document.location="nwp500hh"+fchour+"e.htm";
			}
		} else if (PressureElement=="200"){
			if (ProductElement=="wind"){
				document.location="nwp200wd"+fchour+"e.htm";
			} else if (ProductElement=="isotech+streamline"){
				document.location="nwp200is"+fchour+"e.htm";
			}
		} else if (PressureElement=="sfc"){
			if (ProductElement=="weather"){
				document.location="nwpsfcwx"+fchour+"e.htm";
			} else if (ProductElement=="temp"){
				document.location="nwpsfctt"+fchour+"e.htm";
			} else if (ProductElement=="mslp"){
				document.location="nwpsfcpp"+fchour+"e.htm";
			} else if (ProductElement=="wind"){
				document.location="nwpsfcwd"+fchour+"e.htm";
			}
		}
	}
}

function getTermInfo(term){
   newWin=window.open("nwp_backgroundinfo_e.htm#"+term,"FLW","resizable=yes,scrollbars=yes,status=yes,toolbar=1,location=0,directories=0");
   newWin.focus();
}

