<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.profitsharing.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Profit Sharing - Performance</title>
 <link>http://www.profitsharing.org/taxonomy/term/2/0</link>
 <description></description>
 <language>en</language>
<item>
 <title>Real Rate of Return Calculator</title>
 <link>http://www.profitsharing.org/node/34</link>
 <description>&lt;!-- google_ad_section_start --&gt;
&lt;br /&gt;
&lt;script language = &quot;JavaScript&quot;&gt;
&lt;!-- hide script
function Start(page) {
OpenWin = this.open(page, &quot;CtrlWindow&quot;, &quot;toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=640,height=350,titlebar=no&quot;);
}

//*********************************************************************************
//**                                                                             **
//**	Script written by sironix.com, altered by profitsharing.org		 **
//**										 **
//**	July 13, 2001								 **
//**										 **
//*********************************************************************************

var a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14
var t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13
var gain, roi, rate, longamt

function currency(anynum) {
        //returns number as string in $xxx,xxx.xx format.
        anynum = &quot;&quot; + eval(anynum)  //evaluate (in case an expression sent)
        intnum = parseInt(anynum,10)  //isolate integer portion
	intnum = Math.abs(intnum)
        intstr = &quot;&quot;+intnum
        //add comma in thousands place.
        if (intnum &gt;= 1000) {
                intlen = intstr.length
                temp1=parseInt(&quot;&quot;+(intnum/1000),10)
                temp2=intstr.substring(intlen-3,intlen)
                intstr = temp1+&quot;,&quot;+temp2
        }
        if (intnum &gt;= 1000000) {
                intlen = intstr.length
                temp1=parseInt(&quot;&quot;+(intnum/1000000),10)
                temp2=intstr.substring(intlen-7,intlen)
                intstr = temp1+&quot;,&quot;+temp2
        }

        decnum = Math.abs(parseFloat(anynum)-parseInt(anynum,10)) //isolate decimal portion
        decnum = decnum * 100 // multiply decimal portion by 100.
        decwhl = Math.abs(Math.round(decnum))
        //if (decwhl &lt; 10) {decstr = &quot;0&quot; + decwhl} else {decstr = &quot;&quot; + decwhl}
        decstr = &quot;&quot; + decwhl
        while (decstr.length &lt; 2) {decstr += &quot;0&quot;}
        retval = intstr + &quot;.&quot; + decstr 
        if (anynum &lt; 0) {
                retval=&quot;(&quot;+retval+&quot;)&quot;
        }
        return &quot;$&quot;+retval
}

function fixed(anynum) {
        //returns number as string in xxx,xxx.x format.
        anynum = &quot;&quot; + eval(anynum)  //evaluate (in case an expression sent)
	anynum = Math.round(10 * anynum) / 10
        intnum = parseInt(anynum,10)  //isolate integer portion
	intnum = Math.abs(intnum)
        intstr = &quot;&quot;+intnum
        //add comma in thousands place.
        if (intnum &gt;= 1000) {
                intlen = intstr.length
                temp1=parseInt(&quot;&quot;+(intnum/1000),10)
                temp2=intstr.substring(intlen-3,intlen)
                intstr = temp1+&quot;,&quot;+temp2
        }
        if (intnum &gt;= 1000000) {
                intlen = intstr.length
                temp1=parseInt(&quot;&quot;+(intnum/1000000),10)
                temp2=intstr.substring(intlen-7,intlen)
                intstr = temp1+&quot;,&quot;+temp2
        }

        decnum = Math.abs(parseFloat(anynum)-parseInt(anynum,10)) //isolate decimal portion
        decnum = decnum * 10 // multiply decimal portion by 10.
        decwhl = Math.abs(Math.round(decnum))
        //if (decwhl &lt; 10) {decstr = &quot;0&quot; + decwhl} else {decstr = &quot;&quot; + decwhl}
        decstr = &quot;&quot; + decwhl
        while (decstr.length &lt; 1) {decstr += &quot;0&quot;}
	if (anynum &lt; 0) { intstr = &quot;-&quot;+intstr}
        return &quot;&quot;+intstr + &quot;.&quot;+decstr
}

function displaymsg(msg) {
	document.calc.msg.value = msg;
	document.calc.gain.value = &quot;&quot;;
	document.calc.roi.value = &quot;&quot;;
	document.calc.rate.value = &quot;&quot;;
}

