<!doctype html>
<html>
<head>
<title>Legend (of Map, perhaps) - RJM Programming - September, 2016 - Thanks to http://www.html5rocks.com/en/tutorials/file/dndfiles/ and https://www.midwinter-dg.com/permalink-7-great-css-based-text-effects-using-the-text-shadow-property_2011-03-03.html</title>
<meta charset="utf-8"/>
<style>
#byte_content {
margin: 5px 0;
max-height: 100px;
overflow-y: auto;
overflow-x: hidden;
}
#byte_range { margin-top: 5px; }

a.onmap {
color: #fff;
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #fff, 0 0 20px #ff2d95, 0 0 30px #ff2d95, 0 0 40px #ff2d95, 0 0 50px #ff2d95, 0 0 75px #ff2d95;
letter-spacing: 2px;
font: 14px 'MisoRegular';
}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

<script type='text/javascript'>
var whereami=location.search.split('whereami=')[1] ? decodeURIComponent(location.search.split('whereami=')[1]).split('&')[0].toLowerCase().replace(/_/g,'-').replace(/whereami/g,'where-am-i') : 'the';
var whatami=location.search.split('whatami=')[1] ? decodeURIComponent(location.search.split('whatami=')[1]).split('&')[0].toLowerCase().replace(/_/g,'-').replace(/whatami/g,'what-am-i') : '';
var idhtml='', idurl='';
var pdatebit="", cdatebit="";
var pserverbit="", cserverbit="";
//var rawurl=location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]).split('&')[0] : '';
var rawurl=location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]) : '';
var rawhtml=location.search.split('tarea=')[1] ? decodeURIComponent(location.search.split('tarea=')[1].split('&')[0]) : '';
var showlabel=location.search.split('showlabel=')[1] ? decodeURIComponent(location.search.split('showlabel=')[1]).split('&')[0] : 'off';
var widths=[], heights=[];
var tox=[], toy=[];
var href=[], onclick=[], names=[], sortnames=[];
var filen = '', firstgo=true;
var mapimg='';
var xrawurl='';
var popup=null;
var yehbut='';
var ifh='600px';
var tablehtml='';
var idone=false;
var fgc=false;
var wasstr='', sortstr='', headstr='', tailstr='</table>', mode=1;

var firstgeo=true;
var startPos=null;
var geoprefix="http://www.rjmprogramming.com.au/PHP/Map/map.php?title=Where%20Are%20We&onclick=y&label=%5b%27Lat%27,&value=%27Lon%27,%20%27Name%27%5d&data=";
var geodelim=encodeURIComponent(", ");
var geoif='';

var sok=true;
var eok=true;
var pok=true;

var httpxml=null;

function toggler(cfor) {
if (cfor.indexOf(' for ') != -1) {
return cfor.replace(" for "," <a style='text-decoration:underline;' title='Toggle between sorted labels and in order of original HTML map element' onclick=' if (mode == 1) { document.getElementById(\"dtable\").innerHTML=headstr + wasstr + tailstr; } else { document.getElementById(\"dtable\").innerHTML=headstr + sortstr + tailstr; } mode=eval(1 - mode); '>for</a> ");
}
return cfor;
}

function oursort(intbh) {
var outtbh=intbh, curtr, iy, iyy, jyy;
if (names.length > 0) {
if (names[0] != '') {
headstr=intbh.substring(0,intbh.indexOf('<tr'));
wasstr=intbh.substring(intbh.indexOf('<tr')).replace('</table>','');
sortnames=names.sort();
curtr=wasstr.split('<tr');
outtbh='';
for (iy=0; iy<sortnames.length; iy++) {
jyy=0;
for (iyy=0; iyy<curtr.length; iyy++) {
if (curtr[iyy].indexOf('>' + sortnames[iy] + '</a>') != -1) {
jyy=iyy;
}
}
outtbh+='<tr' + curtr[jyy];
}
sortstr=outtbh;
outtbh=intbh.replace(wasstr, sortstr);
}
}
return '<div id=dtable>' + outtbh + '</div>';
}

function createCORSRequest(method, url) { // thanks to http://jquery-howto.blogspot.com.au/2013/09/jquery-cross-domain-ajax-request.html
setTimeout(checkrest, 2000);
try {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr){
// XHR has 'withCredentials' property only if it supports CORS
xhr.open(method, url, true);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET');
try {
xhr.overrideMimeType('text/xml'); // unsupported by IE
} catch(e) {}
} else if (typeof XDomainRequest != "undefined"){ // if IE use XDR
xhr = new XDomainRequest();
xhr.open(method, url);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET');
try {
xhr.overrideMimeType('text/xml'); // unsupported by IE
} catch(e) {}
} else {
xhr = null;
}
} catch(ee) {
xhr = null;
}
if (!xhr) {
// Feed jQuery JSON
$.getJSON((url.replace('?','&') + "&format=json&jsoncallback=?").replace('&','?'), displayHtml);
}
return xhr;
}

function checkrest() {
if (rawhtml == '') {
if ((rawurl.split('&')[0].indexOf('rjmprogramming.com.au') == -1 && rawurl.split('&')[0].indexOf('/localhost:8888/') == -1)) { // || (xrawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1 || rawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1)) {
fgc=true;
//document.getElementById('myif').src = 'http://localhost:8888/legend_via_map.php?url=' + encodeURIComponent(xrawurl);
document.getElementById('myif').src = 'http://www.rjmprogramming.com.au/HTMLCSS/legend_via_map.php?url=' + encodeURIComponent(xrawurl);
}
}
}


