<!doctype html>
<html>
<head>
<title>The Other Side of the World - RJM Programming - March, 2017</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.25, maximum-scale=8, user-scalable=yes" />
<style>
select { margin-top: 8px; margin-bottom: 8px; }
input { margin-top: 8px; margin-bottom: 8px; }
</style>
<script type='text/javascript'>
var ssize=1, lastpurl='', purlvsplacebits=[], purlplacebits=[], aplace='', wthere=false, url = "//www.rjmprogramming.com.au/PHP/Map/map.php?title=Other%20Side%20Of%20the%20World&onclick=y&label=['Lat',&value='Lon','Name']&data=";
var place=["placearr["], country=["cntryarr["], ylat=["latarr["], xlong=["longarr["], distfrom=[], distto=[], iplaces=0, jplace=0, topfivefrom=[-1.0, -1.0, -1.0, -1.0, -1.0], topfiveto=[-1.0, -1.0, -1.0, -1.0, -1.0];
var divisor=10.0, divl=1;
var wasvl=0, doneonce=false, slat=0.0, slong=0.0;
var otherideas='', lastx='', startPos=null, ee, melb=-34.0;
var tzpurltwo="//www.rjmprogramming.com.au/PHP/tz_places.php?wlink=https%3A%2F%2Fwww.wunderground.com%2Fq%2Fzmw%3A00000.1.01492&iso=NO&lat=59.910000&long=10.740000&place=Oslo%2C%20Norway&tzname=Europe%2FOslo&iam=1&wlink2=https%3A%2F%2Fwww.wunderground.com%2Fq%2Fzmw%3A00000.97.98642&iso2=PH&lat2=9.520000&long2=123.430000&place2=Oslob%2C%20Philippines&tzname2=Asia%2FManila&iam2=2";
var tzpurl="//www.rjmprogramming.com.au/PHP/tz_places.php?wlink=https%3A%2F%2Fwww.wunderground.com%2Fq%2Fzmw%3A00000.18.94326&iso=AU&lat=-23.700001&long=133.880005&place=Alice%20Springs%2C%20Australia&tzname=Australia%2FDarwin&iam=1";

// PlaceName|GMTOffset|TimeRightNow|TimeZoneName
// <form onsubmit="return checktop(this);" target="mapif" action="//www.rjmprogramming.com.au/PHP/Map/map.php" method="POST">
// <input value="Cairo, Egypt" name="title" type="hidden">
// <input name="wlink" value="https://www.wunderground.com/q/zmw:00000.1.62375" type="hidden">
// <input value="['Lat'," name="label" type="hidden"><div id="dgmtoff">
// <input name="gmtoff" value="2" type="hidden"><input name="rightnow" value="2:30" type="hidden">
// <input name="tzname" value="Africa/Cairo" type="hidden"></div><input value="'Lon','Name']" name="value" type="hidden">
// <input name="wouldlikeyoutoseekpermission" id="wouldlikeyoutoseekpermission" value="" type="hidden">
// <input value=",[30.059999,31.250000,~Cairo, Egypt~]" name="data" type="hidden">
// <input value="y" name="onclick" type="hidden"><input id="smapif" value="Show" style="display:none;" type="submit">
// </form>


//window.onload = initAll;

function do_td_bottom(osel) {
var suffix="",newval="", prefix="", rest="", j=1;
var atzpurl=tzpurl.split("?");

for (var i=1; i<=osel.length; i++) {
if (suffix == "") prefix=atzpurl[0] + "?";
if (osel.options[eval(-1 + i)].selected) {
if (suffix == "") {
rest+=osel.options[eval(-1 + i)].value;
} else {
rest+='&' + osel.options[eval(-1 + i)].value.replace(/=/g, (suffix + '='));
}
suffix='' + eval(1 + j);
j++;
}
}
if (prefix != "" && rest != "") {
document.getElementById('td_bottom').innerHTML='<iframe id="itd_bottom" width=100% height=800 src="' + prefix + rest + '" title="Timezone Multiple Places"></iframe>';
location.href='#td_bottom';
}
}

function pretzbits() {
tzbits(document.getElementById('itd_bl'));
}

