window.onload = function() {
	document.diagonal.onsubmit = function() {
		el = document.diagonal.elements;
		for (i=0; i<el.length; i++) {
			if (el[i].type == 'text' && !(el[i].value > 0)) {
				alert('数値を正しく入力してください。');
				return false;
			}
		}
		x = document.diagonal.tate.value;
		y = document.diagonal.yoko.value;
		n = Math.pow(10, document.diagonal.round.selectedIndex);
		document.getElementById('resCarrier').firstChild.nodeValue = Math.round(Math.sqrt(Math.pow(x, 2)+Math.pow(y, 2))*n)/n;
	}
}
