<!doctype html>
<html>
<head>
<title>Favourites Polling</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type='text/javascript'>
var template_record='';
var sofar=',';
var cnt=0;
var goes=0;
var cmdlist=[];
var report='';
var nextc=1;
var extras='', extradelim='';
var afirstcall=true;
var basiscnt=0;

var pollq=["fruits;apple:banana:pear:grapes:watermelon:orange:mandarin:strawberries:raspberries:blackberries",
"seasons;spring:summer:autumn:winter",
"days;Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday",
"planets;Mercury:Venus:Earth:Mars:Jupiter:Saturn:Uranus:Neptune:Pluto",
"bridges;Golden Gate Bridge, San Francisco, United States:Tower Bridge, London, England:Brooklyn Bridge, New York, United States:Ponte Vecchio, Florence, Italy:Rialto Bridge, Venice, Italy:Millau Viaduct, Millau, France:Charles Bridge, Prague, Czech Republic:Akashi Kaikyō Bridge, Kobe, Japan",
"rivers;Nile:Amazon:Yangtze:Mississippi:Yenisei:Ob:Huang He:Amur:Congo:Lena:Mackenzie:Niger:Mekong:Paraná:Murray:Volga:Shatt al-Arab:Purus:Madeira:Yukon:Indus"
];
var opollq=["Other(s)",
"Other(s)",
"Other(s)",
"Other(s)",
"Other(s)",
"Other(s)"
];

var ninehundred=location.search.split('ninehundred=')[1] ? eval(decodeURIComponent(location.search.split('ninehundred=')[1].split('&')[0])) : 2000;
var mores=location.search.split('cvsmsmallurl=')[1] ? decodeURIComponent(location.search.split('cvsmsmallurl=')[1].split('&')[0]) : '';

var shorturl=document.URL.split('#')[0].split('?')[0];
var prevprefix='';
var prevsuffix='';
var prefix='';
var suffix='';

function xdecodeURIComponent(fg) { return fg; }

function cr_setCookie(thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
var expireDate = new Date();
var fixpre="";
if (shorturl.indexOf('//') != -1) {
//if (thisg.indexOf(shorturl) == -1) {
thisg=thisg.split('#')[eval(-1 + thisg.split('#').length)];
if (thisg == "") {
if (shorturl.indexOf('cvsmsmallurl%3D') != -1) {
fixpre=shorturl.split("cvsmsmallurl%3D")[1];
} else if (shorturl.indexOf('cvsmsmallurl=') != -1) {
fixpre=shorturl.split("cvsmsmallurl=")[1];
} else {
fixpre='';
}
} else {
if (shorturl.indexOf('cvsmsmallurl%3D') != -1) {
fixpre=shorturl.split("cvsmsmallurl%3D")[1]; // + "#";
} else if (shorturl.indexOf('cvsmsmallurl=') != -1) {
fixpre=shorturl.split("cvsmsmallurl=")[1]; // + "#";
} else {
fixpre=''; // + "#";
}
}
//}
}
expireDate.setMonth(expireDate.getMonth()+6);
if (("cvsmsmallurl=" + encodeURIComponent(fixpre + thisg) + "; expires=" + expireDate.toGMTString()).length < ninehundred) {
document.cookie = "cvsmsmallurl=" + encodeURIComponent(fixpre + thisg) + "; expires=" + expireDate.toGMTString();
}
}

function cr_deleteCookie() { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth()-6);
document.cookie = "cvsmsmallurl=; expires=" + expireDate.toGMTString();
}

