if(in1 >= 50){document.form1.thaigrade.value = "1";}
if (in1 >= 60){document.form1.thaigrade.value = "2";}
if (in1 >= 70){document.form1.thaigrade.value = "3";}
if (in1 >= 80){document.form1.thaigrade.value = "4";}
if (in1 > 100){document.form1.thaigrade.value = "error";}
if (in1 < 50){document.form1.thaigrade.value = "0";}
var in2 = parseInt(document.form1.math.value);
if(in2 >= 50){document.form1.mathgrade.value = "1";}
if (in2 >= 60){document.form1.mathgrade.value = "2";}
if (in2 >= 70){document.form1.mathgrade.value = "3";}
if (in2 >= 80){document.form1.mathgrade.value = "4";}
if (in2 > 100){document.form1.thaigrade.value = "error";}
if (in2 < 50){document.form1.mathgrade.value = "0";}
var in3 = parseInt(document.form1.science.value);
if(in3 >= 50){document.form1.sciencegrade.value = "1";}
if (in3 >= 60){document.form1.sciencegrade.value = "2";}
if (in3 >= 70){document.form1.sciencegrade.value = "3";}
if (in3 >= 80){document.form1.sciencegrade.value = "4";}
if (in3 > 100){document.form1.thaigrade.value = "error";}
if (in3 < 50){document.form1.sciencegrade.value = "0";}
var in4 = parseInt(document.form1.social.value);
if(in4 >= 50){document.form1.socialgrade.value = "1";}
if (in4 >= 60){document.form1.socialgrade.value = "2";}
if (in4 >= 70){document.form1.socialgrade.value = "3";}
if (in4 >= 80){document.form1.socialgrade.value = "4";}
if (in4 > 100){document.form1.thaigrade.value = "error";}
if (in4 < 50){document.form1.socialgrade.value = "0";}
var in5 = parseInt(document.form1.art.value);
if(in5 >= 50){document.form1.artgrade.value = "1";}
if (in5 >= 60){document.form1.artgrade.value = "2";}
if (in5 >= 70){document.form1.artgrade.value = "3";}
if (in5 >= 80){document.form1.artgrade.value = "4";}
if (in5 > 100){document.form1.thaigrade.value = "error";}
if (in5 < 50){document.form1.artgrade.value = "0";}
var in6 = parseInt(document.form1.health.value);
if(in6 >= 50){document.form1.healthgrade.value = "1";}
if (in6 >= 60){document.form1.healthgrade.value = "2";}
if (in6 >= 70){document.form1.healthgrade.value = "3";}
if (in6 >= 80){document.form1.healthgrade.value = "4";}
if (in6 > 100){document.form1.thaigrade.value = "error";}
if (in6 < 50){document.form1.healthgrade.value = "0";}
var in7 = parseInt(document.form1.work.value);
if(in7 >= 50){document.form1.workgrade.value = "1";}
if (in7 >= 60){document.form1.workgrade.value = "2";}
if (in7>= 70){document.form1.workgrade.value = "3";}
if (in7 >= 80){document.form1.workgrade.value = "4";}
if (in7 > 100){document.form1.thaigrade.value = "error";}
if (in7 < 50){document.form1.workgrade.value = "0";}
var in8 = parseInt(document.form1.eng.value);
if(in8 >= 50){document.form1.enggrade.value = "1";}
if (in8 >= 60){document.form1.enggrade.value = "2";}
if (in8>= 70){document.form1.enggrade.value = "3";}
if (in8 >= 80){document.form1.enggrade.value = "4";}
if (in8 > 100){document.form1.thaigrade.value = "error";}
if (in8 < 50){document.form1.enggrade.value = "0";}
var sum = ((in1+in2+in3+in4+in5+in6+in7+in8)/8)/25;
document.form1.total.value = sum;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>