// JavaScript Document
var rdgroup = new Array();
rdgroup[0]="Rdo_laugh";
rdgroup[1]="Rdo_Caugh";
rdgroup[2]="Rdo_sneeze";
rdgroup[3]="Rdo_run";
rdgroup[4]="Rdo_lift";
rdgroup[5]="Rdo_lying";
rdgroup[6]="Rdo_sitting";
rdgroup[7]="Rdo_level";
rdgroup[8]="Rdo_uphill";
rdgroup[9]="Rdo_downhill";
rdgroup[10]="Rdo_legstog";
rdgroup[11]="Rdo_subsequent";
rdgroup[12]="Rdo_movement";
var rdvalue = new Array();

function page2()
{
	window.location.href="Urinary-Incontinence-Calculator-for-Women other1.asp?page=2";	
}
function page1()
{
	window.location.href="Urinary-Incontinence-Calculator-for-Women other1.asp?page=1";		
}

function calc()
{
		var total=0;
		var never=0;
		var seldom=0;
		var sometimes=0;
		var often=0;
		var always=0;
		var index=0;
		var saying=0;
		var indicates,indicates1,indicates2;

	if(valrdButton())
	{
		for(p=0;p<rdvalue.length;p++)
		{
			total = parseInt(total) + parseInt(rdvalue[p]);
			if(rdvalue[p]=='1'){never++;}
			if(rdvalue[p]=='2'){seldom++;}
			if(rdvalue[p]=='3'){sometimes++;}
			if(rdvalue[p]=='4'){often++;}
			if(rdvalue[p]=='5'){always++;}			
		}
		index=index+Math.round((total/13)*100)/100;
		saying=saying+Math.ceil(index);
		document.getElementById("totalscore").value=total;
		//document.getElementById("no_of_never").innerHTML=never;
		//document.getElementById("no_of_always").innerHTML=always;
		document.getElementById("Leakage_Index").value=index;
		switch (saying)
		{
			case 1:	
				{ 
					document.getElementById("Indicates").value="Never";
					document.getElementById("Indicates1").value="Seldom";
					document.getElementById("Indicates2").value=seldom;
					Indicates="Never";
					Indicates1="Seldom";
					Indicates2=seldom;
					break; 
				}
			case 2:	
				{ 
					document.getElementById("Indicates").value="Seldom";
					document.getElementById("Indicates1").value="Seldom";
					document.getElementById("Indicates2").value=seldom;
					Indicates="Seldom";
					Indicates1="Seldom";
					Indicates2=seldom;
					break; 
				}
			case 3:	
				{ 
					document.getElementById("Indicates").value="Sometimes";
					document.getElementById("Indicates1").value="Sometimes";
					document.getElementById("Indicates2").value=sometimes;
					Indicates="Sometimes";
					Indicates1="Sometimes";
					Indicates2=sometimes;
					break; 
				}
			case 4:	
				{ 
					document.getElementById("Indicates").value="Often";
					document.getElementById("Indicates1").value="Often";
					document.getElementById("Indicates2").value=often;
					Indicates="Often";
					Indicates1="Often";
					Indicates2=often;
					break; 
				}
			case 5:	
				{ 
					document.getElementById("Indicates").value="Always";
					document.getElementById("Indicates1").value="Always";
					document.getElementById("Indicates2").value=always;
					Indicates="Always";
					Indicates1="Always";
					Indicates2=always;
					break; 
				}
		}
/*		document.getElementById("Indicates").innerHTML=saying;
*/		
		
		window.location.href="Urinary-Incontinence-Calculator-for-Women-result.asp?total="+total+"&index="+index+"&Indicate="+Indicates+"&Indicate1="+Indicates1+"&Indicate2="+Indicates2;	
		
	}
}

function valrdButton() 
{
//alert(document.getElementById(rdgroup[0]).checked)
for(j=0;j<rdgroup.length;j++)
	{
	cnt=-1;
	for (var i=1; i<=5; i++) 
		{
        if (document.getElementById(rdgroup[j] + i).checked) {cnt = i; i = 6;}
  	  }
    if (cnt > -1) 
		{
		rdvalue[j]= document.getElementById(rdgroup[j] + cnt).value;
		}
    else 
		{
		rdvalue[j]="";
		alert("Select all the activities");
		return false;
		}
	}
//if(errmsg!="")alert(errmsg);
return true;
}

function cleartext()
{
	document.getElementById("result1").innerHTML=" ";
	document.getElementById("result").innerHTML=" ";
	document.getElementById('submitform').style.display='none';	
}
