function randomRTProblem(form) { 	var theS = (Math.round(Math.random()*1800)) + 500;  	var theAR = (Math.round(Math.random()*500)) + 100;  	form.SInput.value="" + theS;  	form.ARInput.value="" + theAR;  	form.RTOutput.value=""; 	form.DROutput.value=""; }  function findRT(form) { 	var theS = form.SInput.value; 	if (!isPositiveNumber(theS)) { 		return false; 	} 	var theAR = form.ARInput.value; 	if (!isPositiveNumber(theAR)) { 		return false; 	} 	var theRT = theS/theAR; 	form.RTOutput.value = "" + Math.round(theRT*100)/100; 	var theDR = 365/theRT; 	form.DROutput.value = "" + Math.round(theDR*100)/100; 	return true; }  function calcRTHelp(form) { 	var theS = form.SInput.value; 	if (!isPositiveNumber(theS)) { 		return false; 	} 	var theAR = form.ARInput.value; 	if (!isPositiveNumber(theAR)) { 		return false; 	} 	var theRT = theS/theAR; 	var theAns = "" + Math.round(theRT*100)/100; 	var theDR = 365/theRT; 	var theAns1 = "" + Math.round(theDR*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Receivables Turnover Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Receivables Turnover Help</h1>";	theStr += "<P>The <b>Receivables Turnover</b> is calculated as follows:</P>";	theStr += drawFraction("Receivables Turnover","Sales","Accounts Receivables",theS,theAR,theAns);	theStr += "<h1>Days' Receivables Help</h1>";	theStr += "<P>The <b>Days' Receivables</b> is calculated as follows:</P>";	theStr += drawFraction("Days' Receivables","365","Receivables Turnover","365",theRT,theAns1);	theStr += "<CENTER>";	theStr += "<P><FORM NAME=\"Form1\">";	theStr += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></CENTER>";	theStr += "</P></BODY></HTML>" 	newWin = window.open("","","scrollbars,resizable,width=400,height=330"); 	if (newWin != null) { 		newWin.document.write(theStr); 		newWin.document.close(); 		newWin.focus(); 	} 	return true;}function randomITProblem(form) { 	var theCOGS = (Math.round(Math.random()*1800)) + 500;  	var theInv = (Math.round(Math.random()*500)) + 300;  	form.COGSInput.value="" + theCOGS;  	form.InvInput.value="" + theInv;  	form.ITOutput.value=""; 	form.DIOutput.value=""; }  function findIT(form) { 	var theCOGS = form.COGSInput.value; 	if (!isPositiveNumber(theCOGS)) { 		return false; 	} 	var theInv = form.InvInput.value; 	if (!isPositiveNumber(theInv)) { 		return false; 	} 	var theIT = theCOGS/theInv; 	form.ITOutput.value = "" + Math.round(theIT*100)/100; 	var theDI = 365/theIT; 	form.DIOutput.value = "" + Math.round(theDI*100)/100; 	return true; }  function calcITHelp(form) { 	var theCOGS = form.COGSInput.value; 	if (!isPositiveNumber(theCOGS)) { 		return false; 	} 	var theInv = form.InvInput.value; 	if (!isPositiveNumber(theInv)) { 		return false; 	} 	var theIT = theCOGS/theInv; 	var theAns = "" + Math.round(theIT*100)/100; 	var theDI = 365/theIT; 	var theAns1 = "" + Math.round(theDI*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Inventory Turnover Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Inventory Turnover Help</h1>";	theStr += "<P>The <b>Inventory Turnover</b> is calculated as follows:</P>";	theStr += drawFraction("Inventory Turnover","Cost of Goods Sold","Inventory",theCOGS,theInv,theAns);	theStr += "<h1>Days' Inventory Help</h1>";	theStr += "<P>The <b>Days' Inventory</b> is calculated as follows:</P>";	theStr += drawFraction("Days' Inventory","365","Inventory Turnover","365",theIT,theAns1);	theStr += "<CENTER>";	theStr += "<P><FORM NAME=\"Form1\">";	theStr += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></CENTER>";	theStr += "</P></BODY></HTML>" 	newWin = window.open("","","scrollbars,resizable,width=400,height=330"); 	if (newWin != null) { 		newWin.document.write(theStr); 		newWin.document.close(); 		newWin.focus(); 	} 	return true;}function randomFAProblem(form) { 	var theS = (Math.round(Math.random()*1800)) + 500;  	var theFA = (Math.round(Math.random()*1800)) + 500;  	var theTA = (Math.round(Math.random()*500)) + 200 + theFA; 	form.SInput.value="" + theS;  	form.FAInput.value="" + theFA;  	form.TAInput.value="" + theTA;  	form.FATOutput.value=""; 	form.TATOutput.value=""; }  function findFA(form) { 	var theS = form.SInput.value; 	if (!isPositiveNumber(theS)) { 		return false; 	} 	var theFA = form.FAInput.value; 	if (!isPositiveNumber(theFA)) { 		return false; 	} 	var theTA = form.TAInput.value; 	if (!isPositiveNumber(theTA)) { 		return false; 	} 	var theFAT = theS/theFA; 	form.FATOutput.value = "" + Math.round(theFAT*100)/100; 	var theTAT = theS/theTA; 	form.TATOutput.value = "" + Math.round(theTAT*100)/100; 	return true; }  function calcFAHelp(form) { 	var theS = form.SInput.value; 	if (!isPositiveNumber(theS)) { 		return false; 	} 	var theFA = form.FAInput.value; 	if (!isPositiveNumber(theFA)) { 		return false; 	} 	var theTA = form.TAInput.value; 	if (!isPositiveNumber(theTA)) { 		return false; 	} 	var theFAT = theS/theFA; 	var theAns = "" + Math.round(theFAT*100)/100; 	var theTAT = theS/theTA; 	var theAns1 = "" + Math.round(theTAT*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Fixed Asset Turnover Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Fixed Asset Turnover Help</h1>";	theStr += "<P>The <b>Fixed Asset Turnover</b> is calculated as follows:</P>";	theStr += drawFraction("Fixed Asset Turnover","Sales","Net Fixed Assets",theS,theFA,theAns);	theStr += "<h1>Total Asset Turnover Help</h1>";	theStr += "<P>The <b>Total Asset Turnover</b> is calculated as follows:</P>";	theStr += drawFraction("Total Asset Turnover","Sales","Total Assets",theS,theTA,theAns1);	theStr += "<CENTER>";	theStr += "<P><FORM NAME=\"Form1\">";	theStr += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></CENTER>";	theStr += "</P></BODY></HTML>" 	newWin = window.open("","","scrollbars,resizable,width=400,height=330"); 	if (newWin != null) { 		newWin.document.write(theStr); 		newWin.document.close(); 		newWin.focus(); 	} 	return true;}function isPositiveNumber(inputStr) { 	for (var i = 0; i < inputStr.length; i++) { 		var oneChar = inputStr.substring(i,i+1); 		if (((oneChar >= "0") && (oneChar <= "9")) || (oneChar == ".")) { 		 		} else { 			alert("Please make sure that only numbers are input."); 			return false; 		}  	}	return true; }  function drawFraction(inLHS,inNumFormula,inDenFormula,inNum,inDen,inAnswer) {	var theOut = "<table cellspacing='1' cellpadding='1'><tr>";	theOut += "<td rowspan='3' valign='center'>" + inLHS + "</td>";	theOut += "<td rowspan='3' valign='center'>=</td>";	theOut += "<td valign='center' align='center'>" + inNumFormula + "</td>";	theOut += "<td rowspan='3' valign='center'>=</td>";	theOut += "<td valign='center' align='center'>" + inNum + "</td>";	theOut += "<td rowspan='3' valign='center'>=</td>";	theOut += "<td rowspan='3' valign='center'>" + inAnswer + "</td>";	theOut += "</tr>";	theOut += "<tr>";	theOut += "<td valign='center' align='center'><hr noshade></td>";	theOut += "<td valign='center' align='center'><hr noshade></td>";	theOut += "</tr>";	theOut += "<tr>";	theOut += "<td valign='center' align='center'>" + inDenFormula + "</td>";	theOut += "<td valign='center' align='center'>" + inDen + "</td>";	theOut += "</tr></table>";	return theOut;}function drawSimpleFraction(inNum,inDen) {	var theOut = "<table cellspacing='1' cellpadding='1'>";	theOut += "<tr><td valign='center' align='center'>" + inNum + "</td></tr>";	theOut += "<tr><td valign='center' align='center'><hr noshade></td></tr>";	theOut += "<tr><td valign='center' align='center'>" + inDen + "</td></tr>";	theOut += "</table>";	return theOut;}function calcCRHelp(form) { 	var theCA = form.CAInput.value; 	if (!isPositiveNumber(theCA)) { 		return false; 	} 	var theCL = form.CLInput.value; 	if (!isPositiveNumber(theCL)) { 		return false; 	} 	var theCR = theCA/theCL; 	var theAns = "" + Math.round(theCR*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Current Ratio Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Current Ratio Help</h1>";	theStr += "<P>The <b>Current Ratio</b> is calculated as follows:</P>";	theStr += drawFraction("Current Ratio","Current Assets","Current Liabilities",theCA,theCL,theAns);	theStr += "<CENTER>";	theStr += "<P><FORM NAME=\"Form1\">";	theStr += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></CENTER>";	theStr += "</P></BODY></HTML>" 	newWin = window.open("","","scrollbars,resizable,width=400,height=260"); 	if (newWin != null) { 		newWin.document.write(theStr); 		newWin.document.close(); 		newWin.focus(); 	} 	return true;}function calcQRHelp(form) { 	var theCA = form.CAInput.value; 	if (!isPositiveNumber(theCA)) { 		return false; 	} 	var theInv = form.InvInput.value; 	if (!isPositiveNumber(theInv)) { 		return false; 	} 	var theCL = form.CLInput.value; 	if (!isPositiveNumber(theCL)) { 		return false; 	} 	var theQR = (theCA-theInv)/theCL; 	var theAns = "" + Math.round(theQR*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Quick Ratio Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Quick Ratio Help</h1>";	theStr += "<P>The <b>Quick Ratio</b> is calculated as follows:</P>";	theStr += drawFraction("Quick Ratio","Current Assets - Inventory","Current Liabilities",theCA + " - " + theInv,theCL,theAns);	theStr += "<CENTER>";	theStr += "<P><FORM NAME=\"Form1\">";	theStr += "<INPUT TYPE=\"button\" VALUE=\"   OK   \" onClick=\"window.close();\"></FORM></CENTER>";	theStr += "</P></BODY></HTML>" 	newWin = window.open("","","scrollbars,resizable,width=400,height=260"); 	if (newWin != null) { 		newWin.document.write(theStr); 		newWin.document.close(); 		newWin.focus(); 	} 	return true;}