function displayHtml(data) {
rawhtml = data;
checkins();
}

function changed(othis) {
xrawhtml = othis;
if (!httpxml) ajaxFunction(othis);
if (httpxml) {
//httpxml.open("GET", othis, true);
httpxml.send(null);
}
}

function stateChanged() {
if (httpxml.readyState == 4) {
if (httpxml.status == 200) {
rawhtml = httpxml.responseText;
checkins();
}
}
}

function ajaxFunction(inu) {
//var httpxml;
try {
// Firefox, Opera 8.0+, Safari
httpxml=createCORSRequest( "get", inu); //.replace('//','@@').split('/')[0].replace('@@','//') ); // new XMLHttpRequest();
httpxml.onreadystatechange=stateChanged;
//alert(95);
} catch (e) {
// Internet Explorer
try {
httpxml=new ActiveXObject("Msxml2.XMLHTTP");
httpxml.onreadystatechange=stateChanged;
} catch (e) {
try {
httpxml=new ActiveXObject("Microsoft.XMLHTTP");
httpxml.onreadystatechange=stateChanged;
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
}

function receiveMessage(event) {
// Do we trust the sender of this message? (might be
// different from what we originally opened, for example).
if (event.origin !== "http://members.ozemail.com.au") {
return;
}

// event.source is popup
// event.data is document.body.innerHTML + " Hello RJM Programming! the secret response is: av" + "-a-car-do!"
if (event.source == popup) {
if (event.data.indexOf('av-a-' + 'car-do!') != -1) {
//alert(9);
if (event.data.indexOf('where-am-') != -1 && firstgeo) locate_yourself();
//alert(event.data.substring(eval(-200 + event.data.length)));
var eventdata=event.data;

var xidbits, zidbits, idbits=event.data.replace(/<\/div>/g,'<div ').split('<div');
if (idbits.length >= 3) {
if (idbits[eval(-3 + idbits.length)].indexOf('}') == -1) {
//alert(idbits[eval(-3 + idbits.length)]);
//alert(idbits[eval(-2 + idbits.length)]);
//alert(idbits[eval(-1 + idbits.length)]);
xidbits=idbits[eval(-3 + idbits.length)].split('>');
cserverbit=xidbits[eval(-1 + xidbits.length)].replace(" ","").replace(" ","").replace(" ","");
//alert(cserverbit);
document.getElementById('iqp').src='./check_php.php?ip=' + cserverbit;
xidbits[0]=cserverbit;
} else {
xidbits=idbits[eval(-3 + idbits.length)].split('}');
cdatebit=' at ' + xidbits[eval(-1 + xidbits.length)];
if (document.getElementById('ch')) {
if (document.getElementById('ch').innerHTML.indexOf(' at ') == -1) document.getElementById('ch').innerHTML+=cdatebit;
}
zidbits=idbits[eval(-3 + idbits.length)].split('"loc": "');
if (zidbits.length > 1) {
geoprefix+=geodelim + encodeURIComponent('[' + zidbits[1].split('"')[0] + ',~ChildServer~]');
geodelim=encodeURIComponent(', ');
}
xidbits=idbits[eval(-3 + idbits.length)].split('{');
}
cserverbit=xidbits[0].replace(" ","").replace(" ","").replace(" ","");
} else if (idbits[0].indexOf('.') != -1) {
xidbits=idbits[0].split('>');
cserverbit=xidbits[eval(-1 + xidbits.length)].replace(" ","").replace(" ","").replace(" ","");
document.getElementById('iqp').src='./check_php.php?ip=' + cserverbit;
}

var eventdatasplit=eventdata.split('</html>');
if (eventdatasplit.length > 1) {
//alert(900);
var huhsplit=eventdatasplit[1].split('Latitude/Longitude: ');
//alert(huhsplit.length + ' ' + eventdatasplit[1]);
if (huhsplit.length > 1) {
eventdatasplit=huhsplit[1].split(',');
if (eventdatasplit.length > 1) {
geoprefix+=geodelim + encodeURIComponent('[' + eventdatasplit[0] + ',' + eventdatasplit[1] + ',~Child~]');
if (document.getElementById('dgeo').innerHTML == '') {
//alert(geoprefix);
if (0 == 7) window.open(geoprefix, "_blank", "top=50,left=50");
geoif+="<iframe id=imap src='" + geoprefix + "' style='overflow:scroll;height:400px;width:600px;' width=600 height=400></iframe><br>" + idurl;
//document.getElementById('dgeo').innerHTML="<iframe onerror=\" sok=false; \" onload=\" sok=true; \" id='mys' style=\" z-index: 15;\" title='RJM Programming ... welcome' src=\"http://www.rjmprogramming.com.au/PHP/Map/map.php?title=RJM%20Programming&label=%5b%27Lat%27,&value=%27Lon%27,%20%27Name%27%5d&data=,%20%5b-33.907371,151.176386,%22Here%20is%20our%20link%20for%20Google%20Map%20of%20%3Ca%20target=_blank%20href=https://maps.google.com.au/maps?z%3D15%26t%3Dm%26q%3Dloc%3A-33.907371%2B151.176386%3ERJM%20Programming%3C/a%3E%20or%20%3Ca%20target=_blank%20title=PHPJavascriptHTMLGoogleChartMapOnclickTutorial%20href=http://www.rjmprogramming.com.au/ITblog/phpjavascripthtml-google-chart-map-onclick-tutorial/%3E%28how%20we%20do%20this%20map%29%3C/a%3E%22,~RJM%20Programming~%5d\" width='100%' height=429></iframe>";
}
geodelim=encodeURIComponent(', ');
}
}
}
if (whatami.replace('the','') != '') {
var adivs=event.data.split('</html>')[0].replace(/<\/div>/g, '<div ').split('<div ');
//alert(adivs[eval(-4 + adivs.length)]);
//alert(adivs[eval(-3 + adivs.length)]);
//alert(adivs[eval(-2 + adivs.length)]);
//alert(adivs[eval(-1 + adivs.length)]);
geoif+='<h3 id=ch>What Child Host is Like' + cdatebit + '</h3><br><div ' + adivs[Math.max(0,eval(-4 + adivs.length))].replace(/<\/img>/g,'</div>').replace(/<img/g,'<div') + '</div><br>';
//alert(event.data.substring(eval(-1500 + event.data.length)));
}
rawhtml=event.data.split('</html>')[0] + '</html>';
checkins();
}
}
}


function locate_yourself() { // ideas via http://www.html5rocks.com/en/tutorials/geolocation/trip_meter/ ... thanks
if (firstgo && whereami.replace('the','') != '') {
try {
navigator.geolocation.getCurrentPosition(function(position) {
if (firstgeo) {
startPos = position;
//document.getElementById('sLat').innerHTML = startPos.coords.latitude;
//document.getElementById('sLon').innerHTML = startPos.coords.longitude;
//document.getElementById('pLat').innerHTML = startPos.coords.latitude;
//document.getElementById('pLon').innerHTML = startPos.coords.longitude;
//document.getElementById('eLat').innerHTML = startPos.coords.latitude;
//document.getElementById('eLon').innerHTML = startPos.coords.longitude;
geoprefix+=geodelim + encodeURIComponent('[' + startPos.coords.latitude + ',' + startPos.coords.longitude + ',~Parent~]');
geodelim=encodeURIComponent(', ');
firstgeo=false;
}
});
} catch(ee) { }
}
}

function check_id(iois) {
var xidbits, zidbits, idbits;

if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
if (pserverbit == '') {
idhtml=aconto.body.innerHTML;
idbits=idhtml.replace(/<\/div>/g,'<div ').split('<div');
if (idbits.length >= 3) {
xidbits=idbits[eval(-3 + idbits.length)].split('}');
pdatebit=' at ' + xidbits[eval(-1 + xidbits.length)];
zidbits=idbits[eval(-3 + idbits.length)].split('"loc": "');
if (zidbits.length > 1) {
geoprefix+=geodelim + encodeURIComponent('[' + zidbits[1].split('"')[0] + ',~ParentServer~]');
if (document.getElementById('imap')) {
document.getElementById('imap').src+=geodelim + encodeURIComponent('[' + zidbits[1].split('"')[0] + ',~ChildServer~]');
} else {
geoif+="<iframe id=imap src='" + geoprefix + "' style='overflow:scroll;height:400px;width:600px;' width=600 height=400></iframe><br>" + idurl;
}
geodelim=encodeURIComponent(', ');
}
xidbits=idbits[eval(-3 + idbits.length)].split('{');
pserverbit=xidbits[0].replace(" ","").replace(" ","").replace(" ","");
} else if (idbits[0].indexOf('.') != -1) {
xidbits=idbits[0].split('>');
pserverbit=xidbits[eval(-1 + xidbits.length)].replace(" ","").replace(" ","").replace(" ","");
}
idurl="<h3 id=hp>What Parent Host is Like" + pdatebit + "</h3><br><iframe src=./check_php.php title=What style='overflow:scroll;height:400px;width:600px;' width=600 height=400></iframe><br>";
geoif=idurl;
idurl='';
} else {
idbits=aconto.body.innerHTML.replace(/<\/div>/g,'<div ').split('<div');
if (idbits.length >= 3) {
xidbits=idbits[eval(-3 + idbits.length)].split('}');
cdatebit=' at ' + xidbits[eval(-1 + xidbits.length)];
if (document.getElementById('ch').innerHTML.indexOf(' at ') == -1) document.getElementById('ch').innerHTML+=cdatebit;
zidbits=idbits[eval(-3 + idbits.length)].split('"loc": "');
if (zidbits.length > 1) {
//alert(zidbits[1].split('"')[0] + ',~ChildServer~]');
geoprefix+=geodelim + encodeURIComponent('[' + zidbits[1].split('"')[0] + ',~ChildServer~]');
if (document.getElementById('imap')) {
document.getElementById('imap').src+=geodelim + encodeURIComponent('[' + zidbits[1].split('"')[0] + ',~ChildServer~]');
} else {
geoif+="<iframe id=imap src='" + geoprefix + "' style='overflow:scroll;height:400px;width:600px;' width=600 height=400></iframe><br>" + idurl;
}
geodelim=encodeURIComponent(', ');
}
xidbits=idbits[eval(-3 + idbits.length)].split('{');
cserverbit=xidbits[0].replace(" ","").replace(" ","").replace(" ","");
} else if (idbits[0].indexOf('.') != -1) {
xidbits=idbits[0].split('>');
cserverbit=xidbits[eval(-1 + xidbits.length)].replace(" ","").replace(" ","").replace(" ","");
}
}
}
}
}
}


