// country_quiz.js // Help out backgrounds of country_flag/currency/capital_quiz.php suite // RJM Programming // November, 2016 var trjm=null; function flagcheck(inv) { var suffix=''; goes++; if (document.getElementById('tdflag').innerHTML.indexOf(inv.value) != -1) { score++; } else { suffix=' The country represented by you needed for your answer was ' + document.getElementById(countryids[choice]).title; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; document.getElementById('country').value=''; choose(); } function capitalcheck(inv) { if (inv.value != '') { var suffix=''; goes++; if (ourcomp(inv.value,document.getElementById('country').value)) { score++; } else { suffix=' The country ' + document.getElementById(countryids[choice]).id.replace(/_/g,' ') + ' represented by has the capital city ' + document.getElementById(countryids[choice]).title; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; choose(); } } function currencycheck(inv) { if (inv.value != '') { var suffix=''; goes++; if (ourcomp(inv.value,document.getElementById('country').value)) { score++; } else { suffix=' The country ' + document.getElementById(countryids[choice]).id.replace(/_/g,' ') + ' (' + countrycodes[choice] + ') represented by has the currency ' + document.getElementById(countryids[choice]).title; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; choose(); } } function ifon() { if (trjm != null) { document.getElementById('iback').style.display='block'; } else { document.getElementById('iback').style.display='none'; } } function check(inv) { var ourcis=""; if (inv.value != "") { if (document.URL.indexOf('_flag_') != -1) { ourcis="http://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=" + encodeURIComponent(" flag of " + document.getElementById(countryids[choice]).title); flagcheck(inv); } else if (document.URL.indexOf('_capital_') != -1) { ourcis="http://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=" + encodeURIComponent(" capital of " + document.getElementById(countryids[choice]).id.replace(/_/g,' ')); capitalcheck(inv); } else if (document.URL.indexOf('_currency_') != -1) { ourcis="http://www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=" + encodeURIComponent(" currency of " + document.getElementById(countryids[choice]).id.replace(/_/g,' ')); currencycheck(inv); } if (trjm != null) { document.getElementById('iback').src=ourcis; document.getElementById('iback').style.display='block'; } } } function andquizthen() { if (trjm == null) { trjm=document.getElementsByTagName('h3')[0]; if (trjm != null) { trjm.innerHTML+=' Optional YouTube Video lookups '; document.body.innerHTML+=""; choose(); } } } setTimeout(andquizthen, 2000);