function randomizeSelectedVerbs() {
	document.conjugator.answer.value="";
	document.conjugator.answer.focus(); 
	pronoun=document.conjugator.pronouns.selectedIndex;
    	verb=Math.floor(Math.random()*selectedinfinitive.length)
  	document.conjugator.verb.value=selectedinfinitive[verb];
	

	if (document.conjugator.pronouns.selectedIndex==0) {
		pronoun=Math.floor(Math.random()*20);

	}
	
	if (document.conjugator.pronouns.selectedIndex==1) {
		pronoun=Math.floor(Math.random()*20);
		while (pronoun==8 || pronoun==19) {
			pronoun=Math.floor(Math.random()*20);
		}
	}
	
	if (pronoun==2 || pronoun==12 || pronoun==14 || pronoun==16) {
		solution=selectedyo[verb];
		document.conjugator.pronoun.value="yo";
		}
	if (pronoun==3 || pronoun==13 || pronoun==15 || pronoun==17) {
		solution=selectedtu[verb];
		document.conjugator.pronoun.value="tú";
		}
	if (pronoun==0 || pronoun==4) {
		solution=selectedella[verb];
		document.conjugator.pronoun.value="él";
		}
	if (pronoun==5) {
		solution=selectedella[verb];
		document.conjugator.pronoun.value="ella";
		}
	if (pronoun==6) {
		solution=selectedella[verb];
		document.conjugator.pronoun.value="usted";
		}
	if (pronoun==7 || pronoun==18) {
		solution=selectednosotros[verb];
		document.conjugator.pronoun.value="nosotros";
		}
	if (pronoun==8 || pronoun==19) {
		solution=selectedvosotros[verb];
		document.conjugator.pronoun.value="vosotros";
		}
	if (pronoun==1 || pronoun==9) {
		solution=selectedellas[verb];
		document.conjugator.pronoun.value="ellas";
		}
	if (pronoun==10) {
		solution=selectedellas[verb];
		document.conjugator.pronoun.value="ellos";
		}
	if (pronoun==11) {
		solution=selectedellas[verb];
		document.conjugator.pronoun.value="ustedes";
		}
	
	return;
}	

function randomizeSelectedCommands() {        

	document.conjugator.answer.value="";        
	document.conjugator.answer.focus();         
	pronoun=document.conjugator.pronouns.selectedIndex;        
	verb=Math.floor(Math.random()*selectedinfinitive.length)        
	document.conjugator.verb.value=selectedinfinitive[verb];                

	if (document.conjugator.pronouns.selectedIndex==0) {                
		pronoun=Math.floor(Math.random()*2);                
		if (pronoun==0) {                
			solution=selectedpositive[verb];                
			document.conjugator.pronoun.value="positive command";
	                }                

		if (pronoun==1) {                
			solution=selectednegative[verb];                
			document.conjugator.pronoun.value="negative command";
	                }        
	}                

	if (document.conjugator.pronouns.selectedIndex==1){                
		solution=selectedpositive[verb];                
		document.conjugator.pronoun.value="positive command";        
	}        

	if (document.conjugator.pronouns.selectedIndex==2) {                
		solution=selectednegative[verb];                
		document.conjugator.pronoun.value="negative command";        
	}                
	return;
}

function randomizeAllVerbs() {
       	document.conjugator.answer.value="";
	document.conjugator.answer.focus();
    	pronoun=document.conjugator.pronouns.selectedIndex;
    	verb=Math.floor(Math.random()*infinitive.length);
	document.conjugator.verb.value=infinitive[verb];

	

	if (document.conjugator.pronouns.selectedIndex==0) {
		pronoun=Math.floor(Math.random()*20);

	}
	
	if (document.conjugator.pronouns.selectedIndex==1) {
		pronoun=Math.floor(Math.random()*20);
		while (pronoun==8 || pronoun==19) {
			pronoun=Math.floor(Math.random()*20);
		}
	}
	
	if (pronoun==2 || pronoun==12 || pronoun==14 || pronoun==16) {
		solution=yo[verb];
		document.conjugator.pronoun.value="yo";
		}
	if (pronoun==3 || pronoun==13 || pronoun==15 || pronoun==17) {
		solution=tu[verb];
		document.conjugator.pronoun.value="tú";
		}
	if (pronoun==0 || pronoun==4) {
		solution=ella[verb];
		document.conjugator.pronoun.value="él";
		}
	if (pronoun==5) {
		solution=ella[verb];
		document.conjugator.pronoun.value="ella";
		}
	if (pronoun==6) {
		solution=ella[verb];
		document.conjugator.pronoun.value="usted";
		}
	if (pronoun==7 || pronoun==18) {
		solution=nosotros[verb];
		document.conjugator.pronoun.value="nosotros";
		}
	if (pronoun==8 || pronoun==19) {
		solution=vosotros[verb];
		document.conjugator.pronoun.value="vosotros";
		}
	if (pronoun==1 || pronoun==9) {
		solution=ellas[verb];
		document.conjugator.pronoun.value="ellas";
		}
	if (pronoun==10) {
		solution=ellas[verb];
		document.conjugator.pronoun.value="ellos";
		}
	if (pronoun==11) {
		solution=ellas[verb];
		document.conjugator.pronoun.value="ustedes";
		}
	
	return;

}	

