//Find out what the user has selected in Pros and Cons
function GetProsConsStressValues(filename) {
 
 var check = 0;
   var MyTotal = 0;
   var rowTotals = new Array();
   var intValue = 0;
      for (var i = 0; i < 3; i++){
	  	rowTotals[i] = 0; // initialize array
   		var checked = document.feelings.worry[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}   
     checked = document.feelings.asleep[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	  checked = document.feelings.irritated[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	  checked = document.feelings.remembering[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
		checked = document.feelings.morning[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	checked = document.feelings.decisions[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	checked = document.feelings.accomplished[i].checked;
      if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	checked = document.feelings.restlessness[i].checked;
	if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	checked = document.feelings.headaches[i].checked;
	if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	checked = document.feelings.drymouth[i].checked;
	if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
		if (filename !== 'prosConsPhysical'){
	checked = document.feelings.cry[i].checked;
	if (checked)
      	{
			MyTotal++;
			rowTotals[i]++;
      	}
	}
	}
		if (MyTotal < 10)
   		{
   		alert ('Please select one answer for each row before continuing.');
		}
  else {
  		//var sUrl = filename + ".htm?1="+rowTotals[0];
		//sUrl = sUrl + ",2="+rowTotals[1];
		//sUrl = sUrl + ",3="+rowTotals[2];
		//openResults(sUrl,"StressResult"); 
		//location = sUrl;
		showProsConsResults(rowTotals[0],rowTotals[1],rowTotals[2])
		}
}
//Open the Pros and Cons Stress Pop-up

function ProsConsStress(int1,int2,int3) {
	var sUrl = "ProsConsStressResult.htm?1="+int1;
		sUrl = sUrl + ",2="+int2;
		sUrl = sUrl + ",3="+int3;
		openResults(sUrl,"StressResult"); 
}

function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function


function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function

// Get values from the URL of the Pros and Cons Results pop-up
function GetProsConsResult(){

	var value = new Array();
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split(",");
	for (var i = 0; i < pairs.length; i++){
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		value[i] = pairs[i].substring(pos+1);
		}
		showProsConsResults(value[0],value[1],value[2]);
}
function clear11(){
			document.getElementById('A1').style.backgroundColor = '#FCF4DD';
			document.getElementById('A2').style.backgroundColor = '#FCF4DD';
			document.getElementById('A3').style.backgroundColor = '#FCF4DD';
			document.getElementById('A4').style.backgroundColor = '#FCF4DD';
			document.getElementById('A5').style.backgroundColor = '#FCF4DD';
			document.getElementById('A6').style.backgroundColor = '#FCF4DD';
			document.getElementById('A7').style.backgroundColor = '#FCF4DD';
			document.getElementById('A8').style.backgroundColor = '#FCF4DD';
			document.getElementById('A9').style.backgroundColor = '#FCF4DD';
			document.getElementById('A10').style.backgroundColor = '#FCF4DD';
			document.getElementById('A11').style.backgroundColor = '#FCF4DD';
//
			document.getElementById('B1').style.backgroundColor = '#FCF4DD';
			document.getElementById('B2').style.backgroundColor = '#FCF4DD';
			document.getElementById('B3').style.backgroundColor = '#FCF4DD';
			document.getElementById('B4').style.backgroundColor = '#FCF4DD';
			document.getElementById('B5').style.backgroundColor = '#FCF4DD';
			document.getElementById('B6').style.backgroundColor = '#FCF4DD';
			document.getElementById('B7').style.backgroundColor = '#FCF4DD';
			document.getElementById('B8').style.backgroundColor = '#FCF4DD';
			document.getElementById('B9').style.backgroundColor = '#FCF4DD';
			document.getElementById('B10').style.backgroundColor = '#FCF4DD';
			document.getElementById('B11').style.backgroundColor = '#FCF4DD';
			//
			document.getElementById('C1').style.backgroundColor = '#FCF4DD';
			document.getElementById('C2').style.backgroundColor = '#FCF4DD';
			document.getElementById('C3').style.backgroundColor = '#FCF4DD';
			document.getElementById('C4').style.backgroundColor = '#FCF4DD';
			document.getElementById('C5').style.backgroundColor = '#FCF4DD';
			document.getElementById('C6').style.backgroundColor = '#FCF4DD';
			document.getElementById('C7').style.backgroundColor = '#FCF4DD';
			document.getElementById('C8').style.backgroundColor = '#FCF4DD';
			document.getElementById('C9').style.backgroundColor = '#FCF4DD';
			document.getElementById('C10').style.backgroundColor = '#FCF4DD';
			document.getElementById('C11').style.backgroundColor = '#FCF4DD';
}
function clear10(){
			document.getElementById('A1').style.backgroundColor = '#FCF4DD';
			document.getElementById('A2').style.backgroundColor = '#FCF4DD';
			document.getElementById('A3').style.backgroundColor = '#FCF4DD';
			document.getElementById('A4').style.backgroundColor = '#FCF4DD';
			document.getElementById('A5').style.backgroundColor = '#FCF4DD';
			document.getElementById('A6').style.backgroundColor = '#FCF4DD';
			document.getElementById('A7').style.backgroundColor = '#FCF4DD';
			document.getElementById('A8').style.backgroundColor = '#FCF4DD';
			document.getElementById('A9').style.backgroundColor = '#FCF4DD';
			document.getElementById('A10').style.backgroundColor = '#FCF4DD';
			
//
			document.getElementById('B1').style.backgroundColor = '#FCF4DD';
			document.getElementById('B2').style.backgroundColor = '#FCF4DD';
			document.getElementById('B3').style.backgroundColor = '#FCF4DD';
			document.getElementById('B4').style.backgroundColor = '#FCF4DD';
			document.getElementById('B5').style.backgroundColor = '#FCF4DD';
			document.getElementById('B6').style.backgroundColor = '#FCF4DD';
			document.getElementById('B7').style.backgroundColor = '#FCF4DD';
			document.getElementById('B8').style.backgroundColor = '#FCF4DD';
			document.getElementById('B9').style.backgroundColor = '#FCF4DD';
			document.getElementById('B10').style.backgroundColor = '#FCF4DD';
			
			//
			document.getElementById('C1').style.backgroundColor = '#FCF4DD';
			document.getElementById('C2').style.backgroundColor = '#FCF4DD';
			document.getElementById('C3').style.backgroundColor = '#FCF4DD';
			document.getElementById('C4').style.backgroundColor = '#FCF4DD';
			document.getElementById('C5').style.backgroundColor = '#FCF4DD';
			document.getElementById('C6').style.backgroundColor = '#FCF4DD';
			document.getElementById('C7').style.backgroundColor = '#FCF4DD';
			document.getElementById('C8').style.backgroundColor = '#FCF4DD';
			document.getElementById('C9').style.backgroundColor = '#FCF4DD';
			document.getElementById('C10').style.backgroundColor = '#FCF4DD';
			
}
// Set the BGColor for the Pros & Cons Results Page
function showProsConsResults(int1,int2,int3){

switch (parseInt(int1)) {
		case 0:
			 // do nothing
		break;
		case 1:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
		break;
		case 2:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
		break;
		case 3:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
		break;
		case 4:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
		break;
		case 5:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
		break;
		case 6:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
		break;
		case 7:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
			document.getElementById('A7').style.backgroundColor = '#DF82D8';
		break;
		case 8:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
			document.getElementById('A7').style.backgroundColor = '#DF82D8';
			document.getElementById('A8').style.backgroundColor = '#DF82D8';
		break;
		case 9:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
			document.getElementById('A7').style.backgroundColor = '#DF82D8';
			document.getElementById('A8').style.backgroundColor = '#DF82D8';
			document.getElementById('A9').style.backgroundColor = '#DF82D8';
		break;
		case 10:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
			document.getElementById('A7').style.backgroundColor = '#DF82D8';
			document.getElementById('A8').style.backgroundColor = '#DF82D8';
			document.getElementById('A9').style.backgroundColor = '#DF82D8';
			document.getElementById('A10').style.backgroundColor = '#DF82D8';
		break;
		case 11:
			document.getElementById('A1').style.backgroundColor = '#DF82D8';
			document.getElementById('A2').style.backgroundColor = '#DF82D8';
			document.getElementById('A3').style.backgroundColor = '#DF82D8';
			document.getElementById('A4').style.backgroundColor = '#DF82D8';
			document.getElementById('A5').style.backgroundColor = '#DF82D8';
			document.getElementById('A6').style.backgroundColor = '#DF82D8';
			document.getElementById('A7').style.backgroundColor = '#DF82D8';
			document.getElementById('A8').style.backgroundColor = '#DF82D8';
			document.getElementById('A9').style.backgroundColor = '#DF82D8';
			document.getElementById('A10').style.backgroundColor = '#DF82D8';
			document.getElementById('A11').style.backgroundColor = '#DF82D8';
		break;
	}
	switch (parseInt(int2)) {
		case 0:
			 // do nothing
		break;
		case 1:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
		break;
		case 2:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
		break;
		case 3:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
		break;
		case 4:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
		break;
		case 5:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
		break;
		case 6:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
		break;
		case 7:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
			document.getElementById('B7').style.backgroundColor = '#C767C1';
		break;
		case 8:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
			document.getElementById('B7').style.backgroundColor = '#C767C1';
			document.getElementById('B8').style.backgroundColor = '#C767C1';
		break;
		case 9:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
			document.getElementById('B7').style.backgroundColor = '#C767C1';
			document.getElementById('B8').style.backgroundColor = '#C767C1';
			document.getElementById('B9').style.backgroundColor = '#C767C1';
		break;
		case 10:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
			document.getElementById('B7').style.backgroundColor = '#C767C1';
			document.getElementById('B8').style.backgroundColor = '#C767C1';
			document.getElementById('B9').style.backgroundColor = '#C767C1';
			document.getElementById('B10').style.backgroundColor = '#C767C1';
		break;
		case 11:
			document.getElementById('B1').style.backgroundColor = '#C767C1';
			document.getElementById('B2').style.backgroundColor = '#C767C1';
			document.getElementById('B3').style.backgroundColor = '#C767C1';
			document.getElementById('B4').style.backgroundColor = '#C767C1';
			document.getElementById('B5').style.backgroundColor = '#C767C1';
			document.getElementById('B6').style.backgroundColor = '#C767C1';
			document.getElementById('B7').style.backgroundColor = '#C767C1';
			document.getElementById('B8').style.backgroundColor = '#C767C1';
			document.getElementById('B9').style.backgroundColor = '#C767C1';
			document.getElementById('B10').style.backgroundColor = '#C767C1';
			document.getElementById('B11').style.backgroundColor = '#C767C1';
		break;
	}
	switch (parseInt(int3)) {
		case 0:
			 // do nothing
		break;
		case 1:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
		break;
		case 2:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
		break;
		case 3:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
		break;
		case 4:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
		break;
		case 5:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
		break;
		case 6:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
		break;
		case 7:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
			document.getElementById('C7').style.backgroundColor = '#B63BAE';
		break;
		case 8:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
			document.getElementById('C7').style.backgroundColor = '#B63BAE';
			document.getElementById('C8').style.backgroundColor = '#B63BAE';
		break;
		case 9:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
			document.getElementById('C7').style.backgroundColor = '#B63BAE';
			document.getElementById('C8').style.backgroundColor = '#B63BAE';
			document.getElementById('C9').style.backgroundColor = '#B63BAE';
		break;
		case 10:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
			document.getElementById('C7').style.backgroundColor = '#B63BAE';
			document.getElementById('C8').style.backgroundColor = '#B63BAE';
			document.getElementById('C9').style.backgroundColor = '#B63BAE';
			document.getElementById('C10').style.backgroundColor = '#B63BAE';
		break;
		case 11:
			document.getElementById('C1').style.backgroundColor = '#B63BAE';
			document.getElementById('C2').style.backgroundColor = '#B63BAE';
			document.getElementById('C3').style.backgroundColor = '#B63BAE';
			document.getElementById('C4').style.backgroundColor = '#B63BAE';
			document.getElementById('C5').style.backgroundColor = '#B63BAE';
			document.getElementById('C6').style.backgroundColor = '#B63BAE';
			document.getElementById('C7').style.backgroundColor = '#B63BAE';
			document.getElementById('C8').style.backgroundColor = '#B63BAE';
			document.getElementById('C9').style.backgroundColor = '#B63BAE';
			document.getElementById('C10').style.backgroundColor = '#B63BAE';
			document.getElementById('C11').style.backgroundColor = '#B63BAE';
		break;
	}
}
 


//rollover function
function roll(img_name, img_src)
   {
   document[img_name].src = img_src;
   }

//preloads images
function preloadImages(){
	var siteImages=new Array()
	for (i=0;i<preloadImages.arguments.length;i++) {
		siteImages[i]=new Image();
		siteImages[i].src=preloadImages.arguments[i];
	}
}
function whereAmI() {
for (var i = 0; i < 4; i++)

var selected = document.where.page.selectedIndex;
 
switch (selected) {
		case 0:
		// not active
		break;
		case 1:
		// not active
		location = "WherePhysical.htm";
		break;
		case 2:
		// (Plan & Commit
			location = "WhereNutrition.htm";
		break;
		case 3:
		//Learn About It 
		location = "WhereStress.htm";
		break;
		case 4:
		//Learn About It 
		alert('Pain Management is not active in this prototype.');
		break;
	}
}

function GoToWhereStress(prev) {
	var value = 0;
	for (var i = 0; i < 5; i++){
	 var checked = document.where.here[i].checked;
	 if (checked)
	 	{
	 value = parseInt(document.where.here[i].value);
		}
	}
	switch (value) {
		case 1:
		// not active
		location = "StageStick.htm?prev="+prev;
		break;
		case 2:
		// not active
		location = "StagestayFocused.htm?prev="+prev;
		break;
		case 3:
		// (Plan & Commit
			location = "Stageplan.htm?prev="+prev;
		break;
		case 4:
		//Learn About It 
		location = "StageLearn.htm?prev="+prev;
		break;
		case 5:
		//Not Active.
		location = "Stageplan.htm?prev="+prev;
		break;
	}
}
//stress test tool
function getStressAnswers() {
   var check = 0;
   var MyTotal = 0;
   var intValue = 0;
      for (var i = 0; i < 3; i++)
   {
   var checked = document.feelings.worry[i].checked;
      if (checked)
      	{
			intValue = parseInt(document.feelings.worry[i].value);
			MyTotal++;
      	}   
     checked = document.feelings.asleep[i].checked;
      if (checked)
      	{
			intValue = intValue + parseInt(document.feelings.asleep[i].value);
			MyTotal++;
      	}
	  checked = document.feelings.irritated[i].checked;
      if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.irritated[i].value);
			MyTotal++;
      	}
	  checked = document.feelings.remembering[i].checked;
      if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.remembering[i].value);
			MyTotal++;
      	}
		checked = document.feelings.morning[i].checked;
      if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.morning[i].value);
			MyTotal++;
      	}
	checked = document.feelings.decisions[i].checked;
      if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.decisions[i].value);
			MyTotal++;
      	}
	checked = document.feelings.accomplished[i].checked;
      if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.accomplished[i].value);
			MyTotal++;
      	}
	checked = document.feelings.restlessness[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.restlessness[i].value);
			MyTotal++;
      	}
	checked = document.feelings.headaches[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.headaches[i].value);
			MyTotal++;
      	}
	checked = document.feelings.drymouth[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.drymouth[i].value);
			MyTotal++;
      	}
	checked = document.feelings.cry[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.cry[i].value);
			MyTotal++;
      	}
	checked = document.feelings.breath[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.breath[i].value);
			MyTotal++;
    	}

	checked = document.feelings.scared[i].checked;
	if (checked)
    	{
		intValue =  intValue + parseInt(document.feelings.scared[i].value);
		MyTotal++;
     	}
	checked = document.feelings.tense[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.tense[i].value);
			MyTotal++;
      	}
	checked = document.feelings.appetite[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.appetite[i].value);
			MyTotal++;
      	}
	checked = document.feelings.fun[i].checked;
	if (checked)
     	{
			intValue =  intValue + parseInt(document.feelings.fun[i].value);
			MyTotal++;
     	}
	checked = document.feelings.control[i].checked;
	if (checked)
     	{
		intValue =  intValue + parseInt(document.feelings.control[i].value);
		MyTotal++;
      	}
	checked = document.feelings.heartbeating[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.heartbeating[i].value);
			MyTotal++;
      	}
	checked = document.feelings.tightness[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.tightness[i].value);
			MyTotal++;
     	}
	checked = document.feelings.selfconscious[i].checked;
	if (checked)
      	{
			intValue =  intValue + parseInt(document.feelings.selfconscious[i].value);
			MyTotal++;
      	}
  }
   if (MyTotal < 19)
   		{
   		alert ('Please select one answer for each row before continuing.');
		}
  else {
		openResults("Result.htm?result="+intValue,"StressResult"); 
		}
}
//opens new window for tool tips
function openResults(url,windowname) {
	tipWin = window.open(url,windowname,'width=691,height=378,innerWidth=691,innerHeight=378,top=300,left=300,screenX=300,screenY=300,scrollbars=yes,resizable=no');
	tipWin.focus();
}
function GetArgs(){
	var args = new Object();
	var query = location.search.substring(1);
	var item = query.split("=");
	//return item[1];
	document.write(item[1]);
}
function GetHTML(){
	var args = new Object();
	var query = location.search.substring(1);
	var item = query.split("=");
	//return item[1];
	item[1] = item[1]+".htm";
	location = item[1];
}