function tzbits(iois) {
var ibase=0, there=false, interested=-1;
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
if (aconto.body.innerHTML.indexOf("return checktop(") != -1) {
var proposeds='', acbits=aconto.body.innerHTML.split("return checktop("), sproposeds='', repthis='';
var inps=acbits[1].split('</form>')[0].split('<input '), jnps=0;
for (jnps=1; jnps<inps.length; jnps++) {
if (inps[jnps].indexOf('name="title"') != -1) {
proposeds=inps[jnps].split('value="')[1].split('"')[0] + proposeds;
//alert("0: " + proposeds + ' ... ' + inps.length);
sproposeds=proposeds;
repthis=',~' + encodeURIComponent(inps[jnps].split('value="')[1].split('"')[0]) + '~';
interested=lastpurl.indexOf(',~' + encodeURIComponent(inps[jnps].split('value="')[1].split('"')[0]) + '~');
} else if (inps[jnps].indexOf('name="gmtoff"') != -1 && proposeds.split('|').length == 1) {
proposeds+='|' + inps[jnps].split('value="')[1].split('"')[0];
//alert("1: " + proposeds);
} else if (inps[jnps].indexOf('name="gmtoff"') != -1 && proposeds.split('|').length > 1) {
proposeds=proposeds.replace('|','|' + inps[jnps].split('value="')[1].split('"')[0]);
//alert("2: " + proposeds);

} else if (inps[jnps].indexOf('name="rightnow"') != -1 && proposeds.split('|').length == 1) {
proposeds+='||' + inps[jnps].split('value="')[1].split('"')[0];
//alert("3: " + proposeds);
} else if (inps[jnps].indexOf('name="rightnow"') != -1 && proposeds.split('|').length == 2) {
proposeds+='|' + inps[jnps].split('value="')[1].split('"')[0];
//alert("4: " + proposeds);
} else if (inps[jnps].indexOf('name="rightnow"') != -1 && proposeds.split('|').length > 2) {
proposeds=proposeds.replace(proposeds.split('|')[0] + '|' + proposeds.split('|')[1],proposeds.split('|')[0] + '|' + proposeds.split('|')[1] + '|' + inps[jnps].split('value="')[1].split('"')[0]);
//alert("5: " + proposeds);


} else if (inps[jnps].indexOf('name="tzname"') != -1 && proposeds.split('|').length == 1) {
proposeds+='|||' + inps[jnps].split('value="')[1].split('"')[0];
//alert("6: " + proposeds);
} else if (inps[jnps].indexOf('name="tzname"') != -1 && proposeds.split('|').length == 2) {
proposeds+='||' + inps[jnps].split('value="')[1].split('"')[0];
//alert("7: " + proposeds);
} else if (inps[jnps].indexOf('name="tzname"') != -1 && proposeds.split('|').length == 3) {
proposeds+='|' + inps[jnps].split('value="')[1].split('"')[0];
//alert("8: " + proposeds);
} else if (inps[jnps].indexOf('name="tzname"') != -1 && proposeds.split('|').length > 3) {
proposeds=proposeds.replace(proposeds.split('|')[0] + '|' + proposeds.split('|')[1] + '|' + proposeds.split('|')[2],proposeds.split('|')[0] + '|' + proposeds.split('|')[1] + '|' + proposeds.split('|')[2] + '|' + inps[jnps].split('value="')[1].split('"')[0]);
//alert("9: " + proposeds);
}

}
for (ibase=0; ibase<purlvsplacebits.length; ibase++) {
if (!there && (purlvsplacebits[ibase] + "|").indexOf((proposeds + "|")) == 0) {
there=true;
}
}
if (!there) {
//alert("Added " + proposeds + ' ... via ... ' + acbits[1].split('</form>')[0]);
purlvsplacebits.push(proposeds);
document.getElementById('dmulti').style.display='inline';
}
if (interested != -1 && sproposeds != proposeds) {
document.getElementById('myiframe').src=lastpurl.replace(repthis, ',~' + encodeURIComponent(proposeds) + '~').replace(repthis.replace(',~',''), repthis.replace(',~','').replace('~','| | | ~'));
lastpurl=lastpurl.replace(repthis, ',~' + encodeURIComponent(proposeds) + '~').replace(repthis.replace(',~',''), repthis.replace(',~','').replace('~','| | | ~'));
}
}
}
}
}
}

function saveurls(purl) {
var outpurl=purl, ibase=0, thebaseplacebits=purl.split(',~'), vsbaseplace='', baseplace='', there=false;
if (thebaseplacebits.length > 1) {
baseplace=decodeURIComponent(thebaseplacebits[1].split('~')[0]);
vsbaseplace=baseplace.split(' (0')[0].split(' (1')[0].split(' (2')[0].split(' (3')[0].split(' (4')[0].split(' (5')[0].split(' (6')[0].split(' (7')[0].split(' (8')[0].split(' (9')[0];

if (vsbaseplace != baseplace) {
if (vsbaseplace.split(' (').length == 2) vsbaseplace=vsbaseplace.replace(' (' + vsbaseplace.split(' (')[1].split(')')[0] + ')','');
for (ibase=0; ibase<purlvsplacebits.length; ibase++) {
if (!there && (purlvsplacebits[ibase] + "|").indexOf((vsbaseplace + "|")) == 0) {
there=true;
}
}
if (!there) {
//alert('//www.rjmprogramming.com.au/weather/autocomplete.htm?place=' + (vsbaseplace));
document.getElementById('mygir').src='//www.rjmprogramming.com.au/weather/autocomplete.htm?place=' + encodeURIComponent(vsbaseplace);
} else {
there=false;
}
}

if (baseplace.indexOf('|') == -1) {
for (ibase=0; ibase<purlvsplacebits.length; ibase++) {
if (purlvsplacebits[ibase].indexOf('|') != -1) {
if ((purlvsplacebits[ibase] + "|").indexOf((baseplace + "|")) == 0) {
baseplace=purlvsplacebits[ibase];
outpurl=outpurl.replace(',~' + thebaseplacebits[1].split('~')[0], ',~' + encodeURIComponent(purlvsplacebits[ibase]));
}
}
}
for (ibase=0; ibase<purlplacebits.length; ibase++) {
if (!there && (purlplacebits[ibase] + "|").indexOf((baseplace + "|")) == 0) {
there=true;
}
}
if (!there) {
//alert('added ' + baseplace);
purlplacebits.push(baseplace);
}
}
}
lastpurl=outpurl;
return outpurl;
}

