<!doctype html>
<html>
<head>
<title>Agenda Items - RJM Programming - December, 2019</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type='text/javascript'>

var curai=1;
var templatetr='';
var prevh3='';
var saveawayv='';
var lastformih='';
var dive='';
var dval='';
var myh3suffix='';
var defbits=[""];
var deftitle=[""];
var defcontent=[""];
var defprompt=[""];
var thischoice=0;

Date.prototype.toDateInputValue = (function() { // thanks to https://stackoverflow.com/questions/6982692/how-to-set-input-type-dates-default-value-to-today
var local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
return local.toJSON().split('.')[0].replace('T',' '); //.slice(0,10);
});

function saveaway(ino) {
saveawayv=ino.value;
if (!document.getElementById('ab' + ino.id)) {
document.getElementById('hidden').innerHTML+='<input type=hidden name=' + ino.id + ' id=ab' + ino.id + ' value="' + ino.value + '"></input>';
} else {
document.getElementById('ab' + ino.id).value=ino.value;
}
}

function prepopit() {
document.getElementById('selpast').style.visibility='visible';
document.getElementById('selpast').click();
}

function popit(tv) {
// ?organization=mjfgh jhg &aidatetime=2019-12-11 17:03:43&divagendaitem2_1=jhgf mgnf&divagendaitem3_1=jhgf hgjdf&divagendaitem2_2=hjgf nhfg&divagendaitem3_2=hjgf jhgf&divagendaitem2_3=|rmetcalfe15@gmail.com
var dmcont=defcontent[eval(0 + eval(tv.split('|')[0]))];
var beq='', aeq='';
if (dmcont.indexOf('organization=') != -1) {
document.getElementById('organization').innerHTML=dmcont.split('organization=')[1].split('&')[0];
assess(document.getElementById('organization'));
}
if (dmcont.indexOf('aidatetime=') != -1) {
document.getElementById('aidatetime').value=dmcont.split('aidatetime=')[1].split('&')[0];
saveaway(document.getElementById('aidatetime'));
}
var dms=dmcont.split('&divagenda');
for (var ii=1; ii<dms.length; ii++) {
beq=dms[ii].split('=')[0];
aeq=dms[ii].split('=')[1].split('&')[0];
if (aeq != '') {
document.getElementById('divagenda' + beq).innerHTML=aeq;
assess(document.getElementById('divagenda' + beq));
}
}
}

