function randomDRProblem(form) { 	var theTA = (Math.round(Math.random()*2000)) + 1000;  	var theTE = (Math.round(Math.random()*(theTA - 800))) + 500;  	var theTD = theTA - theTE; 	form.TAInput.value="" + theTA;  	form.TDInput.value="" + theTD;  	form.TEInput.value="" + theTE;  	form.DROutput.value=""; 	form.DEOutput.value=""; 	form.EMOutput.value=""; }  function findDR(form) { 	var theTA = form.TAInput.value; 	if (!isPositiveNumber(theTA)) { 		return false; 	} 	var theTD = form.TDInput.value; 	if (!isPositiveNumber(theTD)) { 		return false; 	} 	var theTE = form.TEInput.value; 	if (!isPositiveNumber(theTE)) { 		return false; 	} 	var theDR = theTD/theTA; 	form.DROutput.value = "" + Math.round(theDR*10000)/100; 	var theDE = theTD/theTE; 	form.DEOutput.value = "" + Math.round(theDE*100)/100; 	var theEM = theTA/theTE; 	form.EMOutput.value = "" + Math.round(theEM*100)/100; 	return true; }  function calcDRHelp(form) { 	var theTA = form.TAInput.value; 	if (!isPositiveNumber(theTA)) { 		return false; 	} 	var theTD = form.TDInput.value; 	if (!isPositiveNumber(theTD)) { 		return false; 	} 	var theTE = form.TEInput.value; 	if (!isPositiveNumber(theTE)) { 		return false; 	} 	var theDR = theTD/theTA; 	var theAns = "" + Math.round(theDR*10000)/100; 	var theDE = theTD/theTE; 	var theAns1 = "" + Math.round(theDE*100)/100; 	var theEM = theTA/theTE; 	var theAns2 = "" + Math.round(theEM*100)/100; 	var theStr = "<HTML><HEAD><TITLE>Debt Management Ratio Help</TITLE></HEAD><BODY BGCOLOR=\"white\">"; 	theStr += "<h1>Debt Ratio Help</h1>";	theStr += "<P>The <b>Debt Ratio</b> is calculated as follows:</P>";	theStr += drawFraction("Debt Ratio","Total Debt","Total Assets",theTD,theTA,theAns + "\%");	theStr += "<h1>Debt-Equity Ratio Help</h1>";	theStr += "<P>The <b>Debt-Equity Ratio</b> is calculated as follows:</P>";	theStr += drawFraction("Debt-Equity Ratio","Total Debt","Total Owners' Equity",theTD,theTE,theAns1);	theStr += "<h1>Equity Multiplier Help</h1>";	theStr += "<P>The <b>Equity Multiplier</b> is calculated as follows:</P>";	theStr += drawFraction("Equity Multiplier","Total Assets","Total Owners' Equity",theTA,theTE,theAns2);	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=410"); 	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;}
