function randomCRProblem(form) { 	var theCA = (Math.round(Math.random()*1800)) + 500;  	var theCL = (Math.round(Math.random()*1500)) + 500;  	form.CAInput.value="" + theCA;  	form.CLInput.value="" + theCL;  	form.CROutput.value=""; }  function findCR(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; 	form.CROutput.value = "" + Math.round(theCR*100)/100; 	return true; }  function randomQRProblem(form) { 	var theInv = (Math.round(Math.random()*700)) + 400;  	var theCA = (Math.round(Math.random()*800)) + 400 + theInv;  	var theCL = (Math.round(Math.random()*1500)) + 500;  	form.CAInput.value="" + theCA;  	form.InvInput.value="" + theInv;  	form.CLInput.value="" + theCL;  	form.QROutput.value=""; }  function findQR(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; 	form.QROutput.value = "" + Math.round(theQR*100)/100; 	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;}