function cr_cookieVal(firstcall) {
var iadds=0;
if (firstcall) {
if (document.cookie != '') {
var txCookie=document.cookie.split("; ");
for (var jx=0; jx<txCookie.length; jx++) {
if ("cvsmsmallurl" == txCookie[jx].split("=")[0]) {
if (decodeURIComponent(txCookie[jx].split("=")[1]) != "") {
///if (decodeURIComponent(txCookie[jx].split("=")[1]).indexOf('//') != -1) {
var xshorturl=shorturl.split('#')[0].split('?')[0] + '?cvsmsmallurl=' + (decodeURIComponent(txCookie[jx].split("=")[1].replace('?cvsmsmallurl=','').replace('cvsmsmallurl=','').split('#')[0]));
document.getElementById('myh1').innerHTML+=" <a id=adc onclick='cr_deleteCookie(); this.style.display=\"none\"; ' style='text-decoration:none;cursor:pointer;' title='Clear this webpage cookies only'>-</a>" + " <a href='" + xshorturl + "' style='text-decoration:none;cursor:pointer;' title='Recall last saved Favourites Poll'>></a>";
//}
}
}
}
}
}
if (firstcall && mores != '') {
if (document.cookie == '') {
extras=mores;
cr_setCookie(mores);
}
// |9.8,5~nonother!reptiles;snake:goanna:lizzard
adds=mores.split('|' + eval(1 + basiscnt))[0].split('|');
for (iadds=0; iadds<adds.length; iadds++) {
// http://localhost:8888/checkbox_vs_select_multiple.html?cvsmsmallurl=4!10%7C6!1%7C3!1%7C5!1%7C1.Walrus!1%7C2!1
if (adds[iadds].split('!')[0].indexOf('.') != -1) {
//alert(adds[iadds]);
//alert(eval(-1 + eval(adds[iadds].split('!')[0].split('.')[0].split('~')[0])));
//alert(adds[iadds].split('!')[0].split('.')[1]);
opollq[eval(-1 + eval(adds[iadds].split('!')[0].split('.')[0].split('~')[0]))]=adds[iadds].split('!')[0].split('.')[1];
}
}
if (mores.indexOf('|' + eval(1 + basiscnt) + '.') != -1 || mores.indexOf('|' + eval(1 + basiscnt) + '~') != -1 || mores.indexOf('|' + eval(1 + basiscnt) + '!') != -1) {
var outofl='' + eval(1 + basiscnt);
if (mores.indexOf('|' + eval(1 + basiscnt) + '~') != -1) {
outofl+='~' + mores.split('|' + eval(1 + basiscnt) + '~')[1];
} else if (mores.indexOf('|' + eval(1 + basiscnt) + '.') != -1) {
outofl+='.' + mores.split('|' + eval(1 + basiscnt) + '.')[1];
} else {
outofl+='!' + mores.split('|' + eval(1 + basiscnt) + '!')[1];
}
var adds=outofl.split('|');
for (iadds=1; iadds<=adds.length; iadds++) {
pollq.push(adds[eval(-1 + iadds)].split('!')[1]);
// 7.3!birds;penguin:sparrow:crow:magpie:wren
//alert(pollq.length + ' ... ' + outofl);
//alert(adds[eval(-1 + iadds)].split('!')[1]);
// 7.1!birds%3Bwren%3Asparrow%3Apenguin
if (adds[eval(-1 + iadds)].split('!')[0] != '' && adds[eval(-1 + iadds)].split('!')[0].indexOf('~') != -1) {
opollq.push(adds[eval(-1 + iadds)].split('!')[0].split('~')[1]);
} else {
opollq.push('Other(s)');
}
}
}
} else {
if (document.cookie != '') {
var tCookie=document.cookie.split("; ");
for (var j=0; j<tCookie.length; j++) {
if ("cvsmsmallurl" == tCookie[j].split("=")[0]) {
if (firstcall && decodeURIComponent(tCookie[j].split("=")[1]) != "") {
if (decodeURIComponent(tCookie[j].split("=")[1]).indexOf('//') != -1) {
shorturl=decodeURIComponent(tCookie[j].replace('?cvsmsmallurl=','').replace('cvsmsmallurl=','')).split('#')[0];
}
}
return decodeURIComponent(tCookie[j].replace('?cvsmsmallurl=','').replace('cvsmsmallurl=',''));
}
}
}
}
return '';
}