function dateobj(anystring) {
	baddate = new Date()

	if (anystring.length &lt;= 0) {baddate.setTime(0);return baddate;} else {month = parseInt(anystring,10);}
	
	//find the first slash in anystring
	pos = 0
	for (var i=0; i &lt;= anystring.length-1; i++) {
		if (anystring.charAt(i) == &quot;/&quot;) {pos = i;break;}
	}
	
	if (pos &lt;= 0) {baddate.setTime(0);return baddate;}

	dstring = anystring.substring(pos + 1,anystring.length)	
	if (dstring.length &lt;= 0) {baddate.setTime(0);return baddate;} else {day = parseInt(dstring,10)}

	//find the second slash in anystring
	pos = 0
	for (var i=0; i &lt;= dstring.length-1; i++) {
		if (dstring.charAt(i) == &quot;/&quot;) {pos = i;break;}
	}

	if (pos &lt;= 0) {baddate.setTime(0);return baddate;}

	ystring = dstring.substring(pos + 1,dstring.length)	
	if (ystring.length &lt;= 0) {baddate.setTime(0);return baddate;} else {year = parseInt(ystring,10)}

	if (year &lt; 70) {year += 2000} else {year += 1900}
	
	if ((month &lt;= 0) || (day &lt;= 0) || (month &gt; 12) || (day &gt; 31) || (year &lt; 0)) {baddate.setTime(0);return baddate;}
	
	if (((month == 4) || (month == 6) || (month == 9) || (month == 11)) &amp;&amp; (day &gt; 30)) {baddate.setTime(0);return baddate;}

	rem4 = year % 4
	
	if ((month == 2) &amp;&amp; (rem4 != 0) &amp;&amp; (day &gt; 28)) {baddate.setTime(0);return baddate;}
	
	if ((month == 2) &amp;&amp; (rem4 == 0) &amp;&amp; (day &gt; 29)) {baddate.setTime(0);return baddate;}
	
	outdate = new Date(year,month - 1,day)

	return outdate
}

function calcterm(date1, date2) {
	//returns the term in years between 2 dates
        millisecs = date2.getTime() - date1.getTime();
        return (millisecs/(1000*60*60*24*365))
} 