function great_circle_distance(talis, gnolis, latis, longis) {
var ourdist=0.0;
var rgnol=eval((gnolis) * Math.PI / 180.0);
var rtal=eval((talis) * Math.PI / 180.0);
var rlong=eval((longis) * Math.PI / 180.0);
var rlat=eval((latis) * Math.PI / 180.0);

var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI / 180.0));

var acof = eval(Math.sin(rtal) * Math.sin(rlat)) + (Math.cos(rtal) * Math.cos(rlat) * Math.cos(deltalong)); // via http://en.wikipedia.org/wiki/Great-circle_distance ... thanks

ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) / 100;
return eval(ourdist / 1000.0);
}

function selto(sio) {
if (sio.value != '') {
var cols=sio.options[sio.selectedIndex].title.replace(/_/g,' ').split(',');
document.getElementById('latitude').value=cols[1];
document.getElementById('longitude').value=cols[2];
var placebits=cols[0].split('/'), aname='';
for (var ival=eval(-1 + placebits.length); ival>=0; ival--) {
if (aname == '') {
aname=placebits[ival];
} else {
aname+=', ' + placebits[ival];
}
}
document.getElementById('place').value=sio.options[sio.selectedIndex].text; //aname;
totalmore();
wthere=true;
showit(null);
newtpz();
wthere=false;
}
}

function postgleanlatlong() {
somelatlong(document.getElementById('mygi'));
}

function postgleanlatlongr() {
somelatlong(document.getElementById('mygir'));
}

function somelatlong(iois) {
var title_eq;
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
//if (aconto.body.innerHTML.trim().length > 0) alert(aconto.body.innerHTML);
title_eq=aconto.body.innerHTML.split(' id="myselcont"');
if (document.getElementById('topjsondata').innerHTML != '') {
//alert(':' + document.getElementById('topjsondata').innerHTML);
document.getElementById("wudiv").style.display="inline";
document.getElementById("ourselcont").style.display="inline";
document.getElementById("ourselcont").innerHTML=document.getElementById('jsondata').innerHTML.replace('Please select ','Optionally select ');
} else if (title_eq.length > 1) {
//alert(title_eq[1]);
document.getElementById("wudiv").style.display="inline";
document.getElementById("ourselcont").style.display="inline";
document.getElementById("ourselcont").innerHTML=title_eq[1].split('</select>')[0].replace(title_eq[1].split('>')[0] + '>','').replace('Please select ','Optionally select ');
//alert(title_eq[1].split(' ')[0]);
}
if (eval(document.getElementById("ourselcont").innerHTML.length) > 5) {
var howmanyarr=document.getElementById("ourselcont").innerHTML.substring(5).split('<option '); // check if just one real option ... so we may as well chose it
//alert(howmanyarr.length + ' vs ' + document.getElementById("ourselcont").innerHTML);
if (howmanyarr.length == 2 || (aplace != '' && aplace == document.getElementById('place').value && howmanyarr.length >= 2)) {
aplace=' ';
if (howmanyarr[1].indexOf(' value="') != -1) {
document.getElementById("ourselcont").value=howmanyarr[1].split(' value="')[1].split('"')[0];
//alert(encodeURIComponent(howmanyarr[1].split(' value="')[1].split('"')[0]));
selto(document.getElementById("ourselcont"));
//alert(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title);
//alert(encodeURIComponent(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].text));
//newtpz();
} else if (howmanyarr[1].indexOf(" value='") != -1) {
document.getElementById("ourselcont").value=howmanyarr[1].split(" value='")[1].split("'")[0];
//alert(encodeURIComponent(howmanyarr[1].split(" value='")[1].split("'")[0]));
selto(document.getElementById("ourselcont"));
//alert(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title);
//alert(encodeURIComponent(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].text));
//newtpz();
} else {
document.getElementById("ourselcont").value=howmanyarr[1].replace(">"," ").split(" value=")[1].split(" ")[0];
selto(document.getElementById("ourselcont"));
//newtpz();
}
}
}
}
}
}
}

