function cal()
{
	var sum= 0;
	var ms="";
	var flag=0;
	var attempt = 0;


	for (i=0;i<document.test.Q1.length;i++)
	{
		if (document.test.Q1[i].checked ==false && document.test.Q2[i].checked ==false && document.test.Q3[i].checked ==false && document.test.Q4[i].checked ==false && document.test.Q5[i].checked ==false && document.test.Q6[i].checked ==false && document.test.Q7[i].checked ==false && document.test.Q8[i].checked ==false && document.test.Q9[i].checked ==false && document.test.Q10[i].checked ==false)
		{flag=1; }
		else {flag=0;
		break;}
	}


	if(flag==1)
	{document.test.textarea1.value = "Please select at least one option!"
	}

   else{

		for (i=0;i<document.test.Q1.length;i++)
		{
		if (document.test.Q1[i].checked && document.test.Q1[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;} 
			else if(document.test.Q1[i].checked && document.test.Q1[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ1. Your partner likes talking with you.\n\tCorrect Ans: Yes \n\nExplanation -> If your partner likes talking with you mean that he/she always love you. So you are lucky. \n"}

		if (document.test.Q2[i].checked && document.test.Q2[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q2[i].checked && document.test.Q2[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ2.He/she cancels plans when partners buds to be with you.\n\tCorrect Ans: Yes \n\nExplanation -> Means your partner always taking care of you.\n"}

		if (document.test.Q3[i].checked && document.test.Q3[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if(document.test.Q3[i].checked && document.test.Q3[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ3. Your partner was nervous When he met your family.\n\tCorrect Ans: No \n\nExplanation -> If your partner was narvous at that when he/she met to your family means he/she want only you and not your relatives.\n"}

		if (document.test.Q4[i].checked && document.test.Q4[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q4[i].checked && document.test.Q4[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ4. Your partner gives you gift on some important days like birthdays and Valentine's Day.\n\tCorrect Ans: Yes \n\nExplanation -> You are too much lcky if your partner remember at least these day's.\n"}


		if (document.test.Q5[i].checked && document.test.Q5[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q5[i].checked && document.test.Q5[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ5.  Both of You have a shared vocabulary.\n\tCorrect Ans: Yes \n\nExplanation -> If you have shared vocabulary then your relation should be forever. Both of you are lucky person.\n"}


		if (document.test.Q6[i].checked && document.test.Q6[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q6[i].checked && document.test.Q6[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ6. Your partner call you with your nick name.\n\tCorrect Ans: Yes \n\nExplanation -> If your partner calls you with your nick name it is very nice. \n"}


		if (document.test.Q7[i].checked && document.test.Q7[i].value=="a")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q7[i].checked && document.test.Q7[i].value=="b")
			{attempt= attempt + 1; var ms = ms + "\nQ7. Is it true that your partner taking care in public places?\n\tYour Ans: No\tCorrect Ans: Yes \n\nExplanation -> Your partner loves you from heart.\n"}

		if (document.test.Q8[i].checked && document.test.Q8[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q8[i].checked && document.test.Q8[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ8. Is it your partner taking care of your health?\n\tCorrect Ans: Yes \n\nExplanation -> If you are doing something (or behaving what you are not) just to impress the other person then we can not say it as true love. True love is not that which make the you feel uncomfortable.\n"}

		if (document.test.Q9[i].checked && document.test.Q9[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q9[i].checked && document.test.Q9[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ9. Chronically late is your partners life style?\n\tCorrect Ans: No \n\nExplanation -> It is not good. Search exact reason behind it.\n"}


		if (document.test.Q10[i].checked && document.test.Q10[i].value=="b")
			{attempt= attempt + 1; sum=sum + 1;}
			else if (document.test.Q10[i].checked && document.test.Q10[i].value=="a")
			{attempt= attempt + 1; var ms = ms + "\nQ10. Is it your partner remember doctor's appointment at time when you are seek?\n\tCorrect Ans: Yes \n\nExplanation -> If your partner remember doctor's appointment then you really lucky because love is more private thing between two people so you can not make it public. You may feel a bit of prestige in your friends group, but hardly a love.\n"}

       }

  
  document.test.textarea1.value = ""
  var rs=""
  if (sum<=5)
	  { var rs="It dosen't seem like you are having a very good relationship with your partner, please improve it's not good for your future."}
  if (sum>5 && sum<8) 
	  {var rs="You have good relation with your partner, but still you have to improve it."}
  if (sum>=8) 
	  {var rs="Congratulations! Your relation with partner is very good."}

  document.test.textarea1.value = "             Love and Relationship Test Result\n\n" + rs +"\n\nAttempted Questions : " + attempt + "\nCorrect Answers : " + sum + "\nTotal Questions : " + 10 + "\nYour Percentage : " + (sum/10)*100 + "%"+ "\n\n\nKeep scrolling to find out explanation for your wrong answers...\n" + ms

  }
	
}
