<!doctype html>
<html>
<head>
<title>Missing Two - RJM Programming - December, 2018 ... Thanks to https://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/</title>
<meta id="myviewport" name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes" >
<style>
summary { background-color: #f0f0f0; }
.ph::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: red;
opacity: 1; /* Firefox */
font-size: 8px;
}
.ph:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: red;
font-size: 8px;
}
.ph::-ms-input-placeholder { /* Microsoft Edge */
color: red;
font-size: 8px;
}
</style>
<script type='text/javascript'>
var iinb=0;
var ati=0, atis=[], atic=[];
var apz="";
var dly=1;
var fdone=false;
var wor=0.0;
var xwor=0.0;
var gts=0.0;
var oiqplaceholder='';
var userlatitude=0.0, userlongitude=0.0;
var zalpha=0, chalpha=null, ralpha=0.0;
var WGS_ELLIPSOID = { a: 6378137.0, b: 6356752.314 }; // meter ... thanks to https://gis.stackexchange.com/questions/242188/calculating-the-earth-radius-at-latitude
var dmore='none';
var trfoota="<td id=posttdmid style='vertical-align:top;><input id=goagain style='display:none;background-color:lightgreen;font-size:24px;' onclick=\"nextplease(); this.style.display='none';\" type=button value='Go Again'></input></td>";
var tdfoota="";
var xipn=location.search.split('ipn=')[1] ? ('' + decodeURIComponent(location.search.split('ipn=')[1].split('&')[0]).replace(/\+/g,' ')) : ''; //document.getElementById('tplacen').value;
var xxipn=xipn.trim();
var xxxipn=xipn;
if (xxipn != xxxipn) { dly=3000; }
var wasthisso='' + (screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type); //"portrait";
var wasangle=eval(180 - eval('' + window.orientation));
if (xxxipn != xxipn) { wor=eval(180 + eval('' + window.orientation)); xwor=wor; xwor+=90; }
if ((navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || document.URL.indexOf('alert=') != -1) && document.URL.toLowerCase().indexOf('https:') != 0) {
location.href=(document.URL.replace('http:','https:') + '&random=' + Math.floor(Math.random() * 174765654)).replace('.html&','.html?');
}
if ((navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || document.URL.indexOf('update=') != -1) && document.URL.toLowerCase().indexOf('https:') != 0) {
location.href=(document.URL.replace('http:','https:') + '&random=' + Math.floor(Math.random() * 174765654)).replace('.html&','.html?');
}
var gid, gtarget, goptions;
function gsuccess(pos) {
var crd = pos.coords;
if (gtarget.latitude === crd.latitude && gtarget.longitude === crd.longitude) {
console.log('Congratulations, you reached the target');
navigator.geolocation.clearWatch(gid);
//} else {
// alert('now at ' + crd.latitude + ',' + crd.longitude);
}
}
function gerror(err) {
console.warn('ERROR(' + err.code + '): ' + err.message);
}
gtarget = {
latitude : 0,
longitude: 0
};
goptions = {
enableHighAccuracy: false,
timeout: 5000,
maximumAge: 0
};
// Thanks to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await and
// https://gist.github.com/Ajasra/ddd616505013a4309c0dda8a8ba626cb
async function myfunction() {
console.log('Inside of myfunction');
//alert(0);
if (window.DeviceOrientationEvent && typeof(DeviceOrientationEvent.requestPermission) === "function") {
//alert(4);
const permissionState = await DeviceOrientationEvent.requestPermission().then(response => {
if (response === 'granted') {
if (1 == 2) { alert('GrAnted'); }
//window.addEventListener('deviceorientation', OrientationHandler, true);
setTimeout(fallow, 2000);
dorh();
} else { console.log('prompt'); return false; } //} else if (result.state === 'prompt') {
//if (1 == 2) { alert("Need prompt!"); }
//} else {
//if (1 == 2) { alert("Not Supported!"); }
//}
}).catch(console.error);
//if (permissionState === "granted") {
// alert('granted');
//} else {
// alert('denied');
//}
} else if (window.DeviceOrientationEvent) {
//alert(44);
dmore='none';
setTimeout(fallow, 2000); //document.getElementById('ballow').style.display='block';
dorh();
} else {
dmore='none';
setTimeout(fallow, 2000);
}
if (window.DeviceMotionEvent && typeof(DeviceMotionEvent.requestPermission) === "function") {
//alert(24);
const permissionStateM = await DeviceMotionEvent.requestPermission().then(response => {
if (response === 'granted') {
if (1 == 2) { alert('GranTed'); }
window.addEventListener('devicemotion', function(event) {
lalpha='' + event.rotationRate.alpha;
if (chalpha != null) {
zalpha='' + chalpha;
} else if (eval('' + zalpha) == 0) {
zalpha='' + Math.abs(eval('' + event.accelerationIncludingGravity.z));
} else if (eval('' + Math.abs(eval('' + event.accelerationIncludingGravity.z))) < eval('' + zalpha)) {
zalpha='' + Math.abs(eval('' + event.accelerationIncludingGravity.z));
}
});
//window.addEventListener('deviceorientation', OrientationHandler, true);
} else { console.log('prompt'); return false; } //} else if (result.state === 'prompt') {
//if (1 == 2) { alert("NeeD prompt!"); }
//} else {
//if (1 == 2) { alert("NoT Supported!"); }
//}
}).catch(console.error);
//if (permissionStateM === "granted") {
// alert('Granted');
//} else {
// alert('Denied');
//}
} else if (window.DeviceMotionEvent) {
//alert(244);
window.addEventListener('devicemotion', function(event) {
lalpha='' + event.rotationRate.alpha;
if (chalpha != null) {
zalpha='' + chalpha;
} else if (eval('' + zalpha) == 0) {
zalpha='' + Math.abs(eval('' + event.accelerationIncludingGravity.z));
} else if (eval('' + Math.abs(eval('' + event.accelerationIncludingGravity.z))) < eval('' + zalpha)) {
zalpha='' + Math.abs(eval('' + event.accelerationIncludingGravity.z));
}
});
}
}
// Here we wait for the myfunction to finish
// and then returns a promise that'll be waited for aswell
// It's useless to wait the myfunction to finish before to return
// we can simply returns a promise that will be resolved later
// Also point that we don't use async keyword on the function because
// we can simply returns the promise returned by myfunction
function start() {
return myfunction();
}
// Call start
(async() => {
console.log('before start');
await start();
console.log('after start');
})();
var degtorad = Math.PI / 180; // Degree-to-Radian conversion ... thanks to https://www.w3.org/TR/orientation-event/#worked-example
var appendz="";
var sf=50, prets=450;
var oldprets=prets;
var eles=['latf','longf','brg','dist','latt','longt'];
var cwhat=[false,false,false,false,true,true];
var decided=false;
var isokformore='';
var wasthisso="portrait";
var jsokformore='';
var trid='trgraphics';
var elev=2.0;
var dorbrg=-1.0, tiltLeftToRight=-1.0, tiltFrontToBack=-1.0, datstart=true, initial_yaw=0.0, initial_pitch=-1.0, initial_roll=-1.0, lalpha=0.0, lastalpha='';
var dok=true;
var viastart=false;
var dcnt=0;
var gllentry='';
var gllonesuffix='f';
var faux=false;
var cfok=true;
var lastclick='';
var fplacen=location.search.split('fplacen=')[1] ? (' ' + decodeURIComponent(location.search.split('fplacen=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
var sparefplacen=fplacen;
var tplacen=location.search.split('tplacen=')[1] ? (' ' + decodeURIComponent(location.search.split('tplacen=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
var fromto=location.search.split('tplacen=')[1] ? (location.search.split('fplacen=')[1] ? 'to' : 'from') : 'from';
var tdid='tdfrom';
var divid='dfrom';
var gc='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.From%2Chttp.To' +
'&peninfo=latfrom|longfrom|127968_From,latto|longto|128205_To,nearestlat|nearestlong|nearestplace' +
'&width=417&height=260&country=Places&popularity=' +
'&data=%20[latfrom|longfrom|~From~,2]%20,%20[latto|longto|~To~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]';
var mu="//www.rjmprogramming.com.au/PHP/Map/map.php?title=London&onclick=y&label=['Lat',&value='Lon','Name']&data=,[51.5072,-0.1275,~London~]";
var origmu=mu;
var tpurl="https://www.google.com/maps/dir/Sydney+NSW,+Australia/Brisbane+QLD,+Australia";
var origtpurl=tpurl;
var accomurl='//www.google.com/search?q=accommodation+in+Springwood,+New+South+Wales&rlz=1C5CHFA_enAU832AU832&sxsrf=AOaemvKkE3W-5RrqTUzo4tGtosOlwjOXFA:1631413859134&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiHjbicsvjyAhWIyzgGHb-bDkcQ_AUoA3oECAEQBQ&biw=1439&bih=729';
var documentURL=document.URL;
setTimeout(bthe, 3000);
function fallow() {
document.getElementById('ballow').style.display=dmore; //'none';
}
function get_radius_at_lat(lat) { // thanks to https://gis.stackexchange.com/questions/242188/calculating-the-earth-radius-at-latitude
lat = lat * (Math.PI / 180.0);
var f1 = Math.pow((Math.pow(WGS_ELLIPSOID.a, 2) * Math.cos(lat)), 2);
var f2 = Math.pow((Math.pow(WGS_ELLIPSOID.b, 2) * Math.sin(lat)), 2);
var f3 = Math.pow((WGS_ELLIPSOID.a * Math.cos(lat)), 2);
var f4 = Math.pow((WGS_ELLIPSOID.b * Math.sin(lat)), 2);
var radius = Math.sqrt((f1 + f2) / (f3 + f4));
return radius;
}
function elevviaz(inlat) { // thanks to https://www.physicsclassroom.com/class/circles/Lesson-3/The-Value-of-g
var dsq=0.0, ddsql=0.0;
if (eval('' + zalpha) != 0) {
var cone=0.0000000000667430;
var mone=5980000000000000000000000.0;
var rone=get_radius_at_lat(inlat); //6380000.0000;
//for (var ii=1; ii<=24; ii++) {
// mone*=10.0;
//}
dsq=eval('' + mone);
alert('dsq(1 is big const)=' + dsq);
dsq*=eval('' + cone);
alert('dsq(2 times small const vs 398600441800000.0)=' + dsq);
dsq=398600441800000.0;
dsq/=9.8; //eval('' + zalpha);
alert('dsq(3 divide by iphone ' + zalpha + ')=' + dsq);
dsq=Math.pow(dsq, 0.5);
alert('dsq(4 square root)=' + dsq);
rone=dsq; //dsq-=rone;
alert('dsq(5 minus sea level earth radius ' + rone + ')=' + dsq);
dsq=eval('' + mone);
alert('dsq(1 is big const)=' + dsq);
dsq*=eval('' + cone);
alert('dsq(2 times small const vs 398600441800000.0)=' + dsq);
dsq=398600441800000.0;
dsq/=eval('' + zalpha);
alert('dsq(3 divide by iphone ' + zalpha + ')=' + dsq);
dsq=Math.pow(dsq, 0.5);
alert('dsq(4 square root)=' + dsq);
dsq-=rone;
alert('dsq(5 minus sea level earth radius ' + rone + ')=' + dsq);
}
return dsq;
}
function getLocation(inb) {
iinb=inb.indexOf(';');
if (navigator.geolocation) {
try {
navigator.geolocation.getCurrentPosition(showPosition);
//setTimeout(later, 1000);
if (appendz != "" && iinb != -1) { appendz=""; }
if (inb != inb.trim() && document.getElementById('spfr').innerHTML.indexOf('rom') != -1) { fplacen+=' '; }
if (inb != inb.trim() && document.getElementById('spfr').innerHTML.indexOf('rom') == -1) { tplacen+=' '; }
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
document.getElementById('ipn').value=fplacen;
} else {
document.getElementById('ipn').value=tplacen;
}
gid = navigator.geolocation.watchPosition(gsuccess, gerror, goptions);
return false;
} catch(err) {
//setTimeout(later, 1000);
}
} else if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
if (appendz != '') {
fplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('ssf').innerHTML=fplacen;
} else {
fplacen='Here';
}
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',' + fplacen;
askit();
//document.getElementById('spfr').innerHTML='to';
return false;
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
if (appendz != '') {
tplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('sst').innerHTML=tplacen;
} else {
tplacen='Here';
}
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',' + tplacen;
askit();
return false;
}
}
}
return true;
}
function showPosition(position) {
if (userlatitude == 0.0 && userlongitude == 0.0) {
userlatitude=eval('' + position.coords.latitude);
userlongitude=eval('' + position.coords.longitude);
//alert('' + position.coords.heading);
if (('' + position.coords.altitude).replace('null','') != '' && iinb == -1) {
appendz=";" + ('' + position.coords.altitude).replace('null','');
}
if (userlatitude != 0.0 || userlongitude != 0.0) {
//document.getElementById('you').innerHTML='(0,0)';
if (document.getElementById('spfr').innerHTML.indexOf('rom') != -1) {
if (document.getElementById('latf') && document.getElementById('longf')) {
document.getElementById('latf').focus();
document.getElementById('latf').value=userlatitude;
document.getElementById('longf').focus();
document.getElementById('longf').value=userlongitude;
document.getElementById('latf').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('ssf').innerHTML='Here';
if (appendz != '') {
fplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('ssf').innerHTML=fplacen;
} else {
fplacen='Here';
}
gllentry='' + document.getElementById('latf').value + ',' + document.getElementById('longf').value + ',' + fplacen;
askit();
//document.getElementById('spfr').innerHTML='to';
}
} else {
if (document.getElementById('latt') && document.getElementById('longt')) {
document.getElementById('latt').focus();
document.getElementById('latt').value=userlatitude;
document.getElementById('longt').focus();
document.getElementById('longt').value=userlongitude;
document.getElementById('latt').focus();
userlatitude=0.0;
userlongitude=0.0;
document.getElementById('sst').innerHTML='Here';
if (appendz != '') {
tplacen='Here (elevation ' + appendz.substring(1) + ' m)';
document.getElementById('sst').innerHTML=tplacen;
} else {
tplacen='Here';
}
gllentry='' + document.getElementById('latt').value + ',' + document.getElementById('longt').value + ',' + tplacen;
askit();
}
}
}
}
}
function mdms(tvis, otvis) {
var altvl=0.0, dvr=1.0, isv=0;
if (eval('' + atic.length) >= 1) {
//alert('ov=' + otvis.value + ' and atic[0]=' + atic[0]);
if (atic[0].indexOf('-') != -1 && otvis.value.indexOf('-') == -1) {
isv++;
} else if (atic[0].indexOf('+') != -1 && otvis.value.indexOf('+') == -1) {
isv++;
} else if (eval('' + atis.length) >= 2) {
if (eval('' + atis[1]) > 60) { isv++; }
}
}
if (eval('' + atic.length) > 1) {
//alert('Here ' + atic.length + ' last is=' + atic[eval(-1 + atic.length)]);
for (var ijh=0; ijh<atic.length; ijh++) {
if (atic[ijh].trim() != '') {
isv++;
if (atic[0].indexOf('-') != -1) {
altvl-=eval(eval('' + dvr) * eval(atic[ijh].replace('-','')));
} else {
altvl+=eval(eval('' + dvr) * eval(atic[ijh].replace('-','')));
}
//alert('Here ' + altvl);
dvr/=60.0;
}
}
if (isv > 1) {
tvis='' + altvl;
otvis.value='' + altvl;
}
}
ati=0;
atic=[];
atis=[];
return tvis;
}
function idms(otvis) {
var altvl=0.0, dvr=1.0, isv=0;
if (eval('' + atic.length) >= 1) {
//alert('Ov=' + otvis.value + ' and Atic[0]=' + atic[0]);
if (atic[0].indexOf('-') != -1 && otvis.value.indexOf('-') == -1) {
isv++;
} else if (atic[0].indexOf('+') != -1 && otvis.value.indexOf('+') == -1) {
isv++;
} else if (eval('' + atis.length) >= 2) {
if (eval('' + atis[1]) > 60) { isv++; }
}
}
if (eval('' + atic.length) > 1) {
//alert('here ' + atic.length + ' last is=' + atic[eval(-1 + atic.length)]);
for (var ijh=0; ijh<atic.length; ijh++) {
if (atic[ijh].trim() != '') {
isv++;
if (atic[0].indexOf('-') != -1) {
altvl-=eval(eval('' + dvr) * eval(atic[ijh].replace('-','').replace('+','')));
} else {
altvl+=eval(eval('' + dvr) * eval(atic[ijh].replace('-','').replace('+','')));
}
//alert('here ' + altvl);
dvr/=60.0;
}
}
if (isv > 1) {
otvis.value='' + altvl;
}
}
ati=0;
atic=[];
atis=[];
return otvis;
}
function couldbedms(event) {
var wasc='';
if (eval('' + event.keyCode) == 69 || eval('' + event.keyCode) == 78 || eval('' + event.keyCode) == 87 || eval('' + event.keyCode) == 83 || eval('' + event.keyCode) == 187 || eval('' + event.keyCode) == 189 || eval('' + event.keyCode) == 190 || (eval('' + event.keyCode) >= 48 && eval('' + event.keyCode) <= 57)) {
if (ati == 0) { atis=[]; atis.push(0); atic.push(''); } else if (ati < 0) { ati=0; }
ati++;
atis[eval(-1 + atis.length)]=ati;
if (eval('' + event.keyCode) == 87 || eval('' + event.keyCode) == 83) {
if (atic[0].indexOf('-') == -1) { wasc=atic[0]; atic[0]='-' + wasc; }
} else if (eval('' + event.keyCode) == 69 || eval('' + event.keyCode) == 78) {
if (atic[0].indexOf('+') == -1) { wasc=atic[0]; atic[0]='+' + wasc; }
} else if (eval('' + event.keyCode) != 187) {
atic[eval(-1 + atic.length)]+=String.fromCharCode(eval(eval('' + event.keyCode) % 144));
}
} else {
ati=-1;
if (eval('' + event.keyCode) >= 65 && eval('' + event.keyCode) <= 90) {
atis.push(eval('' + event.keyCode));
} else {
atis.push(0);
}
atic.push('');
}
}
function compassHeading( alpha, beta, gamma ) { // thanks to https://www.w3.org/TR/orientation-event/#worked-example
var _x = beta ? beta * degtorad : 0; // beta value
var _y = gamma ? gamma * degtorad : 0; // gamma value
var _z = alpha ? alpha * degtorad : 0; // alpha value
var cX = Math.cos( _x );
var cY = Math.cos( _y );
var cZ = Math.cos( _z );
var sX = Math.sin( _x );
var sY = Math.sin( _y );
var sZ = Math.sin( _z );
// Calculate Vx and Vy components
var Vx = - cZ * sY - sZ * sX * cY;
var Vy = - sZ * sY + cZ * sX * cY;
// Calculate compass heading
var compassHeading = Math.atan( Vx / Vy );
// Convert compass heading to use whole unit circle
if( Vy < 0 ) {
compassHeading += Math.PI;
} else if( Vx < 0 ) {
compassHeading += 2 * Math.PI;
}
return compassHeading * ( 180 / Math.PI ); // Compass Heading (in degrees)
}
function bthe() {
if (documentURL.indexOf('?') != -1) {
isokformore='?' + documentURL.split('?')[1].split('#')[0];
}
}
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 ourdist;
}
function nextplease() {
var i;
console.log('nextplease 1');
if ((isokformore + jsokformore) != '' && 1 == 1) {
console.log('nextplease 11');
if (1 == 1) {
window.open(document.URL.split('?')[0].split('?')[0], '_blank');
} else {
document.getElementById('outofthisworld').value='slong';
window.scrollTo(0,0); //location.href='#dtop';
}
} else {
console.log('nextplease 111');
for (i=0; i<eles.length; i++) {
document.getElementById(eles[i]).value='0.0000000';
document.getElementById(eles[i]).style.backgroundColor='white';
}
eles=['latf','longf','brg','dist','latt','longt'];
cwhat=[false,false,false,false,true,true];
decided=false;
}
console.log('nextplease 2');
}
function calcit() {
var i, ourbrg=0.0, ourdist=0.0, j;
if (jsokformore != '') {
document.getElementById('latf').type='text';
document.getElementById('longf').type='text';
document.getElementById('latt').type='text';
document.getElementById('longt').type='text';
document.getElementById('brg').type='text';
document.getElementById('dist').type='text';
} else {
if ((isokformore + jsokformore) != '') {
document.getElementById('outofthisworld').value='ifill';
} else {
if (!cwhat[0] && !cwhat[1] && !cwhat[2] && !cwhat[3] && !cwhat[4] && !cwhat[5]) {
if (Math.abs(eval('' + document.getElementById(eles[4]).value)) < 0.00000004 && Math.abs(eval('' + document.getElementById(eles[5]).value)) < 0.00000004) {
cwhat[4]=true;
cwhat[5]=true;
} else if (Math.abs(eval('' + document.getElementById(eles[2]).value)) < 0.00000004 && Math.abs(eval('' + document.getElementById(eles[3]).value)) < 0.00000004) {
cwhat[2]=true;
cwhat[3]=true;
}
}
//alert(('' + cwhat[0]) + ('' + cwhat[1]) + ('' + cwhat[2]) + ('' + cwhat[3]) + ('' + cwhat[4]) + ('' + cwhat[5]));
if (jsokformore != '' || (cwhat[0] && cwhat[1] || (!cwhat[0] && !cwhat[1] && !cwhat[2] && !cwhat[3] && !cwhat[4] && !cwhat[5]))) {
isokformore=' ';
if (('' + document.getElementById('mysel').value) == '1') {
ourbrg=eval(eval(540.0 + 180.0 + eval('' + document.getElementById(eles[2]).value)) % 360.0);
} else {
ourbrg=eval('' + document.getElementById(eles[2]).value);
}
for (j=eval(('' + document.getElementById('mysel').value)); j>=1; j--) {
ourdist=eval('' + document.getElementById(eles[3]).value);
document.getElementById(eles[0]).value='' +
eval(eval(eval(180.0 / Math.PI) * Math.asin(
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(eval('' + ourdist) / 6371000.0)))) +
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(eval('' + ourdist) / 6371000.0))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + ourbrg)))))));
document.getElementById(eles[1]).value=eval(eval(180.0 / Math.PI) * eval(eval(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[5]).value)) +
Math.atan2(
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + ourbrg)) *
eval('' + Math.sin(eval(eval('' + ourdist) / 6371000.0)))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))),
eval(eval('' + Math.cos(eval(eval('' + ourdist) / 6371000.0))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))))));
if (document.getElementById(eles[0]).value.indexOf('e-') != -1) { document.getElementById(eles[0]).value='0.0000000'; }
if (document.getElementById(eles[1]).value.indexOf('e-') != -1) { document.getElementById(eles[1]).value='0.0000000'; }
if (j != 1) {
ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value)))))
)))) % 360.0);
//ourbrg=eval(eval(540.0 + eval('' + document.getElementById(eles[2]).value)) % 360.0);
document.getElementById(eles[2]).value='' + ourbrg;
document.getElementById('mysel').value='1';
//alert(ourbrg);
}
}
document.getElementById(eles[0]).style.backgroundColor='lightgreen';
document.getElementById(eles[1]).style.backgroundColor='lightgreen';
document.getElementById('goagain').style.display='block'; // setTimeout(nextplease,10000);
} else if (cwhat[2] && cwhat[3]) {
isokformore=' ';
ourdist=great_circle_distance(document.getElementById(eles[0]).value,document.getElementById(eles[1]).value,document.getElementById(eles[4]).value,document.getElementById(eles[5]).value);
document.getElementById(eles[3]).value='' + ourdist;
//Let ‘R’ be the radius of Earth,
//‘L’ be the longitude,
//‘θ’ be latitude,
//‘β‘ be Bearing.
//Bearing from point A to B, can be calculated as,
//β = atan2(X,Y),
//where, X and Y are two quantities and can be calculated as:
//X = cos θb * sin ∆L
//Y = cos θa * sin θb – sin θa * cos θb * cos ∆L
ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[5]).value) - eval('' + document.getElementById(eles[1]).value)))))
)))) % 360.0);
document.getElementById('mysel').value='2';
document.getElementById(eles[2]).value='' + ourbrg;
document.getElementById(eles[2]).style.backgroundColor='lightgreen';
document.getElementById(eles[3]).style.backgroundColor='lightgreen';
document.getElementById('goagain').style.display='block'; // setTimeout(nextplease,10000);
} else if (cwhat[4] && cwhat[5]) {
isokformore=' ';
if (('' + document.getElementById('mysel').value) == '2') {
ourbrg=eval(eval(540.0 + 180.0 + eval('' + document.getElementById(eles[2]).value)) % 360.0);
} else {
ourbrg=eval('' + document.getElementById(eles[2]).value);
}
for (j=eval(3 - eval(('' + document.getElementById('mysel').value))); j>=1; j--) {
ourdist=eval('' + document.getElementById(eles[3]).value);
//Let first point latitude be la1,
///longitude as lo1,
//d be distance,
//R as radius of Earth,
//Ad be the angular distance i.e d/R and
//θ be the bearing,
//Here is the formula to find the second point, when first point, bearing and distance is known:
//latitude of second point = la2 = asin(sin la1 * cos Ad + cos la1 * sin Ad * cos θ), and
//longitude of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)
document.getElementById(eles[4]).value='' +
eval(eval(eval(180.0 / Math.PI) * Math.asin(
Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)) *
Math.cos(eval(eval('' + ourdist) / 6371000.0)) +
Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)) *
Math.sin(eval(eval('' + ourdist) / 6371000.0)) *
Math.cos(eval(Math.PI / 180.0) * eval('' + ourbrg)))));
//Let first point latitude be la1,
//longitude as lo1,
//d be distance,
//R as radius of Earth,
//Ad be the angular distance i.e d/R and
//θ be the bearing,
// longitude of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)
document.getElementById(eles[5]).value=eval(eval(180.0 / Math.PI) * eval(eval(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[1]).value)) +
Math.atan2(
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + ourbrg)) *
eval('' + Math.sin(eval(eval('' + ourdist) / 6371000.0)))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))),
eval(eval('' + Math.cos(eval(eval('' + ourdist) / 6371000.0))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value)))))));
if (j != 1) {
ourbrg=eval(eval(360.0 + eval(eval(eval(180.0 / Math.PI) * Math.atan2(
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[1]).value) - eval('' + document.getElementById(eles[5]).value))))),
eval(eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value)))) -
eval(eval('' + Math.sin(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[4]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval('' + document.getElementById(eles[0]).value))) *
eval('' + Math.cos(eval(Math.PI / 180.0) * eval(eval('' + document.getElementById(eles[1]).value) - eval('' + document.getElementById(eles[5]).value)))))
)))) % 360.0);
//ourbrg=eval(eval(540.0 + eval('' + document.getElementById(eles[2]).value)) % 360.0);
document.getElementById(eles[2]).value='' + ourbrg;
document.getElementById('mysel').value='2';
//alert(ourbrg);
}
}
if (document.getElementById(eles[4]).value.indexOf('e-') != -1) { document.getElementById(eles[4]).value='0.0000000'; }
if (document.getElementById(eles[5]).value.indexOf('e-') != -1) { document.getElementById(eles[5]).value='0.0000000'; }
document.getElementById(eles[4]).style.backgroundColor='lightgreen';
document.getElementById(eles[5]).style.backgroundColor='lightgreen';
document.getElementById('goagain').style.display='block'; // setTimeout(nextplease,10000);
} else {
alert('Oops! Cannot calculate this mix, sorry.');
nextplease();
}
if ((isokformore + jsokformore) != '') {
document.getElementById('slong').style.cursor='pointer';
document.getElementById('slong').style.textDecoration='underline';
document.getElementById('slong').title='Click for another leg of a trip, perhaps?';
document.getElementById('slong').innerHTML='+';
isokformore='?latf=' + encodeURIComponent(document.getElementById('latt').value) + '&longf=' + encodeURIComponent(document.getElementById('longt').value);
window.scrollTo(0,0); //location.href='#dtop';
setTimeout(bthen, 3000);
} else {
window.scrollTo(0,0); //location.href='#dtop';
setTimeout(bthen, 3000);
}
}
}
}
// 38.627089
// -90.200203
// 96.51262423499941 279.26239975009173
// 382900
function mapit(ao) {
if ((isokformore + jsokformore) != '' && !faux) {
console.log('ao.id=' + ao.id);
//alert(isokformore + ' ... ' + top.document.getElementById('ltt').value);
if (ao.id.toLowerCase().indexOf('from') != -1) {
document.getElementById('outofthisworld').value=ao.id + '|' + top.document.getElementById('ltf').value + ',' + top.document.getElementById('lgf').value;
top.document.getElementById('outofthisworld').value=ao.id + '|' + top.document.getElementById('ltf').value + ',' + top.document.getElementById('lgf').value;
} else if (ao.id.toLowerCase().indexOf('to') != -1) {
document.getElementById('outofthisworld').value=ao.id + '|' + top.document.getElementById('ltt').value + ',' + top.document.getElementById('lgt').value;
top.document.getElementById('outofthisworld').value=ao.id + '|' + top.document.getElementById('ltt').value + ',' + top.document.getElementById('lgt').value;
} else {
document.getElementById('outofthisworld').value=ao.id;
}
} else {
trid='trgraphics';
tdid='td' + ao.id.replace('td','').replace('a','');
divid='d' + ao.id.replace('td','').replace('a','');
var htt='http:';
if (document.URL.toLowerCase().indexOf('https:') == 0) { htt='https:'; }
console.log('tdid=' + tdid);
if (tdid == 'tdfrom') {
if (('' + document.getElementById(ao.id.replace('td','a')).href).replace('undefined','') == '') {
document.getElementById(ao.id.replace('td','a')).setAttribute('data-href',htt + '//www.rjmprogramming.com.au/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(document.getElementById('latf').value) + '&longitude=' + encodeURIComponent(document.getElementById('longf').value));
//document.getElementById(ao.id.replace('td','a')).target='_blank';
//alert(document.getElementById(ao.id.replace('td','a')).href);
//} else {
//alert(('' + document.getElementById(ao.id.replace('td','a')).href));
}
if (1 == 1) {
if (!faux) { top.document.getElementById('nearestif').src='//www.rjmprogramming.com.au/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(document.getElementById('latf').value) + '&longitude=' + encodeURIComponent(document.getElementById('longf').value); }
} else {
top.document.getElementById('latitude').value=document.getElementById('latf').value;
top.document.getElementById('longitude').value=document.getElementById('longf').value;
if (!faux) { top.document.getElementById('inearest').click(); }
}
} else if (tdid == 'tdto') {
if (('' + document.getElementById(ao.id.replace('td','a')).href).replace('undefined','') == '') {
document.getElementById(ao.id.replace('td','a')).setAttribute('data-href',htt + '//www.rjmprogramming.com.au/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(document.getElementById('latt').value) + '&longitude=' + encodeURIComponent(document.getElementById('longt').value));
//document.getElementById(ao.id.replace('td','a')).target='_blank';
//alert(document.getElementById(ao.id.replace('td','a')).href);
//} else {
//alert(('' + document.getElementById(ao.id.replace('td','a')).href));
}
if (1 == 1) {
if (!faux) { top.document.getElementById('nearestif').src='//www.rjmprogramming.com.au/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(document.getElementById('latt').value) + '&longitude=' + encodeURIComponent(document.getElementById('longt').value); }
} else {
top.document.getElementById('latitude').value=document.getElementById('latt').value;
top.document.getElementById('longitude').value=document.getElementById('longt').value;
if (!faux) { top.document.getElementById('inearest').click(); }
}
}
}
window.scrollTo(0,document.body.scrollHeight); //location.href='#ifill';
faux=false;
}
function athen() {
if (top.document.getElementById('dto')) {
if (top.document.getElementById('dto').innerHTML.indexOf(' size="3"') != -1) {
top.document.getElementById('dto').innerHTML=top.document.getElementById('dto').innerHTML.replace(' size="3"', ' size="4"');
}
}
if (top.document.getElementById('dfrom')) {
if (top.document.getElementById('dfrom').innerHTML.indexOf(' size="3"') != -1) {
top.document.getElementById('dfrom').innerHTML=top.document.getElementById('dfrom').innerHTML.replace(' size="3"', ' size="4"');
}
}
window.scrollTo(0,document.body.scrollHeight); //location.href='#ifill';
}
function bthen() {
if (top.document.getElementById('dto')) {
if (top.document.getElementById('dto').innerHTML.indexOf(' size="3"') != -1) {
top.document.getElementById('dto').innerHTML=top.document.getElementById('dto').innerHTML.replace(' size="3"', ' size="4"');
}
}
if (top.document.getElementById('dfrom')) {
if (top.document.getElementById('dfrom').innerHTML.indexOf(' size="3"') != -1) {
top.document.getElementById('dfrom').innerHTML=top.document.getElementById('dfrom').innerHTML.replace(' size="3"', ' size="4"');
}
}
top.window.scrollTo(0,0); //location.href='#ifill';
}
function checknp(oiis) {
var i, j, k, plist='', ogc='';
// www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php
//?title=Earth%20Places
//&aregexographicals=y
//&aregeographicals=HTTP.From%2Chttp.To%2Chttp.Lome
//&peninfo=75.57|-92.28|127968_From,64.04|-18.15|128205_To,-16.30|151.44|Lome
//&width=417
//&height=260
//&country=Places
//&popularity=
//&data=%20[75.57|-92.28|~From~,2]%20,%20[64.04|-18.15|~To~,2]%20,%20[-16.30|151.44|~Lome~,2]
// <select size="4" id="snearest" style="background-color:olive;" onchange=" alert(this.options[this.selectedIndex].title + String.fromCharCode(32) + this.options[this.selectedIndex].text); "><option title="" value="">Please see Nearest TimeZone Places below ...</option>
// <option data-ll="(5.55,-0.21667)" title="Nearest" value="Africa/Accra">Africa/Accra in Ghana is 617.6km (+0) from (0.0000000,0.0000000)</option>
// <option data-ll="(6.13333,1.21666)" title="Next Nearest" value="Africa/Lome">Africa/Lome in Togo is 695.234km (+0) from (0.0000000,0.0000000)</option>
// <option data-ll="(5.31666,-4.03334)" title="Third Nearest" value="Africa/Abidjan">Africa/Abidjan in Cote d'Ivoire is 741.662km (+0) from (0.0000000,0.0000000)</option>
// </select>
// www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.From%2Chttp.To%2Chttp.Lome&peninfo=75.57|-92.28|127968_From,64.04|-18.15|128205_To,-16.30|151.44|Lome&width=417&height=260&country=Places&popularity=&data=%20[75.57|-92.28|~From~,2]%20,%20[64.04|-18.15|~To~,2]%20,%20[-16.30|151.44|~Lome~,2]
var altolat='', altolong='';
if (document.getElementById('nearest')) {
//alert('hereIS');
if (document.getElementById('nearest').innerHTML != '' && document.getElementById('nearest').innerHTML.trim() == document.getElementById('nearest').innerHTML) {
//alert(top.document.getElementById('outofthisworld').value);
document.getElementById('nearest').innerHTML+=' ';
setTimeout(athen, 3000);
if (top.document.getElementById('outofthisworld').value.indexOf('|') != -1) {
if (top.document.getElementById('outofthisworld').value.split('|')[1] != '') {
altolat=top.document.getElementById('outofthisworld').value.split('|')[1].split(',')[0];
altolong=top.document.getElementById('outofthisworld').value.split('|')[1].split(',')[1];
//alert(top.document.getElementById('outofthisworld').value);
tdid='td' + top.document.getElementById('outofthisworld').value.split('|')[0].replace('a','');
divid='d' + top.document.getElementById('outofthisworld').value.split('|')[0].replace('a','');
top.document.getElementById('outofthisworld').value=top.document.getElementById('outofthisworld').value.split('|')[0];
}
}
document.getElementById(divid).style.display='table-cell';
document.getElementById(divid).innerHTML=document.getElementById('nearest').innerHTML.replace('position:','background-color:lightblue;').replace('absolute;','').replace('top:','').replace('left:','').replace('70px;','').replace('350px;','');
//var dbits=document.getElementById(divid).innerHTML=document.getElementById('nearest').innerHTML.split(' data-ll=');
//var vbits=document.getElementById(divid).innerHTML=document.getElementById('nearest').innerHTML.replace(' value=',' Value=').split(' value=');
//alert(top.document.getElementById('nearest').innerHTML);
var dbits=top.document.getElementById('nearest').innerHTML.split(' data-ll=');
var vbits=top.document.getElementById('nearest').innerHTML.replace(' value=',' Value=').split(' value=');
if (dbits.length > 1) {
ogc='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.From%2Chttp.To' +
'&peninfo=latfrom|longfrom|127968_From,latto|longto|128205_To,nearestlat|nearestlong|nearestplace' +
'&width=417&height=260&country=Places&popularity=' +
'&data=%20[latfrom|longfrom|~From~,2]%20,%20[latto|longto|~To~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]';
if (tdid.toLowerCase().indexOf('from') != -1) {
//alert(altolat + ' ... ' + altolong + ' ___ ' + document.getElementById(divid).innerHTML);
if (altolat != '' && altolong != '') {
ogc=ogc.replace('latfrom', altolat).replace('latfrom', altolat);
ogc=ogc.replace('longfrom', altolong).replace('longfrom', altolong);
} else {
ogc=ogc.replace('latfrom', document.getElementById('latf').value).replace('latfrom', document.getElementById('latf').value);
ogc=ogc.replace('longfrom', document.getElementById('longf').value).replace('longfrom', document.getElementById('longf').value);
}
plist='';
for (i=1; i<vbits.length; i++) {
plist+='%2Chttp.' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' '));
}
ogc=ogc.replace('%2Chttp.To', plist);
plist='';
for (i=1; i<dbits.length; i++) {
plist+='%20,%20[' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[0] + '|' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[1] + '|~' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' ')) + '~]';
}
ogc=ogc.replace('%20,%20[latto|longto|~To~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]', plist);
plist='';
for (i=1; i<dbits.length; i++) {
plist+=',' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[0] + '|' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[1] + '|' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' ')) + '';
}
ogc=ogc.replace(',latto|longto|128205_To,nearestlat|nearestlong|nearestplace', plist);
} else if (tdid.toLowerCase().indexOf('to') != -1) {
ogc='//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.To%2Chttp.From' +
'&peninfo=latto|longto|128205_To,latfrom|longfrom|127968_From,nearestlat|nearestlong|nearestplace' +
'&width=417&height=260&country=Places&popularity=' +
'&data=%20[latto|longto|~To~,2]%20,%20[latfrom|longfrom|~From~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]';
if (altolat != '' && altolong != '') {
ogc=ogc.replace('latto', altolat).replace('latto', altolat);
ogc=ogc.replace('longto', altolong).replace('longto', altolong);
//alert(altolat + ' .#. ' + altolong + ' ___ ' + ogc);
} else {
ogc=ogc.replace('latto', document.getElementById('latt').value).replace('latto', document.getElementById('latt').value);
ogc=ogc.replace('longto', document.getElementById('longt').value).replace('longto', document.getElementById('longt').value);
}
plist='';
for (i=1; i<vbits.length; i++) {
plist+='%2Chttp.' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' '));
}
//alert(plist + ' ... ' + ogc.replace('%2Chttp.From', plist) + ' via ' + ogc);
ogc=ogc.replace('%2Chttp.From', plist);
plist='';
for (i=1; i<dbits.length; i++) {
plist+='%20,%20[' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[0] + '|' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[1] + '|~' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' ')) + '~]';
}
//alert(plist + ' ... ' + ogc.replace('%20,%20[latfrom|longfrom|~From~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]', plist) + ' via ' + ogc);
ogc=ogc.replace('%20,%20[latfrom|longfrom|~From~,2]%20,%20[nearestlat|nearestlong|~nearestplace~,2]', plist);
plist='';
for (i=1; i<dbits.length; i++) {
plist+=',' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[0] + '|' + dbits[i].substring(2).split(dbits[i].substring(0,1))[0].replace(')','').split(',')[1] + '|' + encodeURIComponent(vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/')[eval(-1 + vbits[i].substring(1).split(vbits[i].substring(0,1))[0].split('/').length)].replace(/\_/g,' ')) + '';
}
//alert(plist + ' ... ' + ogc.replace(',latfrom|longfrom|127968_From,nearestlat|nearestlong|nearestplace', plist) + ' via ' + ogc);
ogc=ogc.replace(',latfrom|longfrom|127968_From,nearestlat|nearestlong|nearestplace', plist);
}
document.getElementById(trid).style.display='table-row';
if (document.getElementById(tdid).innerHTML.indexOf(ogc) == -1 && ogc.indexOf('nearestlat') == -1) {
document.getElementById(tdid).innerHTML+='<iframe style=display:inline-block;height:300px;width:450px; src="' + ogc + '"></iframe>';
}
} else if (tdid.toLowerCase().indexOf('from') != -1) {
document.getElementById(trid).style.display='table-row';
if (altolat == '') { altolat=top.document.getElementById('ltf').value; }
if (altolong == '') { altolong=top.document.getElementById('lgf').value; }
document.getElementById(tdid).innerHTML+='<iframe style=display:inline-block;height:300px;width:450px; src="' + '//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.From' +
'&peninfo=' + altolat + '|' + altolong + '|127968_From' +
'&width=417&height=260&country=Places&popularity=' +
'&data=%20[' + altolat + '|' + altolong + '|~From~,2]' + '"></iframe>';
} else if (tdid.toLowerCase().indexOf('to') != -1) {
document.getElementById(trid).style.display='table-row';
if (altolat == '') { altolat=top.document.getElementById('ltt').value; }
if (altolong == '') { altolong=top.document.getElementById('lgt').value; }
document.getElementById(tdid).innerHTML+='<iframe style=display:inline-block;height:300px;width:450px; src="' + '//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places&aregexographicals=y&aregeographicals=HTTP.To' +
'&peninfo=' + altolat + '|' + altolong + '|128205_To' +
'&width=417&height=260&country=Places&popularity=' +
'&data=%20[' + altolat + '|' + altolong + '|~To~,2]' + '"></iframe>';
}
}
}
}
function moreifok() {
//alert('add row here');
//bthe();
if (cfok) {
//alert(isokformore);
cfok=false;
if (isokformore.trim() != '') {
//alert(5);
document.getElementById('next1').style.display='table-row';
document.getElementById('niframe').style.backgroundColor='yellow';
document.getElementById('niframe').src=document.URL.split('#')[0].split('?')[0] + isokformore;
isokformore=' ';
//alert(55);
}
}
}
function myselit(oso) {
if (oso.value == '1') {
document.getElementById('brg').value='' + eval(eval(180.0 + eval(('' + document.getElementById('brg').value).replace('~0.','.').replace('~',''))) % 360.0);
}
oso.value='2';
}
function dorh() {
//let laSensor = new LinearAccelerationSensor({frequency: 60});
//laSensor.addEventListener('reading', e => {
// console.log("Linear acceleration along the X-axis " + laSensor.x);
// console.log("Linear acceleration along the Y-axis " + laSensor.y);
// console.log("Linear acceleration along the Z-axis " + laSensor.z);
//});
//laSensor.start();
//window.addEventListener('devicemotion', function(event) {
// alert(event.rotationRate.alpha + ' m/s2');
//});
if (1 == 1) {
window.addEventListener("orientationchange", function() {
// Announce the new orientation number
wasangle=eval(180 - eval('' + window.orientation));
if (xxxipn != xxipn) { wor=eval(180 + eval('' + window.orientation)); xwor=wor; xwor+=90; }
if (document.getElementById('arrowup') && xxxipn == xxipn) {
//alert('' + eval(Math.round(0) - eval('' + wasangle)));
try { document.getElementById('arrowup').style.webkitTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e10) { }
try { document.getElementById('arrowup').style.MozTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e1000) { }
try { document.getElementById('arrowup').style.msTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e100) { }
try { document.getElementById('arrowup').style.OTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e10000) { }
try { document.getElementById('arrowup').style.transform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e1) { }
} else if (document.getElementById('arrowup')) {
document.getElementById('arrowup').title='Bearing in yellow is with respect to direction you are pointing with respect to up the screen';
}
var thisso='' + screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type;
if (('' + thisso) == 'undefined') {
var mql=window.matchMedia("(orientation: portrait)");
// If there are matches, we're in portrait
if (mql.matches) {
thisso="Portrait"; // Portrait orientation
} else {
thisso="Landscape"; // Landscape orientation
}
}
if (thisso != wasthisso) {
wasthisso=thisso;
//alert('ori');
}
}, false);
}
if (window.DeviceOrientationEvent) {
if (1 == 2) { alert(1); }
// Listen for orientation changes ... thanks to https://davidwalsh.name/orientation-change
// Listen for the deviceorientation event and handle the raw data
window.addEventListener('deviceorientation', function(eventData) {
// gamma is the left-to-right tilt in degrees, where right is positive
if (1 == 2) { alert(11); }
if (document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') == -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf(' and ') == -1) {
document.getElementById('ipn').className='ph';
document.getElementById('ipn').placeholder+='. Append space and portrait face north for gyroscope bearing.';
if (xxxipn == xxipn) {
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.5, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
}
setTimeout(asafn, 5000);
}
}
//eventData.absolute=true;
var eventDataalpha = eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
if (sf < 90) { sf++; }
if (eventData.absolute !== true && navigator.userAgent.match(/iPhone/i)) {
sf=70;
sf=80;
sf=90;
if (navigator.userAgent.toLowerCase().indexOf('safari/') > -1) {
prets=eval(360 + 90 + eval(0 * eval('' + eventData.webkitCompassAccuracy))); // 360;
} else {
prets=eval(180 + 270 + eval(0 * eval('' + eventData.webkitCompassAccuracy))); // 360;
}
oldprets=prets;
} else if (eventData.absolute !== true && eval('' + eventData.webkitCompassAccuracy) > 0 && +eventData.webkitCompassAccuracy < sf) { // 50
prets=eval(450 - eval(1 * eval('' + eventData.webkitCompassAccuracy))); // 360;
oldprets=prets;
}
if (eventData.absolute !== true && eval('' + eventData.webkitCompassAccuracy) > 0 && +eventData.webkitCompassAccuracy < sf) { // 50
if (!fdone) {
fdone=true;
console.log('final eventData.webkitCompassHeading/Accuracy=' + eventData.webkitCompassHeading + '/' + eventData.webkitCompassAccuracy);
}
eventDataalpha = eval('' + eventData.webkitCompassHeading || 0);
if (xxipn == xxxipn) { xxxipn+=' '; wor=eval(180 + eval('' + window.orientation)); xwor=wor; xwor+=90; }
if (document.getElementById('dntable')) { document.getElementById('dntable').style.display='inline-block'; }
} else if (eventData.absolute !== true && navigator.userAgent.match(/iPhone/i)) {
console.log('eventData.webkitCompassAccuracy=' + +eventData.webkitCompassAccuracy);
}
if (!datstart) { if (xxxipn != xxipn && 1 == 2) { initial_yaw=eval(eventData.alpha); } eventDataalpha-=initial_yaw; }
tiltLeftToRight = eval('' + eventData.gamma);
// beta is the front-to-back tilt in degrees, where front is positive
tiltFrontToBack = eval('' + eventData.beta);
// alpha is the compass direction the device is facing in degrees
lastalpha='' + eventData.alpha; // lalpha; //
dorbrg = eval('' + eventDataalpha); //compassHeading(eval('' + eventDataalpha), tiltFrontToBack, tiltLeftToRight);
if (1 == 2) { alert(dorbrg); }
if (document.URL.indexOf('aleJUNKrt=') != -1) {
alert(dorbrg);
}
if (document.URL.indexOf('upJUNKdate=') != -1 || (fplacen != '' && tplacen == '')) {
if (eventData.absolute || 1 == 1) {
//document.getElementById('brg').value='' + eval(eval(540.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + eval(eval(720.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + dorbrg;
if (eval(dcnt % 10) == 0) {
document.getElementById('brg').value='' + eval(eval(720.0 + eval('' + wor) + eval('' + dorbrg)) % 360.0);
document.getElementById('brg').style.backgroundColor='yellow';
}
dcnt++;
}
}
if (datstart && (fplacen != '' && tplacen == '')) {
datstart=false;
//initial_yaw=eval(360.0 - eval('' + lalpha)); //eventData.alpha));
//alert('0:' + initial_yaw);
if (!eventData.absolute) {
if (xxxipn != xxipn && 1 == 2) {
initial_yaw=initial_yaw; //0.0000001;
} else {
initial_yaw=eventDataalpha; //eval(360.0 - eval('' + eventData.alpha)); // lalpha)); //
}
}
//alert('' + initial_yaw);
initial_pitch=Math.round(tiltFrontToBack);
initial_roll=Math.round(tiltLeftToRight);
//alert(initial_yaw + ',' + initial_pitch + ',' + initial_roll);
}
if (document.getElementById('ntable')) {
var ts=prets;
if (document.getElementById('arrowup') && xxxipn == xxipn) {
try { document.getElementById('arrowup').style.webkitTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e10) { }
try { document.getElementById('arrowup').style.MozTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e1000) { }
try { document.getElementById('arrowup').style.msTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e100) { }
try { document.getElementById('arrowup').style.OTransform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e10000) { }
try { document.getElementById('arrowup').style.transform = ("rotate(" + eval(Math.round(-180) + eval('' + wasangle)) + "deg)"); } catch(e1) { }
} else if (document.getElementById('arrowup')) {
document.getElementById('arrowup').title='Bearing in yellow is with respect to direction you are pointing with respect to up the screen';
}
if (wasangle != 0) {
ts+=wasangle;
if (xxipn != xxxipn && 1 == 1) {
//document.getElementById('tdn').innerHTML='' + window.orientation + '<br>' + Math.round(dorbrg);
//if (wasangle != 180) { ts-=eval(360 - wasangle); }
ts-=wor
//ts-=180.0;
//if (1 == 1 && navigator.userAgent.toLowerCase().indexOf('safari/') > -1) {
//ts-=90;
//} else if (wasangle == 90) {
//ts-=180.0;
//}
//ts=xwor;
ts=eval(2.0 * Math.round(dorbrg));
ts=eval('' + window.orientation); //wasangle;
if (Math.abs(eval('' + window.orientation)) == 90) { ts+=90.0; } else { ts-=90.0; }
ts-=eval(1 * eval('' + eventData.webkitCompassAccuracy));
if (navigator.userAgent.match(/iPhone/i)) { ts-=180.0; }
}
}
gts=eval(ts - Math.round(dorbrg));
try { document.getElementById('ntable').style.webkitTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e10) { }
try { document.getElementById('ntable').style.MozTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e1000) { }
try { document.getElementById('ntable').style.msTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e100) { }
try { document.getElementById('ntable').style.OTransform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e10000) { }
try { document.getElementById('ntable').style.transform = ("rotate(" + eval(ts - Math.round(dorbrg)) + "deg)"); } catch(e1) { }
}
handleOrientationEvent(tiltFrontToBack, tiltLeftToRight, dorbrg, eventData.absolute);
if ((fplacen != '' && tplacen == '') && document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') != -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and ') != -1) {
document.getElementById('ipn').style.backgroundColor='#f0f0f0';
//document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and face north for gyroscope bearing.')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + ' Now swivel to direction of interest then tap yellow textbox.';
if (xxxipn == xxipn) {
document.getElementById("myviewport").setAttribute("content", "width=device-width, initial-scale=1.2, minimum-scale=0.1, maximum-scale=8, user-scalable=yes");
}
//window.scrollBy(0,50); //location.href='#brg';
}
}
}, false);
}
}
var handleOrientationEvent = function(tiltFrontToBack, tiltLeftToRight, dorbrg, absis) {
// do something amazing
if (1 == 2) { alert(dorbrg); }
if (document.URL.indexOf('alJUNKert=') != -1) {
alert(dorbrg);
}
if (document.URL.indexOf('upJUNKdate=') != -1 || (fplacen != '' && tplacen == '')) {
if (absis || 1 == 1) {
//document.getElementById('brg').value='' + eval(eval(540.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + eval(eval(720.0 - eval('' + dorbrg)) % 360.0);
//document.getElementById('brg').value='' + dorbrg;
if (eval(dcnt % 10) == 0) {
document.getElementById('brg').value='' + eval(eval(720.0 + eval('' + dorbrg)) % 360.0);
document.getElementById('brg').style.backgroundColor='yellow';
//if (xxxipn != xxipn) { alert(prets); document.getElementById('sstatus').innerHTML='x:' + prets; }
}
dcnt++;
}
}
};
function asafn() {
if (document.getElementById('ipn')) {
//if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and face north for gyroscope bearing.') == -1) {
if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and portrait face north for ') != -1) {
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + 'Append space and portrait face north onto ;elevation(m)?';
setTimeout(asafn, 5000);
} else if (('' + document.getElementById('ipn').placeholder).indexOf('Append space and ') != -1) {
document.getElementById('ipn').placeholder=document.getElementById('ipn').placeholder.split('Append space and ')[0] + 'Append space and portrait face north for horizon bearing.';
setTimeout(asafn, 5000);
}
}
}
function moremaybe() {
if (sparefplacen != '') {
fplacen=sparefplacen;
sparefplacen='';
}
var ofplacen=fplacen;
var otplacen=tplacen;
if (xipn != '') {
document.getElementById('ipn').value=xipn;
//alert(xipn);
}
//dorh();
if (document.getElementById('gform')) {
if (document.URL.indexOf('https:') != -1) { document.getElementById('gform').action=document.getElementById('gform').action.replace('http:','https:'); }
}
var latto=location.search.split('latf=')[1] ? decodeURIComponent(location.search.split('latf=')[1].split('&')[0]) : '';
var longto=location.search.split('longf=')[1] ? decodeURIComponent(location.search.split('longf=')[1].split('&')[0]) : '';
var clatto=location.search.split('latt=')[1] ? decodeURIComponent(location.search.split('latt=')[1].split('&')[0]) : '';
var clongto=location.search.split('longt=')[1] ? decodeURIComponent(location.search.split('longt=')[1].split('&')[0]) : '';
var cbrg=location.search.split('brg=')[1] ? decodeURIComponent(location.search.split('brg=')[1].split('&')[0]) : '';
var cdist=location.search.split('dist=')[1] ? decodeURIComponent(location.search.split('dist=')[1].split('&')[0]) : '';
var mysel=location.search.split('mysel=')[1] ? decodeURIComponent(location.search.split('mysel=')[1].split('&')[0]) : '2';
var dosms=location.search.split('sms=')[1] ? decodeURIComponent(location.search.split('sms=')[1].split('&')[0]) : '';
if (fplacen != '') {
document.getElementById('ssf').innerHTML=fplacen;
fplacen='';
}
if (tplacen.trim() != '') {
document.gety.appendChild(tag);
}
} else {
scrto="<scr" + "ipt type='text/javascript'> " + thedatais + " </scr" + "ipt>";
if (prefixingstuff.indexOf(scrfrom) != -1) {
prefixingstuff=prefixingstuff.replace(scrfrom, scrto);
console.log('b:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
scrfrom=scrto;
dscriptstuff+=scrto;
tag = document.createElement('script');
tag.setAttribute("type", "text/javascript");
tag.innerHTML = thedatais;
document.body.appendChild(tag);
}
}
} else if (stylookfordata == '2') {
if (styfrom == 'youllneverfindthis' && styto != 'youllneverfindthis' && styto.trim().substring(0,1) != '<') { styfrom=styto; }
if (styfrom.indexOf('.CSS') != -1) {
styto="<sty" + "le> " + thedatais + " </STY" + "LE>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('c:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
styfrom=styto;
}
} else {
styto="<sty" + "le> " + thedatais + " </sty" + "le>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('d:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
styfrom=styto;
}
}
}
} else if (document.getElementById('result1').value.trim() != '') {
thedatais=document.getElementById('result1').value;
//document.getElementById('result1').value='';
//document.getElementById('result1').innerHTML='';
//alert(thedatais + ' ... ' + prefixingstuff + ' ... ' + scrlookfordata + ' and scrfrom=' + scrfrom + ' and scrto=' + scrfrom);
if (scrlookfordata == '1') {
if (scrfrom == 'youllneverfindthis' && scrto != 'youllneverfindthis' && scrto.trim().substring(0,1) != '<') { scrfrom=scrto; }
if (scrfrom.indexOf('.JS') != -1) {
scrto="<scr" + "ipt type='text/javascript'> " + thedatais + " </SCR" + "IPT>";
//alert('Does prefixingstuff=' + prefixingstuff + ' contain scrfrom=' + scrfrom + ' to be replaced by ' + scrto);
if (prefixingstuff.indexOf(scrfrom) != -1) {
prefixingstuff=prefixingstuff.replace(scrfrom, scrto);
console.log('e:' + prefixingstuff);
//alert('Yes prefixingstuff=' + prefixingstuff + ' contain scrfrom=' + scrfrom + ' to be replaced by ' + scrto);
wasprefixingstuff=prefixingstuff;
scrfrom=scrto;
dscriptstuff+=scrto;
tag = document.createElement('script');
tag.setAttribute("type", "text/javascript");
tag.innerHTML = thedatais;
document.body.appendChild(tag);
}
} else {
scrto="<scr" + "ipt type='text/javascript'> " + thedatais + " </scr" + "ipt>";
if (prefixingstuff.indexOf(scrfrom) != -1) {
prefixingstuff=prefixingstuff.replace(scrfrom, scrto);
console.log('f:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
scrfrom=scrto;
dscriptstuff+=scrto;
tag = document.createElement('script');
tag.setAttribute("type", "text/javascript");
tag.innerHTML = thedatais;
document.body.appendChild(tag);
}
}
} else if (stylookfordata == '2') {
if (styfrom == 'youllneverfindthis' && styto != 'youllneverfindthis' && styto.trim().substring(0,1) != '<') { styfrom=styto; }
if (styfrom.indexOf('.CSS') != -1) {
styto="<sty" + "le> " + thedatais + " </STY" + "LE>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('g:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
styfrom=styto;
}
} else {
styto="<sty" + "le> " + thedatais + " </sty" + "le>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('h:' + prefixingstuff);
wasprefixingstuff=prefixingstuff;
styfrom=styto;
}
}
}
}
if (wass != prefixingstuff) {
var ssargstuff=argstuff;
if (prefixingstuff.trim() != '') {
if (ssargstuff == '') {
ssargstuff='?nontz=' + encodeURIComponent(prefixingstuff);
} else if (ssargstuff.indexOf('nontz=') != -1 && ssargstuff.indexOf(encodeURIComponent(prefixingstuff)) == -1) {
ssargstuff=ssargstuff.replace('nontz=', 'nontz=' + encodeURIComponent(prefixingstuff));
}
}
argstuff=ssargstuff;
//alert('ssargStuff = ' + ssargstuff);
//alert('before look for no:' + document.getElementById('sdurl').value);
if (1 == 1 || (gnewh != lasthcalc && gnewh != '#' && gnewh != washash)) {
//alert('usIng ssargstuff=' + ssargstuff);
document.getElementById('sdurl').value=(document.getElementById('sdurl').value.split('#')[0].split('?')[0] + thecssarg + ((argstuff + '#') == '#' ? argstuff + '#' : '#' + argstuff.substring(1) + '&') + gnewh.substring(1).replace(/^\%2C/g,'')).replace('', '&');
lasthcalc=gnewh;
} else if (document.getElementById('sdurl').value.indexOf('?') == -1 && argstuff.indexOf('?') == 0) {
//alert('Using ssargstuff=' + ssargstuff);
document.getElementById('sdurl').value=(document.getElementById('sdurl').value.split('#')[0].split('?')[0] + thecssarg + ((argstuff + '#') == '#' ? argstuff + '#' : '#' + argstuff.substring(1) + '&') + ('#' + gnewh.substring(1).replace(/^\%2C/g,'')).replace(/^\#$/g, '')).replace('', '&');
if (gnewh.replace('#','') != '') { lasthcalc=gnewh; }
}
}
}
function stylookfor() {
}
function storeshare(iois) {
if (iois.src.indexOf('localhost') != -1) {
waconto = (iois.contentWindow || iois.contentDocument);
if (waconto != null) {
if (waconto.document) { waconto = waconto.document; }
shareb=waconto.getElementById('share');
}
}
}
function scranal(iois) {
if (iois.src.indexOf('localhost') != -1) {
var scraconto = (iois.contentWindow || iois.contentDocument);
if (scraconto != null) {
if (scraconto.document) { scraconto = scraconto.document; }
//alert(scraconto.body.outerHTML);
}
}
}
function styanal(iois) {
if (iois.src.indexOf('localhost') != -1) {
var styaconto = (iois.contentWindow || iois.contentDocument);
if (styaconto != null) {
if (styaconto.document) { styaconto = styaconto.document; }
//alert(styaconto.body.outerHTML);
}
}
}
function scrStateChanged() {
if (scrmyxhr.readyState == 4) {
if (scrmyxhr.status == 200) {
if (scrfrom.indexOf('.JS') != -1) {
scrto="<scr" + "ipt type='text/javascript'> " + scrmyxhr.responseText + " </SCR" + "IPT>";
if (prefixingstuff.indexOf(scrfrom) != -1) {
prefixingstuff=prefixingstuff.replace(scrfrom, scrto);
console.log('i:' + prefixingstuff);
scrfrom=scrto;
}
} else {
scrto="<scr" + "ipt type='text/javascript'> " + scrmyxhr.responseText + " </scr" + "ipt>";
if (prefixingstuff.indexOf(scrfrom) != -1) {
prefixingstuff=prefixingstuff.replace(scrfrom, scrto);
console.log('j:' + prefixingstuff);
scrfrom=scrto;
}
}
}
}
}
function styStateChanged() {
if (stymyxhr.readyState == 4) {
if (stymyxhr.status == 200) {
if (styfrom.indexOf('.CSS') != -1) {
styto="<sty" + "le> " + stymyxhr.responseText + " </STY" + "LE>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('k:' + prefixingstuff);
styfrom=styto;
}
} else {
styto="<sty" + "le> " + stymyxhr.responseText + " </sty" + "le>";
if (prefixingstuff.indexOf(styfrom) != -1) {
prefixingstuff=prefixingstuff.replace(styfrom, styto);
console.log('l:' + prefixingstuff);
styfrom=styto;
}
}
}
}
}
function ajaxit(insto) {
var insfrom='';
if (insto.indexOf('filecss:') != -1) {
insfrom=insto;
}
if (insto.indexOf('filescript:') != -1) {
insfrom=insto;
}
//alert('Insfrom=' + insfrom + ' and insto=' + insto);
if (insfrom.indexOf('filescript:') == 0) {
//alert('insfrom=' + insfrom + ' and insto=' + insto);
if (insto == insfrom) {
//alert('7:' + insfrom);
if (17 == 17) {
if (('' + document.getElementById('cbi').style.display).indexOf('none') != -1) {
if (document.getElementById('result1').value == '') {
scrlookfordata='1';
stylookfordata='2';
} else {
scrlookfordata='2';
stylookfordata='1';
}
document.getElementById('cbi').style.display='block';
alert('To later, optionally, share this Javascript with recipients, please select it via the Please Choose button leading you to a File Browser.');
//setTimeout(function(){ alert(document.getElementById('result1').value); }, 30000);
}
} else if (7 == 7) {
scrwo=window.open(insfrom.split('filescript:')[1].split('//')[0] + '//' + insfrom.split('filescript:')[1].split('//')[1].split('/')[0] + '/getex.php?url=' + encodeURIComponent(insfrom.split('filescript:')[1].split(';')[0]), '_blank', 'top=50,left=50,width=50,height=50');
setTimeout(function(){ alert(document.getElementById('myta').value); }, 3000);
} else if (5 == 5) {
document.getElementById('scrmytaif').src='/getex.php?url=' + encodeURIComponent(insfrom.split('filescript:')[1].split(';')[0]);
} else {
scrmyxhr = new XMLHttpRequest();
scrmyxhr.open('GET', insfrom.split('filescript:')[1].split(';')[0], true);
scrmyxhr.responseType = 'Document'; // vs 'text'
scrmyxhr.onreadystatechange=scrStateChanged;
scrmyxhr.send(null);
}
}
} else if (insfrom.indexOf('filecss:') == 0) {
if (insto == insfrom) {
if (17 == 17) {
if (('' + document.getElementById('cbi').style.display).indexOf('none') != -1) {
if (document.getElementById('result1').value == '') {
scrlookfordata='2';
stylookfordata='1';
} else {
scrlookfordata='1';
stylookfordata='2';
}
document.getElementById('cbi').style.display='block';
alert('To later, optionally, share this CSS Styling with recipients, please select it via the Please Choose button leading you to a File Browser.');
//setTimeout(function(){ alert(document.getElementById('result1').value); }, 30000);
}
} else if (7 == 7) {
stywo=window.open(insfrom.split('filecss:')[1].split('//')[0] + '//' + insfrom.split('filecss:')[1].split('//')[1].split('/')[0] + '/getex.php?url=' + encodeURIComponent(insfrom.split('filecss:')[1].split(';')[0]), '_blank', 'top=50,left=50,width=50,height=50');
setTimeout(function(){ alert(document.getElementById('myta').value); }, 3000);
} else if (5 == 5) {
document.getElementById('stymytaif').src='/getex.php?url=' + encodeURIComponent(insfrom.split('filecss:')[1].split(';')[0]);
} else {
stymyxhr = new XMLHttpRequest();
stymyxhr.open('GET', insfrom.split('filecss:')[1].split(';')[0], true);
stymyxhr.responseType = 'Document'; // vs 'text'
stymyxhr.onreadystatechange=styStateChanged;
stymyxhr.send(null);
}
}
}
return insto;
}
function nomc(hashttpmaybe) {
var nohttp=hashttpmaybe;
var ihp=0, hparts=nohttp.split('https://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('https://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:https://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:https://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTPS://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTPS://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTPS://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTPS://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('http://');
//alert('Nohttp=' + nohttp + ' and hparts.length=' + hparts.length + ' and last hparts=' + hparts[eval(-1 + hparts.length)]);
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('http://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
//alert(scrto);
if (scrto == 'youllneverfindthis') {
scrto='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
//alert(scrto);
nohttp=nohttp.replace('filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:http://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.css')[0] + '.css', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.css')[0] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:http://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
hparts=nohttp.split('HTTP://');
for (ihp=1; ihp<hparts.length; ihp++) {
if (hparts[ihp].indexOf('localhost') == -1) {
nohttp=nohttp.replace('HTTP://' + hparts[ihp], '//' + hparts[ihp]);
} else if (hparts[ihp].indexOf('.js') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.js')[0] + '.js';
}
} else if (hparts[ihp].indexOf('.JS') != -1) {
if (scrto == 'youllneverfindthis') {
scrto='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
nohttp=nohttp.replace('filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS', ajaxit(scrto));
} else {
scrfrom='filescript:HTTP://' + hparts[ihp].split('.JS')[0] + '.JS';
}
} else if (hparts[ihp].indexOf('.css') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp] + '.css';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp] + '.css', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp] + '.css';
}
} else if (hparts[ihp].indexOf('.CSS') != -1) {
if (styto == 'youllneverfindthis') {
styto='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
nohttp=nohttp.replace('filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS', ajaxit(styto));
} else {
styfrom='filecss:HTTP://' + hparts[ihp].split('.CSS')[0] + '.CSS';
}
}
}
//alert('nohttp=' + nohttp.replace(scrfrom, scrto).replace(styfrom, styto));
return nohttp.replace(scrfrom, scrto).replace(styfrom, styto);
}
function glegit(iwhat) {
return '' + iwhat.getAttribute('data-tleg');
}
function windowopen(w1, w2, w3) {
var twoends=[], tzps=[];
if (gleg != '') {
twoends=gleg.split('.');
}
if (eval('' + twoends.length) > 1) {
w3='top=50,left=50,width=1000,height=900';
if (plottz[eval('' + twoends[0])].trim() != '' && plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 3) + ',height=900');
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth * 2 / 3) + ',width=' + Math.floor(screenwidth / 3) + ',height=900');
} else if (plottz[eval('' + twoends[0])].trim() != '') {
w3='top=50,left=' + Math.floor(screenwidth / w) + ',width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[0])].trim()), '_blank','top=50,left=2,width=' + Math.floor(screenwidth / 2) + ',height=900');
} else if (plottz[eval('' + twoends[1])].trim() != '') {
w3='top=50,left=5,width=' + Math.floor(screenwidth / 2) + ',height=900';
window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + encodeURIComponent(plottz[eval('' + twoends[1])].trim()), '_blank','top=50,left=' + Math.floor(screenwidth / 2) + ',width=' + Math.floor(screenwidth / 2) + ',height=900');
}
}
return window.open(w1, w2, w3);
}
function addcty(injp) {
var iwq=0;
if (decodeURIComponent(injp).replace(/\_/g,' ').indexOf(', ') == -1 && decodeURIComponent(injp).replace(/\_/g,' ').indexOf('[') == -1) {
if (1 == 1) {
return thedecodeURIComponent(injp);
} else {
for (iwq=0; iwq<plotplace.length; iwq++) {
if (decodeURIComponent(plotplace[iwq]).replace(/\_/g,' ').indexOf(', ') != -1) {
if (decodeURIComponent(injp) == decodeURIComponent(plotplace[iwq]).replace(/\_/g,' ').split(', ')[0]) {
return injp + ', ' + decodeURIComponent(plotplace[iwq]).replace(/\_/g,' ').split(', ')[1];
}
}
}
}
}
return injp;
}
function thedecodeURIComponent(insx) {
var outsx=decodeURIComponent(insx);
if (isotwo != '' && isotwo.indexOf(outsx) != -1) {
if (plottz[eval(-1 + plotcc.length)] == '') {
plottz[eval(-1 + plotcc.length)]=' ';
}
plotcc[eval(-1 + plotcc.length)]=isotwo.split(outsx)[1].substring();
for (var ijk=0; ijk<iso_country_codes.length; ijk+=2) {
if (iso_country_codes[ijk].toUpperCase() == isotwo.split(outsx)[1].substring()) {
return outsx + ', ' + iso_country_codes[eval(1 + ijk)];
}
}
}
return outsx;
}
function dountilnoquestion() {
var ibap=0, bap=[], ispare=0;
caret='^';
//document.title=gdefv;
console.log('gdefv=' + gdefv);
if (gdefv.trim() != gdefv.trim().replace(/\?$/g,'') || gdefv.indexOf('!?') != -1 || gdefv.indexOf('?!') != -1 || gdefv.indexOf('?{') != -1 || gdefv.indexOf('?,') != -1 || gdefv.indexOf('?-') != -1) {
bap=gdefv.split('{');
for (ibap=1; ibap<bap.length; ibap++) {
if (bap[ibap].split('}')[0].indexOf('?') != -1) {
gdefv=gdefv.replace(bap[ibap], bap[ibap].replace(/\?/g, '%3f'));
}
}
//alert('gdefv=' + gdefv);
// Alice Springs|133.87000|_23.70000^-Sydney?!
curgdefv=gdefv.split('?')[0].split(',')[eval(-1 + gdefv.split('?')[0].split(',').length)].trim().replace(/^\[/g,'');
//alert('Curgdefv=' + curgdefv);
curgdefv=curgdefv.split('^')[eval(-1 + curgdefv.split('^').length)].replace(/^\-/g,'');
//alert('curGdefv=' + curgdefv);
if (curgdefv != curgdefv.replace(/\!$/g,'')) {
caret='^ ';
gdefv=gdefv.replace(curgdefv, curgdefv.replace(/\!$/g,''));
//alert('1:' + gdefv);
curgdefv=curgdefv.replace(/\!$/g,'');
} else if (gdefv.indexOf(curgdefv + '?!') != -1) {
caret='^ ';
gdefv=gdefv.replace(curgdefv + '?!', curgdefv + '?');
//alert('2:' + gdefv);
curgdefv=curgdefv;
}
if (caret == '^ ' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') == -1) {
caret='^';
if (bigback.indexOf(curgdefv + ':') == -1 && bigback.indexOf(curgdefv.replace(/\ /g,'_') + ':') == -1 && nextwiftwo.indexOf(encodeURIComponent(curgdefv)) == -1) {
//alert(curgdefv);
if (wiftwoavailable) {
wiftwoavailable=false;
//alert('1:' + '/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')).replace(/\%252d/g,'%2d'));
document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')).replace(/\%252d/g,'%2d');
} else {
nextwiftwo+='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.replace(/\ /g,'_')) + '#';
}
}
}
}
//alert('*' + caret + '*');
if (caret == '^') {
if (yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
ispare=yourtzlistindexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<');
//gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
gdefv=gdefv.replace(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_') + '?', curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//alert('gdefv=' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
} else {
setTimeout(dountilnoquestion, 1000);
}
} else {
//alert('curgdefv=' + curgdefv);
document.getElementById('placegeo').value=' ';
//alert('11:' + '/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ /g,'_')).replace(/\%252d/g,'%2d'));
//document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')).replace(/\%252d/g,'%2d');
//alert('11:' + '/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')));
// document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_'));
}
} else if (caret == '^ ') {
if (caret == '^' && yourtzlist.toLowerCase().indexOf('/' + curgdefv.toLowerCase().replace(/\ /g,'_') + '<') != -1) {
//gdefv=gdefv.replace(curgdefv + '?', curgdefv + '^');
gdefv=gdefv.replace(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_') + '?', curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//alert('gdefv=' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
} else {
setTimeout(dountilnoquestion, 1000);
}
} else {
//alert('curgdefv=' + curgdefv);
document.getElementById('placegeo').value=' ';
//alert('111:' + '/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ /g,'_')));
//document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_'));
//alert('111:' + '/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_')));
// document.getElementById('wiftwo').src='/PHP/fgc/index.php?tzexact=&tznickname=' + encodeURIComponent(curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-')[eval(-1 + curgdefv.split(',')[eval(-1 + curgdefv.split(',').length)].split('-').length)].split('{')[0].trim().replace(/\ /g,'_'));
}
}
}
function woit(what) {
if (what.trim() != '') {
//alert(what + ' ... ' + bigback);
if (bigback.indexOf(what + ':') != -1 || bigback.indexOf(what.replace(/\ /g,'_') + ':') != -1) {
if (wobi) {
if (!wobi.closed) { wobi.close(); }
}
wobi=window.open('', '_blank', 'top=50,left=50,width=900,height=800');
if (bigback.indexOf(what + ':') != -1) {
wobi.document.write(bigback.split(what + ':')[1].split('</div>')[0] + '</div>');
} else {
wobi.document.write(bigback.split(what.replace(/\ /g,'_') + ':')[1].split('</div>')[0] + '</div>');
}
setTimeout(function(){ wobi.document.title=what + ' ... Wikipedia images ... thanks'; }, 6000);
}
}
}
function coordittwo(xiois) {
var xxaconto = (xiois.contentWindow || xiois.contentDocument);
if (xxaconto != null) {
if (xxaconto.document) { xxaconto = xxaconto.document; }
var xxacontobodyouterHTML=xxaconto.body.outerHTML.replace(/\"\;/g,'"');
//alert(xxacontobodyouterHTML);
if (xxacontobodyouterHTML.indexOf('.style.background="URL(') != -1) {
//alert('URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + '');
//alert('"' + xxacontobodyouterHTML.split('.style.backgroundRepeat="')[1].split('"')[0] + '"');
//alert('"' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0] + '"');
if (bigback.indexOf(xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':') == -1) {
if (document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0])) {
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\ /g,'_')).style.cursor='pointer';
document.getElementById('span' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\ /g,'_')).title='Wikipedia images available for ' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\_/g,' ') + ' clicking here now.';
}
bigback+=xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0] + ':' + document.getElementById('ourcanvas').outerHTML.replace('<canvas','<div title="Images for ' + xiois.src.split('tznickname=')[1].split('&')[0].split('#')[0].replace(/\_/g,' ') + ' thanks to Wikipedia at https://wikipedia.org" ').replace('</canvas>','</div>').replace(':none;',':block;background:' + 'URL(' + xxacontobodyouterHTML.split('.style.background="URL(')[1].split('"')[0] + ';background-repeat:no-repeat;background-position:' + xxacontobodyouterHTML.split('.style.backgroundPosition="')[1].split('"')[0]);
}
}
wiftwoavailable=true;
if (nextwiftwo.split('#')[0] != '') {
if (nextwiftwo.split('#')[0].indexOf('dopg=') != -1) {
document.getElementById('placegeo').value=' ';
override=nextwiftwo.split('#')[0].replace('dopg=y&','').split('tznickname=')[1].split('&')[0].split('#')[0];
//alert('2:' + '/PHP/fgc/index.php?placegeo=' + encodeURIComponent(override.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_'));
document.getElementById('wif').src='/PHP/fgc/index.php?placegeo=' + encodeURIComponent(override.replace(/\ \(/g,', ').replace(/\)$/g,'')).replace(/\%20/g,'_');
}
xiois.src=nextwiftwo.split('#')[0].replace('dopg=y&','');
nextwiftwo=nextwiftwo.replace(nextwiftwo.split('#')[0] + '#', '');
wiftwoavailable=false;
}
}
}
function coordit(xiois) {
var thisoverride=override;
override='';
xaconto = (xiois.contentWindow || xiois.contentDocument);
//alert(11);
if (xaconto != null) {
//alert('111 ' + xiois.src);
try {
if (xaconto.document) { xaconto = xaconto.document; }
//alert('1111 ' + xaconto.body.innerHTML);
if (xaconto.body.innerHTML.indexOf('>Coordinates') != -1) {
var subpart=xaconto.body.innerHTML.split('>Coordinates')[1];
latdeg=-999;
longdeg=-999;
latmin=0;
longmin=0;
latsec=0;
longsec=0;
sparelat='';
sparelong='';
if (subpart.indexOf('"latitude"') != -1 && subpart.indexOf('"longitude"') != -1) {
latdeg=subpart.split('"latitude"')[1].split('>')[1].split("°")[0].split('<')[0];
sparelat=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].slice(-1);
latmin=subpart.split('"latitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + latdeg.length))).split("′")[0].split(sparelat)[0].split('<')[0];
if (sparelat == 'S') { latdeg=eval(eval(eval(-1 * latmin) / 60) - latdeg); } else { latdeg+=eval(eval('' + latmin) / 60) }
longdeg=subpart.split('"longitude"')[1].split('>')[1].split("°")[0].split('<')[0];
sparelong=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].slice(-1);
longmin=subpart.split('"longitude"')[1].split('>')[1].split('<')[0].substring(eval(1 + eval('' + longdeg.length))).split("′")[0].split(sparelong)[0].split('<')[0];
if (sparelong == 'W') { longdeg=eval(eval(eval(-1 * longmin) / 60) - longdeg); } else { longdeg+=eval(eval('' + longmin) / 60) }
if (gdefv.indexOf(curgdefv + '?') != -1) {
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + + ('|' + latdeg).replace('|-','|_') + '^');
dountilnoquestion();
}
return true;
} else if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
//alert(document.getElementById('placegeo').value);
if (eval('' + document.getElementById('placegeo').title.split(',').length) >= 3) {
isotwo+=curgdefv + document.getElementById('placegeo').title.split(',')[eval(-3 + document.getElementById('placegeo').title.split(',').length)];
if (thisoverride != '') { alert(isotwo + ' ... regarding ' + thisoverride); }
setTimeout(newhashit, 5000);
}
latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];
//alert('' + longdeg);
if (gdefv.indexOf(curgdefv + '?') != -1) {
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv=' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
setTimeout(dountilnoquestion, 1000);
}
//dountilnoquestion();
}
return true;
}
} else {
if (('' + document.getElementById('placegeo').value).trim().indexOf(',') != -1) {
//alert(document.getElementById('placegeo').value);
//alert(document.getElementById('placegeo').value);
if (eval('' + document.getElementById('placegeo').title.split(',').length) >= 3) {
isotwo+=curgdefv + document.getElementById('placegeo').title.split(',')[eval(-3 + document.getElementById('placegeo').title.split(',').length)];
if (thisoverride != '') { alert(isotwo + ' ... Regarding ' + thisoverride); }
setTimeout(newhashit, 5000);
}
latdeg=document.getElementById('placegeo').value.split(',')[eval(-2 + document.getElementById('placegeo').value.split(',').length)];
longdeg=document.getElementById('placegeo').value.split(',')[eval(-1 + document.getElementById('placegeo').value.split(',').length)];
//alert('7:' + longdeg + ' ' + document.getElementById('placegeo').value);
//alert('77:' + latdeg + ' gdefv=' + gdefv + ' and curgdefv?=' + curgdefv + '?');
// 77:-23.70000 gdefv=Alice Springs?-Sydney? and curgdefv?=Alice Springs?
// 77:-33.86778 gdefv=Alice Springs|133.87000|_23.70000^-Sydney? and curgdefv?=Sydney?
if (gdefv.indexOf(curgdefv + '?') != -1) {
//alert('r:' + document.getElementById('placegeo').value);
gdefv=gdefv.replace(curgdefv + '?', curgdefv + ('|' + longdeg).replace('|-','|_') + ('|' + latdeg).replace('|-','|_') + '^');
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv =' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
dountilnoquestion(); //setTimeout(dountilnoquestion, 1000);
}
// dountilnoquestion();
}
} else {
if (gdefv.indexOf(curgdefv + '?') != -1) {
//alert('q:' + document.getElementById('placegeo').value);
gdefv=gdefv.replace(curgdefv + '?', curgdefv + caret.trim());
if (gdefv.indexOf('?') == -1) {
gdefv=gdefv.replace(/\^/g, '').replace(/\%3f/g, '?');
//document.title=gdefv;
//alert('gdefv= ' + gdefv);
scmok=true;
movesallowed=true;
gmovesallowed=true;
five=5;
gfive=5;
document.getElementById('myimg').click(); //scmove();
return '';
} else {
dountilnoquestion(); //setTimeout(dountilnoquestion, 1000);
}
//
}
}
//gextras='';
//if (window.opener) {
// window.opener.putgextras(gextras);
//} else if (window.parent) {
// parent.putgextras(gextras);
//}
}
} catch(hgjg) { }
}
return true;
}
function iuo(newtooldmaybe) {
var outmel=newtooldmaybe, pref='', suff='';
var flds=[];
//alert('0:' + outmel);
if (outmel.trim() != '') {
if (outmel != outmel.replace(/^\ /g, '')) {
while (outmel != outmel.replace(/^\ /g, '')) {
outmel=outmel.replace(/^\ /g, '');
pref+=' ';
}
}
//alert('00:' + outmel);
if (outmel != outmel.replace(/\ $/g, '')) {
while (outmel != outmel.replace(/\ $/g, '')) {
outmel=outmel.replace(/\ $/g, '');
suff+=' ';
}
}
//alert('000:' + outmel);
if (outmel.indexOf('|') != -1) {
//alert('10:' + outmel);
outmel=outmel.replace(/\|\_/g, '|-').replace(/^\_/g, '-'); //.replace(/\ /g,'_');
//alert('110:' + outmel);
flds=outmel.replace('[', '').replace(']', '').split('|');
if (eval('' + flds.length) == 2 || (eval('' + flds.length) == 3 && flds[eval(-1 + flds.length)].trim() == '')) {
if (outmel.indexOf('.') == -1) {
//if (outmel.trim() != '') { alert(newtooldmaybe + ' Vs ' + pref + flds[0] + ',' + flds[1] + suff); }
return pref + flds[0] + ',' + flds[1] + suff;
} else {
//if (outmel.trim() != '') { alert(outmel); alert(newtooldmaybe + ' vS ' + pref + '[' + flds[0] + ',' + flds[1] + ']' + suff); }
return pref + '[' + flds[0] + ',' + flds[1] + ']' + suff;
}
} else if (eval('' + flds.length) >= 3) {
//if (outmel.trim() != '') { alert(outmel); alert(newtooldmaybe + ' VS ' + pref + '[' + flds[eval(-2 + flds.length)] + ',' + flds[eval(-1 + flds.length)] + ',' + outmel.replace('|' + flds[eval(-2 + flds.length)] + '|' + flds[eval(-1 + flds.length)], '').replace('[','').replace(']','') + ']' + suff); }
return pref + '[' + flds[eval(-2 + flds.length)] + ',' + flds[eval(-1 + flds.length)] + ',' + outmel.replace('|' + flds[eval(-2 + flds.length)] + '|' + flds[eval(-1 + flds.length)], '').replace('[','').replace(']','') + ']' + suff;
}
}
// Budgewoi33.2329° S, 151.5516° E
}
//if (outmel.trim() != '') { alert(newtooldmaybe + ' vs ' + pref + outmel + suff); }
return pref + outmel + suff;
}
function toiuo(meldaccordingly) {
var minus=String.fromCharCode(9), haveseencapital=false, outmel=meldaccordingly, pref='', suff='', icom=0, degfixes=[], ideg=0, xtlat='', xtlong='', nums='', ijk=0, xtplace='', tobechanged='', comfixes=[];
if (outmel.trim() != '') {
if (outmel != outmel.replace(/^\ /g, '')) {
while (outmel != outmel.replace(/^\ /g, '')) {
outmel=outmel.replace(/^\ /g, '');
pref+=' ';
}
}
if (outmel != outmel.replace(/\ $/g, '')) {
while (outmel != outmel.replace(/\ $/g, '')) {
outmel=outmel.replace(/\ $/g, '');
suff+=' ';
}
}
degfixes=outmel.split('[');
if (eval('' + degfixes.length) > 1) {
for (ideg=1; ideg<degfixes.length; ideg++) {
xtlat='';
xtlong='';
xtplace='';
tobechanged='[' + degfixes[ideg].split(']')[0] + ']';
comfixes=degfixes[ideg].split(']')[0].split(',');
if (eval('' + comfixes.length) >= 2) {
if (eval('' + comfixes.length) == 2) {
xtlong='' + comfixes[0];
xtlat='' + comfixes[1];
//outmel=outmel.replace('' + tobechanged + '', '[' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + ']');
outmel=outmel.replace('' + tobechanged + '', '' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + '');
} else {
xtlong='' + comfixes[0];
xtlat='' + comfixes[1];
xtplace=degfixes[ideg].split(']')[0].replace(xtlong + ',' + xtlat + ',', '');
//outmel=outmel.replace('' + tobechanged + '', '[' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + ']');
outmel=outmel.replace('' + tobechanged + '', '' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong.replace('-','_') + '|' + xtlat.replace('-','_') + '');
}
}
}
}
degfixes=outmel.split(String.fromCodePoint(176));
if (eval('' + degfixes.length) > 1) {
alert('' + degfixes.length + ' ' + outmel);
for (ideg=1; ideg<degfixes.length; ideg+=2) {
xtlat='';
xtlong='';
xtplace='';
nums='';
tobechanged=String.fromCodePoint(176) + degfixes[eval(0 + ideg)] + String.fromCodePoint(176);
if (eval('' + degfixes.length) <= eval(1 + ideg)) {
degfixes.push(' ');
}
switch (degfixes[eval(1 + ideg)].substring(0,2).trim().split(',')[0].split('-')[0].split('|')[0].split('_')[0]) {
case 'E':
tobechanged+=degfixes[eval(1 + ideg)].split('E')[0] + 'E';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlong='' + nums.replace(/^\-/g,'');
break;
case 'W':
tobechanged+=degfixes[eval(1 + ideg)].split('W')[0] + 'W';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlong='_' + nums.replace(/^\-/g,'');
break;
case 'S':
tobechanged+=degfixes[eval(1 + ideg)].split('S')[0] + 'S';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlat='_' + nums.replace(/^\-/g,'');
break;
case 'N':
tobechanged+=degfixes[eval(1 + ideg)].split('N')[0] + 'N';
for (ijk=0; ijk<degfixes[eval(0 + ideg)].length; ijk++) {
if (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '.' || degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) == '-' || (degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(0 + ideg)].substring(ijk).substring(0,1) <= '9')) { nums+=degfixes[eval(0 + ideg)].substring(ijk).substring(0,1); }
}
xtlat='' + nums.replace(/^\-/g,'');
break;
default:
break;
}
//alert('1:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
nums='';
haveseencapital=false;
minus='-';
if (degfixes[eval(-1 + ideg)].indexOf('}') != -1) { minus=String.fromCharCode(9); }
// Budgewoi33.2329° S, 151.5516° E{ydney}-{yes}Budge-Xwoi31.2329° S, 149.5516° E{elbourne}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1).toUpperCase() && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1).toLowerCase()) {
// haveseencapital;
// minus='-';
//}
switch (degfixes[eval(0 + ideg)].substring(0,2).trim().split(',')[0].split('-')[0].split('|')[0].split('_')[0]) {
case 'E':
ijk=eval(-1 + degfixes[eval(0 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlong='' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'W':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlong='_' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'S':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('2s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
xtlat='_' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('3s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
//alert('4s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
}
//alert('5s:' + tobechanged + ' to ' + xtplace + '|' + xtlong + '|' + xtlat);
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
case 'N':
ijk=eval(-1 + degfixes[eval(-1 + ideg)].length);
while (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '.' || (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) >= '0' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) <= '9')) {
nums=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + nums;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
xtlat='' + nums.replace(/^\-/g,'');
while (ijk >= 0 && (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ',' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ' ' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '-' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '[' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '|' || degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == ';')) {
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
while (ijk >= 0 && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != minus && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '}' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '[' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != '|' && degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) != ';') {
xtplace=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + xtplace;
tobechanged=degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) + tobechanged;
ijk--;
}
//if (degfixes[eval(-1 + ideg)].substring(ijk).substring(0,1) == '}') { xtplace=',' + xtplace; }
break;
default:
break;
}
if (xtlong != '' && xtlat != '') {
if (xtplace.trim() != '') {
//alert('9:' + tobechanged + ' to ' + xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
outmel=outmel.replace('[' + tobechanged + ']', xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
outmel=outmel.replace('' + tobechanged + '', xtplace.replace(/\-/g,'%2d') + '|' + xtlong + '|' + xtlat);
} else {
//alert(938);
outmel=outmel.replace('[' + tobechanged + ']', ('[' + xtplace.replace(/\-/g,'%2d')).replace('[,',',[') + '|' + xtlong + '|' + xtlat + ']');
outmel=outmel.replace('' + tobechanged + '', ('[' + xtplace.replace(/\-/g,'%2d')).replace('[,',',[') + '|' + xtlong + '|' + xtlat + ']');
}
}
xtlat='';
xtlong='';
xtplace='';
nums='';
tobechanged='';
}
}
// 151.5516,-33.2329,Budgewoi{ydney}-{yes}149.5516,-31.2329,Budge-Xwoi{elbourne}
degfixes=outmel.split(',');
var youtmel=outmel, wasmel='', thisfld='';
var atstart=0, itstart=-1, degihj='', repl='';
if (eval('' + degfixes.length) > 3) {
if (outmel.indexOf('--') != -1) {
outmel=outmel.replace(/\-\-/g,'-_');
degfixes=outmel.split(',');
youtmel=outmel;
//alert('YoutMel=' + youtmel);
}
if (outmel.indexOf(',-') != -1) {
outmel=outmel.replace(/\,\-/g,',_');
degfixes=outmel.split(',');
youtmel=outmel;
}
if (outmel.toLowerCase().indexOf(' to -') != -1) {
outmel=outmel.replace(/\ to\ \-/g,' to _').replace(/\ TO\ \-/g,' to _');
degfixes=outmel.split(',');
youtmel=outmel;
}
if (outmel.toLowerCase().indexOf(' from -') != -1) {
outmel=outmel.replace(/\ from\ \-/g,' from _').replace(/\ FROM\ \-/g,' from _');
degfixes=outmel.split(',');
youtmel=outmel;
}
if ((outmel.trim() + ' ').substring(0,1) == '-') {
outmel=outmel.replace('-','_');
degfixes=outmel.split(',');
youtmel=outmel;
}
//alert('Youtmel=' + youtmel + ' ' + meldaccordingly);
for (var ihj=0; ihj<degfixes.length; ihj++) {
if (atstart == 0) {
if (degfixes[ihj].trim() != '') {
if (degfixes[ihj].indexOf('{') == -1 && degfixes[ihj].indexOf('[') == -1 && degfixes[ihj].indexOf('}') == -1 && degfixes[ihj].indexOf(']') == -1) {
if (degfixes[ihj].slice(-1) >= '0' && degfixes[ihj].slice(-1) <= '9') {
itstart=ihj;
atstart++;
//alert('found ' + degfixes[ihj]);
}
}
}
} else if (atstart == 1) {
if (degfixes[ihj].trim() != '') {
if (degfixes[ihj].indexOf('{') == -1 && degfixes[ihj].indexOf('[') == -1 && degfixes[ihj].indexOf('}') == -1 && degfixes[ihj].indexOf(']') == -1) {
if (degfixes[ihj].slice(-1) >= '0' && degfixes[ihj].slice(-1) <= '9') {
atstart++;
} else {
atstart=0;
itstart=-1;
}
} else {
atstart=0;
itstart=-1;
}
} else {
atstart=0;
itstart=-1;
}
} else if (atstart == 2) {
wasmel=youtmel;
if (repl == '' && youtmel.indexOf(degfixes[itstart].replace(/\-/g,'%2d')) != -1) {
repl=degfixes[itstart]; //.replace(/\-/g,'%2d');
} else if (repl == '') {
repl=degfixes[itstart];
}
thisfld=degfixes[ihj];
thisfld=thisfld.split('{')[0].split('_')[0].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].split(' to ')[0].split(' TO ')[0].split(' from ')[0].split(' FROM ')[0].replace(/\-$/g,'').replace(/\-/g,'%2d');
if (thisfld.indexOf('%2d') != -1) {
youtmel=youtmel.replace(thisfld.replace(/\%2d/g,'-'), thisfld);
}
//thisfld=thisfld.split('-')[0];
repl=repl.split('}')[eval(-1 + repl.split('}').length)];
repl=repl.split('-')[eval(-1 + repl.split('-').length)];
//alert('thisfld=' + thisfld + ' and repl=' + repl);
//alert('repl=' + repl + ',' + degfixes[eval(-1 + ihj)] + ', replaced by ' + thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' via ' + degfixes[ihj]);
degihj=degfixes[ihj].split('}')[eval(-1 + degfixes[ihj].split('}').length)];
degihj=degfixes[ihj].split('-')[eval(-1 + degfixes[ihj].split('-').length)];
if ((degfixes[ihj] + ' ').toUpperCase().substring(0,1) >= 'A' && (degfixes[ihj] + ' ').toUpperCase().substring(0,1) <= 'Z') {
//alert(' change ' + degfixes[itstart] + ',' + degfixes[eval(-1 + ihj)] + ',' + degfixes[ihj].split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' in ' + outmel);
youtmel=youtmel.replace(repl + ',' + degfixes[eval(-1 + ihj)] + ',' + thisfld.split('{')[0].split('-')[0], thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + '|' + repl.replace('-','_') + '|' + degfixes[eval(-1 + ihj)].replace('-','_'))
} else {
youtmel=youtmel.replace(repl + ',' + degfixes[eval(-1 + ihj)], '||' + repl.replace('-','_') + '|' + thisfld.replace('-','_'))
}
//if (wasmel == youtmel) {
//alert('Oops change ' + repl + ',' + degfixes[eval(-1 + ihj)] + ',' + degfixes[ihj].split('{')[0].replace(/\-/g,'%2d').split('-')[0] + ' IN ' + youtmel);
//} else {
//alert('youtmel=' + youtmel + ' via ' + thisfld.split('{')[0].replace(/\-/g,'%2d').split('-')[0] + '|' + repl.replace('-','_') + '|' + degfixes[eval(-1 + ihj)].replace('-','_'));
//}
repl='';
atstart=0;
itstart=-1;
if (degihj.trim() != '') {
degihj=degihj.split('}')[eval(-1 + degihj.split('}').length)];
//alert(degihj);
if (degihj.indexOf('{') == -1 && degihj.indexOf('[') == -1 && degihj.indexOf('}') == -1 && degihj.indexOf(']') == -1) {
if (degihj.slice(-1) >= '0' && degihj.slice(-1) <= '9') {
itstart=ihj;
atstart++;
repl=degihj;
//alert('Found ' + degihj);
} else {
degihj='';
}
} else {
degihj='';
}
} else {
degihj='';
}
}
}
if (youtmel != outmel) { outmel=youtmel; }
//alert(outmel);
}
}
//if (outmel.trim() != '') { alert(pref + outmel + suff); }
return pref + outmel + suff;
}
<