var arrFlashcards = new Array(); //this is the master array
var arrFlashcardsDisplayOrder = new Array();
var currFlashcard = -1; //index of the arrFlashcardsDisplayOrder array
var viewFirst; //0: Definition, 1: Term

function CreateFlashcard(definitionHTML, termHTML) {
	arrFlashcards[arrFlashcards.length] = Array(definitionHTML, termHTML)
}

function SetFlashcardsTotalNumber() {
	document.getElementById("TotalFlashcards").innerHTML = arrFlashcards.length;
}

function DisplayFlashcard(FlashcardIndex) {
	displayBtnNavigator();
	document.getElementById("innercardContentTop").innerHTML = arrFlashcards[arrFlashcardsDisplayOrder[FlashcardIndex]][0];
	document.getElementById("innercardContentMiddle").innerHTML = arrFlashcards[arrFlashcardsDisplayOrder[FlashcardIndex]][1];
	showhideTab(viewFirst);
	myAccordion.showThisHideOpen(viewFirst);
}

function hideBtnNavigator() {
	document.getElementById("tb_leftColumn").className = "hide";
	document.getElementById("tb_rightColumn").className = "hide";
}

function displayBtnNavigator() {
	if(currFlashcard!=-1) {
		document.getElementById("tb_leftColumn").className = (currFlashcard==0)?"hide":"show";
		document.getElementById("tb_rightColumn").className = (currFlashcard==arrFlashcards.length-1)?"hide":"show";
	}
}

function showhideTab(flag) {
	document.getElementById("tb_innercardContentTop").style.display = (flag==0)?"":"none";
	document.getElementById("tb_cardContentMiddle").style.display = (flag==0)?"none":"";
}

function showFlashcards() {
	currFlashcard = 0;
	viewFirst = (document.frmFlashcards.viewfirst[0].checked)?0:1;
	genFlashcardsDisplayOrder();
	DisplayFlashcard(currFlashcard);
}

function navigateFlashcards(FStep) {
	currFlashcard += FStep;
	DisplayFlashcard(currFlashcard);
}

function genFlashcardsDisplayOrder() {
	var i;	
	for(i=0;i<arrFlashcards.length;i++) arrFlashcardsDisplayOrder[i]=i;
	if(document.frmFlashcards.randomize[0].checked) randomizeArray(arrFlashcardsDisplayOrder);
}

function randomizeArray(o){
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};


CreateFlashcard("\
<p>Measurement of the color of an object on the basis of the ratio of its brightness in blue light to its brightness in ''visual'' (or yellow-green) light.</p> \
","\
<p><strong><i>b</i><sub>B</sub>/<i>b</i><sub>V</sub> color</strong></p> \
");

CreateFlashcard("\
<p>A system in which two stars are in gravitationally bound orbits about their common center of mass.</p> \
","\
<p><strong>binary stars</strong></p> \
");

CreateFlashcard("\
<p>A binary system in which the orbital plane is oriented such that the two stars appear to pass in front of one another as seen from Earth.</p> \
","\
<p><strong>eclipsing binary</strong></p> \
");

CreateFlashcard("\
<p>An instrument element that transmits a limited wavelength range of electromagnetic radiation. </p> \
","\
<p><strong>filter</strong></p> \
");

CreateFlashcard("\
<p>A plot of the luminosities versus the surface temperatures of stars.</p> \
","\
<p><strong>H-R diagram</strong></p> \
");

CreateFlashcard("\
<p>A relationship among these three properties of stars indicating that if any two are known, the third can be calculated.</p> \
","\
<p><strong>luminosity&#150;temperature&#150;radius relationship</strong></p> \
");

CreateFlashcard("\
<p>A system used by astronomers to describe the brightness or luminosity of stars. </p> \
","\
<p><strong>magnitude</strong></p> \
");

CreateFlashcard("\
<p>The strip on the H-R diagram where most stars are found.</p> \
","\
<p><strong>main sequence</strong></p> \
");

CreateFlashcard("\
<p>A unit for measuring angles. 1/60 of a degree of arc.</p> \
","\
<p><strong>minute of arc</strong></p> \
");

CreateFlashcard("\
<p>The fact that real measurements are never perfect; all observations are uncertain by some amount.</p> \
","\
<p><strong>observational uncertainty</strong></p> \
");

CreateFlashcard("\
<p>The apparent shift in the position of one object relative to another object, caused by the changing perspective of the observer. In astronomy, the displacement in the apparent position of a nearby star caused by the changing location of Earth in its orbit.</p> \
","\
<p><strong>parallax</strong></p> \
");

CreateFlashcard("\
<p>The distance to a star with parallax of 1 arcsecond using a base of 1 AU. Approximately 3.26 light-years.</p> \
","\
<p><strong>parsec</strong></p> \
");

CreateFlashcard("\
<p>The angle at the center of a circle subtended by an arc equal to the length of the circle's radius.</p> \
","\
<p><strong>radian</strong></p> \
");

CreateFlashcard("\
<p>A unit used for measuring very small angles. 1/60 of a minute of arc, or 1/3,600 of a degree. </p> \
","\
<p><strong>second of arc</strong></p> \
");

CreateFlashcard("\
<p>A classification system for stars based on the presence and relative strength of absorption lines in their spectra.</p> \
","\
<p><strong>spectral types</strong></p> \
");

CreateFlashcard("\
<p>Use of the spectroscopically determined luminosity and the observed brightness of a star to determine the star's distance.</p> \
","\
<p><strong>spectroscopic parallax</strong></p> \
");

CreateFlashcard("\
<p>A luminous ball of gas that is held together by gravity.</p> \
","\
<p><strong>star</strong></p> \
");

CreateFlashcard("\
<p>The way an animal's brain combines the different information from its two eyes to perceive the distances to objects around it.</p> \
","\
<p><strong>stereoscopic vision</strong></p> \
");

CreateFlashcard("\
<p>A binary star in which the two stars can be seen individually from Earth.</p> \
","\
<p><strong>visual binary</strong></p> \
");

SetFlashcardsTotalNumber();