CODE FOR FUNCTION EFFECT
<script language="JavaScript">
<!--
// Function to calculate Effective Rate of Interest
function effect(rate, npery)
{
npery = parseInt(npery);
if (( npery == 0 ) || ( rate == 0 )){
alert("Why do you want to test me with zeros?");
return(0);
}
rate = eval((rate)/(100));
effect_value = ((Math.pow(1 + (rate/npery), npery)) - 1) * 100;
effect_value = conv_number(effect_value,2);
return (effect_value);
}
function conv_number(expr, decplaces)
{ // This function is from David Goodman's Javascript Bible.
var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));
while (str.length <= decplaces) {
str = "0" + str;
}
var decpoint = str.length - decplaces;
return (str.substring(0,decpoint) + "." + str.substring(decpoint,str.length));
}
// --></script>