// JavaScript Document

//functions for the hail observation form

function clearField(def_val, caller_id) {
	
	var caller = new Object();
	caller = eval("document.forms[0]."+caller_id);
	
	if (caller.value == def_val) {
		caller.value = "";
	}
	
	return;

}


function checkForm() {

	with (document.form1) {

		if (hour.value == "" || hour.value == null || hour.value == "hh" || isNaN(hour.value)) {
		
			alert("Please enter the time that the reported precipitation was observed.");
			hour.focus();
			return;
			
		}
		
		if (minute.value == "" || minute.value == null || minute.value == "mm" || isNaN(minute.value)) {
		
			alert("Please enter the time that the reported precipitation was observed.");
			minute.focus();
			return;
			
		}

		if (lat.value == "" || lat.value == "latitude" || lgt.value == "" || lgt.value == "longitude") {
		
				alert("Please enter the location (latitude and longitude) where the reported precipitation was observed.");
				lat.focus();
				return;
			
		}

		if (isNaN(lat.value) || isNaN(lgt.value)) {
		
				alert("Please enter the latitude and longitude where the reported precipitation was observed in decimal degrees.");
				lat.focus();
				return;
			
		}
		
		submit();
	
	}

}

function openWin(location, ht, wd) {

//	This function opens a new window of the specified size, displaying the specified page

	newWindow=window.open(location,"newWin","scrollbars,resizable,height="+ht+",width="+wd);
	
	newWindow.focus();
	
}