// JavaScript Document

// begin profile selection
function chkForm()
 {
	//clear the error labels
	 document.form1.errPersonality.value = "";
	 document.form1.errConcern.value = "";
	 document.form1.errStatus.value = "";
		
	//get selected values from select controls          
	 selPersIndx = (document.form1.selPersonality.value)
	 selConIndx = (document.form1.selConcern.value)
	 selStatusIndx = (document.form1.selStatus.value)
	 
	 //initialize errorflag
	 error = "f";
	 invType = ""; 
	 
	 //make sure all selections have been made
		if (selPersIndx == "X")
		 {
			error = "t";
			document.form1.errPersonality.value = "Please choose...";
		 }
		else
		 {
		   invType = selPersIndx;
		 }
		 
		
		if (selConIndx == "X")
		 {
			error = "t";
			document.form1.errConcern.value = "Please choose..."; 
		 } 
		else
		  {
			invType = invType + selConIndx; 
		  }
			   
		if (selStatusIndx == "X")
		 {
			error = "t";
			document.form1.errStatus.value = "Please choose...";
		 }
		else
		 {
			invType = invType + selStatusIndx;
		 }
		//if no errors evaluate page re-direction
		if (error == "f")
		 {        
			nxtPage(invType);
		 }
	
	}
	
function nxtPage(invType)
 {
  
	//alert(invType);
	spenderhtml = "spender.html";
	saverhtml = "saver.html";
	plannerhtml = "planner.html";
	investorhtml = "investor.html";
	
	 switch (invType)
		{
		case "AAA":
			location = spenderhtml;
			break;
		case "AAB":
			location = spenderhtml;
			break;
		case "AAC":
			location = spenderhtml;
			break;
		case "ABA":
			location = spenderhtml;
			break;
		case "ABB":
			location = saverhtml;
			break;
		case "ABC":
			location = saverhtml;
			break;
		case "ACA":
			location = spenderhtml;
			break;
		case "ACB":
			location = saverhtml;
			break;
		case "ACC":
			location = saverhtml;
			break;
		case "BAA":
			location = spenderhtml;
			break;
		case "BAB":
			location = saverhtml;
			break;
		case "BAC":
			location = spenderhtml;
			break;
		case "BBA":
			location = spenderhtml;
			break;
		case "BBB":
			location = saverhtml;
			break;
		case "BBC":
			location = saverhtml;
			break;
		case "BCA":
			location = spenderhtml;
			break;
		case "BCB":
			location = saverhtml;
			break;
		case "BCC":
		   location = investorhtml;
			break;
		case "CAA":
			location = spenderhtml;
			break;
		case "CAB":
			location = saverhtml;
			break;
		case "CAC":
			location = spenderhtml;
			break;
		case "CBA":
			location = spenderhtml;
			break;
		case "CBB":
		   location = investorhtml;
			break;
		case "CBC":
			location = plannerhtml;
			break;
		case "CCA":
			location = spenderhtml;
			break;
		case "CCB":
			location = plannerhtml;
			break;
		case "CCC":
			location = plannerhtml;
			break;
		}  
 }
  // end profile selection
  
  
  //Tips to be randomly selected for index.html

var arrTips=new Array();
//Add Tips to array to be selected. To add new tips, keep in mind that quotes must be escaped (see examples in code)

arrTips[arrTips.length] = 'A Spender manages money to find dollars to save.';
arrTips[arrTips.length] = 'The key is to separate needs from wants.';
arrTips[arrTips.length] = 'If you spend too much now, you will certainly pay later.';
arrTips[arrTips.length] = 'Budgeting - no pain, no gain.';
arrTips[arrTips.length] = 'What was your last impulse purchase? Was it worth it?';
arrTips[arrTips.length] = '\"Living for today\" isn\'t always the best policy.';
arrTips[arrTips.length] = 'A Saver understands the importance of tomorrow.';
arrTips[arrTips.length] = 'Bump - Volleyball term, dance move, or savings increase. You choose.';
arrTips[arrTips.length] = 'Life can\'t be like a 4 year olds soccer game. There needs to be goals.';
arrTips[arrTips.length] = 'Your retirement plan gives you the way. Do you have the will?';
arrTips[arrTips.length] = 'If you\'re saving, put your arm up, bend your elbow, pat yourself on the back.';
arrTips[arrTips.length] = 'Have you thought about how much you will need at retirement?';
arrTips[arrTips.length] = 'An Investor makes appropriate decisions based on goals.';
arrTips[arrTips.length] = 'If you have seen all of these tips, you\'ve been here too much. Relax.';
arrTips[arrTips.length] = 'Portfolio - your collection of investments ';
arrTips[arrTips.length] = 'Stock - a simmering liquid used for soup, gravy or sauce';
arrTips[arrTips.length] = 'A stock mutual fund is a collection of similar types of stocks.';
arrTips[arrTips.length] = 'The Planner uses the tools available to achieve their goals.';
arrTips[arrTips.length] = 'Have you thought about what retirement might look like? Start dreaming.';
arrTips[arrTips.length] = 'Don\'t just dream. Do what\'s needed to make it happen.';
arrTips[arrTips.length] = 'Ring Ring. It\'s your future calling. Answer.';
arrTips[arrTips.length] = 'If you forget to save, you can forget retirement.';
arrTips[arrTips.length] = 'Start early. Save often. Retire happy.';
arrTips[arrTips.length] = 'Sharpened saving skills sets savers sailing.';
arrTips[arrTips.length] = 'Will I get there? Magic 8-ball says \"Yes, if you\'re saving enough\"';
arrTips[arrTips.length] = 'Retirement will be your last job. Make sure you get paid well.';
arrTips[arrTips.length] = '10 plus 10 can equal more than 20 with good investment decisions.';
arrTips[arrTips.length] = 'Retirement? Will it be putt-putt or the country club?';
arrTips[arrTips.length] = 'Silly retirement tips mean nothing if they don\'t mean anything to you.';
arrTips[arrTips.length] = 'The big bear says - Only you can save.';
arrTips[arrTips.length] = 'Plant the seeds of saving and watch them grow.';
arrTips[arrTips.length] = 'Review and adjust your goals occasionally, not often.';


function getTip() {
	
	//Select random numberbetween 1 and number of tips.
	var intTip=Math.floor(Math.random()*(arrTips.length-1)) + 1;

	//Set html in Tip Div
	tipHTML = '<h4>Tip #' + (intTip) + ' from the Dean</h4>';
	tipHTML = tipHTML + '<p>' + arrTips[intTip] + '</p>';
	document.getElementById('infoblock').innerHTML = tipHTML;

}

window.onload=getTip;
		
 