function identify_yourself() { // ideas via http://stackoverflow.com/questions/2069364/how-to-get-phpinfo-variables-from-php-programatically ... thanks
if (firstgo && whatami.replace('the','') != '') {
document.getElementById('did').innerHTML="<iframe id=iqp onload=check_id(this); src=./check_php.php title=What style=display:none;></iframe>";
}
}

function crossdomainiframe() {

var thisurl=xrawurl;
if (popup) {
// var popup = window.open(thisurl, 'myif');

// When the popup has fully loaded, if not blocked by a popup blocker:

try {
// This does nothing, assuming the window hasn't changed its location.
popup.postMessage("The user is 'admin' and " + whereami + " password " + whatami + " is 'av-a-c" + "ar-do!'",
"http://members.ozemail.com.au");

// This will successfully queue a message to be sent to the popup, assuming
// the window hasn't changed its location.
popup.postMessage("hello there!", "http://members.ozemail.com.au");

if (window.addEventListener) {
window.addEventListener("message", receiveMessage, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", receiveMessage);
}
} catch(eee) { }
} else {
setTimeout(crossdomainiframe, 2000);
}
}

function circlevia(cx,cy,rad) {
var cdelim='', cis='';
for (var jj=0.0; jj<=360.00; jj++) {
cis+=cdelim + eval(cx + Math.sin(jj * Math.PI / 180.0) * rad);
cdelim=',';
cis+=cdelim + eval(cy + Math.cos(jj * Math.PI / 180.0) * rad);
}
return cis.split(',');
}

function rectanglevia(cx,cy,cxt,cyt) {
var cdelim='', cis='',pcx=cx,pcy=cy;
for (var jj=0; jj<=360; jj+=90) {
pcx=eval(pcx + Math.sin(Math.PI * jj / 180.0) * eval(eval(cxt) - eval(cx)));
cis+=cdelim + pcx;
cdelim=',';
pcy=eval(pcy + Math.cos(Math.PI * jj / 180.0) * eval(eval(cyt) - eval(cy)));
cis+=cdelim + pcy;
}
return cis.split(',');
}

function placeit(whattoleft) {
document.getElementById('placemap').innerHTML="<div style='-webkit-overflow-scrolling:touch;overflow:scroll;height:" + ifh + ";width:600px;'>" + geoif + "<iframe onload=' if (!idone) { idone=true; ifdone(this); }' id=ifplacemap src='" + whattoleft.href + "' style='overflow:scroll;height:" + ifh + ";width:600px;' width=600 height=" + ifh + "></iframe></div>";
}

function checkins() {
var imi, jmi, mapp=-1, mi=1, sparer='', i, j, k, bits, maphtml='', postbits, hrefbits, onclickbits, minw, maxw, minh, maxh,mybits='',delim='';
//tablehtml='';
if (firstgo && whereami.replace('the','') != '') {
document.getElementById('myform').innerHTML+="<input name=whereami value=where-am-i type=hidden></input>";
}
if (firstgo && whatami.replace('the','') != '') {
document.getElementById('myform').innerHTML+="<input name=whatami value=what-am-i type=hidden></input>";
}
if (rawhtml != '' && mapimg == '') {
//alert(8);
while (rawhtml.indexOf('+') != -1) {
rawhtml=rawhtml.replace('+',' ');
}
//alert(rawhtml);
mapp=rawhtml.replace('<MAP ','<map ').indexOf('<map ');
bits=rawhtml.replace('<IMG','<img').split('<img ');

if (bits.length > 1) {
//alert(bits[1]);
jmi=eval(bits[0].length + 5);
if (mapp != -1 && bits.length > 2) {
for (imi=1; imi<bits.length; imi++) {
jmi+=eval(bits[imi].length + 5);
if (eval(mapp) > eval(jmi)) mi++;
}
}
//alert(mi);
postbits=bits[mi].replace(' SRC=',' src=').split('src=');
if (postbits.length > 1) {
//alert(postbits[1]);
mapimg=postbits[1].replace('>',' ').split(' ')[0].replace('"','').replace('"','').replace("'","").replace("'","");
//alert('mApimg=' + mapimg + ' xrawurl=' + xrawurl);
//if (mapimg != '' && mapimg.indexOf('/') == -1 && xrawurl.indexOf('/') != -1) {
if (mapimg != '' && mapimg.indexOf('//') == -1 && mapimg.indexOf(':') == -1 && xrawurl.indexOf(':') != -1 && xrawurl.indexOf('//') != -1) {
//alert(xrawurl);
var qbits=xrawurl.split('/');
if (qbits[eval(-1 + qbits.length)].indexOf('.') != -1) {
mapimg=xrawurl.replace('/' + qbits[eval(-1 + qbits.length)], '/' + mapimg);
//alert('mapimg=' + mapimg);
} else if (qbits[eval(-1 + qbits.length)] == '') {
mapimg=xrawurl + mapimg;
//alert('mapImg=' + mapimg);
} else {
mapimg=xrawurl + '/' + mapimg;
//alert('mapiMg=' + mapimg);
}
}
//alert('mapiMg=' + mapimg);
var ioh = new Image();
ioh.src = mapimg;
ifh = eval(("" + ioh.width).replace('px',''));
if (eval("0" + ifh) == 0) ifh=600;
ifh += 200;
//document.title='iFh=' + ifh;
}
}
}
if (firstgo && rawhtml != '') {
while (rawhtml.indexOf('+') != -1) {
rawhtml=rawhtml.replace('+',' ');
}
//document.getElementById('tarea').value = rawhtml;
}
if (document.getElementById('showlabel').checked && showlabel != 'on') {
if (firstgo) {
document.getElementById('showlabel').checked = false;
} else {
showlabel = 'on';
}
} else if (!document.getElementById('showlabel').checked && showlabel == 'on') {
if (firstgo) {
document.getElementById('showlabel').checked = true;
} else {
showlabel = 'off';
}
}
firstgo = false;
if (rawurl) {
if (rawurl != '') {
sparer=rawurl.split('&tarea=')[0]; //.split('&')[0];
xrawurl=rawurl.split('&tarea=')[0]; //.split('&')[0];
rawurl='';
filen = "<a id=aplace target=_blank onclick=placeit(this); title=MapHTML href='" + sparer + "'>" + sparer + "</a>";
document.getElementById('url').value = sparer;
if (sparer.indexOf('rjmprogramming.com.au') == -1) {
if (sparer.indexOf('members.ozemail.com.au/~mkuulma') != -1) {
if (sparer.indexOf('livingroom_corner.') != -1) {
changed(sparer.split('&tarea=')[0]);
} else {
popup = window.open(sparer.split('&tarea=')[0], 'myif');
}
} else if (1 == 2) {
popup = window.open(sparer.split('&tarea=')[0], '_blank', 'top=30,left=0,width=600,height=800');
setTimeout(crossdomainiframe,3000);
} else {
changed(sparer);
popup = window.open(sparer.split('&tarea=')[0], '_blank', 'top=30,left=0,width=600,height=800');
}
} else {
document.getElementById('myif').src = sparer.split('&tarea=')[0];
}
//if (mapimg != '' && mapimg.indexOf('/') == -1 && sparer.indexOf('/') != -1) {
if (mapimg != '' && mapimg.indexOf(':') == -1 && sparer.indexOf(':') != -1 && mapimg.indexOf('//') == -1 && sparer.indexOf('//') != -1) {
//alert(sparer);
var xbits=sparer.split('&tarea=')[0].split('/');
if (xbits[eval(-1 + xbits.length)].indexOf('.') != -1) {
mapimg=sparer.split('&tarea=')[0].replace('/' + xbits[eval(-1 + xbits.length)], '/' + mapimg);
//alert('mapimg=' + mapimg);
} else if (xbits[eval(-1 + xbits.length)] == '') {
mapimg=sparer.split('&tarea=')[0] + mapimg;
//alert('mapImg=' + mapimg);
} else {
mapimg=sparer.split('&tarea=')[0] + '/' + mapimg;
//alert('mapiMg=' + mapimg);
}
}
//alert('MapiMg=' + mapimg);
if (mapimg != '') {
var ioh = new Image();
ioh.src = mapimg;
ifh = eval(("" + ioh.width).replace('px',''));
if (eval("0" + ifh) == 0) ifh=600;
ifh += 200;
//document.title='iFH=' + ifh;
}
return;
}
}
if (rawhtml) {
if (rawhtml != '') {
// if ((location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]).split('&')[0] : '') != '') document.getElementById('tarea').value = rawhtml; //tablehtml;
names=[];
widths=[];
heights=[];
tox=[];
toy=[];
href=[];
onclick=[];
while (rawhtml.indexOf('+') != -1) {
rawhtml=rawhtml.replace('+',' ');
}
//alert(rawhtml);
bits=rawhtml.split('<!-- Region ');
if (bits.length > 1) {
for (j=1; j<bits.length; j++) {
postbits=bits[j].split(' ');
if (postbits.length > 1) {
if (showlabel == 'on') {
names.push(bits[j].replace(postbits[0] + ' ','').split(' -->')[0]);
} else {
names.push('<span id=span' + j + ' style=display:none;>' + bits[j].replace(postbits[0] + ' ','').split(' -->')[0] + '</span>');
}
}
}
}
bits=rawhtml.replace('</scr' + 'ipt','<scr' + 'ipt').split('<scr' + 'ipt');
if (bits.length > 1) {
document.getElementById('forscripts').innerHTML = '<scr' + 'ipt' + bits[1] + '</scr' + 'ipt>';
}
rawhtml=rawhtml.replace(/onClick=/g, "onclick=");
if (rawhtml.indexOf('coords="') != -1) {
bits=rawhtml.split('coords="');
//if ((location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]).split('&')[0] : '') != '') alert(bits.length);
for (j=1; j<bits.length; j++) {
postbits=bits[j].split('"')[0].split(',');
//alert(postbits.length);
if (postbits.length == 3) {
postbits=circlevia(eval(postbits[0]),eval(postbits[1]),eval(postbits[2]));
} else if (postbits.length == 4) {
postbits=rectanglevia(eval(postbits[0]),eval(postbits[1]),eval(postbits[2]),eval(postbits[3]));
}
hrefbits=bits[j].split('href="');
onclickbits=bits[j].split('onclick="');
for (k=0; k<postbits.length; k+=2) {
if (k == 0) {
minw=eval(postbits[k]);
maxw=eval(postbits[k]);
minh=eval(postbits[eval(1 + k)]);
maxh=eval(postbits[eval(1 + k)]);
//names[eval(-1 + j)]=names[eval(-1 + j)] + ' ' + bits[j].split(' ')[0];
} else {
if (eval(postbits[k]) < eval(minw)) minw=eval(postbits[k]);
if (eval(postbits[k]) > eval(maxw)) maxw=eval(postbits[k]);
if (eval(postbits[eval(1 + k)]) < eval(minh)) minh=eval(postbits[eval(1 + k)]);
if (eval(postbits[eval(1 + k)]) > eval(maxh)) maxh=eval(postbits[eval(1 + k)]);
}
}
widths.push(eval(maxw - minw));
heights.push(eval(maxh - minh));
tox.push(eval(minw) - 5);
toy.push(eval(minh) - 5);
//tox.push(Math.round(eval(minw)));
//if (eval(j) != 1) {
//toy.push(Math.round(eval(minh) + eval(heights[eval(-2 + j)] * 0 / 2)));
//} else {
//alert(minh); // + ' ' + heights[eval(-1 + j)] + ' ' + Math.round(eval(minh) - eval(heights[eval(-1 + j)])));
//toy.push(Math.round(eval(minh) - eval(heights[eval(-1 + j)] * 0)));
//alert(toy[eval(-1 + j)]);
//}
if (names.length < heights.length) names.push("");
//names[eval(-1 + j)]=names[eval(-1 + j)] + ' ' + tox[eval(-1 + j)] + ' ' + toy[eval(-1 + j)] + 'background:url(' + "'" + mapimg + "'" + '); background-position: -' + tox[eval(-1 + j)] + 'px -' + toy[eval(-1 + j)] + 'px; background-clip: inherit; ';
//alert(names[eval(-1 + j)]);
if (hrefbits.length > 1) href.push(' href="' + hrefbits[1].split('"')[0] + '" ');
if (onclickbits.length > 1) onclick.push(' onclick="' + onclickbits[1].split('"')[0] + '" ');
mybits='';
delim='';
for (k=0; k<postbits.length; k+=2) {
mybits+=delim + eval(postbits[k] - minw) + ',' + eval(postbits[eval(1 + k)] - minh);
delim=',';
}
rawhtml=rawhtml.replace(bits[j].split('"')[0], mybits);
}
} else {
bits=rawhtml.split("coords='");
// if ((location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]).split('&')[0] : '') != '') alert('+' + bits.length);
for (j=1; j<bits.length; j++) {
postbits=bits[j].split("'")[0].split(',');
hrefbits=bits[j].split("href='");
onclickbits=bits[j].split("onclick='");
for (k=0; k<postbits.length; k+=2) {
if (k == 0) {
minw=eval(postbits[k]);
maxw=eval(postbits[k]);
minh=eval(postbits[eval(1 + k)]);
maxh=eval(postbits[eval(1 + k)]);
} else {
if (eval(postbits[k]) < eval(minw)) minw=eval(postbits[k]);
if (eval(postbits[k]) > eval(maxw)) maxw=eval(postbits[k]);
if (eval(postbits[eval(1 + k)]) < eval(minh)) minh=eval(postbits[eval(1 + k)]);
if (eval(postbits[eval(1 + k)]) > eval(maxh)) maxh=eval(postbits[eval(1 + k)]);
}
}
widths.push(eval(maxw - minw));
heights.push(eval(maxh - minh));
tox.push(eval(minw) - 5);
toy.push(eval(minh) - 5);
if (names.length < heights.length) names.push("");
if (hrefbits.length > 1) href.push(" href='" + hrefbits[1].split("'")[0] + "' ");
if (onclickbits.length > 1) onclick.push(" onclick='" + onclickbits[1].split("'")[0] + "' ");
mybits='';
delim='';
for (k=0; k<postbits.length; k+=2) {
mybits+=delim + eval(postbits[k] - minw) + ',' + eval(postbits[eval(1 + k)] - minh);
delim=',';
}
rawhtml=rawhtml.replace(bits[j].split('"')[0], mybits);
}
}
bits=rawhtml.replace('</MAP>','<map ').replace('<MAP ','<map ').replace('</map>','<map ').replace(/AREA /g,'area ').split('<map ');
if (bits.length >= 3) {
if (bits[1].indexOf('">') != -1) bits[1]=bits[1].replace('">', '" >');
tablehtml=('<table border=3 cellspacing=5 cellpadding=5 ' + bits[1].replace(/">/g,'"></polygon></svg></td></tr>').replace(/ \/>/g,'</polygon></svg></td></tr').replace(/\/area/g,'/polygon>/svg>/td></tr').replace(/area /g,'tr><td id=td1 ').replace(/coords=/g,'><svg xmlns="http://www.w3.org/2000/svg" height="height1" width="width1" ><polygon style="fill:transparent;stroke:lime;stroke-width:7;fill-rule:nonzero;opacity:0.85;" points=') + '</table>').replace('<tr','<TR><th id=myth style=text-align:left;>Legend' + toggler((' for ' + filen + '</').replace(' for </','</')) + 'th></tr><tr');
//alert(tablehtml + ' w.l=' + widths.length + ' n.l=' + names.length + ' tox.l=' + tox.length + ' toy.l=' + toy.length + ' tox.0=' + tox[0] + ' toy.0=' + toy[0]);
for (i=0; i<widths.length; i++) {
if (mapimg != '') tablehtml=tablehtml.replace('=td1 ', '=td1 style="background:url(' + "'" + mapimg + "'" + '),url(http://www.rjmprogramming.com.au/white.jpg); background-repeat: no-repeat; background-position: -' + Math.max(0,tox[i]) + 'px -' + Math.max(0,toy[i]) + 'px; " ');
tablehtml=tablehtml.replace('=td1 ', '=TD' + eval(1 + i) + ' ');
if (onclick.length > 0 && href.length > 0) {
//alert('<a target=_blank ' + onclick[i] + href[i] + '><svg');
tablehtml=tablehtml.replace('<svg', '<a class=onmap target=_blank ' + onclick[i] + href[i] + '><SVG').replace('</svg>', '</SVG>' + names[i] + '</a>');
} else if (onclick.length > 0) {
//alert('<a target=_blank ' + onclick[i] + '><svg');
tablehtml=tablehtml.replace('<svg', '<a class=onmap target=_blank ' + onclick[i] + '><SVG').replace('</svg>', '</SVG>' + names[i] + '</a>');
} else if (href.length > 0) {
//alert('<a target=_blank ' + href[i] + '><svg');
tablehtml=tablehtml.replace('<svg', '<a class=onmap target=_blank ' + href[i] + '><SVG').replace('</svg>', '</SVG>' + names[i] + '</a>');
}
tablehtml=tablehtml.replace('height1', heights[i]).replace('width1', widths[i]);
// if (i == 0 || i == 1) alert(tablehtml + ' w.l=' + widths.length + ' n.l=' + names.length + ' tox.l=' + tox.length + ' toy.l=' + toy.length + ' tox.0=' + tox[0] + ' toy.0=' + toy[0]);
}
maphtml='<map ' + bits[1] + '</map>';
//if ((location.search.split('url=')[1] ? decodeURIComponent(location.search.split('url=')[1]).split('&')[0] : '') != '') document.getElementById('tarea').value = tablehtml;
document.getElementById('table_content').innerHTML = document.getElementById('forscripts').innerHTML + oursort(tablehtml.replace(/ shape="poly" /g,' ').replace(/ shape="rect" /g,' ').replace(/ shape="circle" /g,' '));
if (mapimg != '' && document.getElementById('aplace')) {
placeit(document.getElementById('aplace'));
}
//setTimeout(andthendo, 2000);
//document.getElementById('table_content').innerHTML = document.getElementById('forscripts').innerHTML + tablehtml.replace(/ shape="poly" /g,' ').replace(/ shape="rect" /g,' ').replace(/ shape="circle" /g,' ');
}
}
}


}

function andthendo() {
//document.getElementById('table_content').innerHTML = document.getElementById('forscripts').innerHTML + tablehtml.replace(/ shape="poly" /g,' ').replace(/ shape="rect" /g,' ').replace(/ shape="circle" /g,' ');
if (mapimg != '' && document.getElementById('aplace')) {
placeit(document.getElementById('aplace'));
}
}

function readBlob(opt_startByte, opt_stopByte) {

var files = document.getElementById('files').files;
if (!files.length) {
alert('Please select a file!');
return;
}

file = files[0];
filen = file.name;
var start = parseInt(opt_startByte) || 0;
var stop = parseInt(opt_stopByte) || file.size - 1;

var reader = new FileReader();

// If we use onloadend, we need to check the readyState.
reader.onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
document.getElementById('byte_content').textContent = evt.target.result;
document.getElementById('byte_range').textContent =
['Read bytes: ', start + 1, ' - ', stop + 1,
' of ', file.size, ' byte file'].join('');
rawhtml = evt.target.result;
checkins();
}
};

var blob = file.slice(start, stop + 1);
reader.readAsBinaryString(blob);
}



function check_if(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
//if ((!fgc && rawurl.indexOf('rjmprogramming.com.au') == -1 && rawurl.indexOf('/localhost:8888/') == -1) || (xrawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1 || rawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1)) {
if (fgc) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
//alert(97000);
rawhtml=aconto.body.innerHTML;
//alert(rawhtml);
checkins();
//aconto.scrollTo(200, 200);
//document.getElementById('mytable').style.top='200px;'
//document.getElementById('mytable').style.left='200px;'
}
fgc=false;
} else if ((xrawurl.indexOf('rjmprogramming.com.au') == -1 && xrawurl.indexOf('/localhost:8888/') == -1)) { // || (xrawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1 || rawurl.indexOf('/~mkuulma/livingroom_corner.htm') != -1)) {
//alert(97);
//if (rawurl.indexOf('/~mkuulma/livingroom_corner.htm') == -1) {
popup=aconto;
//alert(970);
crossdomainiframe();
//rawurl='';
//}
} else {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
//alert(9700);
rawhtml=aconto.body.innerHTML;
//alert(rawhtml);
checkins();
//aconto.scrollTo(200, 200);
//document.getElementById('mytable').style.top='200px;'
//document.getElementById('mytable').style.left='200px;'
}
}
}
}
}

