function calcRisk() {
	var qArray = new Array(0,0,0,0,0,0,0,0);
	var resdiv = document.getElementById('result');
	var filled = true;
	var total = 0;
	var i = 0;

	for (i=0; i < document.frm.question1.length; i++) {
		if (document.frm.question1[i].checked) {
			qArray[0] = parseFloat(document.frm.question1[i].value);
		}
	}
	
	for (i=0; i < document.frm.question2.length; i++) {
		if (document.frm.question2[i].checked) {
			qArray[1] = parseFloat(document.frm.question2[i].value);
		}
	}
	
	for (i=0; i < document.frm.question3.length; i++) {
		if (document.frm.question3[i].checked) {
			qArray[2] = parseFloat(document.frm.question3[i].value);
		}
	}
	
	for (i=0; i < document.frm.question4.length; i++) {
		if (document.frm.question4[i].checked) {
			qArray[3] = parseFloat(document.frm.question4[i].value);
		}
	}
	
	for (i=0; i < document.frm.question5.length; i++) {
		if (document.frm.question5[i].checked) {
			qArray[4] = parseFloat(document.frm.question5[i].value);
		}
	}
	
	for (i=0; i < document.frm.question6.length; i++) {
		if (document.frm.question6[i].checked) {
			qArray[5] = parseFloat(document.frm.question6[i].value);
		}
	}
	
	for (i=0; i < document.frm.question7.length; i++) {
		if (document.frm.question7[i].checked) {
			qArray[6] = parseFloat(document.frm.question7[i].value);
		}
	}
	
	for (i=0; i < document.frm.question8.length; i++) {
		if (document.frm.question8[i].checked) {
			qArray[7] = parseFloat(document.frm.question8[i].value);
		}
	}
	
	for (var q = 0; q < qArray.length; q++) {
		if (qArray[q] == 0) {
			filled = false;
		}
	}
	
	if (filled == false) {
		resdiv.innerHTML = "<p class='error'>INCOMPLETE: Please provide answers to all 8 questions by checking the appropriate box.</p>";
	} else {
		for (i=0; i < qArray.length; i++) {
			total += qArray[i];
		}
		parseTotal(total);
	}

}

function parseTotal(total) {
	var resdiv = document.getElementById('result');
	
	if (total > 7 && total < 27) {

		resdiv.innerHTML = "<p class='profile'>Prudent profile:</p><div class='advice'>Capital security is important to you. You have a low tolerance of volatility. You are primarily seeking investments that offer a regular income and capital preservation.</div><ul class='percent'><li>10% Global Equity</li><li>15% Canadian Equity</li><li>75% Income</li></ul><img src='/wp-content/themes/savii/images/prudent.gif'>";
	} else if (total > 26 && total < 56) {

		resdiv.innerHTML = "<p class='profile'>Moderate profile:</p><div class='advice'>You are seeking a certain level of capital appreciation and your tolerance to risk is moderate. You favour investments that offer a relatively stable income.</div><ul class='percent'><li>15% Global Equity</li><li>25% Canadian Equity</li><li>60% Income</li></ul><img src='/wp-content/themes/savii/images/moderate.gif'>";
	} else if (total > 55 && total < 90) {

		resdiv.innerHTML = "<p class='profile'>Balanced profile:</p><div class='advice'>You are seeking a balance between income and capital appreciation. Your risk tolerance level is average. You are targeting medium and long-term capital appreciation.</div><ul class='percent'><li>20% Global Equity</li><li>35% Canadian Equity</li><li>45% Income</li></ul><img src='/wp-content/themes/savii/images/balanced.gif'>";
	} else if (total > 89 && total < 120) {

		resdiv.innerHTML = "<p class='profile'>Growth profile:</p><div class='advice'>You are seeking above-average growth and are ready to accept a high level of risk. You are a patient investor and you do not allow yourself to be influenced by fluctuations in your portfolio.</div><ul class='percent'><li>25% Global Equity</li><li>30% Income</li><li>45% Canadian Equity</li></ul><img src='/wp-content/themes/savii/images/growth.gif'>";
	} else if (total > 119 && total < 161) {

		resdiv.innerHTML = "<p class='profile'>Aggressive profile:</p><div class='advice'>You have a strong tolerance of risk and market fluctuations do not worry you. You are seeking superior portfolio growth and are willing to accept substantial variations in the value of your portfolio from one year to the next.</div><ul class='percent'><li>15% Income</li><li>30% Global Equity</li><li>55% Canadian Equity</li></ul><img src='/wp-content/themes/savii/images/aggressive.gif'>";

	}
}

function resetRsk() {
	var resdiv = document.getElementById('result');
	resdiv.innerHTML = "";
}
