<!--

var numQues = 15;
var numChoi = 6;


function getScore(form,score) {
  var score = 0;
  var myvalue = 0;
  var currElt;
  var currSelection;
  var profile = "";

  for (i=0; i<numQues; i++) {
    currElt = i*numChoi;
    for (j=0; j<numChoi; j++) {
      currSelection = form.elements[currElt + j];
      if (currSelection.checked) {
	  	myvalue = parseInt(currSelection.value);
        score = score + myvalue;
        break;
      }
    }
  }
  
// form.debug.value = score 

profile = "There isn't, unfortunately, much joy in your life.<br><br>The happy person likes to do useful, productive work, to use his abilities fully. He enjoys helping people, but is not self-sacrificing. At night, sleep researchers have found, he has little trouble falling asleep. He tends to be self-sufficient and can enjoy both solitude and company but is dependent on neither. Generally, he's orderly and punctual.<br><br>Though tolerant of people's minor flaws, the happy person dislikes cruelty and destructiveness. He is healthy, has no hang-ups about prosperity, and refuses to participate in other people's negative emotions - or cling to his own. When choosing a mate, he will pick a congenial, compatible, figure rather than someone romantic and glamorous. Like many busy, absorbed people, he feels days pass quickly, though in large units - weeks, months, years- time may seem endless. Finally, the happy person has a sense of progress, improvement, of getting somewhere.<br>";

if (score >24) {
	profile = "You experience some happy moments.<br><br>The happy person likes to do useful, productive work, to use his abilities fully. He enjoys helping people, but is not self-sacrificing. At night, sleep researchers have found, he has little trouble falling asleep. He tends to be self-sufficient and can enjoy both solitude and company but is dependent on neither. Generally, he's orderly and punctual.<br><br>Though tolerant of people's minor flaws, the happy person dislikes cruelty and destructiveness. He is healthy, has no hang-ups about prosperity, and refuses to participate in other people's negative emotions - or cling to his own. When choosing a mate, he will pick a congenial, compatible, figure rather than someone romantic and glamorous. Like many busy, absorbed people, he feels days pass quickly, though in large units - weeks, months, years- time may seem endless. Finally, the happy person has a sense of progress, improvement, of getting somewhere.<br>";
	} 
	
if (score >44) {
	profile = "You experience many happy moments<br><br>The happy person likes to do useful, productive work, to use his abilities fully. He enjoys helping people, but is not self-sacrificing. At night, sleep researchers have found, he has little trouble falling asleep. He tends to be self-sufficient and can enjoy both solitude and company but is dependent on neither. Generally, he's orderly and punctual.<br><br>Though tolerant of people's minor flaws, the happy person dislikes cruelty and destructiveness. He is healthy, has no hang-ups about prosperity, and refuses to participate in other people's negative emotions - or cling to his own. When choosing a mate, he will pick a congenial, compatible, figure rather than someone romantic and glamorous. Like many busy, absorbed people, he feels days pass quickly, though in large units - weeks, months, years- time may seem endless. Finally, the happy person has a sense of progress, improvement, of getting somewhere.<br>";
	}
	
if (score >64) {
	profile = "Your score qualifies you as a happy person.<br><br>The happy person likes to do useful, productive work, to use his abilities fully. He enjoys helping people, but is not self-sacrificing. At night, sleep researchers have found, he has little trouble falling asleep. He tends to be self-sufficient and can enjoy both solitude and company but is dependent on neither. Generally, he's orderly and punctual.<br><br>Though tolerant of people's minor flaws, the happy person dislikes cruelty and destructiveness. He is healthy, has no hang-ups about prosperity, and refuses to participate in other people's negative emotions - or cling to his own. When choosing a mate, he will pick a congenial, compatible, figure rather than someone romantic and glamorous. Like many busy, absorbed people, he feels days pass quickly, though in large units - weeks, months, years- time may seem endless. Finally, the happy person has a sense of progress, improvement, of getting somewhere.<br>";
	} 
	
var scoreWin = window.open ("","scorewin","width=480,height=400,screenX=270,screenY=184,left=270,top=184");

scoreWin.document.write('<html>'
  + '<head>'
  + '<title>How Happy Are You?</title>'
  + '<link rel="stylesheet" type="text/css" href="popup.css" />'
  + '</head>'
  + '<body>'
  + '<div class=c8>'
  + '<div class=c9>'
  + '<p align="center" valign="middle"><span class="c1"><b>Your score is ' + score + ' %.</span></b></p>' + profile
  + '</div>'
  + '</div>'
  + '<br>'
  + '</body>'
  + '</html>'
  + '');
  
scoreWin.document.close();  

}

// -->
