<!doctype html>
<html>
<head>
<title>Video Capture Email - RJM Programming - October, 2018 - Thanks to https://www.w3.org/TR/html-media-capture/</title>
<style>
* { font-family: Verdana; }
summary { width:100%; background-color:#f0f0f0; }
#topdmenu { background-color:#e0e0e0; }
hr { height:2px; background-color:orange; }
details { background-color:#d0d0d0; }
#topmostmenu { background-color:#c0c0c0; }
input { background-color:#f0b0d0; }
textarea { background-color:#f7f7f7; }
select { background-color:silver; }
</style>
<script type='text/javascript'>

var cdatestr='';
var atop=0;
var awidth=0;
var c=null;
var ctx=null;
var tops=[0];
var img=[];
var cfile=null;
var imgURL=[];
var kk=0;
var cimg=[];
var form=null;
var xhr=null;
var notfirstinsession=0;
var done=false;
var dhuh=null;
var dnhuh=0;
var swir='0';
var norecorder=false;
var firstdetails=null;


var pbb=' (0 of ' + swir.replace('0','1') + ')';
var pbval=0;
var pbmax=10485760;

var dotsofar='';
var nothanks=false;
var jijk=1;
var filezerosize=-1;
var filezerobig=false;
var fnames=[""];
var elem=null, context=null, elemLeft=0, elemTop=0;
var x=0, y=0;
var lasttop=0;
var formspares=[null], xhrs=[null], newform=null;
var newxhr=null;
var dot='yoUwiLlneVerFiNdtHis';
var dotfile='';
var dotfiles='';

var thismediais='video';

var extras=(location.search.split('extras=')[1] ? decodeURIComponent(location.search.split('extras=')[1].split('&')[0]) : '');
var pextras='', qextras='', aia='', was='extras=', ecomma=encodeURIComponent(','), videoplus='?extras=' + encodeURIComponent('video/*'), audioplus='?extras=' + encodeURIComponent('audio/*'), imageplus='?extras=' + encodeURIComponent('image/*'), imageis='extras=' + encodeURIComponent('image/*,'), audiois='extras=' + encodeURIComponent('audio/*,'), videois='extras=' + encodeURIComponent('video/*,');
if (extras != '') {
pextras='&extras=' + encodeURIComponent(extras);
qextras='?extras=' + encodeURIComponent(extras);
}

var selprefix='<select onchange="location.href=document.URL.replace(/video/g,this.value).replace(was,was + ecomma + videoplus.substring(8));"><option value="video">';
var selsuffix='</option><option value="audio">Audio</option><option value="image">Image</option></select>';

if (extras.indexOf("audio") != -1 && extras.indexOf("image") != -1) {
aia=' and/or Audio and/or Image';
} else if (extras.indexOf("audio") != -1) {
aia=' and/or Audio and/or <a onclick="location.href=document.URL + ecomma + imageplus.substring(8);" style="text-decoration:underline;cursor:pointer;">Image</a>';
} else if (extras.indexOf("image") != -1) {
aia=' and/or Image and/or <a onclick="location.href=document.URL + ecomma + audioplus.substring(8);" style="text-decoration:underline;cursor:pointer;">Audio</a>';
} else {
aia=' and/or <a onclick="location.href=document.URL + audioplus.substring(0,8) + ecomma + audioplus.substring(8);" style="text-decoration:underline;cursor:pointer;">Audio</a> <a onclick="location.href=document.URL + imageplus.substring(0,8) + ecomma + imageplus.substring(8) + ecomma + audioplus.substring(8);;" style="text-decoration:underline;cursor:pointer;">and</a>/or <a onclick="location.href=document.URL + imageplus.substring(0,8) + ecomma + imageplus.substring(8);" style="text-decoration:underline;cursor:pointer;">Image</a>';
}

var ourmimetype='';
var types = ["video/mp4","image/svg","audio/wav","audio/x-wav","audio/x-pn-realaudio","audio/x-mpegurl","audio/x-aiff","audio/mpeg","audio/mid",
"audio/basic","audio/ogg","video/x-sgi-movie","video/x-msvideo","video/quicktime","audio/mp3","video/mp4","video/mpeg",
"video/x-la-asf","video/ogg","video/webm","audio/mp4", "image/jpeg", "image/jpeg", "image/png", "image/gif", "image/bmp", "image/tif",
"text/html", "text/html", "text/html", "text/javascript", "text/css", "text/plain", "text/xml", "text/csv",
"application/vnd.ms-word", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/x-php", "application/pdf",
"application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.ms-powerpoint",
"application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"];
var exts = [".mp4",".svg",".wav",".wav",".ram",".m3u",".aiff",".mp3",".rmi",
".snd",".ogg",".movie",".avi",".mov",".mp3",".m4v",".mpeg",
".lsx",".ogv",".webm",".m4a", ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tif",
".htm", ".html", ".htmls", ".js", ".css", ".txt", ".xml", ".csv",
".doc", ".docx", ".php", ".pdf",
".pptx", ".ppt",
".xls", ".xlsx"];


var kisipn='';

function isipn(inf) {
if (kisipn == '') {
if (("/" + inf).replace(("\\").substring(0,1) + "image.","/image.").indexOf("/image.") != -1) {
kisipn="_PuTiPhErE";
return inf.replace('image.', 'image' + kisipn + '.').split('/')[eval(-1 + inf.replace('image.', 'image' + kisipn + '.').split('/').length)].split("\\".substring(0,1))[eval(-1 + inf.replace('image.', 'image' + kisipn + '.').split('/')[eval(-1 + inf.replace('image.', 'image' + kisipn + '.').split('/').length)].split("\\".substring(0,1)).length)];
}
} else {
return inf.replace('.', kisipn + '.').split('/')[eval(-1 + inf.replace('.', kisipn + '.').split('/').length)].split("\\".substring(0,1))[eval(-1 + inf.replace('.', kisipn + '.').split('/')[eval(-1 + inf.replace('.', kisipn + '.').split('/').length)].split("\\".substring(0,1)).length)];
}
return inf.split('/')[eval(-1 + inf.split('/').length)].split("\\".substring(0,1))[eval(-1 + inf.split('/')[eval(-1 + inf.split('/').length)].split("\\".substring(0,1)).length)];;
}

function jsipn(inf) {
if (kisipn != '') {
return inf.replace('.', kisipn + '.').split('/')[eval(-1 + inf.replace('.', kisipn + '.').split('/').length)].split("\\".substring(0,1))[eval(-1 + inf.replace('.', kisipn + '.').split('/')[eval(-1 + inf.replace('.', kisipn + '.').split('/').length)].split("\\".substring(0,1)).length)];
}
return inf.split('/')[eval(-1 + inf.split('/').length)].split("\\".substring(0,1))[eval(-1 + inf.split('/')[eval(-1 + inf.split('/').length)].split("\\".substring(0,1)).length)];;
}


function getccbccbody(inch) {
if (inch.indexOf('||') != -1) {
if (inch.indexOf('||||') != -1) {
document.getElementById('body').value=decodeURIComponent(inch.split('||||')[1]);
inch=inch.split('||||')[0];
}
if (inch.indexOf('|||') != -1) {
document.getElementById('bcc').value=inch.split('|||')[1].replace(/\|/g,',');
inch=inch.split('|||')[0];
}
if (inch.indexOf('||') != -1) {
document.getElementById('cc').value=inch.split('||')[1].replace(/\|/g,',');
inch=inch.split('||')[0];
}
if (document.getElementById('detemail')) {
document.getElementById('detemail').setAttribute('open', 'true');
}
return inch;
} else {
return inch;
}
}

function setCookie(thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
var tn="";
var expireDate = new Date();
var cc_bcc_body="";
if (document.getElementById('cc').value.indexOf('@') != -1) {
cc_bcc_body+='||' + document.getElementById('cc').value.replace(/\,/g,'|');
}
if (document.getElementById('bcc').value.indexOf('@') != -1) {
cc_bcc_body+='|||' + document.getElementById('bcc').value.replace(/\,/g,'|');
}
if (document.getElementById('body').value != '') {
cc_bcc_body+='||||' + encodeURIComponent(document.getElementById('body').value);
}

if (document.getElementById('zipname').value.indexOf(expireDate.getFullYear() + ("0" + eval(1 + expireDate.getMonth())).slice(-2) + ("0" + expireDate.getDate()).slice(-2)) != -1) {
if (document.getElementById('norecorder').checked) {
tn=document.getElementById('to').value.replace(/\,/g,'|') + cc_bcc_body + ',true' + encodeURIComponent(extras) + ',' + document.getElementById('zipname').value.replace(expireDate.getFullYear() + ("0" + eval(1 + expireDate.getMonth())).slice(-2) + ("0" + expireDate.getDate()).slice(-2),"yyyymmdd") + ',' + document.getElementById('swir').value + ',' + document.getElementById('subject').value;
} else {
tn=document.getElementById('to').value.replace(/\,/g,'|') + cc_bcc_body + ',false' + encodeURIComponent(extras) + ',' + document.getElementById('zipname').value.replace(expireDate.getFullYear() + ("0" + eval(1 + expireDate.getMonth())).slice(-2) + ("0" + expireDate.getDate()).slice(-2),"yyyymmdd") + ',' + document.getElementById('swir').value + ',' + document.getElementById('subject').value;
}
} else {
if (document.getElementById('norecorder').checked) {
tn=document.getElementById('to').value.replace(/\,/g,'|') + cc_bcc_body + ',true' + encodeURIComponent(extras) + ',' + document.getElementById('zipname').value + ',' + document.getElementById('swir').value + ',' + document.getElementById('subject').value;
} else {
tn=document.getElementById('to').value.replace(/\,/g,'|') + cc_bcc_body + ',false' + encodeURIComponent(extras) + ',' + document.getElementById('zipname').value + ',' + document.getElementById('swir').value + ',' + document.getElementById('subject').value;
}
}
expireDate.setMonth(expireDate.getMonth()+6);
document.cookie = thisg + "=" + encodeURIComponent(tn) + ";expires=" + expireDate.toGMTString();
}

function cookieVal(cName) {
if (document.cookie != '') {
var tCookie=document.cookie.split("; ");

for (var j=0; j<tCookie.length; j++) {
if (cName == tCookie[j].split("=")[0]) {
return decodeURIComponent(tCookie[j].split("=")[1]);
}
}
}
return '';
}

function deleteAllCookies(cName) {
var expireDate = new Date();
expireDate.setDate(expireDate.getDate()-1);
if (document.cookie != '') {
var tCookie=document.cookie.split("; ");

for (var j=0; j<tCookie.length; j++) {
if (cName == tCookie[j].split("=")[0]) {
document.cookie = goodname + "=;expires=" + expireDate.toGMTString();
}
}
}
}

function bp() {
var exDate = new Date();
var exstr=exDate.getFullYear() + ("0" + eval(1 + exDate.getMonth())).slice(-2) + ("0" + exDate.getDate()).slice(-2);

var to=location.search.split('to=')[1] ? decodeURIComponent(location.search.split('to=')[1].split('&')[0]) : '';
var cc=location.search.split('cc=')[1] ? decodeURIComponent(location.search.split('cc=')[1].split('&')[0]) : '';
var bcc=location.search.split('bcc=')[1] ? decodeURIComponent(location.search.split('bcc=')[1].split('&')[0]) : '';
var body=location.search.split('body=')[1] ? decodeURIComponent(location.search.split('body=')[1].split('&')[0]) : '';
var subject=location.search.split('subject=')[1] ? decodeURIComponent(location.search.split('subject=')[1].split('&')[0]) : '';
var zipname=location.search.split('zipname=')[1] ? decodeURIComponent(location.search.split('zipname=')[1].split('&')[0]).replace('yyyymmdd', exstr) : '';
swir=location.search.split('swir=')[1] ? location.search.split('swir=')[1].split('&')[0] : '0';
var forever=location.search.split('forever=')[1] ? true : false;
var prenorecorder=location.search.split('norecorder=')[1] ? decodeURIComponent(location.search.split('norecorder=')[1].split('&')[0]) : ' ';
if (prenorecorder != ' ' && prenorecorder != extras) {
norecorder=true;
}
//norecorder=location.search.split('norecorder=')[1] ? true : false;
var cval=cookieVal('videocapture');

pbb=' (0 of ' + swir.replace('0','1') + ')';


dhuh=document.getElementById('adhuh'); //document.body;

if (to == '' && subject == '' && zipname == '' && forever) {
deleteAllCookies('videocapture');
} else if (cval == '') {
document.getElementById('to').value=to;
document.getElementById('cc').value=cc;
document.getElementById('bcc').value=bcc;
document.getElementById('body').value=body;
document.getElementById('subject').value=subject;
document.getElementById('zipname').value=zipname;
if (norecorder) { document.getElementById('norecorder').checked=true; }
if (forever) { setCookie('videocapture'); }
} else {
var cs=decodeURIComponent(cval).split(',');
if (cs.length > 4) {
if (cs[0] != '') { document.getElementById('to').value=getccbccbody(cs[0]).replace(/\|/g,','); } else { document.getElementById('to').value=getccbccbody(to).replace(/\|/g,','); }
if (cs[1].substring(0,4) == 'true') { if (extras == '' && cs[1].length > 4) { extras=decodeURiComponent(cs[1].substring(4)); } norecorder=true; document.getElementById('norecorder').checked=norecorder; } else if (cs[1].substring(0,4) == 'fals') { if (extras == '' && cs[1].length > 5) { extras=decodeURiComponent(cs[1].substring(5)); } norecorder=false; document.getElementById('norecorder').checked=norecorder; } else { document.getElementById('norecorder').checked=norecorder; }
if (cs[2] != '') { document.getElementById('zipname').value=cs[2].replace('yyyymmdd', exstr); } else { document.getElementById('zipname').value=zipname; }
if (cs[3] != '') { document.getElementById('swir').value=cs[3]; swir=cs[3]; } else { document.getElementById('swir').value='' + swir; }
if (cs[4] != '') { document.getElementById('subject').value=decodeURIComponent(cval).replace(cs[0] + ',' + cs[1] + ',' + cs[2] + ',' + cs[3] + ',',''); } else { document.getElementById('subject').value=subject; }
} else if (cs.length > 3) {
if (cs[0] != '') { document.getElementById('to').value=getccbccbody(cs[0]).replace(/\|/g,','); } else { document.getElementById('to').value=getccbccbody(to).replace(/\|/g,','); }
if (cs[1].substring(0,4) == 'true') { if (extras == '' && cs[1].length > 4) { extras=decodeURiComponent(cs[1].substring(4)); } norecorder=true; document.getElementById('norecorder').checked=norecorder; } else if (cs[1].substring(0,4) == 'fals') { if (extras == '' && cs[1].length > 5) { extras=decodeURiComponent(cs[1].substring(5)); } norecorder=false; document.getElementById('norecorder').checked=norecorder; } else { document.getElementById('norecorder').checked=norecorder; }
if (cs[2] != '') { document.getElementById('zipname').value=cs[2].replace('yyyymmdd', exstr); } else { document.getElementById('zipname').value=zipname; }
if (cs[3] != '') { document.getElementById('swir').value=cs[3]; swir=cs[3]; } else { document.getElementById('swir').value='' + swir; }
document.getElementById('subject').value=subject;
} else if (cs.length > 2) {
if (cs[0] != '') { document.getElementById('to').value=getccbccbody(cs[0]).replace(/\|/g,','); } else { document.getElementById('to').value=getccbccbody(to).replace(/\|/g,','); }
if (cs[1].substring(0,4) == 'true') { if (extras == '' && cs[1].length > 4) { extras=decodeURiComponent(cs[1].substring(4)); } norecorder=true; document.getElementById('norecorder').checked=norecorder; } else if (cs[1].substring(0,4) == 'fals') { if (extras == '' && cs[1].length > 5) { extras=decodeURiComponent(cs[1].substring(5)); } norecorder=false; document.getElementById('norecorder').checked=norecorder; } else { document.getElementById('norecorder').checked=norecorder; }
if (cs[2] != '') { document.getElementById('zipname').value=cs[2].replace('yyyymmdd', exstr); } else { document.getElementById('zipname').value=zipname; }
document.getElementById('swir').value=swir;
document.getElementById('subject').value=subject;
} else if (cs.length > 1) {
if (cs[0] != '') { document.getElementById('to').value=getccbccbody(cs[0]).replace(/\|/g,','); } else { document.getElementById('to').value=getccbccbody(to).replace(/\|/g,','); }
if (cs[1].substring(0,4) == 'true') { if (extras == '' && cs[1].length > 4) { extras=decodeURiComponent(cs[1].substring(4)); } norecorder=true; document.getElementById('norecorder').checked=norecorder; } else if (cs[1].substring(0,4) == 'fals') { if (extras == '' && cs[1].length > 5) { extras=decodeURiComponent(cs[1].substring(5)); } norecorder=false; document.getElementById('norecorder').checked=norecorder; } else { document.getElementById('norecorder').checked=norecorder; }
document.getElementById('zipname').value=zipname;
document.getElementById('swir').value=swir;
document.getElementById('subject').value=subject;
} else {
if (cs[0] != '') { document.getElementById('to').value=getccbccbody(cs[0]).replace(/\|/g,','); } else { document.getElementById('to').value=getccbccbody(to).replace(/\|/g,','); }
document.getElementById('norecorder').checked=norecorder;
document.getElementById('zipname').value=zipname;
document.getElementById('swir').value=swir;
document.getElementById('subject').value=subject;
}
if (forever) { setCookie('videocapture'); }
}
if (document.getElementById('zipname').value != '') { document.getElementById('zipname').style.display='inline-block'; }

norecorder=location.search.split('norecorder=')[1] ? true : false;
try {
if (norecorder) { document.getElementById('cvideo').removeAttribute('capture'); }
} catch(ee) {
}
if (norecorder) { document.getElementById('norecorder').checked=true; }

var input = document.querySelector('input[type=file]'); // see Example 4

input.onchange = function () {
var file = input.files; //[0];
cfile = file;

//alert(file.length);
done=false;
for (var ii=0; ii<file.length; ii++) {

if (kk == 0) {
fnames=[""];
fnames[0]=file[ii].name;
} else if (ii >= fnames.length) {
fnames.push(file[ii].name);
} else {
fnames[ii]=file[ii].name;
}

pbval+=file[ii].size;
if (pbval > pbmax) { pbmax=pbval; document.getElementById('sbig').innerHTML='' + eval(pbmax / 1048576.0) + 'mB' + pbb; document.getElementById('pb').max='' + pbmax; document.getElementById('pb').style.borderRight='5px inset red'; } else { document.getElementById('pb').style.borderRight='0px inset red'; document.getElementById('sbig').innerHTML='10mB' + pbb; }
document.getElementById('pb').value='' + pbval;
document.getElementById('pb').title='' + eval(pbval / 1048576.0) + 'mB';
if (ii == 0) { displayAsVideo(file); } // see Example 7
if (ii == 0) { done=upload(file); }
}
//if (done) { done=false; notfirstinsession=0; }
};

var cdate = new Date();
cdatestr=cdate.getFullYear() + ("0" + eval(1 + cdate.getMonth())).slice(-2) + ("0" + cdate.getDate()).slice(-2);
document.getElementById('zipname').placeholder+=' ... videozip_' + cdatestr + '.zip';
}

function swirit() {
document.getElementById('swir').value='' + swir;
}

function goagain(file) {
if (file) {
notfirstinsession=0;
kk=0;
//pbval=0;
//pbmax=10485760;
done=false;
for (var ii=0; ii<file.length; ii++) {
//pbval+=file[ii].size;
//if (pbval > pbmax) { pbmax=pbval; document.getElementById('sbig').innerHTML='' + eval(pbmax / 1048576.0) + 'mB'; document.getElementById('pb').max='' + pbmax; document.getElementById('pb').style.borderRight='5px inset red'; } else { document.getElementById('pb').style.borderRight='0px inset red'; document.getElementById('sbig').innerHTML='10mB'; }
//document.getElementById('pb').value='' + pbval;
//document.getElementById('pb').title='' + eval(pbval / 1048576.0) + 'mB';
//if (ii == 0) { displayAsAudio(file); } // see Example 7
if (ii == 0) { done=upload(file); }
}
}
}




function upload(file) {
dotsofar='';
//var dot='yoUwiLlneVerFiNdtHis', dotfile='', dotfiles='';
//formspares=[null];
//xhrs=[null];
var ioff=0;
if (!form) { form = new FormData(); }
if (!xhr) { xhr = new XMLHttpRequest(); }

var tmi='image';


ourmimetype="";
for (var ji=0; ji<exts.length; ji++) {
if (("." + file[0].name.split('.')[eval(-1 + file[0].name.split('.').length)]).toLowerCase() == exts[ji].toLowerCase()) {
ourmimetype=types[ji];
}
}


if (ourmimetype.indexOf('video') != -1) {
tmi='video';
} else if (ourmimetype.indexOf('audio') != -1) {
tmi='audio';
}


if (notfirstinsession == 0) {
if (document.getElementById('to').value.indexOf('@') != -1) {
form.append('to', document.getElementById('to').value);
if (document.getElementById('cc').value.indexOf('@') != -1) {
form.append('cc', document.getElementById('cc').value);
}
if (document.getElementById('bcc').value.indexOf('@') != -1) {
form.append('bcc', document.getElementById('bcc').value);
}
if (document.getElementById('body').value != '') {
form.append('body', document.getElementById('body').value);
}
if (document.getElementById('subject').value != '') {
form.append('subject', document.getElementById('subject').value);
} else {
form.append('subject', 'Image in email');
}
form.append('filename', isipn(file[0].name));
dotfile=isipn(file[0].name);
dotfiles=',' + isipn(file[0].name) + ',';
}
notfirstinsession++;
form.append(tmi, file[0]);
if (document.getElementById('zipname').value != '') {
form.append('zipname', jsipn(document.getElementById('zipname').value));
}
if (!filezerobig && (file.length > 1 || eval('' + swir) > 1)) {
if (filezerosize < 0) { filezerosize=file[0].size; }
filezerobig=false;
if (filezerosize > 1000000) { formspare=null; filezerobig=true; } // 1,156,109
//if (filezerosize > 1) { formspare=null; filezerobig=true; } // 1,156,109
if (filezerobig) {
if (document.getElementById('zipname').value == '') {
form.append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
form.append('of', '' + eval('' + swir) + 'of' + eval('' + swir));
}
}
if (file.length > 1) {
for (var iii=1; iii<file.length; iii++) {
tmi='image';


ourmimetype="";
for (var ji=0; ji<exts.length; ji++) {
if (("." + file[iii].name.split('.')[eval(-1 + file[iii].name.split('.').length)]).toLowerCase() == exts[ji].toLowerCase()) {
ourmimetype=types[ji];
}
}


if (ourmimetype.indexOf('video') != -1) {
tmi='video';
} else if (ourmimetype.indexOf('audio') != -1) {
tmi='audio';
}

if (document.getElementById('to').value.indexOf('@') != -1) {
if (filezerobig) {
if (formspares[0] == null) {
formspares[0]=new FormData();
xhrs[0]=new XMLHttpRequest();
newform=new FormData();
newxhr=new XMLHttpRequest();
if (document.getElementById('zipname').value != '') {
newform.append('zipname', jsipn(document.getElementById('zipname').value));
} else {
newform.append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
newform.append('of', '000' + eval('' + swir) + 'of' + eval('' + swir));
newform.append('filename', file[0].name);
newform.append(tmi, file[0]);
} else {
formspares.push(new FormData());
xhrs.push(new XMLHttpRequest());
}
if (iii == 1) { formspares[eval(-1 + formspares.length)].append('of', '0of' + eval('' + swir)); } else { formspares[eval(-1 + formspares.length)].append('of', '0' + iii + 'of' + eval('' + swir)); }
if (file[iii].name == dotfile) { dot='.'; formspares[eval(-1 + formspares.length)].append('asterisk', dotsofar + file[iii].name.replace(dot,'*' + dot)); dotsofar+=file[iii].name.replace(dot,'*' + dot) + ' '; } else if (dotfiles.indexOf(',' + file[iii].name + ',') != -1) { dot='.'; formspares[eval(-1 + formspares.length)].append('asterisk', dotsofar + file[iii].name.replace(dot,'*' + dot)); dotsofar+=file[iii].name.replace(dot,'*' + dot) + ' '; } else { dotfiles+=file[iii].name + ','; dot='yoUwiLlneVerFiNdtHis'; }
formspares[eval(-1 + formspares.length)].append('filename', jsipn(file[iii].name.replace(dot,'_' + iii + dot)));
if (document.getElementById('zipname').value != '') {
formspares[eval(-1 + formspares.length)].append('zipname', jsipn(document.getElementById('zipname').value));
} else {
formspares[eval(-1 + formspares.length)].append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
} else {
if (jsipn(file[iii].name) == dotfile) { dot='.'; form.append('asterisk', dotsofar + jsipn(file[iii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iii].name).replace(dot,'*' + dot) + ' '; } else if (dotfiles.indexOf(',' + jsipn(file[iii].name) + ',') != -1) { dot='.'; form.append('asterisk', dotsofar + jsipn(file[iii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iii].name).replace(dot,'*' + dot) + ' '; } else { dotfiles+=jsipn(file[iii].name) + ','; dot='yoUwiLlneVerFiNdtHis'; }
form.append('filename' + iii, jsipn(file[iii].name).replace(dot,'_' + iii + dot));
}
}
notfirstinsession++;
if (filezerobig) {
if (formspares[0] == null) {
formspares[0]=new FormData();
xhrs[0]=new XMLHttpRequest();
newform=new FormData();
newxhr=new XMLHttpRequest();
if (document.getElementById('zipname').value != '') {
newform.append('zipname', jsipn(document.getElementById('zipname').value));
} else {
newform.append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
newform.append('of', '000' + eval('' + swir) + 'of' + eval('' + swir));
newform.append('filename', isipn(file[0].name));
newform.append(tmi, file[0]);
}
formspares[eval(-1 + formspares.length)].append('msuffix', '' + iii);
formspares[eval(-1 + formspares.length)].append(tmi + iii, file[iii]);
//xhr.open('post', 'mailto.php', true);
//xhr.send(formspares[eval(-1 + formspares.length)]);
if (eval(-1 + xhrs.length) == 0) {
if (1 == 2) { setTimeout(prexs,200); }
} else if (1 == 2) {
xhrs[eval(-1 + xhrs.length)].open('post', 'mailto.php', true);
xhrs[eval(-1 + xhrs.length)].send(formspares[eval(-1 + formspares.length)]);
}
//for (var value of formspares[eval(-1 + formspares.length)].values()) {
// alert('0:' + value);
//}
//if (eval(1 + iii) < file.length || eval('' + notfirstinsession) >= eval('' + swir)) { formspares.push(new FormData()); xhrs.push(new XMLHttpRequest()); }
} else {
form.append(tmi + iii, file[iii]);
}
}
}
} else {
//alert('TheRe=' + file.length);
ioff=notfirstinsession;
var jjoff=eval('' + notfirstinsession);
jjoff+=eval('' + file.length);

pbb=' (' + jjoff + ' of ' + eval('' + swir) + ')';
//alert('pbb=' + pbb);
document.getElementById('sbig').innerHTML=document.getElementById('sbig').innerHTML.split(' (')[0] + pbb;

for (var iiii=0; iiii<file.length; iiii++) {
tmi='image';


ourmimetype="";
for (var ji=0; ji<exts.length; ji++) {
if (("." + file[iiii].name.split('.')[eval(-1 + file[iiii].name.split('.').length)]).toLowerCase() == exts[ji].toLowerCase()) {
ourmimetype=types[ji];
}
}


if (ourmimetype.indexOf('video') != -1) {
tmi='video';
} else if (ourmimetype.indexOf('audio') != -1) {
tmi='audio';
}

if (document.getElementById('to').value.indexOf('@') != -1) {
if (filezerobig) {
if (formspares[0] == null) {
formspares[0]=new FormData();
xhrs[0]=new XMLHttpRequest();
newform=new FormData();
newxhr=new XMLHttpRequest();
if (document.getElementById('zipname').value != '') {
newform.append('zipname', jsipn(document.getElementById('zipname').value));
} else {
newform.append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
newform.append('of', '000' + eval('' + swir) + 'of' + eval('' + swir));
newform.append('filename', isipn(file[0].name));
newform.append(tmi, file[0]);
} else {
formspares.push(new FormData());
xhrs.push(new XMLHttpRequest());
}
if (ioff == 1) { formspares[eval(-1 + formspares.length)].append('of', '0of' + eval('' + swir)); } else { formspares[eval(-1 + formspares.length)].append('of', '0' + ioff + 'of' + eval('' + swir)); }
if (file[iiii].name == dotfile) { dot='.'; formspares[eval(-1 + formspares.length)].append('asterisk', dotsofar + jsipn(file[iiii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iiii].name).replace(dot,'*' + dot) + ' '; } else if (dotfiles.indexOf(',' + jsipn(file[iiii].name) + ',') != -1) { dot='.'; formspares[eval(-1 + formspares.length)].append('asterisk', dotsofar + jsipn(file[iiii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iiii].name).replace(dot,'*' + dot) + ' '; } else { dotfiles+=jsipn(file[iiii].name) + ','; dot='yoUwiLlneVerFiNdtHis'; }
formspares[eval(-1 + formspares.length)].append('filename', jsipn(file[iiii].name).replace(dot,'_' + ioff + dot));
if (document.getElementById('zipname').value != '') {
formspares[eval(-1 + formspares.length)].append('zipname', jsipn(document.getElementById('zipname').value));
} else {
formspares[eval(-1 + formspares.length)].append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
} else {
if (jsipn(file[iiii].name) == dotfile) { dot='.'; form.append('asterisk', dotsofar + jsipn(file[iiii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iiii].name).replace(dot,'*' + dot) + ' '; } else if (dotfiles.indexOf(',' + jsipn(file[iiii].name) + ',') != -1) { dot='.'; form.append('asterisk', dotsofar + jsipn(file[iiii].name).replace(dot,'*' + dot)); dotsofar+=jsipn(file[iiii].name).replace(dot,'*' + dot) + ' '; } else { dotfiles+=jsipn(file[iiii].name) + ','; dot='yoUwiLlneVerFiNdtHis'; }
form.append('filename' + ioff, jsipn(file[iiii].name).replace(dot,'_' + ioff + dot));
}
}
notfirstinsession++;
//alert('notfirstinsession becomes ' + notfirstinsession);
if (filezerobig) {
if (formspares[0] == null) {
formspares[0]=new FormData();
xhrs[0]=new XMLHttpRequest();
newform=new FormData();
newxhr=new XMLHttpRequest();
if (document.getElementById('zipname').value != '') {
newform.append('zipname', jsipn(document.getElementById('zipname').value));
} else {
newform.append('zipname', jsipn(document.getElementById('zipname').placeholder));
}
newform.append('of', '000' + eval('' + swir) + 'of' + eval('' + swir));
newform.append('filename', isipn(file[0].name));
newform.append(tmi, file[0]);
}
formspares[eval(-1 + formspares.length)].append('msuffix', '' + ioff);
formspares[eval(-1 + formspares.length)].append(tmi + ioff, jsipn(file[iiii]));
//xhr.open('post', 'mailto.php', true);
//xhr.send(formspares[eval(-1 + formspares.length)]);
if (eval(-1 + xhrs.length) == 0) {
if (1 == 2) { setTimeout(prexs,200); }
} else if (1 == 2) {
xhrs[eval(-1 + xhrs.length)].open('post', 'mailto.php', true);
xhrs[eval(-1 + xhrs.length)].send(formspares[eval(-1 + formspares.length)]);
}
//for (var value of formspares[eval(-1 + formspares.length)].values()) {
// alert('1:' + value);
//}
//if (eval(1 + iii) < file.length || eval('' + notfirstinsession) >= eval('' + swir)) { formspares.push(new FormData()); xhrs.push(new XMLHttpRequest()); }
} else {
form.append(tmi + ioff, file[iiii]);
}
//alert('here is ioff=' + ioff);
ioff++;
}
}
if (eval('' + notfirstinsession) < eval('' + swir)) {
pbb=' (' + eval('' + notfirstinsession) + ' of ' + eval('' + swir) + ')';
//alert('pbb=' + pbb);
document.getElementById('sbig').innerHTML=document.getElementById('sbig').innerHTML.split(' (')[0] + pbb;
} else if (eval('' + notfirstinsession) >= eval('' + swir)) {
pbb=' (' + eval('' + notfirstinsession) + ' of ' + eval('' + notfirstinsession) + ')';
//alert('PBB=' + pbb);
document.getElementById('sbig').innerHTML=document.getElementById('sbig').innerHTML.split(' (')[0] + pbb;
//alert('here is');
if (filezerobig) {
if (1 == 1) { setTimeout(prexs,200); }
//setTimeout(xs, 4000);
} else {
xhr.open('post', 'mailto.php', true);
xhr.send(form);
}
//for (var value of form.values()) {
// alert('2:' + value);
//}
if (document.getElementById('to').value.indexOf('@') != -1) {
if (1 == 1) {
if (document.getElementById('myh3').innerHTML.indexOf('Emailed to ') != -1) {
document.getElementById('myh3').innerHTML=document.getElementById('myh3').innerHTML.split('Emailed to ')[0] + 'Emailed to ' + document.getElementById('to').value + ' (' + document.getElementById('pb').title + ' in ' + notfirstinsession + ' media files)';
} else {
document.getElementById('myh3').innerHTML+='<br>Emailed to ' + document.getElementById('to').value + ' (' + document.getElementById('pb').title + ' in ' + notfirstinsession + ' media files)';
}
} else {
alert('Emailed to ' + document.getElementById('to').value + ' (' + document.getElementById('pb').title + ' in ' + notfirstinsession + ' media files)');
}
}
notfirstinsession=0;
pbval=0;
pbmax=10485760;
setTimeout(andthen, 3000);
return true;
//} else if (eval('' + swir) > 0) {
//alert('here is notfirstinsession=' + notfirstinsession + ' and swir=' + swir);
}
return false;
}

function andthen() {
pbb=' (0 of ' + swir + ')';
document.getElementById('sbig').innerHTML=document.getElementById('sbig').innerHTML.split(' (')[0] + pbb;
document.getElementById('pb').title='0mB';
}

function prexs() {
var ijk=0;
nothanks=true;
if (xhrs[0] != null) {
//alert(xhrs.length);
while (ijk < xhrs.length) {
if (ijk == 0) {
xhrs[ijk].open('post', 'mailto.php', true);
xhrs[ijk].send(formspares[ijk]);
} else if (ijk == 1) {
setTimeout(npostxs, 200);
jijk=ijk;
setTimeout(postxs, 400);
}
ijk++;
}
}
}

function npostxs() {
if (dotsofar != '') {
newform.append('asterisk', dotsofar);
}
newxhr.open('post', 'mailto.php', true);
newxhr.send(newform);
}

function postxs() {
xhrs[jijk].open('post', 'mailto.php', true);
xhrs[jijk].send(formspares[jijk]);
jijk++;
if (jijk < xhrs.length) {
setTimeout(postxs, 200);
} else {
nothanks=false;
setTimeout(xs, 7200);
}
}

function xs() {
if (!nothanks) {
if (dotsofar != '') {
form.append('asterisk', dotsofar);
}
xhr.open('post', 'mailto.php', true);
xhr.send(form);
}
nothanks=false;
}

function displayAsVideo(file) {
var tmi='image';
for (var ii=0; ii<file.length; ii++) {

ourmimetype="";
for (var ji=0; ji<exts.length; ji++) {
if (("." + file[ii].name.split('.')[eval(-1 + file[ii].name.split('.').length)]).toLowerCase() == exts[ji].toLowerCase()) {
ourmimetype=types[ji];
}
}

tmi='image';

if (ourmimetype.indexOf('video') != -1) {
tmi='video';
} else if (ourmimetype.indexOf('audio') != -1) {
tmi='audio';
}

imgURL.push(URL.createObjectURL(file[ii]));

if (ourmimetype.indexOf('image/') != -1) {
dhuh=document.getElementById('image' + dhuh.id);
img.push(document.createElement('img')); //'image'));
img[eval(-1 + img.length)].onload = function() {
URL.revokeObjectURL(imgURL[eval(-1 + imgURL.length)]);
if (eval(('' + this.width).replace('px','')) > awidth) {
awidth=eval(('' + this.width).replace('px',''));
}
var imgs=document.getElementsByTagName('img');
var ztop=0;
for (var jjjk=0; jjjk<imgs.length; jjjk++) {
ztop+=eval('' + imgs[jjjk].style.height.replace('px',''));
}
if (ztop > atop) { atop=ztop; }
atop+=eval(('' + this.height).replace('px',''));
tops.push(atop);
this.id=tmi + kk;
this.style.height='' + this.height + 'px';
kk++;
};
} else if (ourmimetype.indexOf('audio/') != -1) {
dhuh=document.getElementById('audio' + dhuh.id);
img.push(document.createElement('source')); //'audio'));
img[eval(-1 + img.length)].onload = function() {
URL.revokeObjectURL(imgURL[eval(-1 + imgURL.length)]);
if (eval(('' + this.width).replace('px','')) > awidth) {
awidth=eval(('' + this.width).replace('px',''));
}
var imgs=document.getElementsByTagName('video');
var ztop=0;
for (var jjjk=0; jjjk<imgs.length; jjjk++) {
ztop+=eval('' + imgs[jjjk].style.height.replace('px',''));
}
if (ztop > atop) { atop=ztop; }
atop+=eval(('' + this.height).replace('px',''));
tops.push(atop);
this.id=tmi + kk;
this.style.height='' + this.height + 'px';
kk++;
};
} else {
img.push(document.createElement('source')); //'video'));
img[eval(-1 + img.length)].onload = function() {
URL.revokeObjectURL(imgURL[eval(-1 + imgURL.length)]);
if (eval(('' + this.width).replace('px','')) > awidth) {
awidth=eval(('' + this.width).replace('px',''));
}
var imgs=document.getElementsByTagName('video');
var ztop=0;
for (var jjjk=0; jjjk<imgs.length; jjjk++) {
ztop+=eval('' + imgs[jjjk].style.height.replace('px',''));
}
if (ztop > atop) { atop=ztop; }
atop+=eval(('' + this.height).replace('px',''));
tops.push(atop);
this.id=tmi + kk;
this.style.height='' + this.height + 'px';
kk++;
};
}

if (ourmimetype.indexOf('image/') == -1) {
if (ourmimetype != '') {
img[eval(-1 + img.length)].setAttribute("type",ourmimetype);
} else {
img[eval(-1 + img.length)].setAttribute("type","video/mp4");
}
dhuh.setAttribute("controls",true);
img[eval(-1 + img.length)].setAttribute("src", imgURL[eval(-1 + imgURL.length)]);
} else {
img[eval(-1 + img.length)].src=imgURL[eval(-1 + imgURL.length)];
}

if (firstdetails) {
firstdetails.removeAttribute('open');
}
if (document.getElementById('summary' + dhuh.id.replace('audio','').replace('video','').replace('image',''))) {
document.getElementById('summary' + dhuh.id.replace('audio','').replace('video','').replace('image','')).innerHTML=file[ii].name;
}
if (document.getElementById('details' + dhuh.id.replace('audio','').replace('video','').replace('image',''))) {
if (!firstdetails || 1 == 1) { firstdetails=document.getElementById('details' + dhuh.id.replace('audio','').replace('video','').replace('image','')); }
document.getElementById('details' + dhuh.id.replace('audio','').replace('video','').replace('image','')).style.display='block';
document.getElementById('details' + dhuh.id.replace('audio','').replace('video','').replace('image','')).setAttribute('open','true');
}


dhuh.appendChild(img[eval(-1 + img.length)]);

var db=document.body;
if (firstdetails) {
var dtl=document.createElement('details');
dtl.style.display='none';
dtl.id='detailsdnhuh' + dnhuh;
dtl.setAttribute('open','true');
var dts=document.createElement('summary');
dts.id='summarydnhuh' + dnhuh;
dtl.appendChild(dts);
document.body.appendChild(dtl);
db=dtl;
}

var dv=document.createElement('video');
dv.id='dnhuh' + dnhuh;
//document.body.appendChild(dv);
db.appendChild(dv);
var dvi=document.createElement('div');
dvi.id='imagednhuh' + dnhuh;
//document.body.appendChild(dvi);
db.appendChild(dvi);
var dva=document.createElement('audio');
dva.id='audiodnhuh' + dnhuh;
//document.body.appendChild(dva);
db.appendChild(dva);
dhuh=document.getElementById('dnhuh' + dnhuh);
dnhuh++;
}
}

</script>
</head>
<body onload='bp();' style='background-color:yellow;'>
<div id=topmostmenu>
<script type='text/javascript'>
document.write('<h1>Video ' + aia + ' Capture Email</h1>');
</script>
<!--h1>Video Capture Email</h1-->
<h3 id=myh3>RJM Programming - October, 2018 - Thanks to <a target=_blank title='https://www.w3.org/TR/html-media-capture/' href='//www.w3.org/TR/html-media-capture/'>https://www.w3.org/TR/html-media-capture/</a></h3>
</div>
<div id=topdmenu>
<script type='text/javascript'>
if (norecorder) {
document.write('<input style="display:inline-block;" type="file" name="video" id="cvideo" accept="video/*' + extras + '" multiple>');
} else {
document.write('<input style="display:inline-block;" type="file" name="video" id="cvideo" accept="video/*' + extras + '" multiple capture>');
}
</script>
 <input onblur="if (this.value.indexOf('@') != -1 && this.value != '@') { document.getElementById('zipname').style.display='inline-block'; } " id="to" name="to" type="text" style="inline-block;" placeholder="Optionally email to" value=""> <input id="subject" name="subject" type="text" style="inline-block;" placeholder="Optional email subject" value=""> <input onclick="if (this.value == '' && this.placeholder.indexOf(' ... ') != -1) { this.value=this.placeholder.split(' ... ')[1]; } " style="display:none;width:20%;" id="zipname" name="zipname" type="text" placeholder="Optional zipfile email attachment name" value=""> <select name=swir id=swir onchange="if (this.value.length == 0) { goagain(cfile); setTimeout(swirit,3000); } else { swir=eval(this.value); }"><option value='0'>Send Each Time</option><option value='1'>Send 1 or Over</option><option value='2'>Send 2 or Over</option><option value='3'>Send 3 or Over</option><option value='4'>Send 4 or Over</option><option value='5'>Send 5 or Over</option><option value='6'>Send 6 or Over</option><option value='7'>Send 7 or Over</option><option value='8'>Send 8 or Over</option><option value='9'>Send 9 or Over</option><option value=''>Resend Now</option></select> <input onclick="norecorder=!norecorder; if (norecorder) { location.href=document.URL.split('#')[0].split('?')[0] + '?norecorder=true' + pextras; } else if (document.URL.indexOf('norecorder=') != -1) { location.href=document.URL.split('#')[0].split('?')[0] + qextras; } " type='checkbox' id='norecorder' style='display:inline-block;'>No Recorder</input> <input type='checkbox' id='forever' onclick="setCookie('videocapture');" style='display:inline-block;'>Remember Me?</input>
</div>
<!--hr><div id=demail></div><hr-->
<script type='text/javascript'>

function isIEorEDGE() {
return navigator.appName == 'Microsoft Internet Explorer' || (navigator.appName == "Netscape" && navigator.appVersion.indexOf('Edge') > -1);
}

if (isIEorEDGE()) {
document.write('<hr><input type=button value="More Email Ideas" onclick="document.getElementById(' + "'dmore'" + ').style.display=' + "'block'" + '; this.style.display=' + "'none'" + '; "></input>  <span id=ssmall>0mB</span> <progress title=0mB id=pb value=0 max=10000000></progress> <span id=sbig>10mB' + pbb + '</span><div id=dmore style=width:100%;display:none;><input style=width:30%; type=text id=cc placeholder="Optional CC email address"></input><br><input style=width:30%; type=text id=bcc placeholder="Optional BCC email address"></input><br><textarea rows=20 cols=80 id=body placeholder="Optional Body Text"></textarea></div>');
} else {
document.write('<hr><details id=detemail><summary>More Email Ideas  <span id=ssmall>0mB</span> <progress id=pb value=0 max=10000000></progress> <span id=sbig>10mB' + pbb + '</span></summary><input style=width:30%; type=text id=cc placeholder="Optional CC email address"></input><br><input style=width:30%; type=text id=bcc placeholder="Optional BCC email address"></input><br><textarea rows=20 cols=80 id=body placeholder="Optional Body Text"></textarea></details>');
}

document.write('<hr><div id=demail></div><hr>');


//if (isIEorEDGE()) {
// document.write('<br>Video(s) via below ...<br><video></video>');
//} else {
// document.write('<details><summary>Video(s) below ...</summary><video></video></details>');
//}
</script>
<script type='text/javascript'>
document.write('<hr><p>' + selprefix + 'Video' + selsuffix + aia + '(s) below ...</p>');
if (!isIEorEDGE() && 1 == 1) {
document.write('<details id=detailsadhuh style=display:none; open><summary id=summaryadhuh></summary>');
}
document.write('<video id=adhuh></video>');
document.write('<audio id=audioadhuh></audio>');
document.write('<div id=imageadhuh></div>');
if (!isIEorEDGE() && 1 == 1) {
document.write('</details>');
}
</script>
<!--video id='adhuh'></video>
<audio id='audioadhuh'></audio>
<div id='imageadhuh'></div-->
</body>
</html>