
var counter = -1;
var flipped = 0;

var myWordArray = new Array();
var myMeaningArray = new Array();

var myword0 = "test";
var myword1 = "test1";
var myword2 = "";
var myword3 = "";
var myword4 = "";
var myword5 = "";
var myword6 = "";
var myword7 = "";
var myword8 = "";
var myword9 = "";
var myword10 = "";
var myword11 = "";
var myword12 = "";
var myword13 = "";
var myword14 = "";
var myword15 = "";
var myword16 = "";
var myword17 = "";
var myword18 = "";
var myword19 = "";

var clickFlag = 0;
var clickFlag2 = 0;


initiate2();

function initiate2()
{
		//alert(getMeaning(0,0));

	var lesson = 0;
	lesson = gup('ThePage');
					for(var aa =0; aa <20; aa++)
					{
						myWordArray[aa] = "<b>" + getWord(lesson,aa) + "</b>";    ///getPlaceWord2(aa);
						myMeaningArray[aa] = getMeaning(lesson,aa);
					}
						
	scrambleWords();
	
		document.getElementById("pl10").innerHTML = "<b> " + myWordArray[0] + "</b>";
		document.getElementById("pl11").innerHTML = "<b> " + myWordArray[1] + "</b>";
		document.getElementById("pl12").innerHTML = "<b> " + myWordArray[2] + "</b>";
		document.getElementById("pl13").innerHTML = "<b> " + myWordArray[3] + "</b>";
		document.getElementById("pl14").innerHTML = "<b> " + myWordArray[4] + "</b>";
		document.getElementById("pl15").innerHTML = "<b> " + myWordArray[5] + "</b>";
		document.getElementById("pl16").innerHTML = "<b> " + myWordArray[6] + "</b>";
		document.getElementById("pl17").innerHTML = "<b> " + myWordArray[7] + "</b>";
		document.getElementById("pl18").innerHTML = "<b> " + myWordArray[8] + "</b>";
		document.getElementById("pl19").innerHTML = "<b> " + myWordArray[9] + "</b>";
		document.getElementById("pl20").innerHTML = "<b> " + myWordArray[10] + "</b>";
		document.getElementById("pl21").innerHTML = "<b> " + myWordArray[11] + "</b>";
		document.getElementById("pl22").innerHTML = "<b> " + myWordArray[12] + "</b>";
		document.getElementById("pl23").innerHTML = "<b> " + myWordArray[13] + "</b>";
		document.getElementById("pl24").innerHTML = "<b> " + myWordArray[14] + "</b>";
		document.getElementById("pl25").innerHTML = "<b> " + myWordArray[15] + "</b>";
		document.getElementById("pl26").innerHTML = "<b> " + myWordArray[16] + "</b>";
		document.getElementById("pl27").innerHTML = "<b> " + myWordArray[17] + "</b>";
		document.getElementById("pl28").innerHTML = "<b> " + myWordArray[18] + "</b>";
		document.getElementById("pl29").innerHTML = "<b> " + myWordArray[19] + "</b>";
	








						
	var chap = parseInt(gup('ThePage'));
	var nextChap = chap + 1;

	//document.getElementById("nextLink").innerHTML = ".\move06.htm?lesson = " + nextChap;

	//document.getElementById("nextLink").innerHTML = "<a class='mylink' href='" + "\move08.htm?lesson=" + nextChap + "'>Continue to next chapter </a>";
						

nextWord();


}		



function scrambleWords()
{

					for(var bb =0; bb <20; bb++)
					{
						var v1 = parseInt((Math.random() * (20)));
						var v2 = parseInt((Math.random() * (20)));

						var t1 = myWordArray[v1];
						var t11 = myMeaningArray[v1];
						
						myWordArray[v1] = myWordArray[v2];
						myMeaningArray[v1] = myMeaningArray[v2];
						
						myWordArray[v2] = t1;
						myMeaningArray[v2] = t11;

					}
					
					resetWord();

}

function flipMeaning()
{
		for(var bb =0; bb <20; bb++)
					{
						var t1 = myWordArray[bb];
						var t11 = myMeaningArray[bb];
						
						myWordArray[bb] = t11;
						myMeaningArray[bb] = t1;
					}
	resetWord();
}

