<!--
//Modified from a script by Vijay Bhagwandas, Lenntech BV
var t //tap-water,cost

function rain(){
	var l = document.forms[0].l.value //length
	var w = document.forms[0].w.value //width
	var A = document.forms[0].A.value //surface
	
	if(A == "" && l != "" && w == ""){
		alert("fill in the width")
		clearForm()
		return
	}
	
	if(A == "" && w != "" && l == ""){
		alert("fill in the length")
		clearForm()
		return
	}
	
	if(A != "" && l != "" && w == ""){
		alert("is your area " +A+ " square feet or what?")
		clearForm()
		return
	}
	
	if(A != "" && w != "" && l == ""){
		alert("is you area " +A+ " square feet or what?")
		clearForm()
		return
	}	
	
	if(A != "" && w != "" && l != ""){
		alert("What do you want?\r\rGive the area, and if you don't know it\r\rgive the length and width")
		clearForm()
		return
	}	
	
	if(A == "" && w == "" && l == ""){
		alert("You'll have to fill in an area or the length and width,\rso the area can be calculated.")
		return
	}
		
		
	if(l == "" && w == ""){
		document.forms[0].t.value = Math.round(document.forms[0].A.value*document.forms[0].a.value*0.6233758)
		t = document.forms[0].t.value
	}
	else{
		A = l*w
		document.forms[0].t.value = Math.round(A*document.forms[0].a.value*0.6233758)
		t = document.forms[0].t.value
	}
	
}

function clearForm(){
	var form = window.document.forms[0]
	for(var i = 0; i < form.elements.length; i++){
		if(i == 3){
			continue
		}
		if(form.elements[i].type == "text"){
			form.elements[i].value = ""
		}
	}
}

document.onkeypress = keyhandler;
function keyhandler(e) {
	Key = (document.layers)?e.which:window.event.keyCode;;
	if( Key == 13 || Key == 32 ){ //13 is ascii value for Enter key
		rain(); 
	}

	if( Key == 27){ //27 is ascii value for escape key
		clearForm(); 
	}
}
//-->
