// country_quiz.js
// Help out backgrounds of country_flag/currency/capital_quiz.php suite
// RJM Programming
// November, 2016
var trjm=null;
var xsprefix='';
var xuprefix="//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Countries&onclick=y&width=298&height=194&country=Country&popularity=Intensity&guess=&data=";
function xselchangeit(osel) {
uprefix+=sprefix + '%20[~' + encodeURIComponent(osel.options[osel.selectedIndex].text) + '~,66]%20';
sprefix=',';
iframeit();
}
function xsetup(ins) {
uprefix+=sprefix + '%20[~' + encodeURIComponent(ins.replace(/_/g,' ')) + '~,66]%20';
sprefix=',';
iframeit();
}
function xiframeit() {
document.getElementById('dgeochart').innerHTML='';
}
function xcheckforpost(insg, oiframe, owhere) {
var outs=insg, fbits='';
if (oiframe == null) {
fbits='
';
} else {
if (oiframe.name != '') {
fbits='';
} else {
fbits='';
}
}
if (insg.length > 950) {
var outarr=insg.split('#')[0].split('?');
if (outarr.length > 1) {
var outarrtwo=outarr[1].split('&'), oath;
for (var im=0; im','');
}
}
if (owhere == null) {
owhere=document.getElementById('mydpost');
if (owhere == null) {
if (document.getElementById('mydpost')) {
document.getElementById('mydpost').innerHTML=fbits;
setTimeout(andlater,1500);
outs="#";
} else {
document.body.innerHTML+='' + fbits + '
';
setTimeout(andlater,1500);
outs="#";
}
} else {
owhere.innerHTML=fbits;
setTimeout(andlater,1500);
outs="#";
}
} else {
owhere.innerHTML=fbits;
setTimeout(andlater,1500);
outs="#";
}
}
return outs;
}
function xandlater() {
document.getElementById('myspost').click();
}
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; } if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } 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; } if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } 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; } if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } 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="//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="//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="//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 xpreandquizthen() {
if (document.getElementById('mydpost') == null && document.getElementById('dgeochart') == null) {
document.body.innerHTML+="";
if (document.getElementById('country').value != '') {
selchangeit(document.getElementById('country'));
}
}
if (document.getElementById('mydpost') == null) {
document.body.innerHTML+='';
if (document.getElementById('country').value != '') {
selchangeit(document.getElementById('country'));
}
}
if (document.getElementById('dgeochart') == null) {
document.body.innerHTML+="";
if (document.getElementById('country').value != '') {
selchangeit(document.getElementById('country'));
}
}
}
function andquizthen() {
// xpreandquizthen();
if (trjm == null) {
trjm=document.getElementsByTagName('h3')[0];
if (trjm != null) {
trjm.innerHTML+=' Optional YouTube Video lookups ';
document.body.innerHTML+="";
choose();
}
}
}
//setTimeout(xpreandquizthen, 2200);
setTimeout(andquizthen, 3000);