function calc(){
	var inch = parseFloat(document.getElementById("inch").value);
	var dot = document.getElementById("dot").selectedIndex;
	var edge_up = parseFloat(document.getElementById("edge_up").value);
	var edge_down = parseFloat(document.getElementById("edge_down").value);
	var edge_right = parseFloat(document.getElementById("edge_right").value);
	var edge_left = parseFloat(document.getElementById("edge_left").value);
	switch(dot){
		case 0:
			var width=0
			var height=0
			var ratioOfWidth=0
			var ratioOfHeight=0
			break;
		case 1:
			var width=320
			var height=180
			var ratioOfWidth=16
			var ratioOfHeight=9
			break;
		case 2:
			var width=320
			var height=240
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 3:
			var width=640
			var height=480
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 4:
			var width=800
			var height=400
			var ratioOfWidth=2
			var ratioOfHeight=1
			break;
		case 5:
			var width=800
			var height=480
			var ratioOfWidth=5
			var ratioOfHeight=3
			break;
		case 6:
			var width=800
			var height=600
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 7:
			var width=1024
			var height=600
			var ratioOfWidth=16
			var ratioOfHeight=9.375
			break;
		case 8:
			var width=1024
			var height=768
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 9:
			var width=1280
			var height=720
			var ratioOfWidth=16
			var ratioOfHeight=9
			break;
		case 10:
			var width=1280
			var height=768
			var ratioOfWidth=5
			var ratioOfHeight=3
			break;
		case 11:
			var width=1280
			var height=800
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
		case 12:
			var width=1280
			var height=960
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 13:
			var width=1280
			var height=1024
			var ratioOfWidth=5
			var ratioOfHeight=4
			break;
		case 14:
			var width=1366
			var height=768
			var ratioOfWidth=683
			var ratioOfHeight=384
			break;
		case 15:
			var width=1440
			var height=900
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
		case 16:
			var width=1400
			var height=1050
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 17:
			var width=1680
			var height=1050
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
		case 18:
			var width=1600
			var height=1200
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 19:
			var width=1920
			var height=1080
			var ratioOfWidth=16
			var ratioOfHeight=9
			break;
		case 20:
			var width=1920
			var height=1200
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
		case 21:
			var width=2048
			var height=1536
			var ratioOfWidth=4
			var ratioOfHeight=3
			break;
		case 22:
			var width=2560
			var height=1600
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
		case 23:
			var width=3840
			var height=2400
			var ratioOfWidth=16
			var ratioOfHeight=10
			break;
	}
var base1 = Math.sqrt(Math.pow(ratioOfWidth,2)+Math.pow(ratioOfHeight,2));
var base2 = inch*2.54/base1;
var base = base2
var dot_pitch = Math.round(base*ratioOfWidth/width*10000)/1000;
var result = "選択された解像度：" + width + "x" + height + "<br>";
result += "総画素数：" + width*height + "<br>";
result += "アスペクト比：" + ratioOfWidth + ":" + ratioOfHeight + "<br>";
result += "インチ：" + inch + "<br><br>";
result += "表示領域縦：" + (Math.round(base*ratioOfHeight*10)/10) + "cm<br>";
result += "表示領域横：" + (Math.round(base*ratioOfWidth*10)/10) + "cm<br>";
result += "モニタ縦：" + (Math.round(base*ratioOfHeight*10)/10 + edge_up + edge_down) + "cm<br>";//モニタの縦表示領域の大きさ＋左右フチ
result += "モニタ横：" + (Math.round(base*ratioOfWidth*10)/10 + edge_right + edge_left) + "cm<br>";//モニタの横表示領域の大きさ＋左右フチ
result += "画素ピッチ：" + dot_pitch + "mm<br>";//メーカーが公表している値に近づくよう微調整
result += "dpi：" + Math.round(2.54/dot_pitch*10) + "<br>"
document.getElementById("result").innerHTML = result;
}