function newkyv(oisvalue, tdwhere) {
if (tdwhere == '') tdwhere='td_br';
document.getElementById(tdwhere).innerHTML='<iframe id="i' + tdwhere + '" width=' + tdwhere.replace('td_bl','100%').replace('td_br','100%') + ' height=800 src="' + '//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=%20%20%20%20%20%20%20%20%20%20%20%20%20%20' + encodeURIComponent(oisvalue) + '" title="YouTube Videos"></iframe>';
}

function newtpz() {
var atzpurl=tzpurl.split("%2Fq%");
tzpurl=atzpurl[0] + encodeURIComponent(document.getElementById("ourselcont").value) + "&iso=" + document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title.split(',')[3] + '&lat=' + document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title.split(',')[1] + '&long=' + document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title.split(',')[2] + '&place=' + encodeURIComponent(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].text) + '&tzname=' + encodeURIComponent(document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].title.split(',')[0]) + '&iam=1';
if (document.getElementById('smulti').innerHTML.indexOf('>' + document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].text + '<') == -1) {
document.getElementById('smulti').innerHTML+='<option value="' + tzpurl.split('?')[1] + '">' + document.getElementById("ourselcont").options[document.getElementById("ourselcont").selectedIndex].text + '</option>';
ssize++;
document.getElementById('smulti').size='' + ssize;
}
document.getElementById('td_bl').innerHTML='<iframe id="itd_bl" onload="setTimeout(pretzbits,3400);" width=100% height=800 src="' + tzpurl + '" title="Timezone Places"></iframe>';
var sbits=document.getElementById('sto').innerHTML.split('</optio');
if (sbits.length >= 3) {
newkyv(sbits[1].split('>')[eval(-1 + sbits[1].split('>').length)].split(' (0')[0].split(' (1')[0].split(' (2')[0].split(' (3')[0].split(' (4')[0].split(' (5')[0].split(' (6')[0].split(' (7')[0].split(' (8')[0].split(' (9')[0], 'td_br');
}
}

function pregleanlatlong() {
gleanlatlong(document.getElementById('iandt'));
}