function lscheck() {
var selbit='', bits, postbits, ibits=0, dpi=0, selneeded=false, isize=0;
if (window.localStorage) {
for (var iq in window.localStorage) {
var val = localStorage.getItem(iq);
if (val) {
if (iq == 'ai_items') {
dval=decodeURIComponent(val);
if (dval != '') {
bits=dval.split('#');
for (ibits=0; ibits<bits.length; ibits++) {
postbits=bits[ibits].split('|');
if (!selneeded) {
isize=1;
selbit='<select id=selpast style="visibility:hidden;display:online-block;" onchange=" if (this.value.trim().length != 0) { thischoice=eval(this.value); popit(this.value); } else if (this.value.length != 0) { localStorage.removeItem(' + "'" + 'ai_items' + "'" + '); document.getElementById(' + "'" + 'myh3' + "'" + ').innerHTML=prevh3; } "><option value="">Optionally load previous agenda ...</option></option></select>';
}
selneeded=true;
if (dpi == 0) {
defbits[0]=bits[0];
//alert(bits[0]);
if (bits[ibits].indexOf('aidatetime=') == -1) {
if (saveawayv == "") {
var sv=new Date().toDateInputValue();
deftitle[0]='Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + sv;
} else {
deftitle[0]='Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + saveawayv;
}
} else {
deftitle[0]='Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + bits[ibits].split('aidatetime=')[1].split('&')[0];
}
defcontent[0]=decodeURIComponent(postbits[0]);
if (postbits.length > 1) {
defprompt[0]=decodeURIComponent(postbits[1]);
}
isize++;
selbit=selbit.replace('</select>', '<option value="' + ibits + '">' + deftitle[ibits] + '</option></select>');
} else {
defbits.push(bits[ibits]);
if (bits[ibits].indexOf('aidatetime=') == -1) {
if (saveawayv == "") {
var svx=new Date().toDateInputValue();
deftitle.push('Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + svx);
} else {
deftitle.push('Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + saveawayv);
}
} else {
deftitle.push('Agenda Items for ' + bits[ibits].split('organization=')[1].split('&')[0] + ' Meeting on ' + bits[ibits].split('aidatetime=')[1].split('&')[0]);
}
defcontent.push(decodeURIComponent(postbits[0]));
if (postbits.length > 1) {
defprompt.push(decodeURIComponent(postbits[1]));
} else {
defprompt.push("");
}
isize++;
selbit=selbit.replace('</select>', '<option value="' + ibits + '">' + deftitle[ibits] + '</option></select>');
}
}
}
}
}
}
if (selbit != '') {
isize++;
document.getElementById('myh3').innerHTML+=' ... <input style="display:inline-block;background-color:orange;" type=button value="Load Previous" onclick=prepopit();></input> ' + selbit.replace('<select ','<select size=' + isize + ' ').replace('</select>','<option value=" ">Clear These</option></select>');
}
}
}

function assess(divo) {
if (divo.id != 'aidatetime') {
if (divo.id.indexOf('3_') != -1) {
lastformih=document.getElementById('mytable').outerHTML; //document.getElementById('myform').innerHTML;
curai++;
document.getElementById('mytbody').innerHTML+=templatetr.replace(/\_1/g, '_' + curai).replace(/1\)/g, '' + curai + ')');
document.getElementById('aidatetime').value = saveawayv;
document.getElementById('divagendaitem2_' + curai).focus();
if (!document.getElementById('ab' + divo.id)) {
document.getElementById('hidden').innerHTML+='<input type=hidden name=' + divo.id + ' id=ab' + divo.id + ' value="' + divo.innerHTML + '"></input>';
} else {
document.getElementById('ab' + divo.id).value=divo.innerHTML;
}
} else if (!document.getElementById('ab' + divo.id)) {
document.getElementById('hidden').innerHTML+='<input type=hidden name=' + divo.id + ' id=ab' + divo.id + ' value="' + divo.innerHTML + '"></input>';
} else {
document.getElementById('ab' + divo.id).value=divo.innerHTML;
}
}
}

function antidive() {
document.getElementById('divemail').innerHTML=dive;
}

function trsave() {
var els, iels, rect;
prevh3=document.getElementById('myh3').innerHTML;
lscheck();
els=document.getElementsByTagName('table');
for (iels=0; iels<els.length; iels++) {
rect=els[iels].getBoundingClientRect();
els[iels].setAttribute('data-width',eval(('' + rect.width).split('.')[0]) / 3);
}
els=document.getElementsByTagName('th');
for (iels=0; iels<els.length; iels++) {
rect=els[iels].getBoundingClientRect();
els[iels].setAttribute('data-width',eval(('' + rect.width).split('.')[0]) / 3);
}
els=document.getElementsByTagName('td');
for (iels=0; iels<els.length; iels++) {
rect=els[iels].getBoundingClientRect();
els[iels].setAttribute('data-width',eval(('' + rect.width).split('.')[0]) / 3);
}
templatetr=document.getElementById('agendaitem_1').outerHTML;
dive=document.getElementById('divemail').innerHTML;
//document.getElementById('divagendaitem2_1').placeholder='Welcome and apologies';
document.getElementById('haidatetime').value = new Date().toDateInputValue();
document.getElementById('aidatetime').value = document.getElementById('haidatetime').value;
saveawayv=document.getElementById('aidatetime').value;
lastformih=document.getElementById('mytable').outerHTML; //document.getElementById('myform').innerHTML;
document.getElementById('organization').focus();
}

function ewoit() {
var esuff='to',etos, preetos, ij, iij, etox='', etoy='', exw='';
var newth = 'Agenda Items for ' + document.getElementById('organization').innerHTML + ' Meeting on ' + saveawayv;
var eto=prompt('Who do I email it to? Enter their email address like rmetcalfe15@gmail.com or (of the form) Robert Metcalfe [rmetcalfe15@gmail.com] and comma separate for to(;list), cc(;list), bcc(;list)', defprompt[thischoice]);
if (eto == null) { eto=''; }
if (eto.indexOf('@') != -1) {
etox=',' + eto + ';';
etoy=';' + eto + ';';
preetos=eto.split(',');
for (iij=0; iij<preetos.length; iij++) {
exw=preetos[iij];
etos=preetos[iij].split(';');
for (ij=0; ij<etos.length; ij++) {
if (etos[ij].indexOf('[') != -1) {
if (ij == 0 && newth.indexOf('Attn:') == -1) { newth='Attn: ' + etos[ij].split('[')[0] + ' ... ' + newth; }
etos[ij]=etos[ij].split('[')[1].split(']')[0];
}
//}
if (document.getElementById('td' + esuff).value == '') {
document.getElementById('td' + esuff).value=etos[ij];
} else {
document.getElementById('td' + esuff).value+=',' + etos[ij];
}
if (esuff == 'to' && etox.indexOf('' + exw + ';') == -1 && etoy.indexOf('' + exw + ';') == -1) {
esuff='cc';
} else if (etox.indexOf('' + exw + ';') == -1 && etoy.indexOf('' + exw + ';') == -1) {
esuff='bcc';
}
}
}
document.getElementById('tdsubj').value=newth + ' - RJM Programming';
var prefix=lastformih.split('</th>')[0];
var suffix=lastformih.replace(prefix, '');
while (prefix.indexOf(String.fromCharCode(10)) != -1) {
prefix=prefix.replace(String.fromCharCode(10), '<br>');
}
while (suffix.indexOf(String.fromCharCode(10)) != -1) {
suffix=suffix.replace(String.fromCharCode(10), '<br>');
}
//alert(suffix);
document.getElementById('tdhuhta').value=(prefix.split('Agenda ')[0] + newth.replace('Agenda Items ','<a target=_blank href=' + document.URL.split('#')[0].split('?')[0] + '>Agenda Items</a> ') + suffix).replace(/\>\<br\>/g,'>');
document.getElementById('fsubm').click();
var thisls='?', idh;
var dh=document.getElementById('hidden').innerHTML;
var dhns=dh.split(' name="');
var dhvs=dh.split(' value="');
for (idh=1; idh<dhns.length; idh++) {
if (idh == 1) {
thisls+=dhns[idh].split('"')[0] + '=';
thisls+=encodeURIComponent(dhvs[idh].split('"')[0]);
} else {
thisls+='&' + dhns[idh].split('"')[0] + '=';
thisls+=encodeURIComponent(dhvs[idh].split('"')[0]);
}
}
if (thisls != '') {
thisls+='|' + encodeURIComponent(eto);
var addthis=true;
for (idh=0; idh<defbits.length; idh++) {
if (defbits[idh] == thisls) { addthis=false; }
}
if (addthis) {
if (dval != '') {
//localStorage.removeItem('ai_items');
//localStorage.setItem('ai_items', thisls);
localStorage.setItem('ai_items', dval + '#' + thisls);
} else {
localStorage.setItem('ai_items', thisls);
}
}
}
setTimeout(antidive, 2000);
}
}

function pdfit() {
var prefix=lastformih.split('</th>')[0];
var suffix=lastformih.replace(prefix, '');
while (prefix.indexOf(String.fromCharCode(10)) != -1) {
prefix=prefix.replace(String.fromCharCode(10), '<br>');
}
while (suffix.indexOf(String.fromCharCode(10)) != -1) {
suffix=suffix.replace(String.fromCharCode(10), '<br>');
}
var newth = 'Agenda Items for ' + document.getElementById('organization').innerHTML + ' Meeting on ' + saveawayv;
document.getElementById('formtable').innerHTML=(prefix.split('Agenda ')[0] + newth.replace('Agenda Items ','<a target=_blank href=' + document.URL.split('#')[0].split('?')[0] + '>Agenda Items</a> ') + suffix.replace(/\ data\-width\=/g,' width=')).replace(/\>\<br\>/g,'>');
document.getElementById('bsubmit').click();
}

function woit() {
var prefix=lastformih.split('</th>')[0];
var suffix=lastformih.replace(prefix, '');
while (prefix.indexOf(String.fromCharCode(10)) != -1) {
prefix=prefix.replace(String.fromCharCode(10), '<br>');
}
while (suffix.indexOf(String.fromCharCode(10)) != -1) {
suffix=suffix.replace(String.fromCharCode(10), '<br>');
}
var newth = 'Agenda Items for ' + document.getElementById('organization').innerHTML + ' Meeting on ' + saveawayv;
var wo=window.open('','_blank','top=50,left=50,width=800,height=800');
wo.document.write(prefix.split('Agenda ')[0] + newth + suffix); //(document.getElementById('myform').innerHTML);
}

</script>
</head>
<body onload="trsave();">
<h1>Meeting Agenda Items</h1>
<h3 id=myh3>RJM Programming - December, 2019</h3>
<h4><input style='display:inline-block;width:20%;' type=datetime id=haidatetime value='' readonly></input></h4>
<form id=myform target=_blank action=./agenda_items.html method=GET>
<table border="10" style="width:90%;margin-left:5%;" id="mytable">
<tbody id=mytbody>
<tr><th colspan=3 id=agendatitle>Agenda Items for <div onblur=assess(this); title='Organization Name could go here' data-name=organization id=organization contenteditable=true style='display:inline-block;border:1px solid red;'> </div> Meeting on <input onblur=saveaway(this); style='display:inline-block;width:30%;' type=datetime id=aidatetime name=aidatetime value=''></input></th></tr>
<tr><td style='width:10%;text-align:right;'>#</td><td bgcolor='#ffff00;'>Description</td><td style='width:20%;'>Moderator</td></tr>
<tr id=agendaitem_1><td id=agendaitem1_1 style='text-align:right;'>1)</td><td id=agendaitem2_1 style='text-align:left;' bgcolor='#ffff00;'><div onblur=assess(this); contenteditable=true data-name=divagendaitem2_1 id=divagendaitem2_1></div></td><td id=agendaitem3_1 style='text-align:left;'><div onblur=assess(this); contenteditable=true data-name=divagendaitem3_1 id=divagendaitem3_1></div></td></tr>
</tbody>
</table>
<br><input onclick="woit();" style='background-color:yellow;margin-left:5%;' type=button name=print id=print value=Print></input> <input onclick="ewoit();" style='background-color:orange;' type=button name=email id=email value=Email></input> <input onclick="pdfit();" style='background-color:pink;' type=button name=pdf id=pdf value=PDF></input>
<div id=hidden>
</div>
</form>
<div id=divemail>
<form id=ifemail target="iemail" style="display:none;" action="//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php" method="POST">
<input type=hidden style=display:none; name=inline value=""></input>
<input type=hidden style=display:none; name=to id=tdto value=""></input>
<input type=hidden style=display:none; name=subj id=tdsubj value="Agenda Items - RJM Programming"></input>
<textarea name=hcont style=display:none; value="" id=tdhuhta cols=160 rows=4></textarea>
<input type=hidden style=display:none; name=cc id=tdcc value=""></input>
<input type=hidden style=display:none; name=bcc id=tdbcc value=""></input>
<input style=display:none; type=submit id=fsubm value="Email"></input>
</form>
</div>
<iframe style=display:none; name=iemail id=iemail src=></iframe>
<form target='_blank' method=POST action=../PHP/form_creator.php><textarea style="background-color:pink;width:90%;display:none;" name=formtable id=formtable rows=20></textarea><input id=bsubmit style="background-color:yellow;display:none;" value="HTML Above to PDF" type=submit></input><input id=bbsubmit style="background-color:orange;display:none;" value="HTML Above to PDF and Canvas" name=both type=submit></input></form>
<input type=text style='position:absolute;left:-200px;top:-200px;' value=''></input>
</body>
</html>