function process(whato) {
var row=1, cv='', sf='', sfd='';
if (whato.id.indexOf('ins') == 0) { // select multiple
while (document.getElementById('opt_' + cnt + '_' + row)) {
if (document.getElementById('opt_' + cnt + '_' + row).selected) {
sf+=sfd + row;
sfd=',';
cmdlist.push("document.getElementById('cbx_" + cnt + '_' + row + "').checked=true");
cmdlist.push("document.getElementById('opt_" + cnt + '_' + row + "').setAttribute('selected', '')");
cmdlist.push("document.getElementById('opt_" + cnt + '_' + row + "').selected = true");
if (document.getElementById('opt_' + cnt + '_' + row).value == 'Other(s)') {
cv=prompt('Optionally change, as required', 'Other(s)');
if (cv == null) { cv='Other(s)'; }
if (cv != 'Other(s)') {

if (prefix.indexOf('|') != -1) {
if (prefix.split('|')[eval(-1 + prefix.split('|').length)].indexOf('-1') != -1) {
if (prefix.split('|')[eval(-1 + prefix.split('|').length)].indexOf('.') == -1) {
prefix=prefix.replace('!-1','.' + cv + '!-1');
} else {
prefix=prefix.replace(prefix.split('!-1')[0].split('.')[eval(-1 + prefix.split('!-1')[0].split('.').length)] + '!-1',cv + '!-1');
}
}
}

if (suffix.indexOf('|') != -1) {
if (suffix.split('|')[eval(-1 + suffix.split('|').length)].indexOf('-1') != -1) {
if (suffix.split('|')[eval(-1 + suffix.split('|').length)].indexOf('~') == -1) {
suffix=suffix.replace('.-1!','.-1~' + cv + '!');
} else {
suffix=suffix.replace(suffix.split('.-1')[1].split('!')[0] + '!','~' + cv + '!');
}
}
}

opollq[eval(-1 + cnt)]=cv;
document.getElementById('opt_' + cnt + '_' + row).value=cv;
document.getElementById('opt_' + cnt + '_' + row).innerHTML=cv;
document.getElementById('cbx_' + cnt + '_' + row).value=cv;
document.getElementById('lab_' + cnt + '_' + row).innerHTML=document.getElementById('lab_' + cnt + '_' + row).innerHTML.replace('Other(s)',cv).replace('Other(s)',cv);
}
}
document.getElementById('cbx_' + cnt + '_' + row).checked=true;
}
row++;
}
prefix=prefix.replace('-1','' + sf);
suffix=suffix.replace('-1','' + sf);
prevprefix=prefix;
prevsuffix=suffix;
} else if (whato.id.indexOf('inc') == 0) { // input checkbox
while (document.getElementById('cbx_' + cnt + '_' + row)) {
if (document.getElementById('cbx_' + cnt + '_' + row).checked) {
sf+=sfd + row;
sfd=',';
cmdlist.push("document.getElementById('opt_" + cnt + '_' + row + "').setAttribute('selected', '')");
cmdlist.push("document.getElementById('opt_" + cnt + '_' + row + "').selected = true");
cmdlist.push("document.getElementById('cbx_" + cnt + '_' + row + "').checked=true");
if (document.getElementById('cbx_' + cnt + '_' + row).value == 'Other(s)') {
cv=prompt('Optionally change, as required', 'Other(s)');
if (cv == null) { cv='Other(s)'; }
if (cv != 'Other(s)') {

if (prefix.indexOf('|') != -1) {
if (prefix.split('|')[eval(-1 + prefix.split('|').length)].indexOf('-1') != -1) {
if (prefix.split('|')[eval(-1 + prefix.split('|').length)].indexOf('.') == -1) {
prefix=prefix.replace('!-1','.' + cv + '!-1');
} else {
prefix=prefix.replace(prefix.split('!-1')[0].split('.')[eval(-1 + prefix.split('!-1')[0].split('.').length)] + '!-1',cv + '!-1');
}
}
}

if (suffix.indexOf('|') != -1) {
if (suffix.split('|')[eval(-1 + suffix.split('|').length)].indexOf('-1') != -1) {
if (suffix.split('|')[eval(-1 + suffix.split('|').length)].indexOf('~') == -1) {
suffix=suffix.replace('.-1!','.-1~' + cv + '!');
} else {
suffix=suffix.replace(suffix.split('.-1')[1].split('!')[0] + '!','~' + cv + '!');
}
}
}

opollq[eval(-1 + cnt)]=cv;
document.getElementById('opt_' + cnt + '_' + row).value=cv;
document.getElementById('opt_' + cnt + '_' + row).innerHTML=cv;
document.getElementById('cbx_' + cnt + '_' + row).value=cv;
document.getElementById('lab_' + cnt + '_' + row).innerHTML=document.getElementById('lab_' + cnt + '_' + row).innerHTML.replace('Other(s)',cv).replace('Other(s)',cv);
}
}
document.getElementById('opt_' + cnt + '_' + row).setAttribute('selected', '');
document.getElementById('opt_' + cnt + '_' + row).selected = true;
}
row++;
}
prefix=prefix.replace('-1','' + sf);
suffix=suffix.replace('-1','' + sf);
prevprefix=prefix;
prevsuffix=suffix;
}
//alert(shorturl + prefix.replace('-1','') + suffix.replace('-1',''));
pickone();
}