// Thanks to:
// http://stutzfamily.com/mrstutz/LatLong/latlonglist.htm#AFGHANISTAN
function gleanlatlong(iois) {
var rawhtml, k, kk, finished=false, spare='', spares, inlat=0.0, inlong=0.0;
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
rawhtml=aconto.body.innerHTML.split('placearr[0]');
place=('placearr[0]' + rawhtml[1]).split(place[0]);
country=('placearr[0]' + rawhtml[1]).split(country[0]);
ylat=('placearr[0]' + rawhtml[1]).split(ylat[0]);
xlong=('placearr[0]' + rawhtml[1]).split(xlong[0]);
//alert(place.length + ' vs ' + country.length + ' vs ' + ylat.length + ' vs ' + xlong.length);
iplaces=eval(-1 + country.length);
while (divisor <= iplaces) {
divisor*=10.0;
divl++;
}
for (jplace=1; jplace<=iplaces; jplace++) {
//if (jplace == iplaces || jplace == 1) {
// alert('hopefully okay below?');
//}
//alert(ylat[eval(0 + jplace)] + ' ... ' + ylat[eval(0 + jplace)].split('=')[1].split(';')[0].trim());
ylat[eval(-1 + jplace)]=eval(ylat[eval(0 + jplace)].split('=')[1].split(';')[0].trim());
//alert(2);
xlong[eval(-1 + jplace)]=eval(xlong[eval(0 + jplace)].split('=')[1].split(';')[0].trim());
//alert(22);
spare=('' + place[eval(0 + jplace)]);
place[eval(-1 + jplace)]='';
if (spare.indexOf("'") != -1 && spare.indexOf("=") != -1) {
place[eval(-1 + jplace)]=('' + place[eval(0 + jplace)]).split('=')[1].split("'")[1];
//alert(222);
if (place[eval(-1 + jplace)].indexOf(' ') != -1) {
spares=place[eval(-1 + jplace)].split(' ');
place[eval(-1 + jplace)]=spares[0].substring(0,1).toUpperCase() + spares[0].substring(1);
for (kk=1; kk<spares.length; kk++) {
place[eval(-1 + jplace)]+=' ' + spares[kk].substring(0,1).toUpperCase() + spares[kk].substring(1);
}
if (place[eval(-1 + jplace)].indexOf('(') != -1) {
spares=place[eval(-1 + jplace)].split('(');
place[eval(-1 + jplace)]=spares[0].substring(0,1).toUpperCase() + spares[0].substring(1);
for (kk=1; kk<spares.length; kk++) {
place[eval(-1 + jplace)]+='(' + spares[kk].substring(0,1).toUpperCase() + spares[kk].substring(1);
}
}
} else {
place[eval(-1 + jplace)]=place[eval(-1 + jplace)].substring(0,1).toUpperCase() + place[eval(-1 + jplace)].substring(1);
}
}
//alert(2222);
spare=('' + country[eval(0 + jplace)]);
country[eval(-1 + jplace)]='';
if (spare.indexOf("'") != -1 && spare.indexOf("=") != -1) {
country[eval(-1 + jplace)]=('' + country[eval(0 + jplace)]).split('=')[1].split("'")[1];
//alert(22222);
if (country[eval(-1 + jplace)].indexOf(' ') != -1) {
spares=country[eval(-1 + jplace)].split(' ');
country[eval(-1 + jplace)]=spares[0].substring(0,1).toUpperCase() + spares[0].substring(1);
for (kk=1; kk<spares.length; kk++) {
country[eval(-1 + jplace)]+=' ' + spares[kk].substring(0,1).toUpperCase() + spares[kk].substring(1);
}
if (country[eval(-1 + jplace)].indexOf('(') != -1) {
spares=country[eval(-1 + jplace)].split('(');
country[eval(-1 + jplace)]=spares[0].substring(0,1).toUpperCase() + spares[0].substring(1);
for (kk=1; kk<spares.length; kk++) {
country[eval(-1 + jplace)]+='(' + spares[kk].substring(0,1).toUpperCase() + spares[kk].substring(1);
}
}
} else {
country[eval(-1 + jplace)]=country[eval(-1 + jplace)].substring(0,1).toUpperCase() + country[eval(-1 + jplace)].substring(1);
}
//alert(222222);
}
//if (jplace == iplaces) {
// alert(ylat[eval(-1 + iplaces)]);
// alert(country[eval(-1 + iplaces)]);
//} else if (jplace == 1) {
// alert('?');
// alert(ylat[eval(-1 + jplace)]);
// alert(country[eval(-1 + jplace)]);
//}

//cleartop();
inlat=eval(document.getElementById('latitude').value); //0.0;
inlong=eval(document.getElementById('longitude').value); //0.0;
slat=inlat;
slong=inlong;
more(inlat,inlong,jplace);
if (1 == 2) {

var inlatoe=eval(-inlat), inlongoe=(eval(inlong) < 0.0 ? eval(180.000000 + (inlong)) : eval(inlong - 180.0));
distfrom[eval(-1 + jplace)]=Math.floor(great_circle_distance(inlat, inlong, ylat[eval(-1 + jplace)], xlong[eval(-1 + jplace)]));
distto[eval(-1 + jplace)]=Math.floor(great_circle_distance(inlatoe, inlongoe, ylat[eval(-1 + jplace)], xlong[eval(-1 + jplace)]));

finished=false;
for (k=0; k<topfivefrom.length; k++) {
if (!finished) {
if (eval(topfivefrom[k]) < 0.0) {
topfivefrom[k]=eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor);
finished=true;
} else if (eval(topfivefrom[k]) > (eval(distfrom[eval(-1 + jplace)]) + eval(jplace / divisor))) {
for (kk=eval(2 - topfivefrom.length); kk>=k; kk--) {
topfivefrom[kk + 1]=topfivefrom[kk];
}
topfivefrom[k]=eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor);
finished=true;
}
}
}
finished=false;
for (k=0; k<topfiveto.length; k++) {
if (!finished) {
if (eval(topfiveto[k]) < 0.0) {
topfiveto[k]=eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor);
finished=true;
} else if (eval(topfiveto[k]) > (eval(distto[eval(-1 + jplace)]) + eval(jplace / divisor))) {
for (kk=eval(2 - topfiveto.length); kk>=k; kk--) {
topfiveto[kk + 1]=topfiveto[kk];
}
topfiveto[k]=eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor);
finished=true;
}
}
}

}
}
}
}
}
fillinsfromto();
}

function pretotalmore() {
topfivefrom.push(-1.0);
topfiveto.push(-1.0);
totalmore();
}

function totalmore() {
var inlat=eval(document.getElementById('latitude').value);
var inlong=eval(document.getElementById('longitude').value);
for (var lplace=1; lplace<iplaces; lplace++) {
more(inlat, inlong, lplace);
}
fillinsfromto();
}

