<!doctype html>
<html>
<head>
<title>Merge Photos - RJM Programming - July, 2017</title>
<script type='text/javascript'>
// https://authorjulieglover.files.wordpress.com/2011/05/obama2527sdoppelganger.jpg
var what=0, elem=[null,null,null], context=[null,null], cwo=[null,null,null], nwidth=[0,0], nheight=[0,0];
var fone='i1', is_partly_composite=false;
var db='',my_h1='',my_h3='',my_h4='';
var timero=null, wo=null;
var lastoid='';
var doit=true;
var cropping=0;
var which=0;
var widths=[0,0];
var heights=[0,0];
var lefts=[0,0];
var tops=[0,0];
var prevlefttwo=0, lefttwo=0, opacity=1.0, next=3;
var imageo=[], iois;
var images=[(location.search.split('image1=')[1] ? decodeURIComponent(location.search.split('image1=')[1].split('&')[0]) : 'IMG_0085.JPG'),(location.search.split('image2=')[1] ? decodeURIComponent(location.search.split('image2=')[1].split('&')[0]) : 'IMG_0086.JPG')];
var qm="?";
if (document.URL.indexOf('?image12') != -1 || document.URL.indexOf('&image12') != -1) { // doppelganger image logic
is_partly_composite=true;
cropping=2;
if (document.URL.indexOf('&image12') != -1) qm="&";
var huhc='image12';
while (document.URL.indexOf(qm + huhc + eval(1 + cropping)) != -1) {
cropping++;
huhc+='' + cropping;
}
//alert(huhc);
var oneimage=(location.search.split(huhc + '=')[1] ? decodeURIComponent(location.search.split(huhc + '=')[1].split('&')[0]) : '');
for (iois=0; iois<cropping; iois++) {
if (iois < 2) {
images[iois]=oneimage;
} else {
images.push(oneimage);
widths.push(0);
heights.push(0);
lefts.push(0);
tops.push(0);
next=eval(2 + iois);
}
}
}
while ('' != (location.search.split('image' + next + '=')[1] ? decodeURIComponent(location.search.split('image' + next + '=')[1].split('&')[0]) : '')) {
images.push((location.search.split('image' + next + '=')[1] ? decodeURIComponent(location.search.split('image' + next + '=')[1].split('&')[0]) : ''));
widths.push(0);
heights.push(0);
lefts.push(0);
tops.push(0);
next++;
}
for (iois=1; iois<next; iois++) {
imageo.push(new Image());
imageo[eval(-1 + iois)].index=eval(-1 + iois);
imageo[eval(-1 + iois)].crop=cropping;
imageo[eval(-1 + iois)].src=images[eval(-1 + iois)];
}
//alert('cropping=' + cropping + ' ... next=' + next);
dowhich();
function andtwo() {
document.getElementById('top_less').innerHTML='';
document.getElementById('top_more').innerHTML='';
document.getElementById('left_less').innerHTML='';
document.getElementById('left_more').innerHTML='';
document.getElementById('opacity_less').innerHTML='';
document.getElementById('opacity_more').innerHTML='';
}
function andt() {
lastoid='';
}
function doitf(oid) {
var i;
if (oid == 'opacity-') {
opacity-=0.05;
for (i=1; i<=imageo.length; i++) {
if (document.getElementById('di' + i)) document.getElementById('di' + i).style.opacity=opacity;
document.getElementById('i' + i).style.opacity=opacity;
}
} else if (oid == 'opacity+') {
opacity+=0.05;
for (i=1; i<=imageo.length; i++) {
if (document.getElementById('di' + i)) document.getElementById('di' + i).style.opacity=opacity;
document.getElementById('i' + i).style.opacity=opacity;
}
} else if (oid == '-') {
lefts[0]-=3;
if (document.getElementById('di1')) document.getElementById('di1').style.left='' + lefts[0] + 'px';
document.getElementById('i1').style.left='' + lefts[0] + 'px';
} else if (oid == '+') {
lefts[0]+=3;
if (document.getElementById('di1')) document.getElementById('di1').style.left='' + lefts[0] + 'px';
document.getElementById('i1').style.left='' + lefts[0] + 'px';
} else if (oid == ' ') {
lastoid='x';
} else if (oid == '') {
if (lastoid == '') {
tops[0]-=3;
if (document.getElementById('di1')) document.getElementById('di1').style.top='' + tops[0] + 'px';
document.getElementById('i1').style.top='' + tops[0] + 'px';
} else {
lastoid='';
}
} else if (('*' + oid + '*').indexOf('i1*') != -1) {
lastoid=oid;
tops[0]+=3;
if (document.getElementById('d' + oid)) document.getElementById('d' + oid).style.top='' + tops[0] + 'px';
document.getElementById(oid).style.top='' + tops[0] + 'px';
setTimeout(andt,1000);
//document.title='here' + tops[0] + 'px';
if (document.body.innerHTML.indexOf('to' + 'p_less') == -1) {
document.body.innerHTML+='<a id="top_less" onclick="doitf(' + "''" + ');" style="position:absolute;top:0;left:0;z-index:9;cursor:pointer;text-decoration:none;">^</a><a id="top_more" onclick="doitf(' + "'i1'" + ');" style="position:absolute;top:0;left:30px;z-index:9;cursor:pointer;text-decoration:none;">v</a><a id="left_less" onclick="doitf(' + "'-'" + ');" style="position:absolute;top:0;left:60px;z-index:9;cursor:pointer;text-decoration:none;"><</a><a id="left_more" onclick="doitf(' + "'+'" + ');" style="position:absolute;top:0;left:90px;z-index:9;cursor:pointer;text-decoration:none;">></a><a id="opacity_less" onclick="doitf(' + "'opacity-'" + ');" style="position:absolute;top:0;left:120px;z-index:9;cursor:pointer;text-decoration:none;">-</a><a id="opacity_more" onclick="doitf(' + "'opacity+'" + ');" style="position:absolute;top:0;left:150px;z-index:9;cursor:pointer;text-decoration:none;">+</a>';
setTimeout(andtwo,30000);
}
} else {
lastoid='';
if (document.body.innerHTML.indexOf('to' + 'p_less') == -1) {
document.body.innerHTML+='<a id="top_less" onclick="doitf(' + "''" + ');" style="position:absolute;top:0;left:0;z-index:9;cursor:pointer;text-decoration:none;">^</a><a id="top_more" onclick="doitf(' + "'i1'" + ');" style="position:absolute;top:0;left:30px;z-index:9;cursor:pointer;text-decoration:none;">v</a><a id="left_less" onclick="doitf(' + "'-'" + ');" style="position:absolute;top:0;left:60px;z-index:9;cursor:pointer;text-decoration:none;"><</a><a id="left_more" onclick="doitf(' + "'+'" + ');" style="position:absolute;top:0;left:90px;z-index:9;cursor:pointer;text-decoration:none;">></a><a id="opacity_less" onclick="doitf(' + "'opacity-'" + ');" style="position:absolute;top:0;left:120px;z-index:9;cursor:pointer;text-decoration:none;">-</a><a id="opacity_more" onclick="doitf(' + "'opacity+'" + ');" style="position:absolute;top:0;left:150px;z-index:9;cursor:pointer;text-decoration:none;">+</a>';
setTimeout(andtwo,30000);
}
doit=false;
}
}
function dowhich() {
if (eval(0 + which) < imageo.length) {
//alert(images[what]);
imageo[which].onerror = function () {
window.setTimeout(dowhich, 8);
};
imageo[which].onload = function () {
var xoff=0.0;
if (this.crop > 0 && this.crop >= this.index) {
widths[this.index] = eval((('' + this.width).replace('px','')) / this.crop); // or 'width' if you want a special/scaled size
heights[this.index] = ('' + this.height).replace('px',''); // or 'height' if you want a special/scaled size
prevlefttwo=lefttwo;
lefts[this.index] = prevlefttwo;
lefttwo+=eval('' + widths[this.index]);
if (this.index > 0) {
for (var ij=0; ij<this.index; ij++) {
xoff+=eval(widths[ij]); //eval(100.0 / this.crop);
}
}
//alert('<div onclick="doitf(this.id);" id="di' + eval(1 + this.index) + '" style="overflow:hidden;position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + ';background:url(' + images[this.index] + ');background-repeat:repeat;background-position: -' + eval(0 + Math.floor(xoff)) + 'px 0px;"></div>');
document.body.innerHTML+='<div onclick="doitf(this.id);" id="di' + eval(1 + this.index) + '" style="overflow:hidden;position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + ';background:url(' + images[this.index] + ');background-repeat:repeat;background-position: -' + eval(0 + Math.floor(xoff)) + 'px 0px;"></div>';
document.body.innerHTML+='<img onclick="doitf(this.id);" id="i' + eval(1 + this.index) + '" src="' + images[this.index] + '" style="display:none;position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + '"></img>';
//db+='<div onclick="doitf(this.id);" id="i' + eval(1 + this.index) + '" style="overflow:hidden;position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + ';background:url(' + images[this.index] + ');background-position: ' + Math.floor(xoff) + 'px 0px;"></div>';
//document.title+=which + ' . ' + imageo.length + ' +-+ ' + this.index + ' .-. ' + db;
} else {
//document.title+=' here ' + next + ' = ';
widths[this.index] = ('' + this.width).replace('px',''); // or 'width' if you want a special/scaled size
heights[this.index] = ('' + this.height).replace('px',''); // or 'height' if you want a special/scaled size
prevlefttwo=lefttwo;
lefts[this.index] = prevlefttwo;
lefttwo+=eval('' + widths[this.index]);
//document.title=lefttwo;
document.body.innerHTML+='<img onclick="doitf(this.id);" id="i' + eval(1 + this.index) + '" src="' + images[this.index] + '" style="position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + '"></img>';
//db+='<img onclick="doitf(this.id);" id="i' + eval(1 + this.index) + '" src="' + images[this.index] + '" style="position:absolute;top:' + tops[this.index] + 'px;left:' + lefts[this.index] + 'px;width:' + widths[this.index] + 'px;height:' + heights[this.index] + 'px;opacity:' + opacity + '"></img>';
//document.title+=which + ' . ' + imageo.length + ' +++ ' + this.index + ' ... ' + db;
}
dowhich();
//setTimeout(dowhich, 8);
};
imageo[which].src = images[which];
which++;
//alert(which);
//setTimeout(dowhich, 8000);
} else {
lefttwo=prevlefttwo;
//alert(db);
document.body.innerHTML+=db;
db='';
setTimeout(creep,1500);
}
}
function creep() {
var inext, ourlt=0, offset=0;
if (what == 0) {
nheight[what]=Math.max(eval(eval(1 * tops[0]) + eval(heights[0])), eval(eval(1 * tops[eval(-1 + tops.length)]) + eval(heights[eval(-1 + heights.length)])));
nwidth[what]=Math.max(eval(eval(1 * lefts[0]) + eval(widths[0])), eval(eval(1 * lefts[eval(-1 + lefts.length)]) + eval(widths[eval(-1 + widths.length)])));
document.body.innerHTML+='<canvas id="mycanvas0" style="display:none;z-index:-1;position:absolute;top:0;left:0px;width:' + nwidth[what] + 'px;height:' + nheight[what] + 'px;" width=' + nwidth[what] + ' height=' + nheight[what] + '></canvas>';
elem[what] = document.getElementById('mycanvas0');
context[what] = elem[what].getContext('2d');
for (var ii=1; ii<=next; ii++) {
if (document.getElementById('i' + ii)) {
context[what].globalAlpha = eval(document.getElementById('i' + ii).style.opacity);
context[what].drawImage(document.getElementById('i' + ii), eval(document.getElementById('i' + ii).style.left.replace('px','')), eval(document.getElementById('i' + ii).style.top.replace('px','')), eval(document.getElementById('i' + ii).style.width.replace('px','')), eval(document.getElementById('i' + ii).style.height.replace('px','')));
if (document.URL.indexOf('immediately=') != -1) {
if (document.getElementById('di' + ii)) {
document.getElementById('di' + ii).style.opacity=0.3;
document.getElementById('di' + ii).style.left='0px';
}
document.getElementById('i' + ii).style.opacity=0.3;
document.getElementById('i' + ii).style.left='0px';
}
}
}
if (document.URL.indexOf('immediately=') != -1) lefttwo=0;
what++;
}
if (db != '') {
document.body.innerHTML+=db;
db='';
}
if (lefttwo <= eval(widths[0] / 100.0)) {
if (doit) {
lefttwo=0;
opacity=0.3;
document.getElementById('i1').style.opacity=opacity;
for (inext=eval(-1 + next); inext>=2; inext--) {
if (document.getElementById('di' + inext)) {
document.getElementById('di' + inext).style.left=lefttwo + 'px';
document.getElementById('di' + inext).style.opacity=opacity;
}
document.getElementById('i' + inext).style.left=lefttwo + 'px';
document.getElementById('i' + inext).style.opacity=opacity;
}
}
dorest();
} else {
if (doit) {
for (inext=eval(-1 + next); inext>=2; inext--) {
if (inext == eval(-1 + next)) {
lefttwo-=eval(prevlefttwo / 100.0);
opacity-=eval(0.7 / 100.0);
if (document.getElementById('di1')) document.getElementById('di1').style.opacity=opacity;
document.getElementById('i1').style.opacity=opacity;
if (document.getElementById('di' + inext)) {
document.getElementById('di' + inext).style.left=lefttwo + 'px';
document.getElementById('di' + inext).style.opacity=opacity;
}
document.getElementById('i' + inext).style.left=lefttwo + 'px';
document.getElementById('i' + inext).style.opacity=opacity;
offset+=widths[eval(-1 + inext)];
} else {
ourlt=(0 - eval(lefts[eval(-1 + inext)] / 100.0));
//alert(ourlt + ' ... ' + inext + ' ... ' + document.getElementById('i' + inext).style.left.replace('px',''));
if (document.getElementById('di' + inext)) {
document.getElementById('di' + inext).style.left=eval(ourlt + eval(document.getElementById('di' + inext).style.left.replace('px',''))) + 'px';
document.getElementById('di' + inext).style.opacity=opacity;
}
document.getElementById('i' + inext).style.left=eval(ourlt + eval(document.getElementById('i' + inext).style.left.replace('px',''))) + 'px';
document.getElementById('i' + inext).style.opacity=opacity;
}
}
setTimeout(creep, 200);
} else {
dorest();
}
}
}
function retitle(newTitle) { // thanks to https://stackoverflow.com/questions/7501424/set-title-in-the-window-popup
if (newTitle.indexOf(' minute') != -1) {
for (var icwo=0; icwo<2; icwo++) {
if (cwo[icwo]) {
if (cwo[icwo].document.readyState == 'loading' || cwo[icwo].document.readyState == 'complete') {
cwo[icwo].document.title=newTitle;
newTitle=newTitle.replace(' original',' final');
}
}
}
} else {
if (wo.document.readyState == 'loading' || wo.document.readyState == 'complete') {
wo.document.title=newTitle;
window.clearInterval(timero);
}
}
}
function copytocanvas() {
var mwidth=Math.max(eval(eval(1 * lefts[0]) + eval(widths[0])), eval(eval(1 * lefts[eval(-1 + lefts.length)]) + eval(widths[eval(-1 + widths.length)])));
var mheight=Math.max(eval(eval(tops[0]) + eval(tops[0])), eval(eval(tops[eval(-1 + tops.length)]) + eval(heights[eval(-1 + heights.length)])));
var bodyih=document.body.innerHTML;
if (1 == 1) {
wo=window.open("","_blank","top=50,left=50,width=" + mwidth + ",height=" + mheight);
timero=window.setInterval("retitle('Select All/Copy here ready for Email Body paste')", 10);
wo.document.write("<html><head><style> * { cursor:none; } </style></head><body>" + (bodyih.split('<h1')[0] + document.getElementById('myh1').outerHTML.split('>')[0] + "> </h1>" + bodyih.split('</h4>')[1]).replace('>><','><').replace('><<','><').replace('>-<','><').replace('>v<','><').replace('>^<','><').replace('>+<','><') + "</body></html>");
} else { // didn't work for us, but thanks to https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas
//alert(mheight + ' ... ' + mwidth);
document.body.innerHTML+='<canvas id="canvas" width="' + mwidth + '" height="' + mheight + '" style="border:2px solid yellow;position:absolute;top:0px;left:0px;"></canvas>';
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var data = '<svg xmlns="http://www.w3.org/2000/svg" width="' + mwidth + '" height="' + mheight + '">' +
'<foreignObject width="' + mwidth + '" height="' + mheight + '">' +
'<div xmlns="http://www.w3.org/1999/xhtml" style="font-size:40px">' +
bodyih +
'</div>' +
'</foreignObject>' +
'</svg>';
//alert(data);
var DOMURL = window.URL || window.webkitURL || window;
var img = new Image();
var svg = new Blob([data], {type: 'image/svg+xml'});
var url = DOMURL.createObjectURL(svg);
img.onload = function() {
ctx.drawImage(img, 0, 0);
DOMURL.revokeObjectURL(url);
}
img.src = url;
location.href='#canvas';
}
}
function hgoes(offon) {
if (offon == 0) {
//alert(1);
my_h1=document.getElementById('myh1').innerHTML;
my_h3=document.getElementById('myh3').innerHTML;
my_h4=document.getElementById('myh4').innerHTML;
document.getElementById('myh1').innerHTML=' ';
document.getElementById('myh3').innerHTML='';
document.getElementById('myh4').innerHTML='';
andtwo();
//alert(2);
setTimeout("hgoes(1)", 7000);
//alert(3);
} else {
document.getElementById('myh1').innerHTML=my_h1;
document.getElementById('myh3').innerHTML=my_h3;
document.getElementById('myh4').innerHTML=my_h4;
document.getElementById('top_less').innerHTML='^';
document.getElementById('top_more').innerHTML='v';
document.getElementById('left_less').innerHTML='<';
document.getElementById('left_more').innerHTML='>';
document.getElementById('opacity_less').innerHTML='-';
document.getElementById('opacity_more').innerHTML='+';
}
}
function dorest() {
nheight[what]=Math.max(eval(eval(0 * tops[0]) + eval(heights[0])), eval(eval(0 * tops[eval(-1 + tops.length)]) + eval(heights[eval(-1 + heights.length)])));
nwidth[what]=Math.max(eval(eval(0 * lefts[0]) + eval(widths[0])), eval(eval(0 * lefts[eval(-1 + lefts.length)]) + eval(widths[eval(-1 + widths.length)])));
if (document.body.innerHTML.indexOf('to' + 'p_less') == -1) {
document.body.innerHTML+='<a id="top_less" onclick="doitf(' + "''" + ');" style="position:absolute;top:0;left:0;z-index:9;cursor:pointer;text-decoration:none;">^</a><a id="top_more" onclick="doitf(' + "'i1'" + ');" style="position:absolute;top:0;left:30px;z-index:9;cursor:pointer;text-decoration:none;">v</a><a id="left_less" onclick="doitf(' + "'-'" + ');" style="position:absolute;top:0;left:60px;z-index:9;cursor:pointer;text-decoration:none;"><</a><a id="left_more" onclick="doitf(' + "'+'" + ');" style="position:absolute;top:0;left:90px;z-index:9;cursor:pointer;text-decoration:none;">></a><a id="opacity_less" onclick="doitf(' + "'opacity-'" + ');" style="position:absolute;top:0;left:120px;z-index:9;cursor:pointer;text-decoration:none;">-</a><a id="opacity_more" onclick="doitf(' + "'opacity+'" + ');" style="position:absolute;top:0;left:150px;z-index:9;cursor:pointer;text-decoration:none;">+</a>';
setTimeout(andtwo,30000);
}
document.body.innerHTML+='<canvas id="mycanvas" style="display:none;z-index:-1;position:absolute;top:0;left:0px;width:' + nwidth[what] + 'px;height:' + nheight[what] + 'px;" width=' + nwidth[what] + ' height=' + nheight[what] + '></canvas>';
//nwidth[what]+=4;
document.body.innerHTML+='<h1 id="myh1" style="position:absolute;top:0;left:' + eval(4 + nwidth[what]) + 'px;width:100%;">Merging Photos</h1><h3 id="myh3" style="position:absolute;top:40px;left:' + nwidth[what] + 'px;width:100%;">RJM Programming - August, 2017</h3><h4 id="myh4" style="position:absolute;top:100px;left:' + nwidth[what] + 'px;width:100%;">Prefix (egs. image1,image2 (multiple images) or <br>image12 (horizontally halved parts of single image will be superimposed) or <br>image1,image234 (combinations) ... <br>add plus (+) to place on top of this blurb, <br>preprefix by toggle=1&[immediately=y&] to throb it [immediately]): <br><input onblur="assess(this.value);" value="" type="text"></input><br><br><input type="button" value="Select All/Copy here or via New Window and Select All/Copy into Email Body ..." onclick="hgoes(0); setTimeout(copytocanvas,6500);"></input></h4><iframe id="myiframe" src="" style="position:absolute;top:0;left:' + nwidth[what] + 'px;width:100%;height:100vh;display:none;z-index:19;"></iframe>';
if (document.URL.indexOf('toggle=') != -1) {
setTimeout(oponezero, 1000);
}
canvasonezero();
}
function SelectText(element) { // thanks to https://stackoverflow.com/questions/27863617/is-it-possible-to-copy-a-canvas-image-to-the-clipboard and https://stackoverflow.com/a/40547470/1118626
var doc = document;
if (doc.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
}
function canvasonezero() {
var nextis='';
elem[what] = document.getElementById('mycanvas');
context[what] = elem[what].getContext('2d');
for (var ii=1; ii<=next; ii++) {
if (document.getElementById('i' + ii)) {
context[what].globalAlpha = eval(document.getElementById('i' + ii).style.opacity);
context[what].drawImage(document.getElementById('i' + ii), eval(document.getElementById('i' + ii).style.left.replace('px','')), eval(document.getElementById('i' + ii).style.top.replace('px','')), eval(document.getElementById('i' + ii).style.width.replace('px','')), eval(document.getElementById('i' + ii).style.height.replace('px','')));
}
}
//document.getElementById('mycanvas').style.zIndex=29;
//alert('huh?');
//document.getElementById('mycanvas').style.zIndex=-1;
if (1 == 1) {
if (what > 0) yescwo();
if (what > 0) setTimeout(nocwo,67000);
} else {
var img = document.createElement('img');
img.src = elem.toDataURL('image/png', 0.5);
var div = document.createElement('div');
div.contentEditable = true;
div.appendChild(img);
document.body.appendChild(div);
// do copy
SelectText(div);
document.execCommand('Copy');
document.body.removeChild(div);
}
}
function yescwo() {
var icwo=0;
if (!is_partly_composite) {
while (elem[icwo]) {
if (elem[icwo]) {
cwo[icwo]=window.open('','_blank','top=500,left=' + nwidth[icwo] + ',width=' + nwidth[icwo] + ',height=' + nheight[icwo]);
cwo[icwo].document.write('<html><body><img src="' + elem[icwo].toDataURL('image/png', 0.5) + '"></img></body></html>');
}
icwo++;
}
retitle('For about a minute you can Select All/Copy this original image arrangement, ready to Paste into email body or image editor.');
}
}
function nocwo() {
var icwo=0;
if (!is_partly_composite) {
while (cwo[icwo]) {
if (cwo[icwo]) {
cwo[icwo].close();
cwo[icwo]=null;
}
icwo++;
}
}
}
function oponezero() {
var nextis='', ppre='';
for (var ii=1; ii<=next; ii++) {
if (document.getElementById('di' + ii)) {
if (('i' + ii) == fone) {
ppre='di' + ii + ' put to 1 ... ';
document.getElementById('di' + ii).style.opacity=1.0;
} else if (nextis == '' && ii > eval(fone.replace('i',''))) {
nextis=('i' + ii);
document.getElementById('di' + ii).style.opacity=0.0;
} else {
document.getElementById('di' + ii).style.opacity=0.0;
}
} else if (document.getElementById('i' + ii)) {
if (('i' + ii) == fone) {
document.getElementById('i' + ii).style.opacity=1.0;
} else if (nextis == '' && ii > eval(fone.replace('i',''))) {
nextis=('i' + ii);
document.getElementById('i' + ii).style.opacity=0.0;
} else {
document.getElementById('i' + ii).style.opacity=0.0;
}
}
}
if (document.getElementById('d' + fone)) {
document.getElementById('d' + fone).style.opacity=1.0;
}
if (nextis == '') nextis='i1';
//alert(ppre + fone + ' and next is ' + nextis);
if (nextis != '') fone=nextis;
setTimeout(oponezero, (location.search.split('toggle=')[1] ? eval(location.search.split('toggle=')[1].split('&')[0] * 500) : 500));
}
function assess(intv) {
var myurl=document.URL.split('#')[0].split('?')[0], ans='', viai=false, extras="";
viai=false;
if (intv.indexOf('toggle=') == 0 && intv.indexOf('&') != -1) {
extras=intv.split('&')[0] + '&';
intv=intv.split('&')[1];
}
tv=intv;
if (intv.indexOf('+') != -1) {
viai=true;
tv=intv.replace(/\+/g,'');
}
if (tv == '') {
if (!viai) location.href=myurl;
if (viai) {
document.getElementById('myh1').innerHTML='';
document.getElementById('myh3').innerHTML='';
document.getElementById('myh4').innerHTML='';
document.getElementById('myiframe').style.display='block';
document.getElementById('myiframe').src=myurl;
}
} else {
var cv=tv.split(','), eg='';
for (var icv=0; icv<cv.length; icv++) {
if (cv[icv].indexOf('image') == 0) {
if (cv[icv].length > 6) {
if (eval(cv[icv].length - 5) == 2) {
eg=' Doppelganger examples are https://authorjulieglover.files.wordpress.com/2011/05/obama2527sdoppelganger.jpg or http://1.bp.blogspot.com/_1XbCsR5voz8/SyVjz6MiFsI/AAAAAAAAGWg/Zw_ZoyTsEaw/s400/lincoln+doppelganger.jpg or https://authorjulieglover.files.wordpress.com/2011/05/palindoppelganger2.png';
} else {
eg='';
}
ans=prompt('Enter Image URL (made up of ' + eval(cv[icv].length - 5) + ' horizontal sections) associated with the label ' + cv[icv] + eg, '');
} else {
ans=prompt('Enter Image URL associated with the label ' + cv[icv], '');
}
if (ans == null || ans == '') {
location.href=myurl;
} else if (myurl.indexOf('?') == -1) {
if (ans.indexOf('+') != -1) {
if (ans.substring(0,1) == '+' && ans.slice(-1) == '+') {
viai=true;
ans=ans.substring(1, eval(-2 + ans.length));
} else if (ans.substring(0,1) == '+') {
viai=true;
ans=ans.substring(1);
} else if (ans.slice(-1) == '+') {
viai=true;
ans=ans.substring(0, eval(-1 + ans.length));
}
}
myurl+='?' + extras + cv[icv] + '=' + encodeURIComponent(ans);
} else {
if (ans.indexOf('+') != -1) {
if (ans.substring(0,1) == '+' && ans.slice(-1) == '+') {
viai=true;
ans=ans.substring(1, eval(-2 + ans.length));
} else if (ans.substring(0,1) == '+') {
viai=true;
ans=ans.substring(1);
} else if (ans.slice(-1) == '+') {
viai=true;
ans=ans.substring(0, eval(-1 + ans.length));
}
}
myurl+='&' + cv[icv] + '=' + encodeURIComponent(ans);
}
}
}
if (!viai) location.href=myurl.replace('%2B','+').replace('%2B','+');
if (viai) {
document.getElementById('myh1').innerHTML='';
document.getElementById('myh3').innerHTML='';
document.getElementById('myh4').innerHTML='';
document.getElementById('myiframe').style.display='block';
//if (myurl.indexOf('%2B') != -1) alert(myurl + ' vs ' + myurl.replace('%2B','+').replace('%2B','+'));
document.getElementById('myiframe').src=myurl.replace('%2B','+').replace('%2B','+');
}
}
}
</script>
</head>
<body>
</body>
</html>