function pickone() {
cnt++;
prefix=prefix.replace('-1','');
suffix=suffix.replace('-1','');
var separator='';
var startwith=template_record;
if (goes >= pollq.length) { separator='<tr><td style="text-align:center;padding:5px 5px 5px 5px;"><a onclick="doreport();" style="padding:5px 5px 5px 5px;background-color:lightgreen;text-decoration:none;border:2px solid red;cursor:pointer;">Run a Favourites Report</a></td><td style="text-align:center;padding:5px 5px 5px 5px;"><a onclick="doreport();" style="padding:5px 5px 5px 5px;background-color:lightgreen;text-decoration:none;border:2px solid red;cursor:pointer;">Run a Favourites Report</a></td><tr>'; sofar=','; }
var choice=-1;
choice=Math.floor(Math.random() * pollq.length);
while (sofar.indexOf(',' + choice + ',') != -1) {
choice=Math.floor(Math.random() * pollq.length);
}

var lastword=pollq[choice].split(';')[0];
var choices=pollq[choice].split(';')[1].split(':');

var selis='<b>' + lastword + '</b><br><select title="' + lastword + '" id="sel' + cnt + '" size=1 multiple></select> <input style="background-color:yellow;" id="ins' + cnt + '" type=button onclick="process(this);" value="Record"></input>';
var chkis='<b>' + lastword + '</b><br><div title="' + lastword + '" id="chk' + cnt + '"></div> <input style="background-color:pink;" id="inc' + cnt + '" type=button onclick="process(this);" value="Record"></input>';

choices.push(opollq[choice]);

prevprefix=prefix;
prevsuffix=suffix;

if (choice >= basiscnt) {
if (opollq[choice] != 'Other(s)') {
// |9.8,5~nonother!reptiles;snake:goanna:lizzard
suffix+='|' + eval(1 + eval('' + choice)) + '.-1~' + opollq[choice] + '!' + pollq[choice];
} else {
suffix+='|' + eval(1 + eval('' + choice)) + '.-1!' + pollq[choice];
}
} else if (prefix == '' && opollq[choice] != 'Other(s)') {
prefix='?cvsmsmallurl=' + eval(1 + eval('' + choice)) + '.' + opollq[choice] + '!-1';
} else if (prefix == '' && opollq[choice] == 'Other(s)') {
prefix='?cvsmsmallurl=' + eval(1 + eval('' + choice)) + '!-1';
} else if (opollq[choice] != 'Other(s)') {
prefix+='|' + eval(1 + eval('' + choice)) + '.' + opollq[choice] + '!-1';
} else {
prefix+='|' + eval(1 + eval('' + choice)) + '!-1';
}

for (var iw=0; iw<choices.length; iw++) {
chkis=chkis.replace('</div>','<label id="lab_' + cnt + '_' + eval(1 + iw) + '"><input id="cbx_' + cnt + '_' + eval(1 + iw) + '" type="checkbox" name="' + lastword + '[]" value="' + choices[iw] + '" />' + choices[iw] + '</label><br></div>');
selis=selis.replace('</select>', '<option id="opt_' + cnt + '_' + eval(1 + iw) + '" value="' + choices[iw] + '" />' + choices[iw] + '</option></select>');
}

startwith=startwith.replace(startwith.split('</td>')[1].split('>')[eval(-1 + startwith.split('</td>')[1].split('>').length)], selis.replace("size=1", "size=" + choices.length));
startwith=startwith.replace(startwith.split('</td>')[0].split('>')[eval(-1 + startwith.split('</td>')[0].split('>').length)], chkis);

if (cnt > 1) {
was=document.getElementById('mytfooter').innerHTML.replace(/opacity\:1/g,'opacity:0.5');
startwith=startwith.replace('tr1', 'tr' + cnt);
document.getElementById('mytfooter').innerHTML=startwith + separator + was;
} else {
document.getElementById('mytfooter').innerHTML=startwith + separator;
}

for (var icmd=0; icmd<cmdlist.length; icmd++) {
eval(cmdlist[icmd]);
}

sofar+=choice + ',';
goes++;
}

