function showcredit() { var credit credit="Script programmed by Jens T.Saetre 25042001" credit+="\n08122002 Changed layout" credit+="\nUpdated 08122002" window.alert(credit); } function Calculate() { var RX_Frequency,RF5150,RF9750,RF10000,RF10050,RF10600,RF10750,RF11000,RF11200,RxMin,RxMax,IF_Freq,RealLO RX_Frequency=1*document.IF.RxFrequency.value; // Reads the value on the form RxMin=1*document.IF.RxMin.value; // Reads the value on the form RxMax=1*document.IF.RxMax.value; // Reads the value on the form RealLO=1*document.IF.RealLO.value; // Reads the value on the form IF_Freq=Math.abs(RX_Frequency-RealLO); //Calculates the L-band IF frequency if ((IF_Freq > RxMax)||(IF_Freq < RxMin)) { // IF frequancy is less than RxMin and higher than RxMax document.IF.RF5150.value="IF out of range"; document.IF.RF9750.value="IF out of range"; document.IF.RF10000.value="IF out of range"; document.IF.RF10050.value="IF out of range"; document.IF.RF10600.value="IF out of range"; document.IF.RF10750.value="IF out of range"; document.IF.RF11000.value="IF out of range"; document.IF.RF11200.value="IF out of range"; } else { // Do the calculations RF5150=5150-IF_Freq; document.IF.RF5150.value=formatvalue(RF5150, 6); RF9750=IF_Freq+9750; document.IF.RF9750.value=formatvalue(RF9750, 6); RF10000=IF_Freq+10000; document.IF.RF10000.value=formatvalue(RF10000, 6); RF10050=IF_Freq+10050; document.IF.RF10050.value=formatvalue(RF10050, 6); RF10600=IF_Freq+10600; document.IF.RF10600.value=formatvalue(RF10600, 6); RF10750=IF_Freq+10750; document.IF.RF10750.value=formatvalue(RF10750, 6); RF11000=IF_Freq+11000; document.IF.RF11000.value=formatvalue(RF11000, 6); RF11200=IF_Freq+11200; document.IF.RF11200.value=formatvalue(RF11200, 6); } } function formatvalue(input, rsize) // Formatting decimal numbers to text { 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); }