    var answered = 0;
	var tally = 0;
	var radio_value = 0;
	var totalquestions = 10;
    
    function submitAnswer(questionId, classId, labelId, nameId) {
		document.getElementById(labelId).style.fontWeight = "bold";
		disableQuestion(classId);
		getValue(nameId)
		answered=answered+1;
		}
    
  	function getValue(nameId) {
		var element = document.getElementsByName(nameId);
		var count = element.length; 
		for (var i = 0; i <count; i++) {
	        if (element[i].checked == true) {
	            var radio_value = element[i].value;
			}
			}
		tally = parseInt(tally) + parseInt(radio_value)
		}

	
    
    function disableQuestion(classId) {
	var alltags=document.all? document.all : document.getElementsByTagName("*")
	for (i=0; i<alltags.length; i++)
	{
		if (alltags[i].className == classId)
		{
			alltags[i].disabled = true;
		}
	}
}
    
	

function showScore() {

	if (answered != totalquestions) {
	alert('Please answer all ten questions.');
	
	}
	else {


	//PREPARE VEIL
	Spry.$$("#modaltable").removeClassName("display");
	Spry.$$("#veil").removeClassName("display");
	
	//FADE-UP VEIL
	Spry.Effect.DoFade('veil', {duration: 250, from: 0, to: 80, finish: function() {

	//FADE-IN CONTENT 
	Spry.Utils.setInnerHTML('tally', '<span class="loader">Calculating Results</span>');
		Spry.$$("#modaltable").setStyle("visibility:visible");

	Spry.Effect.DoFade('tally',{duration: 500, from: 0, to: 100, finish: function() {
		top();
		setTimeout ("showResults()", 1000);
	}
	});
	}
	});
	}
}

	
var t;
function top() {
	
  if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){
    window.scrollBy(0,-200);
    t=setTimeout('top()',10);
	
  	}
  else { 
  clearTimeout(t);
  }
}
  
function showResults() {


// IF IE 6, JUMP TO TOP OF PAGE
var Browser = {
  Version: function() {
    var version = 999; 
    if (navigator.appVersion.indexOf("MSIE") != -1)
      version = parseFloat(navigator.appVersion.split("MSIE")[1]);
    return version;
  }
}

if (Browser.Version() < 7) {
window.location.hash="home"
}
	
	

		if (tally < 11) {
			Spry.Utils.updateContent('quiz_holder','results1.html');
					closeModal();

		}	
		else if (tally > 10 && tally < 20) {	
			Spry.Utils.updateContent('quiz_holder','results2.html');
			closeModal();

		}	
		if (tally > 19) {	
			Spry.Utils.updateContent('quiz_holder','results3.html');
			closeModal();
		}
	}


//CLOSE UPDATER

function closeModal() {
 	Spry.Effect.DoFade('tally', {duration: 250, from: 100, to: 0, finish: finishVeil});

function finishVeil () {

	Spry.Effect.DoFade('veil', {duration: 250, from: 80, to: 0, finish: finishModal});
	}
 
 function finishModal() {
 	Spry.$$("#modaltable").setStyle("visibilty: hidden");
	Spry.$$("#modaltable").addClassName("display");
	Spry.$$("#veil").addClassName("display");

	
	}
 }