CODE FOR FUNCTION SLN

<script language="JavaScript">

<!--

// Function to calculate Depreciation

function sln(cost, salvage, life)

{

cost = parseFloat(cost);

salvage = parseFloat(salvage);

life = parseFloat(life);

if (( cost == 0 ) || ( life == 0 )){

alert("Why do you want to test me with zeros?");

return(0);

}

x = cost - salvage;

sln_value = x / life;

sln_value = conv_number(sln_value,2);

return (sln_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>

Go to my Homepage