function writeStressResults(){
	var text = "";
	var args = new Object();
	var query = location.search.substring(1);
	var item = query.split("=");
	if (parseInt(item[1]) < 39)
	{ text = "Although you may experience the everyday stresses of life, you have learned to incorporate stress management techniques into your lifestyle. This enables you to deal with stressful situations in a healthy way.  Did you know that your ability to handle stress well also minimizes your arthritis pain and symptoms of arthritis? Keep up the good work!";
	document.write(text);
	}
	if ((parseInt(item[1]) > 38) && ( parseInt(item[1]) < 50))
	{ text = "You may be experiencing a moderate amount of stress.  It is important to identify your underlying causes of stress and incorporate ways in which you can handle them better.  Try using the Identifying My Stressor tool to help you find the source of your stress.  Once you identify your source of stress, apply tactics suggested in the tool.  Then in about two weeks, take the Measure Your Stress Test over again. You may find a significant decrease in your stress level.  Remember, changing your outlook on life is the most reliable and effective way to reduce your stress.";
	document.write(text);
	}
	if (parseInt(item[1]) >= 50)
	{ text = "You may be experiencing a significant amount of stress.  It is very important for you to explore some ways in that you can reduce your stress.  Did you know that your stress could be contributing to your arthritis pain and increasing your arthritis symptoms? Learning more about Stress & Your Arthritis can help you gain a better understanding of what you need to do to decrease your stress level.  Try exploring Stress Management Options that may help you relieve some stress.  Once you have worked your new stress management technique for two weeks, try taking the Measure Your Stress Test again.  You may find a significant decrease in your stress level.  Remember, changing your outlook on life is the most reliable and effective way to reduce your stress!";
	document.write(text);
	}
}