function calculate() {
	gain = 0; roi = 0; rate = 0; longamt = 0; 		
	a1 = 0; a2 = 0; a3 = 0; a4 = 0; a5 = 0; a6 = 0; a7 = 0; a8 = 0; a9 = 0; a10 = 0;
	a11 = 0; a12 = 0; a13 = 0; a14 = 0;
	t1 = 0; t2 = 0; t3 = 0; t4 = 0; t5 = 0; t6 = 0; t7 = 0; t8 = 0; t9 = 0; t10 = 0;
	t11 = 0; t12 = 0; t13 = 0;

	document.calc.msg.value = &quot;Validating...&quot;

	d1 = new Date();
	d2 = new Date();
	d3 = new Date();
	d4 = new Date();
	d5 = new Date();
	d6 = new Date();
	d7 = new Date();
	d8 = new Date();
	d9 = new Date();
	d10 = new Date();
	d11 = new Date();
	d12 = new Date();
	d13 = new Date();
	d14 = new Date();

	// get dates
	if (document.calc.datestart.value == &quot;&quot;) {d1.setTime(0)} else {d1 = dateobj(document.calc.datestart.value);}
	if (document.calc.date1.value == &quot;&quot;) {d2.setTime(0)} else {d2 = dateobj(document.calc.date1.value);}
	if (document.calc.date2.value == &quot;&quot;) {d3.setTime(0)} else {d3 = dateobj(document.calc.date2.value);}
	if (document.calc.date3.value == &quot;&quot;) {d4.setTime(0)} else {d4 = dateobj(document.calc.date3.value);}
	if (document.calc.date4.value == &quot;&quot;) {d5.setTime(0)} else {d5 = dateobj(document.calc.date4.value);}
	if (document.calc.date5.value == &quot;&quot;) {d6.setTime(0)} else {d6 = dateobj(document.calc.date5.value);}
	if (document.calc.date6.value == &quot;&quot;) {d7.setTime(0)} else {d7 = dateobj(document.calc.date6.value);}
	if (document.calc.date7.value == &quot;&quot;) {d8.setTime(0)} else {d8 = dateobj(document.calc.date7.value);}
	if (document.calc.date8.value == &quot;&quot;) {d9.setTime(0)} else {d9 = dateobj(document.calc.date8.value);}
	if (document.calc.date9.value == &quot;&quot;) {d10.setTime(0)} else {d10 = dateobj(document.calc.date9.value);}
	if (document.calc.date10.value == &quot;&quot;) {d11.setTime(0)} else {d11 = dateobj(document.calc.date10.value);}
	if (document.calc.date11.value == &quot;&quot;) {d12.setTime(0)} else {d12 = dateobj(document.calc.date11.value);}
	if (document.calc.date12.value == &quot;&quot;) {d13.setTime(0)} else {d13 = dateobj(document.calc.date12.value);}
	if (document.calc.dateend.value == &quot;&quot;) {displaymsg(&quot;Please enter an end date&quot;);return;}
	if (document.calc.dateend.value == &quot;&quot;) {d14.setTime(0)} else {d14 = dateobj(document.calc.dateend.value);}


	if ((d1.getTime() == 0) &amp;&amp; (document.calc.datestart.value != &quot;&quot;)) {displaymsg(&quot;The start date is invalid&quot;);return;}
	if ((d2.getTime() == 0) &amp;&amp; (document.calc.date1.value != &quot;&quot;)) {displaymsg(&quot;The first transaction date is invalid&quot;);return;}
	if ((d3.getTime() == 0) &amp;&amp; (document.calc.date2.value != &quot;&quot;)) {displaymsg(&quot;The second transaction date is invalid&quot;);return;}
	if ((d4.getTime() == 0) &amp;&amp; (document.calc.date3.value != &quot;&quot;)) {displaymsg(&quot;The third transaction date is invalid&quot;);return;}
	if ((d5.getTime() == 0) &amp;&amp; (document.calc.date4.value != &quot;&quot;)) {displaymsg(&quot;The fourth transaction date is invalid&quot;);return;}
	if ((d6.getTime() == 0) &amp;&amp; (document.calc.date5.value != &quot;&quot;)) {displaymsg(&quot;The fifth transaction date is invalid&quot;);return;}
	if ((d7.getTime() == 0) &amp;&amp; (document.calc.date6.value != &quot;&quot;)) {displaymsg(&quot;The sixth transaction date is invalid&quot;);return;}
	if ((d8.getTime() == 0) &amp;&amp; (document.calc.date7.value != &quot;&quot;)) {displaymsg(&quot;The seventh transaction date is invalid&quot;);return;}
	if ((d9.getTime() == 0) &amp;&amp; (document.calc.date8.value != &quot;&quot;)) {displaymsg(&quot;The eigth transaction date is invalid&quot;);return;}
	if ((d10.getTime() == 0) &amp;&amp; (document.calc.date9.value != &quot;&quot;)) {displaymsg(&quot;The ninth transaction date is invalid&quot;);return;}
	if ((d11.getTime() == 0) &amp;&amp; (document.calc.date10.value != &quot;&quot;)) {displaymsg(&quot;The tenth transaction date is invalid&quot;);return;}
	if ((d12.getTime() == 0) &amp;&amp; (document.calc.date11.value != &quot;&quot;)) {displaymsg(&quot;The eleventh transaction date is invalid&quot;);return;}
	if ((d13.getTime() == 0) &amp;&amp; (document.calc.date12.value != &quot;&quot;)) {displaymsg(&quot;The twelveth transaction date is invalid&quot;);return;}
	if (d14.getTime() == 0) {displaymsg(&quot;The end date is invalid&quot;);return;}

	// calc terms
	if (d1.getTime() == 0) {t1 = 0} else {t1 = calcterm(d1,d14);} 
	if (t1 &lt; 0) {displaymsg(&quot;Start date must be earlier than end date&quot;);return;}

	if (d2.getTime() == 0) {t2 = 0} else {t2 = calcterm(d2,d14);} 
	if (t2 &lt; 0) {displaymsg(&quot;Transaction date (1st) must be earlier than end date&quot;);return;}

	if (d3.getTime() == 0) {t3 = 0} else {t3 = calcterm(d3,d14);} 
	if (t3 &lt; 0) {displaymsg(&quot;Transaction date (2nd) must be earlier than end date&quot;);return;}

	if (d4.getTime() == 0) {t4 = 0} else {t4 = calcterm(d4,d14);} 
	if (t4 &lt; 0) {displaymsg(&quot;Transaction date (3rd) must be earlier than end date&quot;);return;}

	if (d5.getTime() == 0) {t5 = 0} else {t5 = calcterm(d5,d14);}
	if (t5 &lt; 0) {displaymsg(&quot;Transaction date (4th) must be earlier than end date&quot;);return;}

	if (d6.getTime() == 0) {t6 = 0} else {t6 = calcterm(d6,d14);}
	if (t6 &lt; 0) {displaymsg(&quot;Transaction date (5th) must be earlier than end date&quot;);return;}

	if (d7.getTime() == 0) {t7 = 0} else {t7 = calcterm(d7,d14);}
	if (t7 &lt; 0) {displaymsg(&quot;Transaction date (6th) must be earlier than end date&quot;);return;}
	
	if (d8.getTime() == 0) {t8 = 0} else {t8 = calcterm(d8,d14);}
	if (t8 &lt; 0) {displaymsg(&quot;Transaction date (7th) must be earlier than end date&quot;);return;}

	if (d9.getTime() == 0) {t9 = 0} else {t9 = calcterm(d9,d14);}
	if (t9 &lt; 0) {displaymsg(&quot;Transaction date (8th) must be earlier than end date&quot;);return;}

	if (d10.getTime() == 0) {t10 = 0} else {t10 = calcterm(d10,d14);}
	if (t10 &lt; 0) {displaymsg(&quot;Transaction date (9th) must be earlier than end date&quot;);return;}

	if (d11.getTime() == 0) {t11 = 0} else {t11 = calcterm(d11,d14);}
	if (t11 &lt; 0) {displaymsg(&quot;Transaction date (10th) must be earlier than end date&quot;);return;}
	
	if (d12.getTime() == 0) {t12 = 0} else {t12 = calcterm(d12,d14);}
	if (t12 &lt; 0) {displaymsg(&quot;Transaction date (11th) must be earlier than end date&quot;);return;}

	if (d13.getTime() == 0) {t13 = 0} else {t13 = calcterm(d13,d14);}
	if (t13 &lt; 0) {displaymsg(&quot;Transaction date (12th) must be earlier than end date&quot;);return;}
 

	if ((t1 &gt; 0) &amp;&amp; (t2 &gt; 0) &amp;&amp; (t1 &lt; t2)) {displaymsg(&quot;Start date must be earlier than transaction date (1st)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t3 &gt; 0) &amp;&amp; (t1 &lt; t3)) {displaymsg(&quot;Start date must be earlier than transaction date (2nd)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t4 &gt; 0) &amp;&amp; (t1 &lt; t4)) {displaymsg(&quot;Start date must be earlier than transaction date (3rd)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t5 &gt; 0) &amp;&amp; (t1 &lt; t5)) {displaymsg(&quot;Start date must be earlier than transaction date (4th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t6 &gt; 0) &amp;&amp; (t1 &lt; t6)) {displaymsg(&quot;Start date must be earlier than transaction date (5th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t7 &gt; 0) &amp;&amp; (t1 &lt; t7)) {displaymsg(&quot;Start date must be earlier than transaction date (6th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t8 &gt; 0) &amp;&amp; (t1 &lt; t8)) {displaymsg(&quot;Start date must be earlier than transaction date (7th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t9 &gt; 0) &amp;&amp; (t1 &lt; t9)) {displaymsg(&quot;Start date must be earlier than transaction date (8th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t10 &gt; 0) &amp;&amp; (t1 &lt; t10)) {displaymsg(&quot;Start date must be earlier than transaction date (9th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t11 &gt; 0) &amp;&amp; (t1 &lt; t11)) {displaymsg(&quot;Start date must be earlier than transaction date (10th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t12 &gt; 0) &amp;&amp; (t1 &lt; t12)) {displaymsg(&quot;Start date must be earlier than transaction date (11th)&quot;);return;}
	if ((t1 &gt; 0) &amp;&amp; (t13 &gt; 0) &amp;&amp; (t1 &lt; t13)) {displaymsg(&quot;Start date must be earlier than transaction date (12th)&quot;);return;}

	// get amounts
	a1 = parseFloat(document.calc.amountstart.value);
	if (isNaN(a1)) {a1 = 0;}
	if (a1 &lt; 0) {displaymsg(&quot;Start amount may not be negative&quot;);return;}

	a2 = parseFloat(document.calc.amount1.value);
	if (isNaN(a2)) {a2 = 0;}
	if (a2 &lt; 0) {displaymsg(&quot;Transaction amount (1st) may not be negative&quot;);return;}

	a3 = parseFloat(document.calc.amount2.value);
	if (isNaN(a3)) {a3 = 0;}
	if (a3 &lt; 0) {displaymsg(&quot;Transaction amount (2nd) may not be negative&quot;);return;}

	a4 = parseFloat(document.calc.amount3.value);
	if (isNaN(a4)) {a4 = 0;}
	if (a4 &lt; 0) {displaymsg(&quot;Transaction amount (3rd) may not be negative&quot;);return;}

	a5 = parseFloat(document.calc.amount4.value);
	if (isNaN(a5)) {a5 = 0;}
	if (a5 &lt; 0) {displaymsg(&quot;Transaction amount (4th) may not be negative&quot;);return;}

	a6 = parseFloat(document.calc.amount5.value);
	if (isNaN(a6)) {a6 = 0;}
	if (a6 &lt; 0) {displaymsg(&quot;Transaction amount (5th) may not be negative&quot;);return;}

	a7 = parseFloat(document.calc.amount6.value);
	if (isNaN(a7)) {a7 = 0;}
	if (a7 &lt; 0) {displaymsg(&quot;Transaction amount (6th) may not be negative&quot;);return;}

	a8 = parseFloat(document.calc.amount7.value);
	if (isNaN(a8)) {a8 = 0;}
	if (a8 &lt; 0) {displaymsg(&quot;Transaction amount (7th) may not be negative&quot;);return;}

	a9 = parseFloat(document.calc.amount8.value);
	if (isNaN(a9)) {a9 = 0;}
	if (a9 &lt; 0) {displaymsg(&quot;Transaction amount (8th) may not be negative&quot;);return;}

	a10 = parseFloat(document.calc.amount9.value);
	if (isNaN(a10)) {a10 = 0;}
	if (a10 &lt; 0) {displaymsg(&quot;Transaction amount (9th) may not be negative&quot;);return;}

	a11 = parseFloat(document.calc.amount10.value);
	if (isNaN(a11)) {a11 = 0;}
	if (a11 &lt; 0) {displaymsg(&quot;Transaction amount (10th) may not be negative&quot;);return;}

	a12 = parseFloat(document.calc.amount11.value);
	if (isNaN(a12)) {a12 = 0;}
	if (a12 &lt; 0) {displaymsg(&quot;Transaction amount (11th) may not be negative&quot;);return;}

	a13 = parseFloat(document.calc.amount12.value);
	if (isNaN(a13)) {a13 = 0;}
	if (a13 &lt; 0) {displaymsg(&quot;Transaction amount (12th) may not be negative&quot;);return;}	

	a14 = parseFloat(document.calc.amountend.value);
	if (isNaN(a14)) {a14 = 0;}
	if (a14 &lt; 0) {displaymsg(&quot;End amount may not be negative&quot;);return;}

	//if (a1 &gt; 0) {document.calc.amountstart.value = currency(a1)}
	//if (a2 &gt; 0) {document.calc.amount1.value = currency(a2)}
	//if (a3 &gt; 0) {document.calc.amount2.value = currency(a3)}
	//if (a4 &gt; 0) {document.calc.amount3.value = currency(a4)}
	//if (a5 &gt; 0) {document.calc.amountend.value = currency(a5)}

	if ((t1 == 0) &amp;&amp; (a1 != 0)) {displaymsg(&quot;Start date must be entered as well as amount&quot;);return;}
	if ((t2 == 0) &amp;&amp; (a2 != 0)) {displaymsg(&quot;Transaction date (1st) must be entered as well as amount&quot;);return;}
	if ((t3 == 0) &amp;&amp; (a3 != 0)) {displaymsg(&quot;Transaction date (2nd) must be entered as well as amount&quot;);return;}
	if ((t4 == 0) &amp;&amp; (a4 != 0)) {displaymsg(&quot;Transaction date (3rd) must be entered as well as amount&quot;);return;}
	if ((t5 == 0) &amp;&amp; (a5 != 0)) {displaymsg(&quot;Transaction date (4th) must be entered as well as amount&quot;);return;}
	if ((t6 == 0) &amp;&amp; (a6 != 0)) {displaymsg(&quot;Transaction date (5th) must be entered as well as amount&quot;);return;}
	if ((t7 == 0) &amp;&amp; (a7 != 0)) {displaymsg(&quot;Transaction date (6th) must be entered as well as amount&quot;);return;}
	if ((t8 == 0) &amp;&amp; (a8 != 0)) {displaymsg(&quot;Transaction date (7th) must be entered as well as amount&quot;);return;}
	if ((t9 == 0) &amp;&amp; (a9 != 0)) {displaymsg(&quot;Transaction date (8th) must be entered as well as amount&quot;);return;}
	if ((t10 == 0) &amp;&amp; (a10 != 0)) {displaymsg(&quot;Transaction date (9th) must be entered as well as amount&quot;);return;}
	if ((t11 == 0) &amp;&amp; (a11 != 0)) {displaymsg(&quot;Transaction date (10th) must be entered as well as amount&quot;);return;}
	if ((t12 == 0) &amp;&amp; (a12 != 0)) {displaymsg(&quot;Transaction date (11th) must be entered as well as amount&quot;);return;}
	if ((t13 == 0) &amp;&amp; (a13 != 0)) {displaymsg(&quot;Transaction date (12th) must be entered as well as amount&quot;);return;}

	// default the transactions to buys
	if ((!document.calc.buysell1[0].checked) &amp;&amp; (!document.calc.buysell1[1].checked) &amp;&amp; (a2 != 0))
		document.calc.buysell1[0].checked = true;
	if ((!document.calc.buysell2[0].checked) &amp;&amp; (!document.calc.buysell2[1].checked) &amp;&amp; (a3 != 0))
		document.calc.buysell2[0].checked = true;
	if ((!document.calc.buysell3[0].checked) &amp;&amp; (!document.calc.buysell3[1].checked) &amp;&amp; (a4 != 0))
		document.calc.buysell3[0].checked = true;
	if ((!document.calc.buysell4[0].checked) &amp;&amp; (!document.calc.buysell4[1].checked) &amp;&amp; (a5 != 0))
		document.calc.buysell4[0].checked = true;
	if ((!document.calc.buysell5[0].checked) &amp;&amp; (!document.calc.buysell5[1].checked) &amp;&amp; (a6 != 0))
		document.calc.buysell5[0].checked = true;
	if ((!document.calc.buysell6[0].checked) &amp;&amp; (!document.calc.buysell6[1].checked) &amp;&amp; (a7 != 0))
		document.calc.buysell6[0].checked = true;
	if ((!document.calc.buysell7[0].checked) &amp;&amp; (!document.calc.buysell7[1].checked) &amp;&amp; (a8 != 0))
		document.calc.buysell7[0].checked = true;
	if ((!document.calc.buysell8[0].checked) &amp;&amp; (!document.calc.buysell8[1].checked) &amp;&amp; (a9 != 0))
		document.calc.buysell8[0].checked = true;
	if ((!document.calc.buysell9[0].checked) &amp;&amp; (!document.calc.buysell9[1].checked) &amp;&amp; (a10 != 0))
		document.calc.buysell9[0].checked = true;
	if ((!document.calc.buysell10[0].checked) &amp;&amp; (!document.calc.buysell10[1].checked) &amp;&amp; (a11 != 0))
		document.calc.buysell10[0].checked = true;
	if ((!document.calc.buysell11[0].checked) &amp;&amp; (!document.calc.buysell11[1].checked) &amp;&amp; (a12 != 0))
		document.calc.buysell11[0].checked = true;
	if ((!document.calc.buysell12[0].checked) &amp;&amp; (!document.calc.buysell12[1].checked) &amp;&amp; (a13 != 0))
		document.calc.buysell12[0].checked = true;

	// switch amounts for sells
	if (document.calc.buysell1[1].checked == true) a2 = 0 - a2;	
	if (document.calc.buysell2[1].checked == true) a3 = 0 - a3;	
	if (document.calc.buysell3[1].checked == true) a4 = 0 - a4;	
	if (document.calc.buysell4[1].checked == true) a5 = 0 - a5;	
	if (document.calc.buysell5[1].checked == true) a6 = 0 - a6;	
	if (document.calc.buysell6[1].checked == true) a7 = 0 - a7;	
	if (document.calc.buysell7[1].checked == true) a8 = 0 - a8;	
	if (document.calc.buysell8[1].checked == true) a9 = 0 - a9;	
	if (document.calc.buysell9[1].checked == true) a10 = 0 - a10;	
	if (document.calc.buysell10[1].checked == true) a11 = 0 - a11;	
	if (document.calc.buysell11[1].checked == true) a12 = 0 - a12;	
	if (document.calc.buysell12[1].checked == true) a13 = 0 - a13;	

	document.calc.msg.value = &quot;Looking good so far...&quot;


	// calculate dollar gain
	gain = a14 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 - a10 - a11 - a12 - a13 - a1;

	// calculate roi
	if (a1 &gt; 0) longamt+=a1;
	if (a2 &gt; 0) longamt+=a2;
	if (a3 &gt; 0) longamt+=a3;
	if (a4 &gt; 0) longamt+=a4;
	if (a5 &gt; 0) longamt+=a5;
	if (a6 &gt; 0) longamt+=a6;
	if (a7 &gt; 0) longamt+=a7;
	if (a8 &gt; 0) longamt+=a8;
	if (a9 &gt; 0) longamt+=a9;
	if (a10 &gt; 0) longamt+=a10;
	if (a11 &gt; 0) longamt+=a11;
	if (a12 &gt; 0) longamt+=a12;
	if (a13 &gt; 0) longamt+=a13;

	if (longamt &lt;= 0) {
		document.calc.gain.value = currency(gain)
		document.calc.roi.value = &quot;Error&quot;
		document.calc.rate.value = &quot;Error&quot;
		document.calc.msg.value = &quot;No positive transactions&quot;
		return;   }

	roi = 100 * gain / longamt;
	//format results
	document.calc.gain.value = currency(gain)
	document.calc.roi.value = fixed(roi) + &quot;%&quot;
	//document.calc.gain.value = gain
	//document.calc.roi.value = roi + &quot;%&quot;

	// solve for rate
	pass_count = 0;
	pct_tolerance = .0000001; 
	abs_tolerance = .1; 
	max_passes = 32;
	close_enough = 0;
	try_rate = .05; 
	guess = .05;
	while (1) { 
		pass_count++; accum_val = 0; accum_deriv = 0;
		accum_val += a1 * Math.pow(1.0 + try_rate, t1); 
		accum_val += a2 * Math.pow(1.0 + try_rate, t2); 
		accum_val += a3 * Math.pow(1.0 + try_rate, t3); 
		accum_val += a4 * Math.pow(1.0 + try_rate, t4); 
		accum_val += a5 * Math.pow(1.0 + try_rate, t5); 
		accum_val += a6 * Math.pow(1.0 + try_rate, t6); 
		accum_val += a7 * Math.pow(1.0 + try_rate, t7); 
		accum_val += a8 * Math.pow(1.0 + try_rate, t8);
		accum_val += a9 * Math.pow(1.0 + try_rate, t9); 
		accum_val += a10 * Math.pow(1.0 + try_rate, t10); 
		accum_val += a11 * Math.pow(1.0 + try_rate, t11); 
		accum_val += a12 * Math.pow(1.0 + try_rate, t12);
		accum_val += a13 * Math.pow(1.0 + try_rate, t13);
		accum_deriv += a1 * t1 * Math.pow(1.0 + try_rate, t1 - 1) / 100.0; 
		accum_deriv += a2 * t2 * Math.pow(1.0 + try_rate, t2 - 1) / 100.0; 
		accum_deriv += a3 * t3 * Math.pow(1.0 + try_rate, t3 - 1) / 100.0; 
		accum_deriv += a4 * t4 * Math.pow(1.0 + try_rate, t4 - 1) / 100.0; 
		accum_deriv += a5 * t5 * Math.pow(1.0 + try_rate, t5 - 1) / 100.0; 
		accum_deriv += a6 * t6 * Math.pow(1.0 + try_rate, t6 - 1) / 100.0; 
		accum_deriv += a7 * t7 * Math.pow(1.0 + try_rate, t7 - 1) / 100.0; 
		accum_deriv += a8 * t8 * Math.pow(1.0 + try_rate, t8 - 1) / 100.0; 
		accum_deriv += a9 * t9 * Math.pow(1.0 + try_rate, t9 - 1) / 100.0; 
		accum_deriv += a10 * t10 * Math.pow(1.0 + try_rate, t10 - 1) / 100.0; 
		accum_deriv += a11 * t11 * Math.pow(1.0 + try_rate, t11 - 1) / 100.0; 
		accum_deriv += a12 * t12 * Math.pow(1.0 + try_rate, t12 - 1) / 100.0; 
		accum_deriv += a13 * t13 * Math.pow(1.0 + try_rate, t13 - 1) / 100.0;

		document.calc.msg.value = try_rate
		off_by = a14 - accum_val;

		if (a14 &gt; 0) {
			pct_off_by = Math.abs(accum_val - a14) / a14; 		
			if (pct_off_by &lt;= pct_tolerance) {close_enough = 1;break;}
	    	}
		else {
			if (Math.abs(off_by) &lt;= abs_tolerance) {close_enough = 1;break;}
		}

		if (pass_count &gt;= max_passes) {break;}

		if (accum_deriv &gt; 0) {
			try_delta = (off_by / accum_deriv) / 100.0; 

			if (try_delta &gt; -1) {		
				try_rate = try_rate + try_delta;
			}
			else {
				try_rate = try_rate + try_delta;

				if (try_rate &lt; 0){
					try_rate = try_rate - try_delta;
					if (try_rate &lt;= -.99) {try_rate = -1.0;close_enough = 1;break;} else {try_rate = -.99;}
				}
			}
		}
		else
		{
			if (try_rate &lt;= 0) {try_rate = guess;} else {try_rate = 2 * try_rate;}
		}
	} 	

	// trace code
	//document.calc.amount1.value = pass_count
	//document.calc.amount2.value = accum_val
	//document.calc.amount3.value = try_rate

	if (close_enough)
	{
		if (try_rate &lt;= -.99) {try_rate = -1.0;}
		try_rate *= 100.0
		document.calc.rate.value = fixed(try_rate) + &quot;%&quot;
		document.calc.msg.value = &quot;Calculation successful...&quot;
	}
	else
	{
		document.calc.rate.value = &quot;Error&quot;
		document.calc.msg.value = &quot;Calculation failed, unable to converge...&quot;
	}
	return;
}
// unhide script --&gt;
&lt;/script&gt;&lt;h2&gt;Real rate of return Calculator&lt;/h2&gt;
&lt;p&gt;Use this calculator to determine a real rate of return on your assets.&lt;br /&gt;
&lt;a href=&quot;javascript:Start(&#039;calcinst.phtml&#039;);&quot;&gt;Click here for instructions.&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;javascript:history.go(-1)&quot;;&gt;Go Back&lt;/a&gt;
&lt;/p&gt;
&lt;!-- google_ad_section_end --&gt;
&lt;p&gt;&lt;a href=&quot;http://www.profitsharing.org/node/34&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.profitsharing.org/node/34#comment</comments>
 <category domain="http://www.profitsharing.org/taxonomy/term/8">maximizing your funds</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/2">Performance</category>
 <pubDate>Fri, 22 Sep 2006 06:50:27 -0500</pubDate>
 <dc:creator>rgbaird</dc:creator>
 <guid isPermaLink="false">34 at http://www.profitsharing.org</guid>
</item>
<item>
 <title>Funds ranked by relative strength</title>
 <link>http://www.profitsharing.org/node/31</link>
 <description>&lt;!-- google_ad_section_start --&gt;
&lt;p&gt;Top 20 funds ranked by relative strength.  If you were going to buy the best 20 funds this week, this is the list you would buy.&lt;/p&gt;
&lt;p&gt;You can view the full list &lt;a href=&quot;http://www.profitsharing.org/node/30&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;!-- google_ad_section_end --&gt;
</description>
 <comments>http://www.profitsharing.org/node/31#comment</comments>
 <category domain="http://www.profitsharing.org/taxonomy/term/2">Performance</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/3">rating</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/5">relative strength</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/6">top 20</category>
 <pubDate>Thu, 14 Sep 2006 08:54:17 -0500</pubDate>
 <dc:creator>rgbaird</dc:creator>
 <guid isPermaLink="false">31 at http://www.profitsharing.org</guid>
</item>
<item>
 <title>Full listing of funds ranked by relative strength</title>
 <link>http://www.profitsharing.org/node/30</link>
 <description>&lt;!-- google_ad_section_start --&gt;
&lt;p&gt;Here is the full listing of funds ranked by relative strength.&lt;/p&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;&lt;i&gt;Security Name&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;&lt;i&gt;Close&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;&lt;i&gt;Index&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;&lt;i&gt;Rel Strn&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;&lt;i&gt;Ticker Symbol&lt;/i&gt;&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ML Regional Bank Hldrs&lt;/td&gt;
&lt;td&gt;152.52&lt;/td&gt;
&lt;td&gt;1298.92&lt;/td&gt;
&lt;td&gt;0.1174&lt;/td&gt;
&lt;td&gt;RKH&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iSHRS SP LATIN AM 40 INDEX&lt;/td&gt;
&lt;td&gt;138.64&lt;/td&gt;
&lt;td&gt;1298.92&lt;/td&gt;
&lt;td&gt;0.1067&lt;/td&gt;
&lt;td&gt;ILF&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SPDR MID CAP&lt;/td&gt;
&lt;!-- google_ad_section_end --&gt;
&lt;p&gt;&lt;a href=&quot;http://www.profitsharing.org/node/30&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.profitsharing.org/node/30#comment</comments>
 <category domain="http://www.profitsharing.org/taxonomy/term/2">Performance</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/3">rating</category>
 <category domain="http://www.profitsharing.org/taxonomy/term/4">relaticve strength</category>
 <pubDate>Tue, 12 Sep 2006 08:24:29 -0500</pubDate>
 <dc:creator>rgbaird</dc:creator>
 <guid isPermaLink="false">30 at http://www.profitsharing.org</guid>
</item>
</channel>
</rss>