function resetCards()
{
document.getElementById("pl10").innerHTML = "<b> " + myWordArray[0] + "</b>";
		document.getElementById("pl11").innerHTML = "<b> " + myWordArray[1] + "</b>";
		document.getElementById("pl12").innerHTML = "<b> " + myWordArray[2] + "</b>";
		document.getElementById("pl13").innerHTML = "<b> " + myWordArray[3] + "</b>";
		document.getElementById("pl14").innerHTML = "<b> " + myWordArray[4] + "</b>";
		document.getElementById("pl15").innerHTML = "<b> " + myWordArray[5] + "</b>";
		document.getElementById("pl16").innerHTML = "<b> " + myWordArray[6] + "</b>";
		document.getElementById("pl17").innerHTML = "<b> " + myWordArray[7] + "</b>";
		document.getElementById("pl18").innerHTML = "<b> " + myWordArray[8] + "</b>";
		document.getElementById("pl19").innerHTML = "<b> " + myWordArray[9] + "</b>";
		document.getElementById("pl20").innerHTML = "<b> " + myWordArray[10] + "</b>";
		document.getElementById("pl21").innerHTML = "<b> " + myWordArray[11] + "</b>";
		document.getElementById("pl22").innerHTML = "<b> " + myWordArray[12] + "</b>";
		document.getElementById("pl23").innerHTML = "<b> " + myWordArray[13] + "</b>";
		document.getElementById("pl24").innerHTML = "<b> " + myWordArray[14] + "</b>";
		document.getElementById("pl25").innerHTML = "<b> " + myWordArray[15] + "</b>";
		document.getElementById("pl26").innerHTML = "<b> " + myWordArray[16] + "</b>";
		document.getElementById("pl27").innerHTML = "<b> " + myWordArray[17] + "</b>";
		document.getElementById("pl28").innerHTML = "<b> " + myWordArray[18] + "</b>";
		document.getElementById("pl29").innerHTML = "<b> " + myWordArray[19] + "</b>";

}



function openSubmenu2(num02)
{
	counter = num02;
	menuhighlight(num02);

	document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
	document.getElementById('fcholder').style.color = "#555555";
	clickFlag2 = 0;
	
	document.getElementById("changeTxt").innerHTML = myWordArray[num02];

}

  function menuhighlight(number1)
{
		document.getElementById('list_1').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_2').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_3').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_4').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_5').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_6').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_7').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_8').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_9').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_10').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_11').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_12').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_13').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_14').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_15').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_16').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_17').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_18').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_19').style.backgroundColor = "#DCE9F0";
		document.getElementById('list_20').style.backgroundColor = "#DCE9F0";

		
		document.getElementById('list_1').style.color = "#555555";
		document.getElementById('list_2').style.color = "#555555";
		document.getElementById('list_3').style.color = "#555555";
		document.getElementById('list_4').style.color = "#555555";
		document.getElementById('list_5').style.color = "#555555";
		document.getElementById('list_6').style.color = "#555555";
		document.getElementById('list_7').style.color = "#555555";
		document.getElementById('list_8').style.color = "#555555";
		document.getElementById('list_9').style.color = "#555555";
		document.getElementById('list_10').style.color = "#555555";
		document.getElementById('list_11').style.color = "#555555";
		document.getElementById('list_12').style.color = "#555555";
		document.getElementById('list_13').style.color = "#555555";
		document.getElementById('list_14').style.color = "#555555";
		document.getElementById('list_15').style.color = "#555555";
		document.getElementById('list_16').style.color = "#555555";
		document.getElementById('list_17').style.color = "#555555";
		document.getElementById('list_18').style.color = "#555555";
		document.getElementById('list_19').style.color = "#555555";
		document.getElementById('list_20').style.color = "#555555";


		
			document.getElementById('list_1').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_2').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_3').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_4').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_5').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_6').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_7').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_8').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_9').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_10').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_11').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_12').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_13').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_14').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_15').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_16').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_17').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_18').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_19').style.backgroundImage = "url('/images/menu_back.JPG')";
			document.getElementById('list_20').style.backgroundImage = "url('/images/menu_back.JPG')";
		

	

		if(number1 == 0)
		{
			document.getElementById('list_1').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_1').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_1').style.color = "white";
		} else if(number1 == 1)
		{
			document.getElementById('list_2').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_2').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_2').style.color = "white";
		} else if(number1 == 2)
		{
			document.getElementById('list_3').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_3').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_3').style.color = "white";
		} else if(number1 == 3)
		{
			document.getElementById('list_4').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_4').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_4').style.color = "white";
		} else if(number1 == 4)
		{
			document.getElementById('list_5').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_5').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_5').style.color = "white";
		} else if(number1 == 5)
		{
			document.getElementById('list_6').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_6').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_6').style.color = "white";
		} else if(number1 == 6)
		{
			document.getElementById('list_7').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_7').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_7').style.color = "white";
		} else if(number1 == 7)
		{
			document.getElementById('list_8').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_8').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_8').style.color = "white";
		} else if(number1 == 8)
		{
			document.getElementById('list_9').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_9').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_9').style.color = "white";
		} else if(number1 == 9)
		{
			document.getElementById('list_10').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_10').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_10').style.color = "white";
		} else if(number1 == 10)
		{
			document.getElementById('list_11').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_11').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_11').style.color = "white";
		} else if(number1 == 11)
		{
			document.getElementById('list_12').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_12').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_12').style.color = "white";
		} else if(number1 == 12)
		{
			document.getElementById('list_13').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_13').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_13').style.color = "white";
		} else if(number1 == 13)
		{
			document.getElementById('list_14').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_14').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_14').style.color = "white";
		} else if(number1 == 14)
		{
			document.getElementById('list_15').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_15').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_15').style.color = "white";
		} else if(number1 == 15)
		{
			document.getElementById('list_16').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_16').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_16').style.color = "white";
		} else if(number1 == 16)
		{
			document.getElementById('list_17').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_17').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_17').style.color = "white";
		} else if(number1 == 17)
		{
			document.getElementById('list_18').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_18').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_18').style.color = "white";
		} else if(number1 == 18)
		{
			document.getElementById('list_19').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_19').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_19').style.color = "white";
		} else if(number1 == 19)
		{
			document.getElementById('list_20').style.backgroundColor = "#4F8EB6";
			document.getElementById('list_20').style.backgroundImage = "url('/images/menu_press.JPG')";
			document.getElementById('list_20').style.color = "white";
		} 

		

}


