var qnum=10;
var score=0;
var could_have_scored=0;
var total_points=30;
var questions_tried=0;
var score_string="";


columns1 = new Array(4);      
columns2 = new Array(4);   
columns3 = new Array(4);
columns4 = new Array(4);
columns5 = new Array(4);
columns6 = new Array(4);      
columns7 = new Array(4);   
columns8 = new Array(4);
columns9 = new Array(4);
columns10 = new Array(4);


tries = new Array();
tries[0] = columns1;
tries[1] = columns2;
tries[2] = columns3;
tries[3] = columns4;
tries[4] = columns5;
tries[5] = columns6;
tries[6] = columns7;
tries[7] = columns8;
tries[8] = columns9;
tries[9] = columns10;


for (i=0; i < qnum; i++)
for (j=0; j < 4; j++) { tries[i][j] = 0; } 

var answers_array=new Array()

//<p align=\"right\"><i>- Sandeha Nivarani chapter 11</i> </p>

answers_array[0]="<p align=\"justify\">Swami elaborated: &quot;&hellip;Kondama Raju, being one with wisdom, always craved Me. One day, he called Pedda Venkama Raju and told him to change his wife's name to Easwaramma. He told this because he felt the Divine vibrations originating from within. <strong>His intention was to convey that she was the Mother of <em>Easwara</em>, God Himself.</strong> But Pedda Venkama Raju was not aware of the inner meaning of this name. He implicitly obeyed the command of his father and changed the name of his wife to Easwaramma.&quot; <br><br><a href=\"http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf</a></p>";	

answers_array[1]="<p align=\"justify\">Swami continued: &quot;Mother Easwaramma intervened and said <strong>'Children, you should not talk ill of your teacher.</strong><strong>No teacher would punish his student without a proper reason. Our Sathya might have committed some mistake.' </strong>Then she asked Me, 'Sathya, what is the mistake You committed?' I told her the facts as they happened. Kondappa ordered, 'Whoever has written the notes should place it on his table. Others should stand upon the bench.' I had not written the notes. That was My mistake. Hence, I stood upon the bench. I also said something which was more than necessary. I said, 'Sir, can all those boys who have taken down the notes answer your questions? Though I have not written the notes, I can answer any question that you may ask.'<br><br>Kondappa thought that I was egotistic and ordered Me to stand upon the bench for three periods. I obeyed him and stood upon the bench. Meanwhile, the other teacher, Mahboob Khan, came to the class. He was a Mohammaden and a noble person. He was pained to see Me standing on the bench. He asked, 'Kondappa, why have you made this boy stand upon the bench?' 'He has not taken down the notes, hence the punishment', said Kondappa. Mahboob Khan defended Me saying, 'So what if He has not taken down the notes? He can answer all your questions, and that is enough. Ask Him to sit down.' But Kondappa insisted that I should be punished as I had disobeyed his command. <br><br>The bell rang and Kondappa had to go to another class. But he was unable to get up from the chair. Initially he thought that his <em>dhoti</em> had got entangled to a nail in the chair. But that was not the case. He was stuck to the chair! When he tried to get up from the chair, the chair also came along with him. Then Mahboob Khan said, 'Kondappa, He is not an ordinary boy. He is one of great Divine Powers. You have punished Him without a proper reason. At least now, ask Him to sit down.' Kondappa realized his mistake and told Me to sit down. Immediately, he could get up from the chair. When all this was narrated to Mother <strong>Easwaramma, she said, &quot;Dear Sathya, you should not punish your own guru (teacher).'</strong> I said, 'I did not punish him; in fact, he punished himself.&quot; <br><br><a href=\"http://www.sssbpt.info/ssspeaks/volume36/sss36-10.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume36/sss36-10.pdf</a></p>";	

answers_array[2]="<p align=\"justify\">Swami recalls happily: &quot;When I appeared in the Form of Lord Shiva to her, she would ask, 'What Swami? Why are you adorning the snakes around your neck?' I would act innocent, 'Well, I don't have snakes on Me.' She would move away saying, 'Look, there are some snakes inside.' But later, on not finding any snake inside, she would ask for forgiveness.<br><br>Like this on many occasions, she had the experience of My Divinity. Similar was the case with Kausalya and Yashoda. Though they knew that their sons were Divine, they used to get carried away by their motherly affection toward them.&quot; <br><br><a href=\"http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf</a></p>";	