function ol() {
basiscnt=pollq.length;
template_record=document.getElementById('mytfooter').innerHTML;
//if (mores != '') { dorepcall(mores); }
cr_cookieVal(afirstcall);
afirstcall=false;
if (mores != '') { dorepcall(mores); }
pickone();
}

function dorepcall(mrs) {
// http://localhost:8888/checkbox_vs_select_multiple.html?cvsmsmallurl=1!1,3|4!2,6,9
//alert(mores);
//alert(mrs);
//alert(opollq[3]);
var shortreport='';
var amrs=mrs.split('|');
var iw, clist='', clists, imrs, jmrs, yeses='', noes='';
report='';
for (imrs=0; imrs<amrs.length; imrs++) {
iw=eval(-1 + eval(amrs[imrs].split('.')[0].split('~')[0].split('!')[0]));
//alert('iw=' + iw);
if (shortreport.indexOf('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ') != -1) {
shortreport=shortreport.replace('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ' + shortreport.split('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ')[1].split(').')[0] + ').','');
}
if (report.indexOf('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ') != -1) {
report=report.replace('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ' + report.split('What are your favourite ' + pollq[iw].split(';')[0] + '? (Not for ')[1].split(').')[0] + ').','');
}
shortreport+='What are your favourite ' + pollq[iw].split(';')[0] + '? '; // + String.fromCharCode(10);
report+='What are your favourite ' + pollq[iw].split(';')[0] + '? '; // + String.fromCharCode(10);
if (iw < basiscnt) {
clist=amrs[imrs].split('!')[1];
} else {
clist=amrs[imrs].split('.')[1].split('~')[0].split('!')[0];
}
for (jmrs=0; jmrs<pollq[iw].split(';')[1].split(':').length; jmrs++) {
if ((',' + clist + ',').indexOf(',' + eval(1 + jmrs) + ',') != -1) {
if (yeses == '') {
if (pollq[iw].split(';')[1].split(':').length <= jmrs) {
yeses=opollq[iw];
} else {
yeses=pollq[iw].split(';')[1].split(':')[jmrs].substring(0,1).toUpperCase() + pollq[iw].split(';')[1].split(':')[jmrs].substring(1);
}
} else {
if (pollq[iw].split(';')[1].split(':').length <= jmrs) {
yeses+=' and ' + opollq[iw];
} else {
yeses+=' and ' + pollq[iw].split(';')[1].split(':')[jmrs];
}
}
} else if (noes == '') {
if (pollq[iw].split(';')[1].split(':').length <= jmrs) {
noes=' (but not for ' + opollq[iw] + ').';
} else {
noes=' (but not for ' + pollq[iw].split(';')[1].split(':')[jmrs] + ').';
}
} else {
if (pollq[iw].split(';')[1].split(':').length <= jmrs) {
noes=noes.replace(')',' and ' + opollq[iw] + ')');
} else {
noes=noes.replace(')',' and ' + pollq[iw].split(';')[1].split(':')[jmrs] + ')');
}
}
}
if (yeses == '') { if (clist != '') { yeses=opollq[iw]; } else { noes=noes.replace('(but not for ', '(Not for ').replace(').', ' and ' + opollq[iw] + ').').replace(' for and ', ' for '); } }
if (yeses.indexOf(opollq[iw]) == -1 && noes.indexOf(opollq[iw]) == -1) { if (noes == '') { noes=' (but not ' + opollq[iw] + ').'; } else { noes=noes.replace(').', ' and ' + opollq[iw] + ').').replace(' for and ', ' for '); } }
shortreport+=yeses + String.fromCharCode(10) + String.fromCharCode(10);
report+=yeses + noes + String.fromCharCode(10) + String.fromCharCode(10);
yeses='';
noes='';
}
var emailurl='mailto:?subject=Favourites%20Report%20...%20' + encodeURIComponent('http://www.rjmprogramming.com.au/HTMLCSS/checkbox_vs_select_multiple.html') + '&body=' + encodeURIComponent(report + String.fromCharCode(10) + String.fromCharCode(10) + shorturl.split('#')[0].split('?')[0] + prevprefix.replace('-1','').substring(0,14) + encodeURIComponent(prevprefix.replace('-1','').substring(14) + prevsuffix.replace('-1','')));
var answer=prompt(report + String.fromCharCode(10) + String.fromCharCode(10) + 'You can enter in an email address to shape to email this report.', 'optionally.fillin@email.address');
if ((emailurl + answer).split('&body=')[1].length.length > ninehundred) {
emailurl='mailto:?subject=Favourites%20Report%20...%20' + encodeURIComponent('http://www.rjmprogramming.com.au/HTMLCSS/checkbox_vs_select_multiple.html') + '&body=' + encodeURIComponent(shorturl.split('#')[0].split('?')[0] + prevprefix.replace('-1','').substring(0,14) + encodeURIComponent(prevprefix.replace('-1','').substring(14) + prevsuffix.replace('-1','')));
}
if (answer == null) { answer=''; }
if (answer.replace('optionally.fillin@email.address','').indexOf('@') != -1) { emailurl=emailurl.replace(':?subject=', ':' + answer + '?subject='); document.getElementById('aemail').href=emailurl; document.getElementById('aemail').click(); }
}