function nextWord()
  {
	document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
	document.getElementById('fcholder').style.color = "#555555";
	clickFlag2 = 0;

	if(counter<19)
	{
		counter++;
		menuhighlight(counter);
	}

	document.getElementById("changeTxt").innerHTML= myWordArray[counter];

}

function resetWord()
{	
	document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
	document.getElementById('fcholder').style.color = "#555555";
	clickFlag2 = 0;
	
	document.getElementById("changeTxt").innerHTML= myWordArray[counter];
}

function prevWord()
  {
	document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
	document.getElementById('fcholder').style.color = "#555555";
	clickFlag2 = 0;

	if(counter>0)
	{
		counter--;
		menuhighlight(counter);
	}

	document.getElementById("changeTxt").innerHTML= myWordArray[counter];

}


function gup( name ){  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  var regexS = "[\\?&]"+name+"=([^&#]*)";  var regex = new RegExp( regexS );  var results = regex.exec( window.location.href );  if( results == null )    return "";  else    return results[1];}

function getMeanig(value01,num01)
  {


  }




function flipIt(Id,value01)
  {
	if(clickFlag2 == 1)
	{
		 document.getElementById("changeTxt").innerHTML= myWordArray[counter];
		 flipped = 0;
	} else {
 		document.getElementById("changeTxt").innerHTML= myMeaningArray[counter];
 		flipped = 1;
	}
 
  }


function choiceClick2(Id,value01)
  {
  	clickFlag = 1;
  	flipIt('2','1');

	if(clickFlag2 == 0)
	{
		
			document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_back_flip.JPG')";
			document.getElementById('fcholder').style.color = "white";
			clickFlag2 = 1;
	} else {
			
			document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
			document.getElementById('fcholder').style.color = "#555555";
			clickFlag2 = 0;
	}
  }


function clearMeaning()
{
	clickFlag = 0;
 			document.getElementById('fcholder').style.backgroundImage = "url('/images/big_card_flip.JPG')";
			document.getElementById('fcholder').style.color = "#555555";
			clickFlag2 = 0;
}