//stress test tool
function checkSelection(tdID,tdID2,tdID3,radiobutton) {
	var buttonCheck = radiobutton;
	if (buttonCheck.value == 1){
		document.getElementById(tdID).style.backgroundColor = '#7EDD5D';
		document.getElementById(tdID2).style.backgroundColor = '';
		document.getElementById(tdID3).style.backgroundColor = '';
		 
	}
	if (buttonCheck.value == 2){
		document.getElementById(tdID).style.backgroundColor = '';
		document.getElementById(tdID2).style.backgroundColor = '#7EDD5D';
		document.getElementById(tdID3).style.backgroundColor = '';
		 
}
if (buttonCheck.value == 3){
		document.getElementById(tdID).style.backgroundColor = '';
		document.getElementById(tdID2).style.backgroundColor = '';
		document.getElementById(tdID3).style.backgroundColor = '#7EDD5D';
	}
}

//check times to take for medications tool
function checkTimeSelection() {
	if (document.medications.timeToTake[0].checked != true) {
		document.medications.dailyValue.disabled = true;
		document.medications.timeSubmit.disabled = true;
	}
	else {
		document.medications.dailyValue.disabled = false;
		document.medications.timeSubmit.disabled = false;
	}
}
// WINDOW OPENERS
//opens new window for tool tips
function openTip(url,windowname) {
	tipWin = window.open(url,windowname,'width=300,height=300,innerWidth=300,innerHeight=300,top=300,left=300,screenX=300,screenY=300,scrollbars=yes,resizable=yes');
	tipWin.focus();
}