answers_array[3]="<p align=\"justify\">Swami continues: &quot;Easwaramma consoled him and sent him away. She was sitting on the steps where Gokak would pass by. After a while Gokak came there. She offered her Namaskar to him and he reciprocated the same most reverentially. Then she said, <strong>&quot;When I did Namaskar to you, you reciprocated the same. In the same manner, if you punish others, you will be punished in return. </strong>The boy out of his innocence has done a mistake. Please forgive him and allow him to attend the classes.' Then Gokak replied, 'Mother, if I forgive him, it would set a bad precedent for others. Anyway, I will forgive him only for your sake.' In this manner, she would go out of her way to help and provide comfort and solace to others. <br><br>Though Mother Easwaramma had no formal education, she conducted herself in an exemplary manner. She was one of profound wisdom. The teaching that Mother Easwaramma imparted remained etched in the heart of Gokak. Later on, when he came as Vice Chancellor to Puttaparthi, he used to recollect her words of wisdom. He would remember her everyday. He would say, 'I see Easwaramma in my dream quite often. I follow her advice implicitly.' <br><br>We should not criticize others. We should not hurt others or make fun of them. We should love all. This is what mother Easwaramma taught everybody. Do your duty sincerely. Then, you will certainly progress in life. Whoever he may be, follow the sacred teachings of our elders.&quot; <br><br><a href=\"http://www.sssbpt.info/ssspeaks/volume36/sss36-10.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume36/sss36-10.pdf</a></p>";	

answers_array[4]="<p align=\"justify\">Swami shares fondly: &quot;She used to say, <strong>&quot;I am not interested in these studies. I come here to see how the students of Swami conduct themselves, how they obey His commands and how they react to Swami's advice and teachings.&quot; <br><br></strong><a href=\"http://www.sssbpt.info/ssspeaks/volume35/sss35-09.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume35/sss35-09.pdf</a></p>";	

answers_array[5]="<p align=\"justify\">Swami said: <strong>&quot;She said, 'I do not want to put You to inconvenience' and went away. She never had put Me to trouble any time. Whenever she asked Me for something, she would come back and ask if she had given any trouble. </strong>To all the devotees who came, she used to entreat not to cause any inconvenience to Swami. She used to be very much worried whenever any minister came to have My <em>Darshan</em>. The situation in those days was such that even a policeman with a red cap was enough to frighten the villagers. Easwaramma used to be very much afraid of the ministers, thinking that they might cause some problem to Me. This was only the result of her sacred love for Me. That is the greatness of mother's love. That is why she could lead a life of fulfillment and peace. In order to propagate this sacred ideal, this day is being celebrated as Easwaramma Day. This is to emphasize that <strong>each one of</strong><strong>you should make your mother happy. If your mother is happy, Swami is happy.&quot; <br><br></strong><a href=\"http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume32/sss32p1-14.pdf</a></p>";	

answers_array[6]="<p align=\"justify\">Swami shared: <strong>&quot;Easwaramma's joy knew no bounds. The whole day she did not feel the need for food and water as she felt highly contented and overjoyed.</strong> She caught hold of My hands and expressed her happiness as her wish was fulfilled in a big way. I told her, 'Be happy.' After some time, she approached Swami again and wanted a school to be built in the village. As desired by her, I got a school constructed. Initially, it was a small one. Later on, I made it into a big building. She was very happy. She went to the school, kissed the children and showered her love on them. <strong>She was extremely happy and said, &quot;In this Age of <em>Kali, </em>it is my good fortune to have a son like You, who has done whatever I wished.&quot; <br><br></strong><a href=\"http://www.sssbpt.info/ssspeaks/volume33/sss33-09.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume33/sss33-09.pdf</a></p>";	

answers_array[7]="<p align=\"justify\"><p>Swami tells us further: <strong>&quot;She replied, 'I cannot live without seeing You often. The moment I see You, I feel happy.'</strong> After saying so, she gave Me some piece of advice, 'Swami, all persons describe themselves as devotees. But no one can tell who are real devotees and who are fake. Totally dedicated devotees will be ready to carry out anything You ask them to do, but there are others who come for their own self-interest. By coming to You they get their desires fulfilled and forget You thereafter. In this matter, You should be very careful.' Swami replied, 'I shall take due care. There is no need for you to tell Me.' After hearing this, she laughed and left the room. I am conveying to you this episode as direct testimony to the greatness of mother's love. She might have given up her body but she is always with Swami. She said, <strong>'I have performed many sacrifices for Your sake and have done many kinds of <em>pujas</em>. I realized the proof thereof. For 40 years I was with You. My life has its fulfillment.'&quot; <br> <br></strong><a href=\"http://www.sssbpt.info/ssspeaks/volume31/sss31-22.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume31/sss31-22.pdf</a></p></p>";	