function ifdone(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
document.getElementById('table_content').innerHTML = document.getElementById('forscripts').innerHTML + oursort(tablehtml.replace(/ shape="poly" /g,' ').replace(/ shape="rect" /g,' ').replace(/ shape="circle" /g,' '));
}
}
}
}

function examine(iois) {
//alert(whereami);
if (whereami.replace('the','') != '') {
if (iois.value.toLowerCase().indexOf('members.ozemail.com.au/~mkuulma/') != -1) {
if (iois.value.toLowerCase().indexOf('whereami=') == -1) {
if (iois.value.toLowerCase().indexOf('?') == -1) {
//alert(whereami);
iois.value+='?whereami=where-am-i';
} else {
iois.value+='&whereami=where-am-i';
}
}
if (whatami.replace('the','') != '') {
if (iois.value.toLowerCase().indexOf('whatami=') == -1) {
if (iois.value.toLowerCase().indexOf('?') == -1) {
//alert(whatami);
iois.value+='?whatami=what-am-i';
} else {
iois.value+='&whatami=what-am-i';
}
}
}
}
} else if (whatami.replace('the','') != '') {
if (iois.value.toLowerCase().indexOf('members.ozemail.com.au/~mkuulma/') != -1) {
if (iois.value.toLowerCase().indexOf('whatami=') == -1) {
if (iois.value.toLowerCase().indexOf('?') == -1) {
//alert(whatami);
iois.value+='?whatami=what-am-i';
} else {
iois.value+='&whatami=what-am-i';
}
}
}
} else if (iois.value.toLowerCase().indexOf('whereami=where') != -1) {
whereami="where-am-i";
document.getElementById('myform').innerHTML+="<input name=whereami value=where-am-i type=hidden></input>";
if (iois.value.toLowerCase().indexOf('whatami=what') != -1) {
whatami="what-am-i";
document.getElementById('myform').innerHTML+="<input name=whatami value=what-am-i type=hidden></input>";
}
} else if (iois.value.toLowerCase().indexOf('whatami=what') != -1) {
whatami="what-am-i";
document.getElementById('myform').innerHTML+="<input name=whatami value=what-am-i type=hidden></input>";
}
}

