// JavaScript Document

//alert ('Sorry, form not yet fully functional.  Please check back soon')

function ans(form) {
  res = get(form);
  if (res == null) {
    alert("Sorry, you must answer all questions for a valid assessment. Please try again.");
    restore;   
 	}
  var dep = 1;
  var anx = 1;
  if (rha > 7) dep = 2;
  if (rha > 10) dep = 3;
  if (rha > 15) dep = 4;
  //alert (+dep);
  if (res > 7) anx = 2;
  if (res > 10) anx = 3;
  if (res > 15) anx = 4;
  //alert (+anx);
  location.href=""+anx+dep+".htm";	 
}

var rha = 0;
function get(form)
{
  var tot=0, value, sel;  //chk
  for(i = 0; i < form.elements.length; i++) {	
    if (form.elements[i].tagName == 'SELECT') {
      value = parseInt(form.elements[i].options[form.elements[i].selectedIndex].value);
      if (isNaN(value)) return null;
      if (value > 0) tot += value;
      else rha -= value;
    }
  }
  return tot;
}

