<!doctype html>
<html>
<head>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<title>XML to HTML - HTML Homegrown - RJM Programming - September, 2015 - via http://www.w3schools.com/xml/xml_attributes.asp</title>
<script type='text/javascript'>
var preinxml="<messages> <note id='501'> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> <note id='502'> <to>Jani</to> <from>Tove</from> <heading>Re: Reminder</heading> <body>I will not</body> </note></messages>";
var inxml=location.search.split('inxml=')[1] ? decodeURIComponent(location.search.split('inxml=')[1].split('&')[0].replace(/\+/g," ")) : preinxml;
var formbits="<form id='myform' action='./xml_to_html.html' method='GET'><input style='valign:top;' type='submit' value='Translate Small XML (here) to HTML'><br></input><textarea name='inxml' rows=5 cols=120></textarea></form>";
var preqs=location.search.split('addressbook=')[1] ? location.search.split('addressbook=')[1].split('&')[0] : "y";
var qs="?addressbook=" + (location.search.split('noaddressbook=')[1] ? location.search.split('noaddressbook=')[1].split('&')[0].toLowerCase().replace("y","n") : preqs);
var lis="";
var ris="";
var clis="";
var cris="";
var elemtype = new Array();
var elemutype = new Array();
var elemid = new Array();
var elemclass = new Array();
var elemcontent = new Array();
var elemhtmlcontent = new Array();
var elemucontent = new Array();
var elemvalid = new Array();
var elempos = new Array();
var elemepos = new Array();
var addresscont="";
function datatypeit(inxml, intype) {
var outhtml=inxml, subtype, more, submore, emore, kk, smore,posttopbit,topbit,lastdt="you" + "will" + "neveeeeer" + "fiind" + "thi" + "s";
topbit=outhtml.split("<?xml ");
if (topbit.length > 1) {
posttopbit=topbit[1].split("?>");
if (posttopbit.length > 1) {
outhtml=outhtml.substring(eval("<?xml ".length + posttopbit[0].length + "?>".length));
}
}
topbit=outhtml.split("<?xml ");
// alert(topbit.length + "??" + outhtml);
if (topbit.length > 1) {
posttopbit=topbit[1].split("?>");
// alert(posttopbit[0]);
if (posttopbit.length > 1) {
// alert(topbit.length + "$?" + eval("<?xml ".length + posttopbit[0].length + "?>".length) + " vs " + outhtml.length + " Vs " + inxml.length);
outhtml=outhtml.substring(eval("<?xml ".length + posttopbit[0].length + "?>".length));
// alert(outhtml);
}
}
if (inxml.indexOf("<") != -1 && intype.toLowerCase() != 'div') {
// alert("?" + outhtml);
while (outhtml.indexOf("<" + intype.toLowerCase()) != -1) {
lastdt=' data-type="' + intype.toLowerCase(); // + '"';
outhtml=outhtml.replace("<" + intype.toLowerCase(), '<div id="' + intype.toLowerCase() + elemtype.length + '" data-type="' + intype.toLowerCase() + '"');
}
while (outhtml.indexOf("<" + intype.toUpperCase()) != -1) {
lastdt=' data-type="' + intype.toUpperCase(); // + '"';
outhtml=outhtml.replace("<" + intype.toUpperCase(), '<DIV id="' + intype.toLowerCase() + elemtype.length + '" data-type="' + intype.toUpperCase() + '"');
}
while (outhtml.indexOf("</" + intype.toLowerCase()) != -1) {
outhtml=outhtml.replace("</" + intype.toLowerCase(), "</div");
}
while (outhtml.indexOf("</" + intype.toUpperCase()) != -1) {
outhtml=outhtml.replace("</" + intype.toUpperCase(), "</DIV");
}
var sbits=outhtml.split("</");
var delim1='="', ipos, jpos;
var delim2='"', doit=true;
for (var ij=0; ij<sbits.length; ij++) {
subtype=sbits[ij].split(">");
if (subtype[0].toLowerCase() != 'div') {
if (outhtml.indexOf("<" + subtype[0].toLowerCase() + ">") != -1 && outhtml.indexOf("</" + subtype[0].toLowerCase() + ">") != -1) {
delim1='="';
delim2='"';
doit=true;
while (outhtml.indexOf("<" + subtype[0].toLowerCase() + ">") != -1) {
ipos=outhtml.indexOf("<" + subtype[0].toLowerCase() + ">");
jpos=outhtml.indexOf("</" + subtype[0].toLowerCase() + ">");
if (eval(jpos) > eval(ipos)) {
if (outhtml.substring(eval(ipos + 1),eval(jpos - 1)).indexOf(" data-") != -1) {
outhtml=outhtml.replace(lastdt + '">', lastdt + "/" + subtype[0].toLowerCase() + '">' + lastdt.replace('data-type="','') + '/' + subtype[0].toLowerCase() + ' ');
outhtml=outhtml.replace("<" + subtype[0].toLowerCase() + ">", "");
outhtml=outhtml.replace("</" + subtype[0].toLowerCase() + ">", "");
doit=false;
} else if (outhtml.substring(eval(ipos + 1),eval(jpos - 1)).indexOf("<") != -1) {
//if (subtype[0].toLowerCase() == "food") alert(986);
delim1="='";
delim2="'";
} else {
//if (subtype[0].toLowerCase() == "food") alert(987 + " " + outhtml.substring(eval(ipos + 1),eval(jpos - 1)));
delim1='="';
delim2='"';
}
} //else {
// // if (subtype[0].toLowerCase() == "food") alert(988);
//delim1='="';
//delim2='"';
//}
if (doit) outhtml=outhtml.replace("<" + subtype[0].toLowerCase() + ">", " data-" + subtype[0].toLowerCase() + delim1);
doit=true;
}
while (outhtml.indexOf("</" + subtype[0].toLowerCase() + ">") != -1) {
outhtml=outhtml.replace("</" + subtype[0].toLowerCase() + ">", delim2);
}
}
if (outhtml.indexOf("<" + subtype[0].toUpperCase() + ">") != -1 && outhtml.indexOf("</" + subtype[0].toUpperCase() + ">") != -1) {
while (outhtml.indexOf("<" + subtype[0].toUpperCase() + ">") != -1) {
delim1='="';
delim2='"';
doit=true;
ipos=outhtml.indexOf("<" + subtype[0].toUpperCase() + ">");
jpos=outhtml.indexOf("</" + subtype[0].toUpperCase() + ">");
if (eval(jpos) > eval(ipos)) {
if (outhtml.substring(eval(ipos + 1),eval(jpos - 1)).indexOf(" data-") != -1) {
outhtml=outhtml.replace(lastdt + '">', lastdt + "/" + subtype[0].toUpperCase() + '">' + lastdt.replace('data-type="','') + '/' + subtype[0].toUpperCase() + ' ');
outhtml=outhtml.replace("<" + subtype[0].toUpperCase() + ">", "");
outhtml=outhtml.replace("</" + subtype[0].toUpperCase() + ">", "");
doit=false;
} else if (outhtml.substring(eval(ipos + 1),eval(jpos - 1)).indexOf("<") != -1) {
//if (subtype[0].toLowerCase() == "food") alert(986);
delim1="='";
delim2="'";
} else {
//if (subtype[0].toLowerCase() == "food") alert(987 + " " + outhtml.substring(eval(ipos + 1),eval(jpos - 1)));
delim1='="';
delim2='"';
}
} //else {
// // if (subtype[0].toLowerCase() == "food") alert(988);
//delim1='="';
//delim2='"';
//}
if (doit) outhtml=outhtml.replace("<" + subtype[0].toUpperCase() + ">", " data-" + subtype[0].toLowerCase() + delim1);
doit=true;
}
while (outhtml.indexOf("</" + subtype[0].toUpperCase() + ">") != -1) {
outhtml=outhtml.replace("</" + subtype[0].toUpperCase() + ">", delim2);
}
}
}
}
sbits=outhtml.split("</");
for (var ji=0; ji<sbits.length; ji++) {
subtype=sbits[ji].split(">");
if (subtype[0].toLowerCase() != 'div') {
while (outhtml.indexOf("<" + subtype[0].toLowerCase()) != -1) {
more=outhtml.split("<" + subtype[0].toLowerCase());
submore=more[1].split(">");
emore=submore[0].split("=");
for (kk=0; kk<emore.length; kk++) {
smore=emore[kk].split(" ");
if (smore[eval(-1 + smore.length)].toLowerCase() != "id" && smore[eval(-1 + smore.length)].toLowerCase() != "title" && smore[eval(-1 + smore.length)].toLowerCase() != "alt" && smore[eval(-1 + smore.length)].toLowerCase() != "style") {
outhtml=outhtml.replace(" " + smore[eval(-1 + smore.length)] + "=", " data-" + smore[eval(-1 + smore.length)].toLowerCase() + "=");
}
}
outhtml=outhtml.replace("<" + subtype[0].toLowerCase(), lastdt.replace(' data-type="','').replace('"','') + "/" + subtype[0].toLowerCase() + ' ' + '<div data-subtype="' + subtype[0].toLowerCase() + '"');
if (outhtml.indexOf(lastdt + '">') != -1) outhtml=outhtml.replace(lastdt + '">', lastdt + "/" + subtype[0].toLowerCase() + '">');
}
while (outhtml.indexOf("<" + subtype[0].toUpperCase()) != -1) {
more=outhtml.split("<" + subtype[0].toUpperCase());
submore=more[1].split(">");
emore=submore[0].split("=");
for (kk=0; kk<emore.length; kk++) {
smore=emore[kk].split(" ");
if (smore[eval(-1 + smore.length)].toLowerCase() != "id" && smore[eval(-1 + smore.length)].toLowerCase() != "title" && smore[eval(-1 + smore.length)].toLowerCase() != "alt" && smore[eval(-1 + smore.length)].toLowerCase() != "style") {
outhtml=outhtml.replace(" " + smore[eval(-1 + smore.length)] + "=", " data-" + smore[eval(-1 + smore.length)].toLowerCase() + "=");
}
}
outhtml=outhtml.replace("<" + subtype[0].toUpperCase(), lastdt.replace(' data-type="','').replace('"','') + "/" + subtype[0].toUpperCase() + ' ' + '<DIV data-subtype="' + subtype[0].toUpperCase() + '"');
if (outhtml.indexOf(lastdt + '">') != -1) outhtml=outhtml.replace(lastdt + '">', lastdt + "/" + subtype[0].toUpperCase() + '">');
}
while (outhtml.indexOf("</" + subtype[0].toLowerCase()) != -1) {
outhtml=outhtml.replace("</" + subtype[0].toLowerCase(), "</div");
}
while (outhtml.indexOf("</" + subtype[0].toUpperCase()) != -1) {
outhtml=outhtml.replace("</" + subtype[0].toUpperCase(), "</DIV");
}
}
}
if (outhtml.indexOf(lastdt) != -1 && outhtml.indexOf('">' + lastdt.replace('data-type="','')) == -1) {
outhtml=outhtml.replace(lastdt + '">', lastdt + '">' + lastdt.replace('data-type="','') + " ");
}
//alert(outhtml);
var relook=outhtml.split(">"), newbits;
if (relook.length > 1) {
for (var et=0; et<eval(relook.length - 1); et+=1) {
newbits=relook[eval(1 + et)].split("<");
if (newbits[0].indexOf(' data-') != -1) outhtml=outhtml.replace(relook[et] + ">", relook[et] + " " + newbits[0] + ">");
}
}
document.body.innerHTML+=("<div align='center'><table><tr><th>XML</th><th> <a target=_blank title='Where the (default first go) XML on left came from ... http://www.w3schools.com/xml/xml_attributes.asp ... thanks' href='http://www.w3schools.com/xml/xml_attributes.asp'>----</a>> Display ----> </th><th>HTML<font size=0>5</font></th></tr><tr><td><textarea style='background-color:yellow;' rows=10 cols=80>" + inxml.replace(/</g, "<").replace(/>/g, ">") + "</textarea></td><td> ----> " + outhtml + " ----> </td><td><textarea style='background-color:lightgreen;' rows=10 cols=80>" + outhtml.replace(/</g, "<").replace(/>/g, ">") + "</textarea></td></tr></table></div><br><br>" + formbits.replace(/</g, "<").replace(/>/g, ">") + "<br><br><iframe frameborder=0 style='width:100%;height:350px;' src='http://www.rjmprogramming.com.au/HTMLCSS/xml_to_html.php" + qs + "' title='simplexml method via http://www.w3schools.com/php/php_xml_simplexml_get.asp suiting data structure knowledge known ahead of time'></iframe><br><br>" + formbits.replace(/</g, "<").replace(/>/g, ">").replace(" Small ", " Big ").replace(" rows=5 ", " rows=50 ").replace("./xml_to_html.html","http://www.rjmprogramming.com.au/HTMLCSS/xml_to_html.php").replace(".html", ".php").replace("GET", "POST"));
}
return outhtml;
}
function howmanyxml(of, within) {
var sbits=within.substring(1).split(of);
return eval(0 + sbits.length);
}
function translate(ac) {
var lso, rso, thisis="";
ac=ac.replace(/</g, "<").replace(/>/g, ">");
var uc=ac.toUpperCase();
var bits=uc.split("<");
var layer=0, ipos=0, jpos=0, kpos=0, thistype="", types, subbits, thiscont="", ii, jj, waspos=0;
var lsf=lis;
var rsf=ris;
if (thisis != "") {
lsf=clis;
rsf=cris;
}
for (ii=0; ii<bits.length; ii++) {
if (bits[ii].trim() != "" && eval(kpos) >= eval(ipos)) {
//alert(99 + " " + bits[ii]);
waspos=ipos;
types=bits[ii].toUpperCase().replace(" ",">").split(">");
thistype=types[0];
if (thistype.toLowerCase() != "script") {
if (uc.indexOf("</" + thistype + ">") != -1) {
subbits=uc.substring(ipos).split("</" + thistype + ">");
layer=howmanyxml("<" + thistype, subbits[0]);
//alert("thistype=" + thistype + " layer= " + layer);
thiscont="";
for (jj=0; jj<layer; jj++) {
//alert(subbits[jj] + " .... " + layer);
if (subbits[jj]) {
jpos+=subbits[jj].length;
if (ipos != jpos) thiscont+=ac.substring(ipos, jpos);
ipos=jpos;
jpos+=thistype.length;
jpos+=3;
if (ipos != jpos) thiscont+=ac.substring(ipos, jpos);
ipos=jpos;
}
}
//alert("</" + thistype + ">" + " ... " + thiscont);
//alert("1 ... " + thiscont);
elemepos.push(ipos);
elempos.push(waspos);
elemtype.push(thistype.toLowerCase());
elemvalid.push(true);
elemcontent.push(thiscont);
elemhtmlcontent.push(datatypeit(thiscont, thistype));
if (thisis != "") elemutype.push(thistype.toLowerCase());
if (thisis != "") elemucontent.push(relative_to_absolute(thiscont.replace(/absolute;/g, "relative;")));
subbits=thiscont.toUpperCase().split(' ID="');
if (subbits.length > 1) {
layer=waspos;
waspos+=subbits[0].length;
waspos+=5;
types=ac.substring(waspos).split('"');
elemid.push(types[0]);
//alert(types[0] + " .y.. " + ac.substring(waspos));
waspos=layer;
} else {
elemid.push("");
}
subbits=thiscont.toUpperCase().split(' CLASS="');
if (subbits.length > 1) {
layer=waspos;
waspos+=subbits[0].length;
waspos+=8;
types=ac.substring(waspos).split('"');
elemclass.push(types[0]);
//alert(types[0] + " .x.. " + ac.substring(waspos));
waspos=layer;
} else {
elemclass.push("");
}
layer=0;
//alert(87);
if (thisis != "") {
if (elemucontent[elemucontent.length - 1].indexOf("<") != -1 && elemucontent[elemucontent.length - 1].indexOf(" ") != -1) {
if (url != "") {
lsf+="<option value='" + eval(elemucontent.length - 1) + "'>" + elemutype[eval(elemucontent.length - 1)].toUpperCase() + " ( element number " + elemucontent.length + " from " + url + ")" + "</option>";
tlsf=tlsf.replace("</tr>", "<td onclick=\"placeit(this,'leftfromselect',encodeURIComponent(this.innerHTML));\" style='background-color:" + col[eval(urlnow % col.length)] + ";border: 5px solid green;'>" + elemucontent[elemucontent.length - 1].replace(/ title='/g, " title='Via " + url + ": ").replace(/ title="/g, ' title="Via ' + url + ': ') + "</td></TR><tr></tr>");
} else {
lsf+="<option value='" + eval(elemucontent.length - 1) + "'>" + elemutype[eval(elemucontent.length - 1)].toUpperCase() + " ( element number " + elemucontent.length + ")" + "</option>";
tlsf=tlsf.replace("</tr>", "<td onclick=\"placeit(this,'leftfromselect',encodeURIComponent(this.innerHTML));\" style='background-color:white;border: 5px solid green;'>" + elemucontent[elemucontent.length - 1] + "</td></TR><tr></tr>");
}
}
} else {
lsf+="<option value='-" + elempos.length + "'>Before " + thistype + " (element number " + elempos.length + ")</option>";
//alert(88);
lsf+="<option value='" + elempos.length + "'>After " + thistype + " (element number " + elempos.length + ")</option>";
//alert(89);
}
} else if (thistype.substring(0,1) != "!" && thistype.substring(0,1) != "/") {
layer=1;
subbits=ac.substring(ipos).split(">");
thiscont=subbits[0] + ">";
subbits=ac.substring(ipos).split("/>");
if (eval(2 + subbits[0].length) < eval(thiscont.length)) {
thiscont=subbits[0] + "/>";
}
jpos+=thiscont.length;
// alert(ac.substring(ipos, jpos));
if (ipos != jpos) thiscont=ac.substring(ipos, jpos);
ipos=jpos;
if (ac.substring(ipos, eval(2 + ipos)) == "</") {
thiscont+="</" + ac.substring(eval(2 + ipos), eval(2 + ipos + thistype.length)) + ">";
jpos+=eval(3 + thistype.length);
ipos=jpos;
//alert("!" + " ... " + thistype + " +++ " + thiscont);
}
//alert("<" + thistype + "" + " ... " + thiscont);
//alert("2 ... " + thiscont);
if (thiscont.toUpperCase().indexOf("<" + thistype.toUpperCase()) != -1) {
elemepos.push(-1);
elempos.push(waspos);
elemtype.push(thistype.toLowerCase());
elemvalid.push(true);
elemcontent.push(thiscont);
elemhtmlcontent.push(datatypeit(thiscont, thistype));
if (thisis != "") elemutype.push(thistype.toLowerCase());
if (thisis != "") elemucontent.push(relative_to_absolute(thiscont.replace(/absolute;/g, "relative;")));
subbits=thiscont.toUpperCase().split(' ID="');
if (subbits.length > 1) {
layer=waspos;
waspos+=subbits[0].length;
waspos+=5;
types=ac.substring(waspos).split('"');
elemid.push(types[0]);
waspos=layer;
//alert(types[0]);
} else {
elemid.push("");
}
subbits=thiscont.toUpperCase().split(' CLASS="');
if (subbits.length > 1) {
layer=waspos;
waspos+=subbits[0].length;
waspos+=9;
types=ac.substring(waspos).split('"');
elemclass.push(types[0]);
waspos=layer;
//alert(types[0]);
} else {
elemclass.push("");
}
layer=0;
if (thisis != "") {
if (elemucontent[elemucontent.length - 1].indexOf("<") != -1 && elemucontent[elemucontent.length - 1].indexOf(" ") != -1) {
if (url != "") {
rsf+="<option value='" + eval(elemucontent.length - 1) + "'>" + + elemutype[eval(elemucontent.length - 1)].toUpperCase() + " ( element number " + elemucontent.length + " from " + url + ")" + "</option>";
trsf=trsf.replace("</tr>", "<td onclick=\"placeit(this,'rightfromselect',encodeURIComponent(this.innerHTML));\" style='background-color:" + col[eval(urlnow % col.length)] + ";border: 5px solid green;'>" + elemucontent[elemucontent.length - 1].replace(/ title='/g, " title='Via " + url + ": ").replace(/ title="/g, ' title="Via ' + url + ': ') + "</td></TR><tr></tr>");
} else {
rsf+="<option value='" + eval(elemucontent.length - 1) + "'>" + + elemutype[eval(elemucontent.length - 1)].toUpperCase() + " ( element number " + elemucontent.length + ")" + "</option>";
trsf=trsf.replace("</tr>", "<td onclick=\"placeit(this,'rightfromselect',encodeURIComponent(this.innerHTML));\" style='background-color:white;border: 5px solid green;'>" + elemucontent[elemucontent.length - 1] + "</td></TR><tr></tr>");
}
}
} else {
rsf+="<option value='-" + elempos.length + "'>Before " + thistype + " (element number " + elempos.length + ")</option>";
rsf+="<option value='" + elempos.length + "'>After " + thistype + " (element number " + elempos.length + ")</option>";
}
}
} else if (thistype.substring(0,1) != "/") {
layer=1;
subbits=ac.substring(ipos).split("-->");
thiscont=subbits[0] + "-->";
jpos+=thiscont.length;
if (ipos != jpos) thiscont+=ac.substring(ipos, jpos);
ipos=jpos;
//alert("huh<" + thistype + "" + " ... " + thiscont);
//alert("3 ... " + thiscont);
layer=0;
elemepos.push(-1);
elempos.push(waspos);
elemtype.push("");
elemvalid.push(false);
elemcontent.push(thiscont);
elemhtmlcontent.push(datatypeit(thiscont, thistype));
if (thisis != "") elemutype.push("");
if (thisis != "") elemucontent.push(relative_to_absolute(thiscont.replace(/absolute;/g, "relative;")));
elemid.push("");
elemclass.push("");
}
}
}
kpos+=bits[ii].length;
kpos++;
}
}
// A business logic idea ... messages/note XML with defined id= are user interactively emailable
function checkforemail() {
var ee, eo, preiu, iu, predivs,divs=[],cdivs;
var ecnt=0;
var oto='', ofrom='', osubject='', obody='';
predivs=document.body.innerHTML.toLowerCase().split(' id=');
for (preiu=1; preiu<predivs.length; preiu++) {
cdivs=predivs[preiu].substring(1).split(predivs[preiu].substring(0,1));
iu=0;
divs[iu]=document.getElementById(cdivs[0]);
try {
oto='';
ofrom='';
oheading='';
obody='';
try {
oto=divs[iu].getAttribute('data-to');
if (oto == null) oto='';
} catch (ee) {
oto='';
}
try {
ofrom=divs[iu].getAttribute('data-from');
if (ofrom == null) ofrom='';
} catch (ee) {
ofrom='';
}
try {
obody=divs[iu].getAttribute('data-body');
if (obody == null) obody='';
} catch (ee) {
obody='';
}
try {
osubject=divs[iu].getAttribute('data-heading');
if (osubject == null) {
osubject='';
osubject=divs[iu].getAttribute('data-subject');
if (osubject == null) osubject='';
}
} catch (ee) {
osubject='';
try {
osubject=divs[iu].getAttribute('data-subject');
if (osubject == null) osubject='';
} catch (ee) {
osubject='';
}
}
} catch (ee) {
}
if (oto != '' || obody != '' || osubject != '') {
if (document.getElementById('elinksplace').innerHTML.replace(/&/g,"&").indexOf(('mailto:' + oto + '?subject=' + encodeURIComponent(osubject) + '&body=' + encodeURIComponent(obody)).replace(/&/g,"&")) == -1) {
document.getElementById('elinksplace').innerHTML+='<a href="mailto:' + oto + '?subject=' + encodeURIComponent(osubject) + '&body=' + encodeURIComponent(obody) + '" id="email' + ecnt + '" style="display:none;">From ' + ofrom + "</a>";
ecnt++;
}
}
}
if (ecnt > 0) {
for (var iuc=eval(-1 + ecnt); iuc>=0; iuc--) {
eo=document.getElementById('email' + iuc);
eo.click();
}
}
}
// A business logic idea ... client pre-emptive iframe ... address book
function getaddressbook(iois) {
var qbits, ie, je, edelim='"', bdone=false;
var idx=['<to>','<to>','<TO>','<To>','data-to="','<from>','<from>','<FROM>','<From>','data-from="','<cc>','<cc>','<CC>','<Cc>','data-cc="','<bcc>','<bcc>','<BCC>','<Bcc>','data-bcc="'];
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
addresscont=aconto.body.innerHTML.replace(/\n/g, ',');
var emailinfo=addresscont.split(',');
for (ie=1; ie<eval(-1 + emailinfo.length); ie+=2) {
if (emailinfo[eval(ie - 1)] != "" && emailinfo[ie].indexOf('@') != -1) {
for (je=0; je<idx.length; je++) {
edelim='<';
if (idx[je].indexOf(edelim) == -1) edelim='"';
if (idx[je].indexOf(edelim) == -1) edelim='<';
if (document.body.innerHTML.toLowerCase().indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)] + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)] + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)] + edelim,idx[je] + emailinfo[eval(ie - 1)] + " [" + emailinfo[ie] + "]" + edelim);
}
}
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim,idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + " [" + emailinfo[ie] + "]" + edelim);
}
}
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim,idx[je] + emailinfo[eval(ie - 1)] + " [" + emailinfo[ie].toUpperCase() + "]" + edelim);
}
}
}
}
}
}
}
}
}
}
// A business logic idea ... email via XML instructions
function emailit() {
var fs=document.getElementsByTagName('form');
var tas=document.getElementsByTagName('textarea');
if (tas.length >= 3) {
tas[2].innerHTML=tas[0].innerHTML;
fs[0].submit();
}
}
</script>
</head>
<body onload="translate(inxml); if (inxml != preinxml) { checkforemail(); } " style='background-color:orange;'>
<h1 align='center'>XML to HTML - HTML Homegrown - RJM Programming - September, 2015</h1>
<div id='elinksplace'><iframe src="addressbook.html" id="eabook" onload=" if (qs.indexOf('=n') == -1) { getaddressbook(this); } " style="display:none;"></iframe><input onclick=" emailit();" type="button" value="Email" style="display:none;position:absolute;top:280px;left:30px;z-index:7;" id="bemail"></input></div>
</body>
</html>