answers_array[8]="<p align=\"justify\">Swami conveys the love of Easwaramma saying: &quot;She replied, 'Swami, this is Your mother. What do You know about the love of a mother? Only a mother can understand my feelings. I am a mother and You are God full of Love for all. <strong>A mother cannot understand God's Love and God cannot understand a mother's love!</strong> I have come here in order to tell You something.' Swami then told her, 'Tell me quickly whatever it is that you want to say; I have to go somewhere soon.' Easwaramma pleaded, 'Swami, I don't know what to do because You are always in a hurry! Please relax, spare me a few moments, and listen carefully to what I have to say.' Swami asked her to continue and she said, 'The situation in the outside world today is not very good. Everywhere, there are bad thoughts, bad actions, and evil manipulations. You believe that people who come here are all full of Love for You. It is natural for You to think so but in my opinion, this is not always the case. When You give <em>Darshan</em>, so many people offer a handkerchief to You. This frightens me. Please accept kerchief only from those in whom You have complete faith; ignore the rest.' <br><br>Swami then asked, 'Why are you making such a request?' and she replied, 'For You, all are equal. Everyone is Your child. However, some people are wicked. The kerchief they offer may have poison and when You wipe Your face, the poison may enter Your mouth.' Swami said, 'Alright, to satisfy you, I shall henceforth be very selective.' <br><br><a href=\"http://www.sssbpt.info/summershowers/ss2000/ss2000-05.pdf\">Click here: http://www.sssbpt.info/summershowers/ss2000/ss2000-05.pdf</a></p>";	

answers_array[9]="<p align=\"justify\">Bhagavan shared further: &quot;I showed them the belt that she gave me. It had no buckle. There are many such noble mothers in this world. But Easwaramma was the chosen one. <strong>I chose her to be My Mother</strong>. That is the intimate relationship between Mother Easwaramma and Myself.&quot; <br> <br><a href=\"http://www.sssbpt.info/ssspeaks/volume34/sss34-08.pdf\">Click here: http://www.sssbpt.info/ssspeaks/volume34/sss34-08.pdf</a></p>";	


//<img src=\"images/14_TestYourSQ/discourse/01.jpg\" alt='image' width='175' height='250' border='1' align='right'>
var answer_images=new Array()
answer_images[0]="";
answer_images[1]="";
answer_images[2]="";
answer_images[3]="";
answer_images[4]="";
answer_images[5]="";
answer_images[6]="";
answer_images[7]="";
answer_images[8]="";
answer_images[9]="";


var right_answers=new Array()
right_answers[0]="2";
right_answers[1]="4";
right_answers[2]="1";
right_answers[3]="2";
right_answers[4]="3";
right_answers[5]="4";
right_answers[6]="4";
right_answers[7]="2";
right_answers[8]="3";
right_answers[9]="4";

var lock=new Array()

lock[0]="0";
lock[1]="0";
lock[2]="0";
lock[3]="0";
lock[4]="0";
lock[5]="0";
lock[6]="0";
lock[7]="0";
lock[8]="0";
lock[9]="0";

var first_attempt= new Array();
first_attempt[0]="Congrats! You have got it right in the very first attempt! You get 3 Points";
first_attempt[1]="Great! First attempt and right! You get 3 Points";
first_attempt[2]="You've got it in the very first attempt!! You get 3 Points";
first_attempt[3]="Well done! First click and right answer! You get 3 Points";
first_attempt[4]="You got it! Great going! You get 3 Points";
first_attempt[5]="Correct! You make it so easy! You get 3 Points";
first_attempt[6]="That's right! You are doing well! You get 3 Points";
first_attempt[7]="Absolutely correct! Well done! You get 3 Points";