function more(inlat, inlong, kplace) {
var jplace, finished=false, k, kk=0;
for (jplace=kplace; jplace<=kplace; jplace++) {
var inlatoe=eval(-inlat), inlongoe=(eval(inlong) < 0.0 ? eval(180.000000 + (inlong)) : eval(inlong - 180.0));
distfrom[eval(-1 + jplace)]=Math.floor(great_circle_distance(inlat, inlong, ylat[eval(-1 + jplace)], xlong[eval(-1 + jplace)]));
distto[eval(-1 + jplace)]=Math.floor(great_circle_distance(inlatoe, inlongoe, ylat[eval(-1 + jplace)], xlong[eval(-1 + jplace)]));
finished=false;
//if (place[eval(-1 + jplace)].indexOf('Melbourne') != -1) {
// document.title='';
//}
for (k=0; k<topfivefrom.length; k++) {
if (!finished) {
if (eval(topfivefrom[k]) < 0.0) {
topfivefrom[k]=eval(eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor));
//if (document.title == '') {
// document.title='' + k + ' ... ' + eval(topfiveto[k]) + ' ... ' + place[eval(-1 + jplace)];
// doneonce=true;
//}
finished=true;
} else if (eval(topfivefrom[k]) > eval(eval(distfrom[eval(-1 + jplace)]) + eval(jplace / divisor))) {
for (kk=eval(-2 + topfivefrom.length); kk>=k; kk--) {
topfivefrom[eval(1 + kk)]=topfivefrom[kk];
}
//if (document.title == '') {
// document.title='was ' + topfivefrom[k] + ' ... ' + eval(eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor)) + ' ... ' + place[eval(-1 + jplace)];
// doneonce=true;
// melb=eval(eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor));
//} else if (eval(topfivefrom[k]) == melb) {
// document.title+=' and then why was ' + topfivefrom[k] + ' ... ' + eval(eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor)) + ' ... ' + place[eval(-1 + jplace)] + ' ... check that what follows is Melbourne ... ' + + topfivefrom[eval(1 + k)];
//}
topfivefrom[k]=eval(eval('' + distfrom[eval(-1 + jplace)]) + eval(jplace / divisor));
finished=true;
}
}
}

if (document.title == '') document.title=' ';
finished=false;
for (k=0; k<topfiveto.length; k++) {
if (!finished) {
if (eval(topfiveto[k]) < 0.0) {
topfiveto[k]=eval(eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor));
finished=true;
//if (!doneonce) {
// doneonce=true;
// document.title=eval(topfiveto[k]) + ' ... ' + place[eval(-1 + jplace)];
//}
} else if (eval(topfiveto[k]) > eval(eval(distto[eval(-1 + jplace)]) + eval(jplace / divisor))) {
//if (k == 0) {
// document.title='was ' + eval(topfiveto[k]) + ' vs ' + eval(eval(distto[eval(-1 + jplace)]) + eval(jplace / divisor)) + ' ::: ' + eval(eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor)) + ' ... ' + place[eval(-1 + jplace)] + ' ... jplace=' + jplace + ' vs ' + eval(eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor)) + ' via divisor=' + divisor;
//}
for (kk=eval(-2 + topfiveto.length); kk>=k; kk--) {
topfiveto[eval(1 + kk)]=topfiveto[kk];
}
topfiveto[k]=eval(eval('' + distto[eval(-1 + jplace)]) + eval(jplace / divisor));
finished=true;
}
}
}
}
}

function cleartop() {
for (var k=0; k<topfivefrom.length; k++) {
topfivefrom[k] = -1.0;
topfiveto[k] = -1.0;
}
}

