function CalculateLens(){var a,b,c,d,e,f,g;f=document.calclens.distance.value;d=document.calclens.width.value;c=document.calclens.height.value;if(f<=0||d<=0&&c<=0){document.calclens.lens.value=0;window.alert("Please enter a valid Distance, and either the minimum width or height of the FOV.")}else{switch(document.calclens.ccdvalue.value){case"third":b=4.8;a=3.6;break;case"quarter":b=3.6;a=2.7;break}if(d!=0){g=b*(f/d);c=Math.round(a*f/g*10)/10;document.calclens.height.value=c}else{g=a*(f/c);d=Math.round(b*f/g*10)/10;document.calclens.width.value=d}document.calclens.lens.value=Math.round(g*10)/10}}function CalculateFOV(){var a,b,c,d,e,f,g;g=document.calcfov.lens.value;f=document.calcfov.distance.value;if(g<=0||f<=0){document.calcfov.angle.value=0;document.calcfov.height.value=0;document.calcfov.width.value=0;window.alert("Please enter a valid Lens Size and Distance.")}else{switch(document.calcfov.ccdvalue.value){case"third":b=4.8;a=3.6;break;case"quarter":b=3.6;a=2.7;break}c=Math.round(a*f/g*10)/10;d=Math.round(b*f/g*10)/10;e=Math.atan(d/f)*100;document.calcfov.height.value=c;document.calcfov.width.value=d;document.calcfov.angle.value=Math.round(e)}}function NullToZero(a){if(a==null||a=="")a=0}