</script>

</head>
<body onload="identify_yourself(); locate_yourself(); checkins(); " style="width:100%;overflow:scroll;">

<table id='mytable' style='width:100%;position:absolute;top:0;left:0;'><tr><td id='tdplacemap' style='vertical-align:top;width:600px;overflow:scroll;'><div id='placemap' style='overflow:scroll;width:600px;'></div><div id='lhs' style=background-color:yellow;width:600px;>
<h1>Legend of HTML Map Element</h1>
<h2>RJM Programming - September, 2016</h2>
<h3>Thanks to <a target=_blank title='HTML5 Rocks' href='http://www.html5rocks.com/en/tutorials/file/dndfiles/'>http://www.html5rocks.com/en/tutorials/file/dndfiles/</a></h3>

HTML File: <input style='background-color:orange;' type="file" id="files" name="file" />
<span class="readBytesButtons">
<button style='display:none;' data-startbyte="0" data-endbyte="4">1-5</button>
<button style='display:none;' data-startbyte="5" data-endbyte="14">6-15</button>
<button style='display:none;' data-startbyte="6" data-endbyte="7">7-8</button>
<button style='background-color:pink;'>Process File Legend for HTML Map Data</button>
</span>
<div style='display:none;' id="byte_range"></div>
<div style='display:none;' id="byte_content"></div>