function fillinsfromto() {
var sih='', csih='', csses, k;
sih="<option value=''>See closest places to " + document.getElementById('place').value + " ...</option>";
for (k=0; k<topfivefrom.length; k++) {
if (eval(topfivefrom[k]) >= 0.0) {
//alert('' + topfivefrom[k]);
csses=('' + topfivefrom[k]).split('.');
while (('' + csses[1]).length < divl) {
csses[1]+='0';
}
while(csses[1].substring(0,1) == '0') {
csses[1]=csses[1].substring(1);
}
sih+='<option value="' + ',[' + ylat[eval(-1 + eval(csses[1]))] + ',' + xlong[eval(-1 + eval(csses[1]))] + ',~' + encodeURIComponent(place[eval(-1 + eval(csses[1]))] + ' (' + country[eval(-1 + eval(csses[1]))]) + ')~]' + '">' + place[eval(-1 + eval(csses[1]))] + ',' + country[eval(-1 + eval(csses[1]))] + ' (' + csses[0] + ')' + '</option>';
sih+='<option value="' + ',[' + ylat[eval(-1 + eval(csses[1]))] + ',' + xlong[eval(-1 + eval(csses[1]))] + ',~' + encodeURIComponent(place[eval(-1 + eval(csses[1]))] + ' (' + country[eval(-1 + eval(csses[1]))]) + ')~]%20' + '">' + place[eval(-1 + eval(csses[1]))] + ',' + country[eval(-1 + eval(csses[1]))] + ' (' + csses[0] + ') (and go there)' + '</option>';
}
}
document.getElementById('sfrom').innerHTML=sih;
sih="<option value=''>See closest places to Other Side of the World to " + document.getElementById('place').value + " ...</option>";
for (k=0; k<topfiveto.length; k++) {
if (eval(topfiveto[k]) >= 0.0) {
csses=('' + topfiveto[k]).split('.');
while (('' + csses[1]).length < divl) {
csses[1]+='0';
}
while(csses[1].substring(0,1) == '0') {
csses[1]=csses[1].substring(1);
}
sih+='<option value="' + ',[' + ylat[eval(-1 + eval(csses[1]))] + ',' + xlong[eval(-1 + eval(csses[1]))] + ',~' + encodeURIComponent(place[eval(-1 + eval(csses[1]))] + ' (' + country[eval(-1 + eval(csses[1]))]) + ')~]' + '">' + place[eval(-1 + eval(csses[1]))] + ',' + country[eval(-1 + eval(csses[1]))] + ' (' + csses[0] + ')' + '</option>';
sih+='<option value="' + ',[' + ylat[eval(-1 + eval(csses[1]))] + ',' + xlong[eval(-1 + eval(csses[1]))] + ',~' + encodeURIComponent(place[eval(-1 + eval(csses[1]))] + ' (' + country[eval(-1 + eval(csses[1]))]) + ')~]%20' + '">' + place[eval(-1 + eval(csses[1]))] + ',' + country[eval(-1 + eval(csses[1]))] + ' (' + csses[0] + ') (and go there)' + '</option>';
}
}
document.getElementById('sto').innerHTML=sih;
cleartop();
document.getElementById('sfrom').value='';
document.getElementById('sto').value='';
}

function fromshowit() {
andshowit(document.getElementById('sfrom'));
}

function toshowit() {
andshowit(document.getElementById('sto'));
}

function andshowit(sval) {
//alert("sval.value=" + sval.value);
if (sval.value != "") {
var thingos=sval.value.replace(',[','').split(',');
document.getElementById('place').value=sval.options[sval.selectedIndex].text;
document.getElementById('latitude').value=thingos[0];
document.getElementById('longitude').value=thingos[1];
totalmore();
showit(sval);
}
}

function postshowit(inva) {
if (!wthere) {
var sbits=document.getElementById('sfrom').innerHTML.split('</optio');
if (sbits.length >= 3 && aplace == '') {
newkyv(sbits[1].split('>')[eval(-1 + sbits[1].split('>').length)].split(' (0')[0].split(' (1')[0].split(' (2')[0].split(' (3')[0].split(' (4')[0].split(' (5')[0].split(' (6')[0].split(' (7')[0].split(' (8')[0].split(' (9')[0], 'td_bl');
}
aplace=aplace.trim();
sbits=document.getElementById('sto').innerHTML.split('</optio');
if (sbits.length >= 3) {
newkyv(sbits[1].split('>')[eval(-1 + sbits[1].split('>').length)].split(' (0')[0].split(' (1')[0].split(' (2')[0].split(' (3')[0].split(' (4')[0].split(' (5')[0].split(' (6')[0].split(' (7')[0].split(' (8')[0].split(' (9')[0], 'td_br');
}
}
}

function showit(sho) {
var oururl=url;
oururl+=',[' + document.getElementById('latitude').value + ',' + document.getElementById('longitude').value + ',~' + encodeURIComponent(document.getElementById('place').value) + '~]' + document.getElementById('sfrom').value.replace(']%20',']');
oururl+=',[' + eval(0.000000 - document.getElementById('latitude').value) + ',' + (eval(document.getElementById('longitude').value) < 0.0 ? eval(180.000000 + (document.getElementById('longitude').value)) : eval(document.getElementById('longitude').value - 180.0)) + ',~' + encodeURIComponent("Other side of the world to ... " + document.getElementById('place').value) + '~]' + document.getElementById('sto').value.replace(']%20',']');
//alert(oururl.replace(',-180',',-179.99999').replace(',180',',179.99999'));
document.getElementById("myiframe").style.display="block";
document.getElementById("myiframe").src=saveurls(oururl.replace(',-180',',179.99999').replace(',180',',179.99999'));
postshowit('called');
if (sho != null) {
if (sho.value.indexOf(']%20') != -1) {
andshowit(sho);
}
}
}


function initAll() {
document.getElementById('place').focus();
}

function ourprewbit() {
var x = document.getElementById("place").value;
//if (x.length >= 3) {
if (x.replace('My Place','').length >= 3 && lastx != x) {
//document.getElementById("ourselcont").size=8;
//document.getElementById("ourselcont").style.display="inline";
//document.getElementById("mybut").style.display="inline";
//alert('using_key.php?theseparameters=aq%3Fquery%3D' + encodeURIComponent(x));
//alert(otherideas);
lastx=x;
//alert('//www.rjmprogramming.com.au/weather/using_key.php?theseparameters=aq%3F' + otherideas + 'query%3D' + encodeURIComponent(x));
document.getElementById('mygi').src='//www.rjmprogramming.com.au/weather/autocomplete.htm?place=' + encodeURIComponent(x);
}
}