function doreport() {
var row=1, col=1, yeses='', noes='';
var shortreport='';
report='';
for (col=nextc; col<cnt; col++) {
shortreport+='What are your favourite ' + document.getElementById('sel' + col).title + '? '; // + String.fromCharCode(10);
report+='What are your favourite ' + document.getElementById('sel' + col).title + '? '; // + String.fromCharCode(10);
while (document.getElementById('opt_' + col + '_' + row)) {
if (document.getElementById('opt_' + col + '_' + row).selected) {
if (yeses == '') {
yeses=document.getElementById('opt_' + col + '_' + row).value.substring(0,1).toUpperCase() + document.getElementById('opt_' + col + '_' + row).value.substring(1);
} else {
yeses+=' and ' + document.getElementById('opt_' + col + '_' + row).value;
}
} else if (noes == '') {
noes=' (but not for ' + document.getElementById('opt_' + col + '_' + row).value + ').';
} else {
noes=noes.replace(')',' and ' + document.getElementById('opt_' + col + '_' + row).value + ')');
}
row++;
}
if (yeses == '') { noes=noes.replace('(but not for ', '(Not for '); }
shortreport+=yeses + String.fromCharCode(10) + String.fromCharCode(10);
report+=yeses + noes + String.fromCharCode(10) + String.fromCharCode(10);
yeses='';
noes='';
row=1;
}
nextc=cnt;
goes-=pollq.length;
var emailurl='mailto:?subject=Favourites%20Report%20...%20' + encodeURIComponent('http://www.rjmprogramming.com.au/HTMLCSS/checkbox_vs_select_multiple.html') + '&body=' + encodeURIComponent(report + String.fromCharCode(10) + String.fromCharCode(10) + shorturl.split('#')[0].split('?')[0] + prevprefix.replace('-1','').substring(0,14) + encodeURIComponent(prevprefix.replace('-1','').substring(14) + prevsuffix.replace('-1','')));
//alert(encodeURIComponent(prefix.replace('-1','').substring(14) + suffix.replace('-1','')));
var answer=prompt(report + String.fromCharCode(10) + String.fromCharCode(10) + 'You can enter in an email address to shape to email this report.', 'optionally.fillin@email.address');
if (answer == null) { answer=''; } else {
cr_setCookie(encodeURIComponent(prevprefix.replace('-1','').substring(14) + prevsuffix.replace('-1','')));
if ((emailurl + answer).split('&body=')[1].length > ninehundred) {
//alert((emailurl + answer).split('&body=')[1].length);
emailurl='mailto:?subject=Favourites%20Report%20...%20' + encodeURIComponent('http://www.rjmprogramming.com.au/HTMLCSS/checkbox_vs_select_multiple.html') + '&body=' + encodeURIComponent(shorturl.split('#')[0].split('?')[0] + prevprefix.replace('-1','').substring(0,14) + encodeURIComponent(prevprefix.replace('-1','').substring(14) + prevsuffix.replace('-1','')));
}
if (answer.replace('optionally.fillin@email.address','').indexOf('@') != -1) { emailurl=emailurl.replace(':?subject=', ':' + answer + '?subject='); document.getElementById('aemail').href=emailurl; document.getElementById('aemail').click(); }
}
prefix='';
suffix='';
prevprefix='';
prevsuffix='';
}

