// JavaScript Document
function total() {
	if (
		parseFloat($("input[@name='Q1']").getValue()) &&
		parseFloat($("input[@name='Q2']").getValue()) &&												   
		parseFloat($("input[@name='Q3']").getValue()) &&
		parseFloat($("input[@name='Q4']").getValue()) &&
		parseFloat($("input[@name='Q5']").getValue()) &&
		parseFloat($("input[@name='Q6']").getValue()) &&
		parseFloat($("input[@name='Q7']").getValue()) &&
		parseFloat($("input[@name='Q8']").getValue()) &&
		parseFloat($("input[@name='Q9']").getValue()) &&
		parseFloat($("input[@name='Q10']").getValue())
		) {
	}
	else {
		return alert("Please make sure you have answered all questions.");
	}
	
	var total = parseFloat($("input[@name='Q1']").getValue()) 
				+ parseFloat($("input[@name='Q2']").getValue())
				+ parseFloat($("input[@name='Q3']").getValue())
				+ parseFloat($("input[@name='Q4']").getValue())
				+ parseFloat($("input[@name='Q5']").getValue())
				+ parseFloat($("input[@name='Q6']").getValue())
				+ parseFloat($("input[@name='Q7']").getValue())
				+ parseFloat($("input[@name='Q8']").getValue())
				+ parseFloat($("input[@name='Q9']").getValue())
				+ parseFloat($("input[@name='Q10']").getValue());
	$("#submit").hide(1000);
	$("ol").hide(1000);

	$("#answer").prepend("<strong>Your score was " + total + "/30.</strong><br>");
	
	if (total >= 20) {
		$("#answer").prepend('<h2>An online course is a real possibility for you.</h2>');
	}
	else if (total >= 19 ) {
		$("#answer").prepend('<h2>An online course may work for you, but you may need to make a few adjustments in your schedule and study habits to succeed.</h2>');
	}
	else if (total >= 10 ) {
		$("#answer").prepend('<h2>An online course may not currently be the best alternative for you; talk to your counselor.</h2>');
	}
	
	$("#answer").fadeIn(200);
	return total;
	
}

$(document).ready(function() {
	
	
	$("#submit").click(function() {
		total()
								
	});
						   
});