<br>
<form id='myform' action='./legend_via_map.htm' method='GET'>
HTML Url: <input onblur='examine(this);' type='text' id='url' name='url' value='' style='width:80%;'></input><br><br>
HTML Itself: <textarea onchange=" if (this.value.indexOf('<') != -1) { rawhtml=this.value; checkins(); } " rows=20 cols=76 name='tarea' id='tarea' value=''></textarea><br><br><br>
<input type='submit' name="submit" id="submit" value="Create Legend for HTML Map Data" style="display:inline;background-color:pink;"></input> Showing (Initially Sorted) Labels <input type='checkbox' id='showlabel' name='showlabel' checked></input>
</form>
</div></td><td>
<div id="table_content"></div>
</td></tr></table>

<script type='text/javascript'>

document.querySelector('.readBytesButtons').addEventListener('click', function(evt) {
if (evt.target.tagName.toLowerCase() == 'button') {
var startByte = evt.target.getAttribute('data-startbyte');
var endByte = evt.target.getAttribute('data-endbyte');
readBlob(startByte, endByte);
}
}, false);

</script>

<div id='forscripts'>
</div>
<iframe id='myif' name='myif' onload='check_if(this);' src='' style='display:none;'></iframe>
<div id='dgeo'></div>
<div id='did'></div>
</body>
</html>