<!doctype html>
<html>
<head>
<title>World Bank API Population Data Google Chart Pie Chart - RJM Programming - February, 2016</title>
<style>
body { background-color: lightgreen; }
table { background-color: #f0f0f0; border: 1px solid red; }
a:hover { background-color: orange; }
</style>
<script type='text/javascript'>
var startswith=location.search.split('startswith=')[1] ? location.search.split('startswith=')[1].split('&')[0] : '';
var year=location.search.split('year=')[1] ? location.search.split('year=')[1].split('&')[0] : '2015';
var yearvs=location.search.split('yearvs=')[1] ? ('&yearvs=' + location.search.split('yearvs=')[1].split('&')[0]) : '';
var justletters=location.search.split('justletters=')[1] ? ('&justletters=' + location.search.split('justletters=')[1].split('&')[0]) : '';
function childiframeviaurl() {
var trinnards="", yearsel="<select onchange='year=this.value; childiframeviaurl();' id=syear></select>", yearselvs="<select onchange='yearvs=this.value; childiframeviaurl();' id=syearvs><option value=''>Year</option></select>";
if (document.getElementById('mytr').innerHTML == '') {
var nd=new Date();
for (var ii=eval(nd.getFullYear()); ii>=1900; ii--) {
xsel="";
if (ii == 2015) xsel=" selected";
yearsel=yearsel.replace("</select>", "<option value=" + ii + xsel + ">" + ii + "</option></select>");
yearselvs=yearselvs.replace("</select>", "<option value='&yearvs=" + ii + xsel + "'>" + ii + " compared to </option></select>");
}
if (startswith == "") {
trinnards+="<td>" + yearselvs + " " + yearsel + "</td><td style='background-color:yellow;'><a href='#' onclick=\"startswith=' '; childiframeviaurl();\">All</a> ... versus Starts With ...</td>";
} else {
trinnards+="<td>" + yearselvs + " " + yearsel + "</td><td><a href='#' onclick=\"startswith=' '; childiframeviaurl();\">All</a> ... versus Starts With ...</td>";
}
for (var i=65; i<=90; i++) {
trinnards+="<td id=" + String.fromCharCode(i) + "><a href='#' onclick='startswith=this.innerHTML; childiframeviaurl();' id=a_" + String.fromCharCode(i) + " title=" + String.fromCharCode(i) + ">" + String.fromCharCode(i) + "</a></td>";
}
trinnards+="<td>  Just Letter Report <input onchange=\" if (this.checked) { justletters='&justletters=y'; } else { justletters=''; } \" type=checkbox id=justletters></input></td>";
document.getElementById('mytr').innerHTML=trinnards;
}
if (startswith != '') {
if (startswith == ' ') {
startswith='';
//alert('http://www.rjmprogramming.com.au/PHP/worldbank_population_data.php?startswith=' + startswith + '&year=' + year + justletters);
}
document.getElementById('childiframe').style.display='block';
document.getElementById('childiframe').src='http://www.rjmprogramming.com.au/PHP/worldbank_population_data.php?startswith=' + startswith + '&year=' + year + yearvs + justletters;
startswith=decodeURIComponent(startswith);
if (document.getElementById(startswith.toUpperCase())) {
document.getElementById(startswith.toUpperCase()).style.backgroundColor='yellow';
}
} else if (year != '') {
document.getElementById('childiframe').style.display='block';
document.getElementById('childiframe').src='http://www.rjmprogramming.com.au/PHP/worldbank_population_data.php?year=' + year + yearvs + justletters;
} else {
document.getElementById('childiframe').style.display='block';
document.getElementById('childiframe').src=('http://www.rjmprogramming.com.au/PHP/worldbank_population_data.php' + justletters.replace('&','?') + yearvs).replace('.php&','.php?');
}
}
</script>
</head>
<body onload='childiframeviaurl();'>
<!--h1>World Bank API Population Data Google Chart Pie Chart</h1>
<h3>RJM Programming</h3>
<h4>Thanks to <a target=_blank title='World Bank API documentation' href='https://datahelpdesk.worldbank.org/knowledgebase/articles/898581-api-basic-call-structure'>World Bank API</a></h4-->
<table id='mytable'><tbody id='mytbody'><tr id='mytr'></tr></tbody></table><br>
<iframe style='width:100%;height:1200px;display:none;' name='childiframe' id='childiframe' src='about:blank'></iframe>
</body>
</html>