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>The event that occurred about 14 billion years ago that marks the beginning of time and the universe.</p> \
","\
<p><strong>Big Bang</strong></p> \
");

CreateFlashcard("\
<p>The formation of low-mass nuclei (H, He, Li, Be, B) during the first few minutes following the Big Bang.</p> \
","\
<p><strong>Big Bang nucleosynthesis</strong></p> \
");

CreateFlashcard("\
<p>A finite universe with a curved spatial structure such that the angles of a triangle always exceed 180°.</p> \
","\
<p><strong>closed universe</strong></p> \
");

CreateFlashcard("\
<p>Isotropic microwave radiation from the celestial sphere having a 2.73 K Planck spectrum. The CBR is understood as residual radiation from the Big Bang.</p> \
","\
<p><strong>cosmic background radiation (CBR) </strong></p> \
");

CreateFlashcard("\
<p>A constant introduced into general relativity by Einstein that characterizes an extra, repulsive force in the universe due to the vacuum of space itself.</p> \
","\
<p><strong>cosmological constant</strong></p> \
");

CreateFlashcard("\
<p>The redshift that results from the expansion of the universe rather than from the motions of galaxies or gravity.</p> \
","\
<p><strong>cosmological redshift</strong></p> \
");

CreateFlashcard("\
<p>The value of the mass density of the universe that, ignoring any cosmological constant, is just barely capable of halting expansion of the universe.</p> \
","\
<p><strong>critical mass density</strong></p> \
");

CreateFlashcard("\
<p>A sequence of techniques for measuring cosmic distances; each method is calibrated using the results from other methods that have been applied to closer objects.</p> \
","\
<p><strong>distance ladder</strong></p> \
");

CreateFlashcard("\
<p>An infinite universe whose spatial structure obeys Euclidean geometry, such that the sum of the angles of a triangle always equals 180°.</p> \
","\
<p><strong>flat universe</strong></p> \
");

CreateFlashcard("\
<p>In cosmology, describes a universe in which observers in any location would observe the same properties.</p> \
","\
<p><strong>homogeneous</strong></p> \
");

CreateFlashcard("\
<p>The puzzling observation that the cosmic background radiation is so uniform in all directions.</p> \
","\
<p><strong>horizon problem</strong></p> \
");

CreateFlashcard("\
<p>The constant of proportionality relating the recession velocities of galaxies to their distances.</p> \
","\
<p><strong>Hubble constant</strong></p> \
");

CreateFlashcard("\
<p>The law stating that the speed at which a galaxy is moving away from us is proportional to the distance of that galaxy.</p> \
","\
<p><strong>Hubble's Law</strong></p> \
");

CreateFlashcard("\
<p>An extremely brief phase of ultra-rapid expansion of the very early universe.</p> \
","\
<p><strong>inflation</strong></p> \
");

CreateFlashcard("\
<p>In cosmology, a universe whose properties observers find to be the same in all directions.</p> \
","\
<p><strong>isotropic</strong></p> \
");

CreateFlashcard("\
<p>The time that it has taken the light from an astronomical object to reach Earth.</p> \
","\
<p><strong>look-back time</strong></p> \
");

CreateFlashcard("\
<p>A unit of distance equal to 1 million <i>light-years</i>.</p> \
","\
<p><strong>mega-light-year (Mly)</strong></p> \
");

CreateFlashcard("\
<p>An infinite universe with a negatively curved spatial structure (much like the surface of a saddle) such that the sum of the angles of a triangle is always less than 180°.</p> \
","\
<p><strong>open universe</strong></p> \
");

CreateFlashcard("\
<p>The motion of a galaxy relative to the overall expansion of the universe.</p> \
","\
<p><strong>peculiar velocity</strong></p> \
");

CreateFlashcard("\
<p>The shifting of the wavelength of light to longer wavelengths by any of several effects.</p> \
","\
<p><strong>redshift</strong></p> \
");

CreateFlashcard("\
<p>A region of space which contains very little matter.</p> \
","\
<p><strong>vacuum</strong></p> \
");

SetFlashcardsTotalNumber();