//opens new window for tool tips
function openRelax(url,windowname) {
	tipWin = window.open(url,windowname,'width=700,height=550,innerWidth=700,innerHeight=550,top=0,left=0,screenX=0,screenY=0,scrollbars=no,resizable=no');
	tipWin.focus();
}

//opens large window for tool tips
function openLGTip(url,windowname) {
	tipLGWin = window.open(url,windowname,'width=550,height=400,innerWidth=550,innerHeight=400,top=300,left=300,screenX=300,screenY=300,scrollbars=yes,resizable=yes');
	tipLGWin.focus();
}

//opens large window for tool tips
function openLGWin(url,windowname) {
	LGWin = window.open(url,windowname,'width=620,height=177,innerWidth=620,innerHeight=177,top=300,left=300,screenX=300,screenY=300,scrollbars=yes,resizable=yes');
	LGWin.focus();
}
//OPEN BMI
function openBMI(url,windowname) {
	LGWin = window.open(url,windowname,'width=685,height=400,innerWidth=685,innerHeight=400,top=0,left=0,screenX=0,screenY=0,scrollbars=no,resizable=no');
	LGWin.focus();
}

//opens window for printing checklists
function openPrintWin(url,windowname) {
	newWin = window.open(url,windowname,'width=700,height=500,innerWidth=700,innerHeight=500,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes');
	newWin.focus();
}

