var order=0; var sides=2; var sequence=0; var state=1; var idx=0; var thisSeq=sequence; var nextIdx=0; var dontAsk=[]; var active=questions.length; function calcNext() { nextIdx=idx; do { if (order==0) { nextIdx++; if (nextIdx>questions.length-1) nextIdx=0; } else if (order==1) { nextIdx--; if (nextIdx<0) nextIdx=questions.length-1; } else if (order==2) { do { nextIdx=Math.floor(Math.random()*questions.length); } while (active>1 && nextIdx==idx); } } while (dontAsk[nextIdx]==1); } function show() { var blank=" "; var q; var a; var qbg; var abg; qbg=qBGC[idx]; abg=aBGC[idx]; if (state==0) { idx=nextIdx; if (thisSeq==0) { q=questions[idx]; if (sides==2) { a=blank; } else { a=""; } } if (thisSeq==1) { if (sides==2) { a=answers[idx]; q=blank; } else { q=answers[idx]; a=""; qbg=abg; } } document.getElementById('flip').innerHTML="Flip"; state=1; } else { if (thisSeq==0) { if (sides==2) { q=questions[idx]; a=answers[idx]; } else { q=answers[idx]; a=""; qbg=abg; } } if (thisSeq==1) { if (sides==2) { a=answers[idx]; q=questions[idx]; } else { q=questions[idx]; a=""; } } document.getElementById('flip').innerHTML="Next"; state=0; calcNext(); if (sequence==2) { thisSeq=Math.floor(Math.random()*2); } } document.getElementById('recto').innerHTML=q; document.getElementById('recto').style.backgroundColor=qbg; if (sides==2) { document.getElementById('verso').innerHTML=a; document.getElementById('verso').style.backgroundColor=abg; } return true; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function setInOrder() { order=0; show(); createCookie("order",order,30); } function setReverse() { order=1; show(); createCookie("order",order,30); } function setRandom() { order=2; show(); createCookie("order",order,30); } function setSingle() { sides=1; createTable(); createCookie("sides",sides,30); } function setBoth() { sides=2; createTable(); createCookie("sides",sides,30); } function setNormal() { sequence=0; thisSeq=0; show(); createCookie("seq",sequence,30); } function setSwap() { sequence=1; thisSeq=1; show(); createCookie("seq",sequence,30); } function setRandomSwap() { sequence=2; show(); createCookie("seq",sequence,30); } function dontAskAgain() { active--; if (active==0) { alert("Can't turn off all cards!"); active=1; } else { dontAsk[idx]=1; createCookie("da"+idx+":"+id,1,30); calcNext(); state=0; show(); } } function loadCookies() { var ca=document.cookie.split(';'); for (i=0;i"+answers[idx]+""; } function showOptions() { document.getElementById('recto').style.backgroundColor="#FFFFFF"; document.getElementById('recto').innerHTML= "Don't ask again
" +"Ask all cards
" +"Ask in original order
" +"Ask in reverse order
" +"Ask in random order
" +"Normal Q/A sequence
" +"Swap Q/A sequence
" +"Random swap
" +"View single side
" +"View both sides
" ; if (sides==2) { document.getElementById('verso').innerHTML=""; document.getElementById('verso').style.backgroundColor="#FFFFFF"; } } function GetWidth() { if (navigator.appName=='Opera') { return screen.width-10; } else if (self.innerHeight) { return self.innerWidth; } return 0; } function GetHeight() { if (navigator.appName=='Opera') { return screen.height-10; } else if (self.innerHeight) { return self.innerHeight; } return 0; } function createTable() { var tableHTML= "

"+ "
"+ " "+ " Flip"+ " "+ " | "+ " Options"+ " "+ " | "+ " LexisRex"+ " "+ "
"+ "
"; if (sides==2) { tableHTML+= " "+ questions[nextIdx]+ " "+ "
"+ "
"+ " "+ " "+ "
"; } else { tableHTML+= " | "+ questions[nextIdx]+ " "+ ""; } document.getElementById('table').innerHTML=tableHTML; state=1; }