I am rebuilding a web site in Joomla 1.7, Camber template. I am trying without success to create a module that will use an 'include' that is currently being used on the current site. The include is a javascript calculator that calculates a percentage of a number placed in an input field. The content, text, number field and calculate button are in the module but the calculation script doesn't work.
I am including the entire calculate.inc include below. I have uploaded this to the includes folder. Any help would be greatly appreciated. I obviously am brain dead about this. It's probably some simple thing but I can't figure it out.
Thanks.
"calculate.inc" code
<h1 class="section"><b>Calculate Your Rebate Savings Now!</b></h1>
<div class="content">
<p>Use our calculator to determine just how much money you may be able
to save by using the Union Home Services™ Real Estate Benefit Program.
Calculator is based on a real estate agent commission of 3%.
Commissions may vary.</p>
<p>Enter the price of the home you want to buy or sell and click 'Calculate'
to see the approximate rebate.</p>
<div id="calculate">
<h3>Home Price:</h3>
<div id="form">
<input type="text" id="inputValue" name="inputValue" value="" size="6" style="width: 6em"/>
<script type="text/javascript">
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0');y.splice(z, 0, pnt); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}
function Calculate(){
// good, but does not work in Firefox: var inputValue2 = parseInt(inputValue.value);
// better, as this works in Safari and Firefox:
var inputValue2 = parseInt(document.getElementById('inputValue').value);
var rebate = (inputValue2 * .03 * .20);
var commission = (inputValue2 * .03);
rebate=formatNumber(rebate,2,',','.','$ ','','',' CR');
commission=formatNumber(commission,2,',','.','$ ','','',' CR');
//document.getElementById("commission").innerHTML = "<p>Total Commission: " + commission + "</p>";
document.getElementById("rebate").innerHTML = "<p>Your rebate of 20%: " + rebate + "</p>";
}
</script><br /><br />
</div>
<p class="small">Note: Numbers only - no dollar signs or commas.</p>
<!--div align="center"><span id="commission"></span></div><br-->
<!--table><tr><td align="center"><div align="center"><span id="rebate"> </span></div></td></tr></table-->
<div align="center"><span id="rebate"> </span></div>
<h3>Your Union Home Services™ 20% Rebate</h3>
<input type="image" value="Calculate" onclick="Calculate()" src="images/calc.jpg"/>
</div><br />
<p class="small"><strong>Disclaimer:</strong> This calculator makes a few assumptions, and the final amount
may vary depending on your specific situation. The real estate agent
commission percentage listed in the calculator is an estimate based
on a 3% commission structure. Commissions may vary and the actual
percentage you receive will be based on the listing agent's
agreement.</p>