<?php
// change_the_reel_video.php
// RJM Programming
// February, 2015

$prefix1="http://www.rjmprogramming.com.au/PHP/video_generic.php";
$prefix2="?filen=";
$entry1="ImageFit_Gimp";
$midbit3="&pat=";
$entry1="Mac/";
$suffix1="&dom=";
$entry3="http://www.rjmprogramming.com.au:80/";
$numtodo=10;

if (isset($_GET['numtodo'])) {
 if (str_replace(" ","",$_GET['numtodo']) != "") {
  $numtodo=$_GET['numtodo'];
 }
} 
echo "<!doctype html><html><head><title>Change the Reel ... RJM Programming ... February, 2015</title><link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>\n<script type='text/javascript'>\n var thisone=0;\n var xt;\n ";
echo "
function alertsize(myif,pixels){
    document.getElementById(myif).style.height=pixels+'px'; //alert(pixels);
    // document.getElementById('d' + myif).style.height=pixels+'px';
    // document.getElementById('r' + myif).style.height=pixels+'px'; alert(pixels); 
}
";
for ($i=0; $i < $numtodo; $i++) {
  echo "\n" . " function fgoes" . $i . "() { ifnum('i" . $i . "'); thisone=" . ($i + 1) . "} ";
}   
echo "\n function fgoes() {\n  ifnum('i' + thisone);\n  thisone=eval(eval(1)+eval(thisone));\n   }\n  function hcheck() {\n var i=0;\n var voif; for (i=0; i<" . $numtodo . "; i++) {\n  voif=document.getElementById('i' + i);\n if (voif.title == 'Playing') { voif.style.height='600px';    }\n   }\n   }\n function ifnum(ifis) {\n alert(ifis); xt=ifis;\n var oif=document.getElementById(ifis);\n var yya=(oif.contentWindow || oif.contentDocument);\n try { if (yya.document) { yya=yya.document; } } catch(ex) { } \n  var mys=yya.getElementById('submit');\n if (ifis != 'i0') { mys.value='Change Reel'; }\n mys.onmouseover=\" parent.document.getElementById('\"" . " + xt + " . "\"').title='Playing'; \";\n  }\n </script>\n</head><body onload='";
for ($i=0; $i < $numtodo; $i++) {
  echo "\n" . ' if (1 == 2) { setTimeout(fgoes' . $i . ', eval(' . ($i + 1) . ' * 4000)); } ';
}   
echo " if (2 == 3) { setInterval(hcheck,1000); } '><div align='center'><h1>Welcome to \"Change the Reel\" video player<font size=2> ... RJM Programming ... February, 2015 ... </font><select onchange=\" var stuff=document.URL.split('?'); location.href=stuff[0] + '?numtodo=' + this.value; \"><option value=" . $numtodo . ">Please select number of videos below (different to " . $numtodo . ") ...</option>";
for ($i=1; $i <= 100; $i++) {
 echo "<option value=" . $i . ">" . $i . "</option>";
}
echo "</select></h1></div><br><!--table style='width:100%;'><tbody id='tbod'-->";
for ($i=0; $i < $numtodo; $i++) {
  if ($i == 0) {
   echo "<!--tr id='ri" . $i . "' style='height:300px;width:100%;'><td id='di" . $i . "' style='height:300px;width:100%;'--><iframe frameborder='0' style='height:300px;width:100%;' id='i" . $i . "' src='" . $prefix1 . "?calledby=i" . $i . "' title='Video " . ($i + 1) . "'></iframe><!--/td></tr-->";
  } else {
   echo "<!--tr id='ri" . $i . "' style='height:300px;width:100%;'><td id='di" . $i . "' style='height:300px;width:100%;'--><iframe frameborder='0' style='height:300px;width:100%;' id='i" . $i . "' src='" . $prefix1 . "?calledby=i" . $i . "' title='Video " . ($i + 1) . "'></iframe><!--/td></tr-->";
  }
}   
echo "<!--/tbody></table--></body></html>";
?>
  
