function showcredit() { var credit credit="Script programmed by Jens T.Saetre" credit+="\n01022004 First version uploaded" window.alert(credit); //var theResponse = window.prompt("Welcome?","Enter your name here."); } function Radians(number) { var rad rad=number*Math.PI/180; return(rad) } function Deg(number) { var rad rad=number*180/Math.PI; return(rad) } function Calculate_FocalpointandBeamwidth() { var FD,Focallength,Diameter; Diameter=document.Parabol.Diameter.value; Diameter=Diameter/100; //converts to meters FD=document.Parabol.FD.value; Focallength=FD*Diameter; FD=Focallength/Diameter; document.Parabol.Focalpoint.value=formatvalue(Focallength*100, 6); BeamWidth=2*Deg( Math.atan(1/(2*FD))); document.Parabol.BeamWidth.value=formatvalue(BeamWidth, 5); } function Calculate_FD_BeamWidth() { var FD,Focallength,Diameter,BeamWidth; Diameter=document.Parabol.Diameter.value; Diameter=Diameter/100; Focallength=document.Parabol.Focalpoint.value; Focallength=Focallength/100; FD=Focallength/Diameter; document.Parabol.FD.value=formatvalue(FD, 4); BeamWidth=2*Deg( Math.atan(1/(2*FD))); document.Parabol.BeamWidth.value=formatvalue(BeamWidth, 5); } function Calculate_Diameter() { var FD,Focallength,Diameter,Depth ; //Diameter=document.Parabol.Diameter.value; Depth =document.Parabol.Depth.value; Depth =Depth /100; Focallength=document.Parabol.Focalpoint.value; Focallength=Focallength/100; Diameter=Math.sqrt(Focallength*16*Depth); FD=Focallength/Diameter; document.Parabol.FD.value=formatvalue(FD, 4); document.Parabol.Diameter.value=formatvalue(Diameter*100, 4); Calculate_BeamWidth(); } function formatvalue(input, rsize) // Desimal avrunding { var invalid = "**************************"; var nines = "999999999999999999999999"; var strin = "" + input; var fltin = parseFloat(strin); if (strin.length <= rsize) return strin; if (strin.indexOf("e") != -1 || fltin > parseFloat(nines.substring(0,rsize)+".4")) return invalid.substring(0, rsize); var rounded = "" + (fltin + (fltin - parseFloat(strin.substring(0, rsize)))); return rounded.substring(0, rsize); }