</script>
</head>
<body style="background-color:lightgreen;" onload=" try { navigator.geolocation.getCurrentPosition(function(position) { startPos = position; document.getElementById('latitude').value = startPos.coords.latitude; document.getElementById('longitude').value = startPos.coords.longitude; if (1 == 1) { totalmore(); document.getElementById('mysb').click(); } }); } catch(ee) { } aplace=location.search.split('place=')[1] ? decodeURIComponent(location.search.split('place=')[1]).split('&')[0] : ''; if (aplace.length > 0) { document.getElementById('place').value=aplace; totalmore(); ourprewbit(); setTimeout(postshowit, 8000); } initAll(); ">
<table cellpadding=7 cellspacing=7 border=10><tbody><tr><td style="vertical-align:top;background-color:lightblue;border:8px solid blue;">
<h1>The Other Side of the World</h1>
<h3>RJM Programming - July, 2017</h3>
<div>
Place Name: <input title="Will look up your keyboard entered place in Weather Underground (thanks) autocomplete database" style="background-color:#f7f7f7;" autocomplete="off" onblur="totalmore(); ourprewbit();" id="place" type="text" value="My Place"></input> <select id='ourselcont' onchange='selto(this);' style='background-color:yellow;display:none;'></select> <div id="wudiv" style="display:none;">Thanks to <a target=_blank title="Weather Underground" href="//www.wunderground.com/"><img style="height:60px;" src="//www.rjmprogramming.com.au/weather/wulogo.JPG" title="Powered by Weather Underground"></img></a></div><br><br><select style="background-color:yellow;" onclick="wasvl=this.value.length; if (this.value.length > 0 && wasvl > 0) { andshowit(this); wasvl=0; }" onchange="wasvl=this.value.length; showit(this);" id="sfrom"></select> <select style="background-color:pink;" onclick="wasvl=this.value.length; if (this.value.length > 0 && wasvl > 0) { andshowit(this); wasvl=0; }" onchange="wasvl=this.value.length; showit(this);" id="sto"></select> <input type=button onclick="pretotalmore();" value="+"></input><br><br>
Latitude: <input style="background-color:#f0f0f0;" onblur="totalmore();" onchange="totalmore();" id="latitude" type="number" step="0.0000000000001" value="0.0000000000000" min="-90.0000000000000" max="90.0000000000000"></input>  Longitude: <input style="background-color:#f0f0f0;" onblur="totalmore();" onchange="totalmore();" id="longitude" type="number" step="0.0000000000001" value="0.0000000000000" min="-180.0000000000000" max="180.0000000000000"></input><br><br><br>
<div style="width:100%;text-align:center;"><input style="height:50px; background-color:silver;" id="mysb" onclick="showit();" type="button" value="Show Your Place and 'Other Side of the World' to the Right"></input></div>
</div>
</td><td style="vertical-align:top;background-color:orange;padding: 6 6 6 6;">
<iframe name="myiframe" id="myiframe" style="display:none;height:500px;width:500px;" src="about:blank"></iframe><div id='dmulti' style='display:none;'><input id='imulti' onclick="do_td_bottom(document.getElementById('smulti'));" type="button" value="Display ..." style="display:inline;"></input><br><select size='1' style="display:inline;" id='smulti' multiple><option value=''>Multiple places below ...</option></select></div>
</td></tr>
<tr><td colspan=2 id='td_bottom' style='overflow-x:scroll;-webkit-overflow-scrolling: touch;width:100%;'></td></tr>
<tr><td id='td_bl' style='overflow-x:scroll;-webkit-overflow-scrolling: touch;width:60%;'></td><td id='td_br' style='overflow-x:scroll;-webkit-overflow-scrolling: touch;width:40%;'></td></tr>
</tbody></table>
<input id='mapphpmailbox' type='hidden' value=''></input>
<iframe id='iandt' onload="setTimeout(pregleanlatlong,5000);" src='//www.rjmprogramming.com.au/PHP/LatLong/index.php?latd=55&latm=52&lats=0&longd=-4&longm=17&longs=0&from=from&country=UNITED%20KINGDOM&place=Glasgow' style='display:none;' title='City Lat/Long list'></iframe>
<div id='topjsondata'></div>
<iframe id='mygi' onload="setTimeout(postgleanlatlong,3000);" src='about:blank' style='display:none;width:100%;height:550px;'></iframe>
<iframe id='mygir' onload="setTimeout(postgleanlatlongr,3000);" src='about:blank' style='display:none;width:100%;height:550px;'></iframe>
</body>
</html>