function ask() {
var pentry=prompt('Enter [things];[option1]:[option2]:[option3] type of entry. Eg. days;Sunday:Monday:Tuesday:Wednesday:Thursday:Friday:Saturday', '');
if (pentry == null) { pentry=''; }
if (pentry.indexOf(';') != -1) {
pollq.push(pentry);
opollq.push('Other(s)');
sofar=',';
cnt=0;
goes=0;
cmdlist=[];
report='';
nextc=1;
document.getElementById('mytfooter').innerHTML=template_record;
pickone();
}
}
</script>
</head>
<body onload='ol();'>
<h1 id=myh1>Favourites Polling <a onclick='ask();' style='text-decoration:none;cursor:pointer;' title='Add your own'>+</a></h1>
<h3>RJM Programming - September, 2018</h3>
<table id=mytable style='width:100%;' border=20>
<thead id=mythead>
<tr><th colspan=2>Favourites Polling - use either approach and other will be updated</th></tr>
<tr><th>Input Checkbox</th><th>Select Multiple</th></tr>
</thead>
<tfoot id=mytfooter>
<tr id="tr1"><td style='vertical-align:top;text-align:center;background-color:#ffddff;opacity:1;'>Input Checkbox line</td><td style='vertical-align:top;text-align:center;background-color:#ffffdd;opacity:1;'>Select Multiple line</td></tr>
</tfoot>
</table>
<a target='_top' style='display:none;' id='aemail' href='mailto:?subject=Favourites%20Report&body='>Email</a>
</body>
</html>