<!doctype html>
<html>
<head>
<title>Slideshow Player (via Iframe click) - RJM Programming - May, 2016</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<script type='text/javascript'>

var urlis='';
var opac=1.0;
var step=-0.1;
var snum=-1;
var midbit='';
var prefix='';
var suffix='';
var ifTitle2 = '';

function getsnum(inu) {
midbit='';
if (prefix == '' && suffix == '') {
var bits=inu.split('/');
if (bits[eval(-1 + bits.length)] == '') {
prefix='index';
snum=0;
midbit='0';
suffix='.html';
} else {
prefix=inu.replace(bits[eval(-1 + bits.length)], '');
snum=-1;
for (var j=prefix.length; j<inu.length; j++) {
if (midbit == '') {
if (inu.substring(j, eval(j + 1)) >= '0' && inu.substring(j, eval(j + 1)) <= '9') {
midbit+=inu.substring(j, eval(j + 1));
snum=eval(midbit);
} else {
prefix+=inu.substring(j, eval(j + 1));
}
} else if (suffix == '' && inu.substring(j, eval(j + 1)) >= '0' && inu.substring(j, eval(j + 1)) <= '9') {
midbit+=inu.substring(j, eval(j + 1));
snum=eval(midbit);
} else {
suffix+=inu.substring(j, eval(j + 1));
//alert(prefix + midbit + suffix);
}
}
}
} else {
midbit=midbit.replace(snum, eval(snum + 1));
snum++;
}
return snum;
}

function imageExists(image_url) { // thanks to http://stackoverflow.com/questions/18837735/check-if-image-exists-on-server-using-javascript

var http = new XMLHttpRequest();

http.open('HEAD', image_url, false);
http.send();

return http.status != 404;

}

function checkImage(imageSrc, good, bad) { // thanks to http://stackoverflow.com/questions/18837735/check-if-image-exists-on-server-using-javascript
var img = new Image();
img.onload = good;
img.onerror = bad;
img.src = imageSrc;
}


function verify(iois) {
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
ifTitle = aconto.title;
iois=iois;
//alert(isTitle);
if (ifTitle.indexOf("404") >= 0 || aconto.body.innerHTML.indexOf('but here, below, is our home page for your perusal ...') >= 0) {

urlis = prompt('Optionally enter the URL of a slideshow slide (to pick up with).', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + urlis;
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = urlis;
document.getElementById('islideshow').src = urlis;
prefix='';
suffix='';
getsnum(urlis);
opac = 1.0;
}
}
} else if (1 == 1) {

//ifTitle2 = ""; //aconto.title;
//alert(iois.src);
//checkImage(iois.src, function(){ ifTitle2=""; }, function(){ ifTitle2="404"; } );
//if (imageExists(iois.src)) {
// ifTitle2="";
//} else {
// ifTitle2="404";
//}
//alert(iois.src); // + ' ' + ifTitle2); // + ' ' + aconto.body.innerHTML);
//var ifTitle2 = aconto.title;
//if (typeof(ifTitle2) == "undefined") {
//alert(iois.src + ' ' + ifTitle2); // + ' ' + aconto.body.innerHTML);
//} else {
//alert(iois.src + ' ' + ifTitle2); // + ' ' + aconto.body.innerHTML);
// ifTitle2="404";
//alert(iois.src + ' ' + ifTitle2); // + ' ' + aconto.body.innerHTML);
// }
if (ifTitle2.indexOf("404") >= 0) { // || aconto.body.innerHTML.indexOf('but here, below, is our home page for your perusal ...') >= 0) {

urlis = prompt('Optionally enter the URL of a slideshow slide (to pick up with).', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + urlis;
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = urlis;
document.getElementById('islideshow').src = urlis;
prefix='';
suffix='';
getsnum(urlis);
opac = 1.0;
}
}
}
} else {
urlis = prompt('Optionally enter the URL of a slideshow slide (to pick up with).', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + urlis;
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = urlis;
document.getElementById('islideshow').src = urlis;
prefix='';
suffix='';
getsnum(urlis);
opac = 1.0;
}
}
} else {
urlis = prompt('Optionally enter the URL of a slideshow slide (to pick up with).', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + urlis;
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = urlis;
document.getElementById('islideshow').src = urlis;
prefix='';
suffix='';
getsnum(urlis);
opac = 1.0;
}
}
}

function andtheni() {
document.getElementById('islideshow').src = urlis;
}

function aqw() {
midbit=midbit.replace(snum, eval(snum + 1));
snum++;
//snum=getsnum(prefix + midbit + suffix);
urlis=prefix + midbit + suffix;
//alert(urlis);
document.getElementById('ourimg').src = urlis;
return ifTitle2;
}

function zaqw() {
midbit=midbit.replace(snum, eval(snum + 1));
snum++;
//snum=getsnum(prefix + midbit + suffix);
urlis=prefix + midbit + suffix;
//alert(urlis);
urlis = prompt('Optionally enter the URL of a slideshow next slide.', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
prefix='';
suffix='';
snum=getsnum(urlis);
document.getElementById('ourimg').src = urlis;
}
return ifTitle2;
}

function doiclick(iois) {
if (urlis != '') {
ifTitle2='404';
//setTimeout(andtheni, 2000);
if (ifTitle2 == '404') {
ifTitle2=aqw();
}
} else {
opac+=step;
if (opac >= 1.0) {
opac=1.0;
step = eval(-step);
} else if (opac <= 0.0) {
opac=0.1;
step = eval(-step);
urlis = prompt('Optionally enter the URL of a slideshow first slide.', urlis);
if (urlis == null) urlis='';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + urlis;
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = urlis;
document.getElementById('islideshow').src = urlis;
prefix='';
suffix='';
getsnum(urlis);
opac = 1.0;
}
}
document.getElementById('islideshow').style.opacity = opac;
}






}

function seturl() {
urlis=location.search.split('slideshowurl=')[1] ? location.search.split('slideshowurl=')[1].split('&')[0] : '';
if (urlis != '') {
document.getElementById('islideshow').title = 'Click for next slide to ' + decodeURIComponent(urlis);
document.getElementById('islideshow').style.borderStyle='dashed';
document.getElementById('ourimg').src = decodeURIComponent(urlis);
document.getElementById('islideshow').src = decodeURIComponent(urlis);
getsnum(decodeURIComponent(urlis));
} else {
document.getElementById('islideshow').src = 'http://www.rjmprogramming.com.au/Welcome.html';
}
}

</script>

</head>
<body onload=' seturl(); '>
<h1 style=' text-align: center; width: 100%; '>Iframe Click - RJM Programming - May, 2016</h1>
<iframe title='Click to change opacity' id='islideshow' onload=' verify(this); ' onclick=' doiclick(this); ' style=' width:100%; height: 800px; opacity:1.0; padding: 15px 15px 15px 15px; ' src=''></iframe>
<img onerror=" ifTitle2='404'; zaqw(); " onload=" ifTitle2=''; andtheni(); " src='http://www.rjmprogramming.com.au/MyBusinessUnidad/Welcome_files/logo.jpg' style=' display:block; ' id='ourimg'></img>
</body>
</html>