var second_attempt= new Array();
second_attempt[0]="Good! You have got it right now! You get 2 Points";
second_attempt[1]="Yes! You got it now! You get 2 Points";
second_attempt[2]="That's right! Now you got it! You get 2 Points";
second_attempt[3]="Right! That's the answer! You get 2 Points";
second_attempt[4]="Yes! Now you have got it! You get 2 Points";
second_attempt[5]="That's right! Good try! You get 2 Points";
second_attempt[6]="Good! Thats the correct answer! You get 2 Points";
second_attempt[7]="You have now answered correctly! Well done! You get 2 Points";


var third_attempt= new Array();
third_attempt[0]="Finally! You got it right! You get 1 Point";
third_attempt[1]="Now you've got it! You get 1 Point";
third_attempt[2]="That's right! You get 1 Point";
third_attempt[3]="Correct! You have got it right now! You get 1 Point";
third_attempt[4]="Yes! That's the answer we were looking for! You get 1 Point";
third_attempt[5]="Finally! You guessed it right! You get 1 Point";
third_attempt[6]="Nice try! You did get it finally! You get 1 Point";
third_attempt[7]="Yes! Nice guess! You get 1 Point";

var final_score_messages= new Array();
final_score_messages[0]=" <strong>Very Good</strong>, Keep it up!";
final_score_messages[1]=" <strong>Good</strong>, you have scored well.";
final_score_messages[2]=" Good attempt. Thank you very much for trying the quiz";
final_score_messages[3]=" Good Try. Thank you very much for trying the quiz";

var right_textanswers=new Array();
var your_answers=new Array();
var your_textanswers=new Array();


function set_string(){
	
	if (questions_tried == 1)
		score_string="You get "+score+" out of "+could_have_scored+" for the 1st question.";
		
	else
		score_string="You get "+score+" out of "+could_have_scored+" for the "+questions_tried+" questions you attempted.";
}

