// Javascript by Graham Laming, copyright 2003 London Electronics Ltd.
//This script helps you to choose the best size display for your viewing distance
var size;
function  doLamingMath(){
var length = eval(document.theForm.elements[0].value);
var filled = eval(document.theForm.elements[0].value.length);
if ((document.theForm[1].type == "radio") && (document.theForm[1].checked)) units = 1;
if ((document.theForm[2].type == "radio") && (document.theForm[2].checked)) units = 1.0936;
if ((document.theForm[3].type == "radio") && (document.theForm[3].checked)) units = 3.281;
if (filled==0){alert("Please enter a viewing distance");}
if (length<=0.05){alert("Please enter a viewing distance");}
if (((document.theForm[1].checked)==false)&&((document.theForm[2].checked)==false)&&((document.theForm[3].checked)==false)){alert("Please choose either metres, yards or feet");}
var metres=(length/units);
var size=(Math.round((metres/10)*25));
var inches=(Math.round(size/25.4));
help=("Please phone \(+44\)01462-850967 for advice. You need digits at least " +size+ " mm \("+inches+" inches\) high");
if(metres>=0.01){recommendation = "You should use a panel meter with 14mm \(0.56\"\) high digits";}
if(metres>=7.0){recommendation = "You should use a display with 25mm \(1\"\) high digits";}
if(metres>=12.6){recommendation = "You should use a display with 57mm \(2 1\/4\"\) high digits";}
if(metres>=25.1){recommendation = "You should use a display with 102mm \(4\"\) high digits";}
if(metres>=50.1){recommendation = "You should use a display with 144mm \(6\"\) high digits";}
if(metres>=75.1){recommendation = "You should use a display with 200mm \(8\"\) high digits";}
if(metres>=100.1){recommendation = "You should use a display with 280mm \(11\"\) high digits";}
if(metres>=141){recommendation = "You should use a display with 400mm \(16\"\) high digits";}
if(metres>=180){recommendation = help;}
alert(""+recommendation+"")}