function showcredit() { var credit credit="Script programmed by Jens T.Saetre" credit+="\n14092000 First version uploaded" credit+="\n08122002 Changed layout" credit+="\n01022004 Added feedhorn beamwidth" 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_BeamWidth() { var FD,BeamWidth FD=document.Parabol.FD.value; // Beamw =2* Atan(1/4*(FD)) BeamWidth=2*Deg( 2*Math.atan(1/(4*FD))); document.Parabol.BeamWidth.value=formatvalue(BeamWidth, 5); } function Calculate_Focalpoint() { var FD,Focallength,Diameter,Depth ; Diameter=document.Parabol.Diameter.value; Diameter=Diameter/100; //converts to meters Depth=document.Parabol.Depth.value; Depth=Depth/100 ;//Converts to meters //Focallength=document.Parabol.Focalpoint.value; Focallength=Diameter*Diameter/(16*Depth); FD=Focallength/Diameter; document.Parabol.FD.value=formatvalue(FD, 4); document.Parabol.Focalpoint.value=formatvalue(Focallength*100, 6); Calculate_BeamWidth(); } function Calculate_Depth() { var FD,Focallength,Diameter,Depth ; Diameter=document.Parabol.Diameter.value; Diameter=Diameter/100; //Depth =document.Parabol.Depth.value; Focallength=document.Parabol.Focalpoint.value; Focallength=Focallength/100; Depth=Diameter*Diameter/(16*Focallength); FD=Focallength/Diameter; document.Parabol.FD.value=formatvalue(FD, 4); document.Parabol.Depth.value=formatvalue(Depth*100, 6); Calculate_BeamWidth(); } function Calculate_FD_Depth() { var FD,Focallength,Diameter,Depth ; Diameter=document.Parabol.Diameter.value; Diameter=Diameter/100; //Depth =document.Parabol.Depth.value; Focallength=document.Parabol.Focalpoint.value; Focallength=Focallength/100; FD=document.Parabol.FD.value; Depth=FD/Focallength; //Focallength/Diameter; //document.Parabol.FD.value=formatvalue(FD, 4); document.Parabol.Depth.value=formatvalue(Depth*100, 6); Calculate_BeamWidth(); } 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); }