function check(i){
    
	var answerarea="answer_area"+i;
	var sum =0;
	var random_num = Math.round(7*Math.random());
	
	//check if tries are allowed
	for(a=0;a<4;a++){sum += tries[i][a];}
	if (sum>=3){ 
		var radiobuttonname="l"+i+"_"+lock[i];
		document.getElementById(radiobuttonname).checked = true;
		return true;
		}
	
	//if tries are allowed
	sum = 0;
	document.getElementById(answerarea).innerHTML="";
	document.getElementById("score_area").innerHTML="";
	
	for(a=0;a<4;a++){
			var radiobuttonname="l"+i+"_"+a;
			var labelname="label"+i+"_"+a;
			if(document.getElementById(radiobuttonname).checked){
				your_answers[i]=document.getElementById(radiobuttonname).value;
				your_textanswers[i]=document.getElementById(labelname).innerHTML;
				tries[i][a]=1;
				lock[i]=a;
				}
			if(document.getElementById(radiobuttonname).value==right_answers[i]){
				right_textanswers[i]=document.getElementById(labelname).innerHTML;
				}
			sum += tries[i][a];	
		}
		if(your_answers[i]==right_answers[i]){
			var chancestogo=4-sum;
			if(chancestogo==3){
			score+=3;
			could_have_scored+=3;
			questions_tried+=1;
			set_string();
			document.getElementById(answerarea).innerHTML += "<table width='100%'  style='background-color:#CCFFCC;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='78%'><font color='#000088'><b>"+ first_attempt[random_num] +"</b></font><br><br><font color='green'><b>Correct Answer : </b></font><font color='brown'>"+your_textanswers[i] + "</font><p align='justify'> <font color='#000088'>" + answers_array[i]+ " <br> <strong>SCORE:</strong> "+score_string+"</font></p></td><td width='22%'>"+ answer_images[i]+"</td></tr></table>";
			
			
			}
			if(chancestogo==2){
			score+=2;
			could_have_scored+=3;
			questions_tried+=1;
			set_string();
			document.getElementById(answerarea).innerHTML += "<table width='100%'  style='background-color:#CCFFCC;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='78%'><font color='#000088'><b>"+ second_attempt[random_num] +"</b></font><br><br><font color='green'><b>Correct Answer : </b></font><font color='brown'>"+your_textanswers[i] + "</font><p align='justify'> <font color='#000088'>" + answers_array[i]+ " <br> <strong>SCORE:</strong> "+score_string+"</font></p></td><td width='22%'>"+ answer_images[i]+"</td></tr></table>";
			
			
			}
			if(chancestogo==1){
			score+=1;
			could_have_scored+=3;
			questions_tried+=1;
			set_string();
			document.getElementById(answerarea).innerHTML += "<table width='100%'  style='background-color:#CCFFCC;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='78%'><font color='#000088'><b>"+ third_attempt[random_num] +"</b></font><br><br><font color='green'><b>Correct Answer : </b></font><font color='brown'>"+your_textanswers[i] + "</font><p align='justify'> <font color='#000088'>" + answers_array[i]+ " <br> <strong>SCORE:</strong>"+score_string+"</font></p></td><td width='22%'>"+ answer_images[i]+"</td></tr></table>";
			
			
			}
			
			
			for (j=0; j < 4; j++) { tries[i][j] = 1; }
			 
		}
		if(your_answers[i]!=right_answers[i]){
			if(sum >=3){
			could_have_scored+=3;
			questions_tried+=1;
			set_string();
			document.getElementById(answerarea).innerHTML += "<table width='100%'  style='background-color:#FFCCCC;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='78%'><font color='brown'><b>Wrong... <br><br>Your Answer : </b>"+your_textanswers[i] +"</font><br><font color='green'><b>Correct Answer : </b></font><font color='brown'>"+right_textanswers[i] + "</font><p align='justify'> <font color='#000088'>" + answers_array[i]+ " <br> <strong>SCORE:</strong>"+score_string+"</font></p></td><td width='22%'>"+ answer_images[i]+"</td></tr></table>";
			
			
			}
			else{
					var chancestogo=3-sum;
					if(chancestogo==1){
					document.getElementById(answerarea).innerHTML+="<p><table width='100%' style='background-color:#FFCCCC;border:1 black;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td style='color:brown'><b>Sorry... this is not the right answer.<br>You have just one more chance to go....</b></td></tr></table>";
					
					}
					else{
					document.getElementById(answerarea).innerHTML+="<p><table width='100%' style='background-color:#FFCCCC;border:1 black;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td style='color:brown'><b>Sorry... this is not the right answer.<br>You have two more chances to go....</b></td></tr></table>";
					
					}
				}
		}
		
	document.getElementById(answerarea).style.display="inline";
	if (questions_tried == qnum)
	{ if(score >= 25)
		{
			document.getElementById("score_area").innerHTML += "<table width='100%'  style='background-color:#FFCC99;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='100%'><p align='justify'> <font color='#000088'> <br> <strong>SCORE:</strong> [ "+score+" of "+total_points+" ]"+final_score_messages[0]+"</font></p> </td></tr></table>";
		}
		if(score >= 15 && score <25)
		{
			document.getElementById("score_area").innerHTML += "<table width='100%'  style='background-color:#FFCC99;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='100%'><p align='justify'> <font color='#000088'> <br> <strong>SCORE:</strong> [ "+score+" of "+total_points+" ]"+final_score_messages[1]+"</font></p> </td></tr></table>";
		}
		if(score >=5 && score< 15)
		{
			document.getElementById("score_area").innerHTML += "<table width='100%'  style='background-color:#FFCC99;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='100%'><p align='justify'> <font color='#000088'> <br> <strong>SCORE:</strong> [ "+score+" of "+total_points+" ]"+final_score_messages[2]+"</font></p> </td></tr></table>";
		}
		if(score <5)
		{
			document.getElementById("score_area").innerHTML += "<table width='100%'  style='background-color:#FFCC99;border:0;font-size:10pt;font-family:Arial' cellpadding='5'><tr><td width='100%'><p align='justify'> <font color='#000088'> <strong>SCORE:</strong> [ "+score+" of "+total_points+" ]"+final_score_messages[3]+"</font></p> </td></tr></table>";
		}
			
	document.getElementById("score_area").style.display="inline";
	}
	
}


function reset_all(){
	document.question_form.reset();
	for (i=0; i<=qnum; i++){
		var answerarea="answer_area"+i;
		for (j=0; j < 4; j++) { tries[i][j] = 0; } 
		document.getElementById(answerarea).innerHTML="";
		document.getElementById(answerarea).style.display="none";
		document.getElementById("score_area").innerHTML="";
		document.getElementById("score_area").style.display="none";
		document.location.href = "quiz.htm#";
		score=0;
		questions_tried=0;
		could_have_scored=0;
		score_string="";
	}
	
}