function randomizeAllCommands() {        
	document.conjugator.answer.value="";        
	document.conjugator.answer.focus();         
	pronoun=document.conjugator.pronouns.selectedIndex;        
	verb=Math.floor(Math.random()*infinitive.length);        
	document.conjugator.verb.value=infinitive[verb];                

	if (document.conjugator.pronouns.selectedIndex==0) {                
		pronoun=Math.floor(Math.random()*2);                
		if (pronoun==0) {                
			solution=positive[verb];                
			document.conjugator.pronoun.value="positive command";                
		}                
		if (pronoun==1) {                
			solution=negative[verb];                
			document.conjugator.pronoun.value="negative command";   
	             }        
	}              
	
	if (document.conjugator.pronouns.selectedIndex==1){                
		solution=positive[verb];                
		document.conjugator.pronoun.value="positive command";        
		}        
	if (document.conjugator.pronouns.selectedIndex==2) {                
		solution=negative[verb];                
		document.conjugator.pronoun.value="negative command";        
		}                

	return;

}



function spanishConjugation() {
	if (start==0) {
		alert("You must first press START to begin the practice.");
		}
	else {
		conjugations++;
		if (commands==1) {
			spanishConjugationCommands();
			return
		}
		if (allverbs==0) {
		alert("yo: "+yo[verb]+"\n tú: "+tu[verb]+"\n ella: "+ella[verb]+"\n nosotros: "+nosotros[verb]+"\n vosotros: "+vosotros[verb]+"\n ellos: "+ellas[verb])
		document.conjugator.answer.focus();
		}
		else {
		alert("yo: " + selectedyo[verb]+ "\n tú: "+selectedtu[verb]+"\n ella: "+selectedella[verb]+"\n nosotros: "+selectednosotros[verb]+"\n vosotros: "+selectedvosotros[verb]+"\n ellos: "+selectedellas[verb])
		document.conjugator.answer.focus();
		}
	}
	
}

function spanishConjugationCommands() {        

	if (start==0) {                
		alert("You must first press START to begin the practice.");                
	}        

	else {                
		if (allverbs==0) {                
			alert("positive: "+positive[verb]+"\n negative: "+negative[verb]);
	               	document.conjugator.answer.focus();       
	         }                

		else {                
			alert("positive: "+selectedpositive[verb]+"\n negative: "+selectednegative[verb]);
	                document.conjugator.answer.focus();               
			 }        
	}
}        	


function spanishAccent() {
	warning();
	text=document.conjugator.answer.value;
	
	
	if (text.charAt(text.length-1)=="" || text.charAt(text.length-1)==" ") {
		return
	}
		


	if (text.charAt(text.length-1)=="a" || text.charAt(text.length-1)=="e" || text.charAt(text.length-1)=="i" || text.charAt(text.length-1)=="o" || text.charAt(text.length-1)=="u") {
		if (text.charAt(text.length-1)=="a") {
		text=text.substring(0,text.length-1);
		document.conjugator.answer.value=text+"á";
		document.conjugator.answer.focus();
		return
		}
		if (text.charAt(text.length-1)=="e") {
		text=text.substring(0,text.length-1);
		document.conjugator.answer.value=text+"é";
		document.conjugator.answer.focus();
		return
		}

		if (text.charAt(text.length-1)=="i") {
		text=text.substring(0,text.length-1);
		document.conjugator.answer.value=text+"í";
		document.conjugator.answer.focus();
		return
		}

		if (text.charAt(text.length-1)=="o") {
		text=text.substring(0,text.length-1);
		document.conjugator.answer.value=text+"ó";
		document.conjugator.answer.focus();
		return
		}

		if (text.charAt(text.length-1)=="u") {
		text=text.substring(0,text.length-1);
		document.conjugator.answer.value=text+"ú";
		document.conjugator.answer.focus();
		return
		}
		
	}
	
	else {
		var wrongLetter2=text.charAt(text.length-1);
		var wrongLetter=wrongLetter2.toUpperCase();
		alert("OOPS!\n You tried to put an accent on the letter \""+wrongLetter+"\".");
		document.conjugator.answer.focus();
	}

}	