//opens window for printing checklists
function openWin(url,windowname) {
	newWin = window.open(url,windowname,'width=795,height=450,innerWidth=795,innerHeight=450,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,status=yes,location=yes');
	newWin.focus();
}

//opens window for tools
 function showPopUp(name,url,width,height) { 
    var detWindow="" 
    detWindow=window.open(url,name,'toolbar=no,location=0,directories=no,status=no,menubar=0,scrollbars=no,left=0,top=0,resizable=no,width='+width+',height='+height);
        }

//--> 

function openPDF(url,windowname) {
	newWin = window.open(url,windowname,'width=795,height=450,innerWidth=795,innerHeight=450,top=0,left=0,screenX=0,screenY=0,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,status=yes,location=yes');
	newWin.focus();
}

//  Begin
function resetform() {
document.forms[0].elements[1]=="";
}
function submitForms() {
if (isEmail())
if (confirm("\n You are about to e-mail your submission. \n\nOK to submit.    CANCEL to abort."))
{
alert("\nYour submission will now be sent.\n\n Thank you for your interest!");
return true;
}
else
{
alert("\n You have chosen to abort the submission.");
return false
}
else 
return false;
}
function isEmail() {
if (document.forms[0].elements[1].value == "") {
alert ("\n The E-Mail field is blank. \n\n Please enter your E-Mail address.")
document.forms[0].elements[1].focus();
return false;
}
if (document.forms[0].elements[1].value.indexOf ('@',0) == -1 ||
document.forms[0].elements[1].value.indexOf ('.',0) == -1) {
alert ("\n  Please enter a valid E-Mail address.")
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
return true;
}
//  End -->
