<?php
  // annotatedtimeline_chart.php
  // Google Annotated Timeline Chart supervisor
  // RJM Programming
  // November, 2015
  // 
  if (file_exists("csv.php")) {
    include "csv.php";
  } else if (file_exists("../csv.php")) { 
    include "../csv.php";
  }
  if (file_exists("bigemail.php")) {
    include "bigemail.php";
  } else if (file_exists("../bigemail.php")) { 
    include "../bigemail.php";
  }

  function retval($inv) {
    if (strpos($inv, "E-") !== false) return "0";
    return $inv;
  }
?>
<html>
  <head> <script type="text/javascript" src="//www.rjmprogramming.com.au/gchartgen.js?c=d"></script>
    <title>Annotated Timeline Chart - RJM Programming - http://www.rjmprogramming.com.au (Copyright &copy; 2013 rjmprogramming.com.au all rights reserved.)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <!--script type="text/javascript" src="//yui.yahooapis.com/2.9.0/build/yahoo/yahoo.js"></script> 
 <script type="text/javascript" src="//yui.yahooapis.com/2.9.0/build/event/event.js" ></script> 
 <script type="text/javascript" src="//yui.yahooapis.com/2.9.0/build/dom/dom.js" ></script> 
 <script type="text/javascript" src="//yui.yahooapis.com/2.9.0/build/calendar/calendar.js"></script> 
<link type="text/css" rel="stylesheet" href="//yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css"-->
<!--script type="text/javascript" src="../../moodle20/lib/yui/2.8.2/build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../moodle20/lib/yui/2.8.2/build/event/event.js"></script>
<script type="text/javascript" src="../../moodle20/lib/yui/2.8.2/build/dom/dom.js"></script>
<script type="text/javascript" src="../../moodle20/lib/yui/2.8.2/build/calendar/calendar.js"></script>
<link type="text/css" rel="stylesheet" href="../../moodle20/lib/yui/2.8.1/build/calendar/assets/skins/sam/calendar.css"-->
<?php
      if (isset($_GET['flash']) || isset($_POST['flash'])) {
    echo ' <script type="text/javascript" src="//www.google.com/jsapi"></script>' . "\n";
      } else {
    echo ' <script type="text/javascript" src="//www.gstatic.com/charts/loader.js"></script>' . "\n";
      }
?>
    <script type="text/javascript">
    var lastoneval=' ';
    var lasttwoval=' ';

    var firstgo=true;
    var thisurl=document.URL.split('?')[0].split('#')[0];
    var pstr='', prevpstr='';
    var num = 0;
    var emailto = "";
    var colonetc = ":000000";
    var colonetcend = ":010000";
    var sgreen = "5px solid red";
    var etwo = "";
    var calwl = "";
    var calcmds=[];
    var thiscalcmd=-1;
    var retval = "";
<?php    
        if (isset($_GET['atc_title'])) {
        echo ' var ttitle = "' . str_replace('+',' ',urldecode($_GET['atc_title'])) . '"; ' . "\n";
        } else {
        echo '  var ttitle = ""; ' . "\n";
        }
        if (isset($_GET['atc_task1'])) {
        echo ' var ttask1 = "' . str_replace('+',' ',urldecode($_GET['atc_task1'])) . '";    ' . "\n";
        } else {
        echo ' var ttask1 = "Sold Pencils"; ' . "\n";
        }
        if (isset($_GET['atc_title1'])) {
        echo ' var ttitle1 = "' . str_replace('+',' ',urldecode($_GET['atc_title1'])) . '";   ' . "\n";
        } else {
        echo ' var ttitle1 = "title1"; ' . "\n";
        }
        if (isset($_GET['atc_text1'])) {
        echo ' var ttext1 = "' . str_replace('+',' ',urldecode($_GET['atc_text1'])) . '";  ' . "\n";
        } else {
        echo ' var ttext1 = "text1"; ' . "\n";
        }
        if (isset($_GET['atc_task2'])) {
        echo ' var ttask2 = "' . str_replace('+',' ',urldecode($_GET['atc_task2'])) . '";  ' . "\n";
        } else {
        echo ' var ttask2 = "Sold Pens";  ' . "\n";
        }
        if (isset($_GET['atc_title2'])) {
        echo ' var ttitle2 = "' . str_replace('+',' ',urldecode($_GET['atc_title2'])) . '"; ' . "\n";
        } else {
        echo ' var ttitle2 = "title2"; ' . "\n";
        }
        if (isset($_GET['atc_text2'])) {
        echo ' var ttext2 = "' . str_replace('+',' ',urldecode($_GET['atc_text2'])) . '";  ' . "\n";
        } else {
        echo '  var ttext2 = "text2"; ' . "\n";
        }
?>      
    var xd = new Date();
    var ourctz = xd.getTimezoneOffset() / 60;	
    var ctz = ourctz;    
    // YAHOO.namespace("example.calendar"); 	 
	    //YAHOO.example.calendar.init = function() { 
	    // YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1SContainer"); 
	    // YAHOO.example.calendar.cal1.render(); 
	    //} 	 
	    //YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init); 	    
   
   var cdrnum=[0,0],cdnum=["",""],cdsnum=["",""],prevtlbit='', thistlbit='', prevdate=[], prevval='', ready=false, x=-1, y=-1, elemLeft=0, elemTop=0, ir=-1, ic=-1, talkingpoint='';
   var tlurls=document.URL.replace('desc1=', 'desc=').replace('/AnnotatedTimelineChart/', '/CalendarChart/').replace('annotatedtimeline_chart.php','calendar_chart.php').split('&data=');
   var tlurl=tlurls[0];
   var tltwourls=document.URL.replace('desc1=', 'desc=').replace('/AnnotatedTimelineChart/', '/TimelineChart/').replace('annotatedtimeline_chart.php','timeline_chart.php').split('&data=');
   var tltwourl=tltwourls[0];
   
   function fillindata() {
     var bed=document.getElementById('bdataval');
     if (bed == null) {
       document.getElementById('bitsatend').innerHTML+='<input type="hidden" id="bdataval" value="' + encodeURIComponent(paramdata) + '"></input>';
     }
   }
   
   function filldata() {
     var bed=document.getElementById('bedata');
     if (bed != null) {
       if (bed.value == '') {
         bed.value=encodeURIComponent(paramdata);
       }
     }
   }
   
   function numsinstr(viad) {
     cdrnum=[0,0];
     var numsofar=0, isn=false, snum='';
     viad+=' ';
     for (var ii=0; ii<viad.length; ii++) {
       if ((viad.substring(ii, eval(1 + ii)) >= '0' && viad.substring(ii, eval(1 + ii)) <= '9') || viad.substring(ii, eval(1 + ii)) == '-' || viad.substring(ii, eval(1 + ii)) == '.') {
        snum+=viad.substring(ii, eval(1 + ii));
       } else if (snum.length >= 1 && snum.replace('-','').replace('.','') != '' && snum.indexOf('--') == -1 && snum.indexOf('..') == -1) {
        cdrnum[numsofar]=eval(snum);
        snum='';
        numsofar++;
        if (eval(numsofar) >= 2) return cdrnum;
       } else {
        snum='';
       }
     }
     return cdrnum;
   }
   
   function preretnum(jr,jc,viad) {
     var mths=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    var retval=[];
    outviad=viad;
    //alert('jr=' + jr + ' and jc=' + jc);
    var hbits=document.head.innerHTML.split('dataTa' + 'ble.addRows([');
    if (eval(hbits.length) > 1) {
    //alert('Jr=' + jr + ' and jc=' + jc);
    //alert(hbits[1]);
          var dbitsare=hbits[1].replace(']]);','],[').split(',[');
          var dofinterest=dbitsare[eval(0 + jr)];
          //alert(jr + ' ... ' + dofinterest + ' +++ ' + dbitsare[0]);
          var vls=dofinterest.replace('[','').replace(']',',').split(',');
          if (eval(vls.length) >= 6) {
           if (thistlbit != '' && thistlbit != (vls[0] + ',' + vls[1] + ',' + vls[2])) {
             prevtlbit=thistlbit;
             thistlbit=(vls[0] + ',' + vls[1] + ',' + vls[2]);
           } else {
             thistlbit=(vls[0] + ',' + vls[1] + ',' + vls[2]);
           }
          
     //alert(vls.length + ' ... ' + vls[0] + ',' + vls[1] + ',' + vls[2]);
     //alert(vls.length + ' ... ' + vls[1] + ',' + vls[2] + ',' + vls[3]);
     //alert(vls.length + ' ... ' + vls[2] + ',' + vls[3] + ',' + vls[4]);
          //alert(vls[1]);
          //alert(mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(',''));
           cdnum=[mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(',''),  mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(','')];
          //alert(vls[1]);
           cdsnum=[(vls[0] + ',' + vls[1] + ',' + vls[2]), (vls[0] + ',' + vls[1] + ',' + vls[2])];
          //alert(vls[2]);
           cdrnum=[vls[3],vls[6]];
           if (pstr != '' && pstr != (vls[3] + ':' + vls[4].replace(/\'/g,' ').replace(/~/g,' ') + ' ' + vls[5].replace(/\'/g,' ').replace(/~/g,' ') + ' ... ' + vls[6] + ':' + vls[7].replace(/\'/g,' ').replace(/~/g,' ') + ' ' + vls[8].replace(/\'/g,' ').replace(/~/g,' '))) {
             prevpstr=pstr;
           }
           pstr=vls[3] + ':' + vls[4].replace(/\'/g,' ').replace(/~/g,' ') + ' ' + vls[5].replace(/\'/g,' ').replace(/~/g,' ') + ' ... ' + vls[6] + ':' + vls[7].replace(/\'/g,' ').replace(/~/g,' ') + ' ' + vls[8].replace(/\'/g,' ').replace(/~/g,' ');
           retval=[eval(vls[0] + ',' + vls[1] + ',' + vls[2]), eval(vls[0] + ',' + vls[1] + ',' + vls[2])];
          //alert(retval[0]);
           return retval;
          }
    }
    return retnum(outviad);
   }   
   
   function retnum(viad) {
     var mths=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
     var retval=[];
     //var prehbits=document.head.innerHTML.indexOf("'," + viad + ",'");  //('["' + viad + '",');
     var hbits=document.head.innerHTML.split('~,' + viad + ',~');  //('["' + viad + '",');
     if (eval(hbits.length) >= 2) {
     //alert(hbits[1]);
          var vls=hbits[1].replace(']',',').split(',');
          if (eval(vls.length) >= 6) {
     //alert(vls.length + ' ... ' + vls[0] + ',' + vls[1] + ',' + vls[2]);
             joffset=3;
             cdnum=[mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(',''),  mths[eval(vls[eval(joffset + 4)])] + ' ' + vls[eval(joffset + 5)].replace(')','') + ', ' + vls[eval(joffset + 3)].replace('new Date(','')];
             vls[2]+=',' + vls[3] + ',' + vls[4] + ',' + vls[5].replace(')','') + ')';
             vls[eval(joffset + 5)]+=',' + vls[eval(joffset + 6)] + ',' + vls[eval(joffset + 7)] + ',' + vls[eval(joffset + 8)].replace(')','') + ')';
             cdsnum=[(vls[0] + ',' + vls[1] + ',' + vls[2]), (vls[eval(joffset + 3)] + ',' + vls[eval(joffset + 4)] + ',' + vls[eval(joffset + 5)])];
             retval=[eval(vls[0] + ',' + vls[1] + ',' + vls[2]), eval(vls[eval(joffset + 3)] + ',' + vls[eval(joffset + 4)] + ',' + vls[eval(joffset + 5)])];
           } else {
             cdnum=[mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(',''),  mths[eval(vls[eval(joffset + 4)])] + ' ' + vls[eval(joffset + 5)].replace(')','') + ', ' + vls[eval(joffset + 3)].replace('new Date(','')];
             cdsnum=[(vls[0] + ',' + vls[1] + ',' + vls[2]), (vls[eval(joffset + 3)] + ',' + vls[eval(joffset + 4)] + ',' + vls[eval(joffset + 5)])];
             retval=[eval(vls[0] + ',' + vls[1] + ',' + vls[2]), eval(vls[eval(joffset + 3)] + ',' + vls[eval(joffset + 4)] + ',' + vls[eval(joffset + 5)])];
           }
           //cdnum=[mths[eval(vls[1])] + ' ' + vls[2].replace(')','') + ', ' + vls[0].replace('new Date(',''),  mths[eval(vls[4])] + ' ' + vls[5].replace(')','') + ', ' + vls[3].replace('new Date(','')];
           //cdsnum=[(vls[0] + ',' + vls[1] + ',' + vls[2]), (vls[3] + ',' + vls[4] + ',' + vls[5])];
           //retval=[eval(vls[0] + ',' + vls[1] + ',' + vls[2]), eval(vls[3] + ',' + vls[4] + ',' + vls[5])];
          //}
     }
     return retval;
   }
   
   function tlblurb() {
     if (prevpstr != '' && pstr != '') {
       return prevpstr + ' to ' + pstr;
     } else if (pstr != '') {
       return pstr;
     }
     return prevpstr;
   }
   
   function oppretnum(viad) {
     var retval=0;
     var yrs=viad.split(',');
     if (yrs.length == 2) {
       var mts=yrs[0].split(' ');
       if (mts.length == 2) {
         var mth='';
         if (mts[0].substring(0,3).toLowerCase() == 'jan') mth=0;
         if (mts[0].substring(0,3).toLowerCase() == 'feb') mth=1;
         if (mts[0].substring(0,3).toLowerCase() == 'mar') mth=2;
         if (mts[0].substring(0,3).toLowerCase() == 'apr') mth=3;
         if (mts[0].substring(0,3).toLowerCase() == 'may') mth=4;
         if (mts[0].substring(0,3).toLowerCase() == 'jun') mth=5;
         if (mts[0].substring(0,3).toLowerCase() == 'jul') mth=6;
         if (mts[0].substring(0,3).toLowerCase() == 'aug') mth=7;
         if (mts[0].substring(0,3).toLowerCase() == 'sep') mth=8;
         if (mts[0].substring(0,3).toLowerCase() == 'oct') mth=9;
         if (mts[0].substring(0,3).toLowerCase() == 'nov') mth=10;
         if (mts[0].substring(0,3).toLowerCase() == 'dec') mth=11;
         //alert('[new Date(' + yrs[1].replace(' ','') + ',' + mth + ',' + mts[1] + '),');
         thistlbit='new Date(' + yrs[1].replace(' ','') + ',' + mth + ',' + mts[1] + ')';
         var otherhbits=document.head.innerHTML.split('[new Date(' + yrs[1].replace(' ','') + ',' + mth + ',' + mts[1] + ',');
         var hbits=document.head.innerHTML.split('[new Date(' + yrs[1].replace(' ','') + ',' + mth + ',' + mts[1] + '),');
         if (hbits.length == 2 || otherhbits.length == 2) {
          var vls;
          if (hbits.length == 2) vls=hbits[1].split(']');
          if (otherhbits.length == 2) vls=otherhbits[1].split(']');
          return eval(vls[0]);
         }
         
         
       }
     } 
     return retval;
   } 

<?php 
  echo "var dataTable, chart, pardata = (location.search.split('data=')[1] ? location.search.split('data=')[1].split('&')[0] : ''), paramdata=decodeURIComponent(pardata); \n";
 
      $GETtp="";
      if (isset($_GET['tp'])) $GETtp = urldecode($_GET['tp']);
      if (isset($_POST['tp'])) $GETtp = urldecode($_POST['tp']);
      if ($GETtp != "") echo "\n talkingpoint=String.fromCharCode(10) + String.fromCharCode(10) + " . '"' . str_replace("`", '" + String.fromCharCode(10) + "', str_replace("\n", '" + String.fromCharCode(10) + "', $GETtp)) . '"' . " + String.fromCharCode(10) + String.fromCharCode(10); \n";

      $GETr = "";
      $GETc = "";
      if (isset($_GET['r'])) $GETr = urldecode($_GET['r']);
      if (isset($_POST['r'])) $GETr = urldecode($_POST['r']);
      if (isset($_GET['c'])) $GETc = urldecode($_GET['c']);
      if (isset($_POST['c'])) $GETc = urldecode($_POST['c']);
      if ($GETr != "") echo "\n ir=eval('" . $GETr . "'); \n";
      if ($GETc != "") echo "\n ic=eval('" . $GETc . "'); \n";

      $GETx = "";
      $GETy = "";
      if (isset($_GET['x'])) $GETx = urldecode($_GET['x']);
      if (isset($_POST['x'])) $GETx = urldecode($_POST['x']);
      if (isset($_GET['y'])) $GETy = urldecode($_GET['y']);
      if (isset($_POST['y'])) $GETy = urldecode($_POST['y']);
      if ($GETx != "" && $GETy != "") {
        echo "\n x=eval('" . $GETx . "'); \n";
        echo "\n y=eval('" . $GETy . "'); \n";
      }

      $GETtitle = "Sold Pencils and Sold Pens";
      $GETtask = ""; //"Task";
      $GETdesc1 = "Sold Pencils";
      $GETtitle1 = "title1";
      $GETtext1 = "text1";
      $GETdesc2 = "Sold Pencils";
      $GETtitle2 = "title2";
      $GETtext2 = "text2";
      $GETdata = "    [new Date(2008, 1 ,1), 30000, null, null, 40645, null, null],[new Date(2008, 1 ,2), 14045, null, null, 20374, null, null],[new Date(2008, 1 ,3), 55022, null, null, 50766, null, null],[new Date(2008, 1 ,4), 75284, null, null, 14334, 'Out of Stock', 'Ran out of stock on pens at 4pm'],[new Date(2008, 1 ,5), 41476, 'Bought Pens', 'Bought 200k pens', 66467, null, null],[new Date(2008, 1 ,6), 33322, null, null, 39463, null, null] ";
    //[ "Washington", new Date(1789, 3, 29), new Date(1797, 2, 3) ],[ "Adams",      new Date(1797, 2, 3),  new Date(1801, 2, 3) ],[ "Jefferson",  new Date(1801, 2, 3),  new Date(1809, 2, 3) ]';
      $mg=$GETdata;

      if (isset($_POST['data'])) {
       //$nineh="1200";
       //$twoh="430";
       $GETdata = str_replace("`", "' + String.fromCharCode(39) + '", str_replace("``", '"', str_replace("~", "'", str_replace("\\'", "'", urldecode(checkdatadata0('POST',$_POST['data']))))));
       //echo "\n pardata = " . '"' . $_POST['data'] . '"; ' . " \n";
       echo "\n paramdata='" . str_replace("\t", '<br>', str_replace("%09", '<br>', str_replace("'",'"',$GETdata))) . "'; \n setTimeout(fillindata, 300); \n setTimeout(filldata, 3000); \n"; // = decodeURIComponent(pardata); " . " \n";
       
      } else if (isset($_GET['data'])) {
       $prevg=$_GET['data'];
       //$nineh="900";
       //$twoh="200";
       $GETdata = str_replace("`", "' + String.fromCharCode(39) + '", str_replace("``", '"', str_replace("~", "'", str_replace("\\'", "'", urldecode(checkdatadata0('GET',$_GET['data']))))));
       if ($prevg != $GETdata) {
        //$nineh="1200";
        //$twoh="430";
        echo "\n paramdata='" . str_replace("\t", '<br>', str_replace("%09", '<br>', str_replace("'",'"',$GETdata))) . "'; \n setTimeout(fillindata, 300); \n setTimeout(filldata, 3000); \n"; // = decodeURIComponent(pardata); " . " \n";
       }
      }


      
      if ($mg == $GETdata && strpos($_SERVER['QUERY_STRING'],"title=") !== false) {
       $bbits = explode("data=", file_get_contents('php://input'));
       $GETtitle = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("title=", $_SERVER['QUERY_STRING'])[1])[0])))));
       $GETtitle1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("title1=", $_SERVER['QUERY_STRING'])[1])[0]))))));
       $GETtitle2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("title2=", $_SERVER['QUERY_STRING'])[1])[0]))))));
       $GETtext1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("text1=", $_SERVER['QUERY_STRING'])[1])[0]))))));
       $GETtext2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("text2=", $_SERVER['QUERY_STRING'])[1])[0]))))));
       $GETtask = str_replace("\\'", "'", urldecode(explode('&',explode("task=", $_SERVER['QUERY_STRING'])[1])[0])); //$_GET['task'];
       $GETdesc1 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("desc1=", $_SERVER['QUERY_STRING'])[1])[0])))));
       $GETdesc2 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode(explode('&',explode("desc2=", $_SERVER['QUERY_STRING'])[1])[0])))));
       if (sizeof($bbits) > 1) {
         $GETdata = str_replace("`", "' + String.fromCharCode(39) + '", str_replace("``", '"', str_replace("~", "'", str_replace("\\'", "'", urldecode(explode('&',$bbits[1])[0])))));
       } else {
         $GETdata = "";
       }
      } else if (isset($_POST['title'])) {
       $GETtitle = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['title'])))));
       $GETtitle1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['title1']))))));
       $GETtitle2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['title2']))))));
       $GETtext1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['text1']))))));
       $GETtext2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['text2']))))));
       //$GETtitle = str_replace("##", "'", $GETtitle);
       $GETtask = str_replace("\\'", "'", urldecode($_POST['task'])); //$_POST['task'];
       //$GETdesc = str_replace("~~", "##", $_POST['desc']);
       $GETdesc1 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['desc1'])))));
       $GETdesc2 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_POST['desc2'])))));
      } else if (isset($_GET['title'])) {
       //$GETtitle = str_replace("~~", "##", $_GET['title']);
       $GETtitle = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['title'])))));
       $GETtitle1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['title1']))))));
       $GETtitle2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['title2']))))));
       $GETtext1 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['text1']))))));
       $GETtext2 = str_replace("\t", "\n", str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['text2']))))));
       //$GETtitle = str_replace("##", "'", $GETtitle);
       $GETtask = str_replace("\\'", "'", urldecode($_GET['task'])); //$_GET['task'];
       //$GETdesc = str_replace("~~", "##", $_GET['desc']);
       $GETdesc1 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['desc1'])))));
       $GETdesc2 = str_replace("~~", "'", str_replace('~', '"', str_replace("`", "'", str_replace("\\'", "'", urldecode($_GET['desc2'])))));
      } 
      
      echo " var colnames= '" . str_replace("'", "", $GETdesc) . "'; \n";


      echo " function myselectfunction() {
 //alert(88);
 if (ready) {
 //alert(87);
  var relist=['remail',''],ire,item,selection,thisval='',ifc=0,thisdate=[],ansbits,avblurb=talkingpoint,ioffset=0,ans=null,doit=true,kl,lk, thisnum, num=0,message = '', dparts, colparts=colnames.split(','), colav=new Array(), predparts, postdparts, diffcolnames=colnames,diffvalues;
  //pstr='';
  if (firstgo) {
      firstgo=false;
    }
 //alert(ifc + ' ... ic=' + ic + ' ... ir=' + ir);
    if (eval(ir) < 0 && eval(ic) < 0) {
 //alert(488);
    selection = chart.getSelection();
 //alert(388);
    if ((selection[0].row != null && selection[0].column != null)) {
 // alert(288);
      ir=selection[0].row;
       ifc=selection[0].column;
 //alert(188);
    }

      if (eval(ir) >= 0 && eval(ic) < 0) {
      var str = dataTable.getFormattedValue(ir, ifc);
//alert(71111 + ' ... ' + str);
      message += '{row:' + ir + ', column:none}; value (col 0) = ' + str;
          thisval=str;
          //pstr=str + ' ' + colparts[0];
          thisdate=preretnum(ir,ifc,str); //retnum(str);
          //alert(thisdate[0]);
          //alert(pstr);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'On These Days=O' + String.fromCharCode(10);
          avblurb+='Show the Elapsed Number of Days=T' + String.fromCharCode(10);
          avblurb+='Add to a Calendar Representation=A[' + cdrnum[0] + ',' + cdrnum[1] + '] (anything after A overrides Calendar label of [' + cdrnum[0] + ',' + cdrnum[1] + '])' + String.fromCharCode(10);
          avblurb+='Add to a Calendar Representation and Show in New Window=N[' + cdrnum[0] + ',' + cdrnum[1] + '] (as above)' + String.fromCharCode(10);
          if (tlurl.indexOf('data=') != -1) avblurb+='Show the Current Calendar Representation on Top of This Annotated Timeline Chart=C ' + String.fromCharCode(10);
          avblurb+='Add to a Timeline Representation=B[' + tlblurb() + '] (anything after A overrides Timeline label of [' + tlblurb() + '])' + String.fromCharCode(10);
          avblurb+='Add to a Timeline Representation and Show in New Window=W[' + tlblurb() + '] (as above)' + String.fromCharCode(10);
          if (tltwourl.indexOf('data=') != -1) avblurb+='Show the Current Timeline Representation on Top of This Annotated Timeline Chart=Y ' + String.fromCharCode(10);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + '' + String.fromCharCode(10);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
          ans=prompt('Regarding ' + colparts[0] + ' (' + thisval + ') you clicked date ' + thisdate[0] + ' ' + avblurb, paramdata);
          if (ans != null) {
            if (ans != '' && ans != paramdata) {
             if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
             ansbits=ans.split(' ');
             if (ansbits[0].indexOf('@') != -1) {
              if (document.getElementById('altemail')) {
              document.getElementById('altemail').value=ansbits[0];
              document.getElementById('remail').href=document.getElementById('remail').href.replace('mt=','mt=' + ansbits[0] + '&junk=youshallneverfindthis').replace('get=','mt=' + ansbits[0] + '&junk=youshallneverfindthis');
              }
              if (document.getElementById('email')) relist[1]='email';
              for (ire=0; ire<2; ire++) {
              if (relist[ire] != '') {
              document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace('fillin.email@address', ansbits[0]);
              if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&r=') + ir) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&r=') + item.row;
              if (ansbits.length > 1) {
                ans=ans.replace(ansbits[0] + ' ','');
                while (ans.indexOf(' ') != -1) {
                  ans=ans.replace(' ','%20');
                }
                while (ans.indexOf('?') != -1) {
                  ans=ans.replace('?','%3f');
                }
                while (ans.indexOf('&') != -1) {
                  ans=ans.replace('&','%26');
                }
                if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) == -1 && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) == -1) {
                  document.getElementById(relist[ire]).href+=encodeURIComponent('&tp=') + encodeURIComponent(ans);
                } else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('&tp='), encodeURIComponent('&tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
				} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('?tp='), encodeURIComponent('?tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
                }
                while (document.getElementById(relist[ire]).href.indexOf(' ') != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(' ','%20');
                }
                //alert(document.getElementById(relist[ire]).href);
              }
              document.getElementById(relist[ire]).click();
              }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'a' || ans.substring(0,1).toLowerCase() == 'n') {
              if (eval(ans.length) > 1) {
               //pstr=ans.substring(1);
               if (ans.substring(1,2) == '[') eval('cdrnum=' + ans.substring(1));
              }
              if (tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1 || tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1) {
              if (tlurl.indexOf('data=') == -1) {
               tlurl+='&data=';
              } else {
               tlurl+=',';
              }
              if (tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1 && tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1) {
                if ('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']' == '[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']';
                } else {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + '],[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']';
                }
              } else if (tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1) {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']';
              } if (tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1) {
                tlurl+='[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']';
              }
              }
              if (ans.substring(0,1).toLowerCase() == 'n') {
                if (tlurl.length >= 800) {
                location.href=iftoobig('',tlurl);
                } else {
                window.open(iftoobig('',tlurl), '_blank', 'top=100,left=100,width=500,height=500');
                }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'b' || ans.substring(0,1).toLowerCase() == 'w') {
              if (eval(ans.length) > 1) {
               pstr=ans.substring(1);
              }
              if (prevtlbit != '' && thistlbit != '') {
              if (tltwourl.indexOf('data=') == -1) {
               tltwourl+='&data=';
              } else {
               tltwourl+=',';
              }
              tltwourl+='[~' + encodeURIComponent(tlblurb()) + '~,' + prevtlbit + ',' + thistlbit + ']';
              if (ans.substring(0,1).toLowerCase() == 'w') {
                if (tltwourl.length >= 800) {
                location.href=iftoobig('',tltwourl);
                } else {
                window.open(iftoobig('',tltwourl), '_blank', 'top=100,left=100,width=500,height=500');
                }
              }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'c') {
              location.href=iftoobig('',tlurl);
             } else if (ans.substring(0,1).toLowerCase() == 'y') {
              location.href=iftoobig('',tltwourl);
             } else if (ans.substring(0,1).toLowerCase() == 't') {
              var d1 = new Date(prevdate);
              var d2 = new Date(str);
              if (1 == 2) {
              document.getElementById('myf1').innerHTML=('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              } else {
              alert('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              //var wo=window.open('','_blank','top=200,left=200,width=300,height=50');
              //wo.document.write('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              //if (document.URL.indexOf('&qq=') == -1) {
              //  location.href=document.URL + '&qq=1';
              //} else {
              //  location.href=document.URL + '9';
              //}
              }
             } else if (ans.substring(0,1).toLowerCase() == 'o') {
              window.open('https://www.google.com/search?q=' + cdnum[0].replace(',','%2C').replace(' ','+').replace(' ','+'), '_blank', 'top=100,left=100,width=400,height=400');
              window.open('https://www.google.com/search?q=' + cdnum[1].replace(',','%2C').replace(' ','+').replace(' ','+'), '_blank', 'top=150,left=150,width=400,height=400');
             } else if (document.URL.indexOf('&data=') == -1) {
              location.href=iftoobig('',document.URL + '&data=' + ourencodeURIComponent(ans));
             } else {
              location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
             }
            }
          }
          prevdate=thisdate;
          prevval=str;
          prevtlbit=thistlbit;
       ir=-1;
       ic=-1;
       return;
      }
  } else {
  //selection = chart.getSelection();
  for (var i = 0; i < selection.length; i++) {
    item = selection[i];
//alert(111);
    if ((item.row != null && item.column != null) || (eval(ir) >= 0 && eval(ic) >= 0)) {
//alert(1111);
      if (eval(ir) >= 0 && eval(ic) >= 0) {
  //alert(999);
        item.row=ir;
        item.column=ic;
  //alert(9999);
        ir=-1;
        ic=-1;
      } else {
//alert(61111);
        ir=item.row;
        ic=item.column;
        //document.title=ir + ',' + ic;
      }
      var str = dataTable.getFormattedValue(item.row, item.column);
//alert('" . $GETdesc2 . "=' + str);
          thisval=str;
          //pstr=str + ' ' + colparts[0];
          thisdate=preretnum(item.row,item.column,str); //retnum(str);
          //alert('thisval=' + thisval + ' and pstr=' + pstr + ' and thisdate[0]=' + thisdate[0]);

    } else if ((item.row != null && item.column == null) || (eval(ir) >= 0 && eval(ic) < 0)) {
      if (eval(ir) >= 0 && eval(ic) < 0) {
  //alert(999);
        item.row=ir;
        //item.column=ic;
  //alert(9999);
        ir=-1;
        ic=-1;
      } else {
//alert(61111);
        ir=item.row;
        ic=-1;
        //document.title=ir + ',' + ic;
      }
      var str = dataTable.getFormattedValue(item.row, 0);
//alert(71111 + ' ... ' + str);
      message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str;
          thisval=str;
          //pstr=str + ' ' + colparts[0];
          thisdate=retnum(str);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'On These Days=O' + String.fromCharCode(10);
          avblurb+='Show the Elapsed Number of Days=T' + String.fromCharCode(10);
          avblurb+='Add to a Calendar Representation=A[' + cdrnum[0] + ',' + cdrnum[1] + '] (anything after A overrides Calendar label of [' + cdrnum[0] + ',' + cdrnum[1] + '])' + String.fromCharCode(10);
          avblurb+='Add to a Calendar Representation and Show in New Window=N[' + cdrnum[0] + ',' + cdrnum[1] + '] (as above)' + String.fromCharCode(10);
          if (tlurl.indexOf('data=') != -1) avblurb+='Show the Current Calendar Representation on Top of This Annotated Timeline Chart=C ' + String.fromCharCode(10);
          avblurb+='Add to a Timeline Representation=B[' + tlblurb() + '] (anything after A overrides Timeline label of [' + tlblurb() + '])' + String.fromCharCode(10);
          avblurb+='Add to a Timeline Representation and Show in New Window=W[' + tlblurb() + '] (as above)' + String.fromCharCode(10);
          if (tltwourl.indexOf('data=') != -1) avblurb+='Show the Current Timeline Representation on Top of This Annotated Timeline Chart=Y ' + String.fromCharCode(10);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + '' + String.fromCharCode(10);
          avblurb+=String.fromCharCode(10) + String.fromCharCode(10) + 'Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
          ans=prompt('Regarding ' + colparts[0] + ' (' + thisval + ') you clicked date ' + thisdate[0] + ' ' + avblurb, paramdata);
          if (ans != null) {
            if (ans != '' && ans != paramdata) {
             if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
             ansbits=ans.split(' ');
             if (ansbits[0].indexOf('@') != -1) {
              if (document.getElementById('altemail')) {
              document.getElementById('altemail').value=ansbits[0];
              document.getElementById('remail').href=document.getElementById('remail').href.replace('mt=','mt=' + ansbits[0] + '&junk=youshallneverfindthis').replace('get=','mt=' + ansbits[0] + '&junk=youshallneverfindthis');
              }
              if (document.getElementById('email')) relist[1]='email';
              for (ire=0; ire<2; ire++) {
              if (relist[ire] != '') {
              document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace('fillin.email@address', ansbits[0]);
              if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&r=') + item.row) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&r=') + item.row;
              //if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&c=') + item.column;
              if (ansbits.length > 1) {
                ans=ans.replace(ansbits[0] + ' ','');
                while (ans.indexOf(' ') != -1) {
                  ans=ans.replace(' ','%20');
                }
                while (ans.indexOf('?') != -1) {
                  ans=ans.replace('?','%3f');
                }
                while (ans.indexOf('&') != -1) {
                  ans=ans.replace('&','%26');
                }
                if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) == -1 && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) == -1) {
                  document.getElementById(relist[ire]).href+=encodeURIComponent('&tp=') + encodeURIComponent(ans);
                } else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('&tp='), encodeURIComponent('&tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
				} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('?tp='), encodeURIComponent('?tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
                }
                while (document.getElementById(relist[ire]).href.indexOf(' ') != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(' ','%20');
                }
                //alert(document.getElementById(relist[ire]).href);
              }
              document.getElementById(relist[ire]).click();
              }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'b' || ans.substring(0,1).toLowerCase() == 'w') {
              if (eval(ans.length) > 1) {
               pstr=ans.substring(1);
              }
              if (prevtlbit != '' && thistlbit != '') {
              if (tltwourl.indexOf('data=') == -1) {
               tltwourl+='&data=';
              } else {
               tltwourl+=',';
              }
              tltwourl+='[~' + encodeURIComponent(tlblurb()) + '~,' + prevtlbit + ',' + thistlbit + ']';
              if (ans.substring(0,1).toLowerCase() == 'w') {
               if (tltwourl.length >= 800) {
                location.href=iftoobig('',tltwourl);
               } else {
                window.open(iftoobig('',tltwourl), '_blank', 'top=100,left=100,width=500,height=500');
               }
              }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'a' || ans.substring(0,1).toLowerCase() == 'n') {
              if (eval(ans.length) > 1) {
               //pstr=ans.substring(1);
               if (ans.substring(1,2) == '[') eval('cdrnum=' + ans.substring(1));
              }
              if (tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1 || tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1) {
              if (tlurl.indexOf('data=') == -1) {
               tlurl+='&data=';
              } else {
               tlurl+=',';
              }
              if (tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1 && tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1) {
                if ('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']' == '[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']';
                } else {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + '],[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']';
                }
              } else if (tlurl.indexOf('[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']') == -1) {
                tlurl+='[' + cdsnum[0] + ',' + cdrnum[0] + '' + ']';
              } if (tlurl.indexOf('[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']') == -1) {
                tlurl+='[' + cdsnum[1] + ',' + cdrnum[1] + '' + ']';
              }
              }
              if (ans.substring(0,1).toLowerCase() == 'n') {
               if (tlurl.length >= 800) {
                location.href=iftoobig('',tlurl);
               } else {
                window.open(iftoobig('',tlurl), '_blank', 'top=100,left=100,width=500,height=500');
               }
              }
             } else if (ans.substring(0,1).toLowerCase() == 'c') {
              location.href=iftoobig('',tlurl);
             } else if (ans.substring(0,1).toLowerCase() == 'y') {
              location.href=iftoobig('',tltwourl);
             } else if (ans.substring(0,1).toLowerCase() == 't') {
              var d1 = new Date(prevdate);
              var d2 = new Date(str);
              if (1 == 2) {
              document.getElementById('myf1').innerHTML=('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              } else {
              alert('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              //var wo=window.open('','_blank','top=200,left=200,width=300,height=50');
              //wo.document.write('It is ' + Math.floor((thisdate[1] - thisdate[0]) / (1000*60*60*24)) + ' days from ' + thisdate[0] + ' to ' + thisdate[1] + '.');
              //if (document.URL.indexOf('&qq=') == -1) {
              //  location.href=document.URL + '&qq=1';
              //} else {
              //  location.href=document.URL + '9';
              //}
              }
             } else if (ans.substring(0,1).toLowerCase() == 'o') {
              window.open('https://www.google.com/search?q=' + cdnum[0].replace(',','%2C').replace(' ','+').replace(' ','+'), '_blank', 'top=100,left=100,width=400,height=400');
              window.open('https://www.google.com/search?q=' + cdnum[1].replace(',','%2C').replace(' ','+').replace(' ','+'), '_blank', 'top=150,left=150,width=400,height=400');
             } else if (document.URL.indexOf('&data=') == -1) {
              location.href=iftoobig('',document.URL + '&data=' + ourencodeURIComponent(ans));
             } else {
              location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
             }
            }
          }
          prevdate=thisdate;
          prevval=str;
          prevtlbit=thistlbit;
    } else if ((item.row == null && item.column != null) || (eval(ir) < 0 && eval(ic) >= 0)) {
  //alert(8999);
      if (eval(ir) >= 0 && eval(ic) < 0) {
  //alert(999);
        //item.row=ir;
        item.column=ic;
  //alert(9999);
        ir=-1;
        ic=-1;
      } else {
//alert(61111);
        ir=-1;
        ic=item.column;
        //document.title=ir + ',' + ic;
      }
      var str = dataTable.getFormattedValue(0, item.column);
      message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str;
    }
  }
  if (message == '') {
    message = 'nothing';
  }
  if (1 == 2) console.log('You selected ' + message);
 }
       ir=-1;
       ic=-1;
}
}     
      //);  
      ";

      // echo "     google.charts.setOnLoadCallback(drawChart);   " . "\n";
      if (isset($_GET['flash']) || isset($_POST['flash'])) {
        echo ' google.load("visualization", "1", {packages:["annotatedtimeline"]}); ' . "\n";
      } else {
        echo "   google.charts.load('current', {'packages':['annotationchart']});   " . "\n";
      }
      echo ' function drawChart() { ' . "\n";
      /*
  var data = new google.visualization.DataTable();
  data.addColumn('date', 'Date');
  data.addColumn('number', 'Sold Pencils');
  data.addColumn('string', 'title1');
  data.addColumn('string', 'text1');
  data.addColumn('number', 'Sold Pens');
  data.addColumn('string', 'title2');
  data.addColumn('string', 'text2');
  data.addRows([
    [new Date(2008, 1 ,1), 30000, null, null, 40645, null, null],
    [new Date(2008, 1 ,2), 14045, null, null, 20374, null, null],
    [new Date(2008, 1 ,3), 55022, null, null, 50766, null, null],
    [new Date(2008, 1 ,4), 75284, null, null, 14334, 'Out of Stock', 'Ran out of stock on pens at 4pm'],
    [new Date(2008, 1 ,5), 41476, 'Bought Pens', 'Bought 200k pens', 66467, null, null],
    [new Date(2008, 1 ,6), 33322, null, null, 39463, null, null]
  ]);

  var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
      document.getElementById('visualization'));
  annotatedtimeline.draw(data, {'displayAnnotations': true});
  */
      //echo " var container = document.getElementById('chart_div'); \n";

      //echo " var chart = new google.visualization.AnnotatedTimeline(container); \n";

      echo ' dataTable = new google.visualization.DataTable(); ' . "\n";
      echo " dataTable.addColumn(  'date', 'Date' ); \n";
      echo " dataTable.addColumn(  'number',  '" . $GETdesc1 . "' ); \n";
      echo " dataTable.addColumn(  'string',  '" . $GETtitle1 . "' ); \n";
      echo " dataTable.addColumn(  'string',  '" . $GETtext1 . "' ); \n";
      echo " dataTable.addColumn(  'number',  '" . $GETdesc2 . "' ); \n";
      echo " dataTable.addColumn(  'string',  '" . $GETtitle2 . "' ); \n";
      echo " dataTable.addColumn(  'string',  '" . $GETtext2 . "' ); \n";

      if ($GETdata == "") {
      echo ' if (parent.document.getElementById("data")) { var prewert=" data.addRows([ "; ' . "\n";
      echo " prewert+=parent.document.getElementById('data').value.substring(0).replace(/\,\]/g,',0]').replace(/\]\~/g,'[\"').replace(/\~\,/g,'\",').replace(/\%5d/g,']').replace(/\`/g,\"'\").replace(/\%5b/g,'[').replace(/\%29/g,')').replace(/\%28/g,'(').replace(/\%20/g,' ').replace(/\%27/g,\"'\").replace(/\%2c/g,',').replace(/newDate/g,'new Date').replace(/\~\~/g,\"'\"); " . "\n";
      echo ' prewert+=" ])";' . "\n";
      echo ' eval(prewert); ' . "\n  } else if (document.URL.indexOf('atc_title=') != -1) { \n";
      echo " var prewert=\" dataTable.addRows([[new Date(2008, 1 ,1), 30000, null, null, 40645, null, null],[new Date(2008, 1 ,2), 14045, null, null, 20374, null, null],[new Date(2008, 1 ,3), 55022, null, null, 50766, null, null],[new Date(2008, 1 ,4), 75284, null, null, 14334, 'Out of Stock', 'Ran out of stock on pens at 4pm'],[new Date(2008, 1 ,5), 41476, 'Bought Pens', 'Bought 200k pens', 66467, null, null],[new Date(2008, 1 ,6), 33322, null, null, 39463, null, null]]);\"; \n ";
      echo " eval(prewert); }  \n";
      } else {
      echo ' dataTable.addRows([' . "\n";
      echo str_replace("\t", "<br>", str_replace("%09", "<br>", str_replace("~~", "'", str_replace("newDate", "new Date", str_replace("%2c", ",", str_replace("%27", "'", str_replace("%20", " ", str_replace("%28", "(", str_replace("%29", ")", str_replace("%5b", "[", str_replace("`", "'",str_replace("%5d", "]",str_replace('~,', '",', str_replace('[~', '["', str_replace(",]", ",0]", str_replace(",]", ",0]", str_replace(",]", ",0]", $GETdata)))))))))))))))));
      echo "]);\n ";
      }

      if (isset($_GET['flash']) || isset($_POST['flash'])) {
        echo " chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); \n";
      } else {
        echo " chart = new google.visualization.AnnotationChart(document.getElementById('chart_div')); \n";
      }
      $GETonclick = "";
      if (isset($_GET['onclick'])) $GETonclick = urldecode($_GET['onclick']);
      if (isset($_POST['onclick'])) $GETonclick = urldecode($_POST['onclick']);
      if ($GETonclick != "") {
      echo "google.visualization.events.addListener(chart, 'ready', function() {  ready=true;  }); \n";
      echo "google.visualization.events.addListener(chart, 'select', myselectfunction); \n";
      }
      $GETextraopts = "";
      if (isset($_GET['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_GET['extraopts'])); }
      if (isset($_POST['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_POST['extraopts'])); }
      if (trim($GETextraopts) != '') { $GETextraopts=str_replace(',,',',',trim($GETextraopts) . ',');   }
      echo " chart.draw(dataTable, { " . $GETextraopts . " displayAnnotations: true, allowHtml: true}); \n";
      if ($GETr != "" && $GETc == "") echo " chart.setSelection([{'row': " . $GETr . ", 'column': null}]); setTimeout(myselectfunction,4100); \n";
      if ($GETr == "" && $GETc != "") echo " chart.setSelection([{'row': null, 'column': " . $GETc . "}]);  setTimeout(myselectfunction,4100); \n";
      if ($GETr != "" && $GETc != "") echo " chart.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]);  setTimeout(myselectfunction,4100); \n";
      echo " } \n";
      
      
      echo "
      
function docgetclass(inc, intag) {
  if (document.getElementsByClassName) {
    return document.getElementsByClassName(inc);
  } else {
    var ijl;
    var anarris=[];
    var huhs=document.getElementsByTagName(intag);
    for (ijl=0; ijl<huhs.length; ijl++) {
     if (huh[ijl].className.indexOf(inc) != -1) {
      anarris.push(huhs[ijl]);
     }
    }
    return anarris;
  }
}

function checkforclass() {
var buildup='';
var cfcs=docgetclass('emojioverlay','*');
for (var ij=0; ij<cfcs.length; ij++) {
  if (cfcs[ij].innerHTML.replace(/&amp;/g,'&').indexOf(';&') != -1) {
    var emjs=cfcs[ij].innerHTML.replace(/&amp;/g,'&').split('&');
    buildup=''; //&#' + emjs[1].split(';')[0] + ';';
    cfcs[ij].style.opacity=eval(cfcs[ij].style.opacity / eval(-1 + emjs.length));
    for (var iemjs=1; iemjs<emjs.length; iemjs++) {
      buildup+='<span title=\"Click to enable Calendar iCal Event for this Timeline Event\" style=\"position:absolute;top:' + cfcs[ij].style.top + ';left:' + cfcs[ij].style.left + ';font-size:' + cfcs[ij].style.fontSize + ';opacity:' + cfcs[ij].style.opacity + ';z-index:' + cfcs[ij].style.zIndex + ';\">&#' + emjs[iemjs].split(';')[0] + ';</span>';
    } 
    cfcs[ij].innerHTML=buildup;  
    cfcs[ij].style.visibility='visible'; 
  }
}
}

";
      
      $ic = 1;
      
      for ($ic=1; $ic<100; $ic++) {
 echo ' function cals' . $ic . '(inhuh,mode) {' . "\n";
 echo ' if (inhuh > ' . $ic . ') { return cals' . ($ic + 1) . '(inhuh,mode); } else if (inhuh < ' . $ic . ') { return cals' . ($ic - 1) . '(inhuh,mode); } else { ' . "\n";
 echo ' if (mode == 0) {YAHOO.example.calendar.cals' . $ic . ' = new YAHOO.widget.Calendar("cals' . $ic . '","cal' . $ic . 'SContainer");  ' . "\n";
 echo ' YAHOO.example.calendar.cals' . $ic . '.render();  ' . "\n";
 echo ' YAHOO.example.calendar.cale' . $ic . ' = new YAHOO.widget.Calendar("cale' . $ic . '","cal' . $ic . 'EContainer");  ' . "\n";
 echo ' YAHOO.example.calendar.cale' . $ic . '.render(); ' . "\n"; 
 echo ' } else { ' . "\n"; 
 echo ' retval = "[";  ' . "\n"; 
 echo ' colonetc = ":000000"; ' . "\n"; 
 echo ' colonetcend = ":010000"; ' . "\n"; 
 echo ' ctz = ourctz; ' . "\n"; 
 echo ' var calzero = document.getElementById("calzero' . $ic . 'store").value; ' . "\n"; 
 echo ' var soneput = document.getElementById("sone' . $ic . 'put"); ' . "\n"; 
 echo ' var stwoput = document.getElementById("stwo' . $ic . 'put"); ' . "\n"; 
 echo ' var eoneput = document.getElementById("eone' . $ic . 'put"); ' . "\n"; 
 echo ' var etwoput = document.getElementById("etwo' . $ic . 'put"); ' . "\n"; 
 echo ' var ioneput = document.getElementById("ione' . $ic . 'put"); ' . "\n"; 
 echo ' var itwoput = document.getElementById("itwo' . $ic . 'put"); ' . "\n"; 
 echo ' var rest = "," + scrutinize(ioneput.value) + ",' . "~" . '" + scrutinize(soneput.value) +  "' . "~" . ',' . "~" . '" + scrutinize(eoneput.value) +  "' . "~" . '"; ' . "\n"; 
 echo ' rest = rest + "," + scrutinize(itwoput.value) + ",' . "~" . '" + scrutinize(stwoput.value) +  "' . "~" . ',' . "~" . '" + scrutinize(etwoput.value) +  "' . "~" . '"; ' . "\n"; 
//echo " retval = retval + '[" . '"' . "' + iput.value + '" . '"' . ",'; " . "\n"; 

 echo ' var ourbstage = rest.replace(/~/g,"").replace(",", " " + ttask1 + ": ").replace(",", " " + ttitle1 + ": ").replace(",", " " + ttext1 + ": ").replace(",", " " + ttask2 + ": ").replace(",", " " + ttitle2 + ": ").replace(",", " " + ttext2 + ": "); ' . "\n"; 
 echo ' var pDates = YAHOO.example.calendar.cals' . $ic . '.getSelectedDates()[0]; ' . "\n"; 
 echo ' var pDatee = YAHOO.example.calendar.cale' . $ic . '.getSelectedDates()[0]; ' . "\n"; 
 echo ' if (pDates) { ' . "\n"; 
 echo ' retval = retval + "newDate(" + eval(1900 + pDates.getYear()) + ","; ' . "\n"; 
 echo ' retval = retval + eval(0 + pDates.getMonth()) + ","; ' . "\n"; 
 echo ' retval = retval + pDates.getDate() + ")" + rest + "]"; ' . "\n"; 
 //echo ' retval = retval + pDates.getDate() + ".";	         ' . "\n"; 
 echo ' if (calzero.length == 1 && emailto.indexOf("@") == -1) { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { while (emailto.indexOf("@") == -1) {   emailto=prompt("Please enter who you want to email calendar reminders to", "fill.in@email.here"); if (emailto == null) {  emailto=""; }  }   } else { emailto=prompt("Optionally enter email address of who you want to email calendar reminders to, else we will call the iCal Calendar application, interactively, now.", ""); if (emailto == null) { emailto=""; }  if (emailto == "") { emailto="@"; }   } if (emailto == "@") {  etwo="&emode=Address&address=Address";   } else { etwo="&emode=To&address=' . '" + encodeURIComponent(emailto);  }   } ' . "\n";
 echo ' if (calzero.length == 1) calcmds.push("http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent(ctz) + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(document.getElementsByTagName("h1")[0].innerHTML) + " " + "' . $ic . '&stage=" + encodeURIComponent(ourbstage) + "&datestart=' . '" + eval(1900 + pDates.getYear()) + ("0" + eval(1 + pDates.getMonth())).slice(-2) + ("0" + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + "&dateend=' . '" + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + "&description=Description&url=" + encodeURIComponent(thisurl)); ' . "\n";
 echo ' if (calzero.length == 1) document.getElementById("calzero' . $ic . 'store").value = "http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent(ctz) + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(document.getElementsByTagName("h1")[0].innerHTML) + " " + "' . $ic . '&stage=" + encodeURIComponent(ourbstage) + "&datestart=' . '" + eval(1900 + pDates.getYear()) + ("0" + eval(1 + pDates.getMonth())).slice(-2) +("0" +  pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + "&dateend=' . '" + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + "&description=Description&url=" + encodeURIComponent(thisurl); ' . "\n";
 echo '      } else { ' . "\n"; 
 echo '  pDates = YAHOO.example.calendar.cale' . ($ic - 1) . '.getSelectedDates()[0]; ' . "\n"; 
 echo ' if (pDates) { ' . "\n"; 
 echo ' retval = retval + "newDate(" + eval(1900 + pDates.getYear()) + ","; ' . "\n"; 
 echo ' retval = retval + eval(0 + pDates.getMonth()) + ","; ' . "\n"; 
 echo ' retval = retval + pDates.getDate() + ")" + rest + "]"; ' . "\n"; 
 //echo ' retval = retval + pDates.getDate() + ".";	         ' . "\n"; 
 echo ' if (calzero.length == 1 && emailto.indexOf("@") == -1) { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { while (emailto.indexOf("@") == -1) {   emailto=prompt("Please enter who you want to email calendar reminders to", "fill.in@email.here"); if (emailto == null) {  emailto=""; }  }   } else { emailto=prompt("Optionally enter email address of who you want to email calendar reminders to, else we will call the iCal Calendar application, interactively, now.", ""); if (emailto == null) { emailto=""; } if (emailto == "") { emailto="@"; }  }   if (emailto == "@") {  etwo="&emode=Address&address=Address";   } else { etwo="&emode=To&address=' . '" + encodeURIComponent(emailto);  }   }  ' . "\n";
 echo ' if (calzero.length == 1) calcmds.push("http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent(ctz) + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(document.getElementsByTagName("h1")[0].innerHTML) + " " + "' . $ic . '&stage=" + encodeURIComponent(ourbstage) + "&datestart=' . '" + eval(1900 + pDates.getYear()) + ("0" + eval(1 + pDates.getMonth())).slice(-2) + ("0" + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + "&dateend=' . '" + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + "&description=Description&url=" + encodeURIComponent(thisurl)); ' . "\n";
 echo ' if (calzero.length == 1) document.getElementById("calzero' . $ic . 'store").value = "http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=" + encodeURIComponent(ctz) + "&inhouse_ynft=y&eventwords=test&title=" + encodeURIComponent(document.getElementsByTagName("h1")[0].innerHTML) + " " + "' . $ic . '&stage=" + encodeURIComponent(ourbstage) + "&datestart=' . '" + eval(1900 + pDates.getYear()) + ("0" + eval(1 + pDates.getMonth())).slice(-2) + ("0" + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + "&dateend=' . '" + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + "&description=Description&url=" + encodeURIComponent(thisurl); ' . "\n";
 echo '      }  ' . "\n"; 
 echo '      } ' . "\n"; 
 echo '  return retval;  } ' . "\n"; 
 echo ' } return ""; } ' . "\n";
      }
      
?>

        
   function altcals1(inhuh,mode) {

 retval = '';  
 
  retval = '[';  
 colonetc = ':000000'; 
 colonetcend = ':010000'; 
 ctz = ourctz; 
 var calzero = document.getElementById('calzero' + inhuh + 'store').value; 
 var soneput = document.getElementById('sone' + inhuh + 'put'); 
 var stwoput = document.getElementById('stwo' + inhuh + 'put'); 
 var eoneput = document.getElementById('eone' + inhuh + 'put'); 
 var etwoput = document.getElementById('etwo' + inhuh + 'put'); 
 var ioneput = document.getElementById('ione' + inhuh + 'put'); 
 var itwoput = document.getElementById('itwo' + inhuh + 'put'); 
 var rest = ',' + scrutinize(ioneput.value) + ',~' + scrutinize(soneput.value) +  '~,~' + scrutinize(eoneput.value) +  '~'; 
 rest = rest + ',' + scrutinize(itwoput.value) + ',~' + scrutinize(stwoput.value) +  '~,~' + scrutinize(etwoput.value) +  '~'; 
 var ourbstage = rest.replace(/~/g,'').replace(',', ' ' + ttask1 + ': ').replace(',', ' ' + ttitle1 + ': ').replace(',', ' ' + ttext1 + ': ').replace(',', ' ' + ttask2 + ': ').replace(',', ' ' + ttitle2 + ': ').replace(',', ' ' + ttext2 + ': '); 
 var pDates = '' + document.getElementById('sd' + inhuh + 'put').value;
 var pDatee = '' + document.getElementById('ed' + inhuh + 'put').value;
 if (pDates.indexOf('-') != -1) { 
 retval = retval + 'newDate(' + pDates.split('-')[0] + ','; 
 retval = retval + eval(-1 + eval('' + pDates.split('-')[1])) + ','; 
 retval = retval + pDates.split('-')[2] + ')' + rest + ']'; 
 if (calzero.length == 1 && emailto.indexOf('@') == -1) { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { while (emailto.indexOf('@') == -1) {   emailto=prompt('Please enter who you want to email calendar reminders to', 'fill.in@email.here'); if (emailto == null) {  emailto=''; }  }   } else { emailto=prompt('Optionally enter email address of who you want to email calendar reminders to, else we will call the iCal Calendar application, interactively, now.', ''); if (emailto == null) { emailto=''; }  if (emailto == '') { emailto='@'; }   } if (emailto == '@') {  etwo='&emode=Address&address=Address';   } else { etwo='&emode=To&address=' + encodeURIComponent(emailto);  }   } 
 if (calzero.length == 1) calcmds.push('http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=' + encodeURIComponent(ctz) + '&inhouse_ynft=y&eventwords=test&title=' + encodeURIComponent(document.getElementsByTagName('h1')[0].innerHTML) + ' ' + '1&stage=' + encodeURIComponent(ourbstage) + '&datestart=' + eval(1900 + pDates.getYear()) + ('0' + eval(1 + pDates.getMonth())).slice(-2) + ('0' + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + '&dateend=' + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + '&description=Description&url=' + encodeURIComponent(thisurl)); 
 if (calzero.length == 1) document.getElementById('calzero' + inhuh + 'store').value = 'http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=' + encodeURIComponent(ctz) + '&inhouse_ynft=y&eventwords=test&title=' + encodeURIComponent(document.getElementsByTagName('h1')[0].innerHTML) + ' ' + '1&stage=' + encodeURIComponent(ourbstage) + '&datestart=' + eval(1900 + pDates.getYear()) + ('0' + eval(1 + pDates.getMonth())).slice(-2) +('0' +  pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + '&dateend=' + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + '&description=Description&url=' + encodeURIComponent(thisurl); 
      } else if (document.getElementById('ed' + eval(-1 + eval('' + inhuh)) + 'put')) { 
  pDates = '' + document.getElementById('ed' + eval(-1 + eval('' + inhuh)) + 'put').value; 
 if (pDates.indexOf('-') != -1) { 
 retval = retval + 'newDate(' + pDates.split('-')[0] + ','; 
 retval = retval + eval(-1 + eval('' + pDates.split('-')[1])) + ','; 
 retval = retval + pDates.split('-')[2] + ')' + rest + ']'; 
 if (calzero.length == 1 && emailto.indexOf('@') == -1) { if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { while (emailto.indexOf('@') == -1) {   emailto=prompt('Please enter who you want to email calendar reminders to', 'fill.in@email.here'); if (emailto == null) {  emailto=''; }  }   } else { emailto=prompt('Optionally enter email address of who you want to email calendar reminders to, else we will call the iCal Calendar application, interactively, now.', ''); if (emailto == null) { emailto=''; } if (emailto == '') { emailto='@'; }  }   if (emailto == '@') {  etwo='&emode=Address&address=Address';   } else { etwo='&emode=To&address=' + encodeURIComponent(emailto);  }   }  
 if (calzero.length == 1) calcmds.push('http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=' + encodeURIComponent(ctz) + '&inhouse_ynft=y&eventwords=test&title=' + encodeURIComponent(document.getElementsByTagName('h1')[0].innerHTML) + ' ' + '1&stage=' + encodeURIComponent(ourbstage) + '&datestart=' + eval(1900 + pDates.getYear()) + ('0' + eval(1 + pDates.getMonth())).slice(-2) + ('0' + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + '&dateend=' + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + '&description=Description&url=' + encodeURIComponent(thisurl)); 
 if (calzero.length == 1) document.getElementById('calzero' + inhuh + 'store').value = 'http://www.rjmprogramming.com.au/PHP/ics_attachment.php?id=0&tz=' + encodeURIComponent(ctz) + '&inhouse_ynft=y&eventwords=test&title=' + encodeURIComponent(document.getElementsByTagName('h1')[0].innerHTML) + ' ' + '1&stage=' + encodeURIComponent(ourbstage) + '&datestart=' + eval(1900 + pDates.getYear()) + ('0' + eval(1 + pDates.getMonth())).slice(-2) + ('0' + pDates.getDate()).slice(-2) + encodeURIComponent(colonetc) + '&dateend=' + eval(1900 + pDates.getYear()) + eval(1 + pDates.getMonth()) + pDates.getDate() + encodeURIComponent(colonetcend) + etwo + '&description=Description&url=' + encodeURIComponent(thisurl); 
      }  
      } 
 
   return retval; 
 
   }
   
   function datefix(infg) {
   }
        

   function cals0(huh,huh2) {
   }
   function cals100(huh,huh2) {
   }
   
   function scrutinize(wthis) {
     var cdbits, tho;
     if (wthis.indexOf(":") != -1 && colonetc == ":000000") {
       cdbits=wthis.split(':');
       tho=eval(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)]);
       colonetc=":" + ("0" + cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)]).slice(-2) + ("0" + cdbits[1].split(' ')[0]).slice(-2) + "00";
       colonetcend=colonetc;
       if (tho < 12) {
        colonetcend=":" + ("0" + eval(tho + 5)).slice(-2) + ("0" + cdbits[1].split(' ')[eval(-1 + cdbits[1].split(' ').length)]).slice(-2) + "00";
       } else if (tho < 23) {
        colonetcend=":23" + ("0" + cdbits[1].split(' ')[eval(-1 + cdbits[1].split(' ').length)]).slice(-2) + "00";
       }
       wthis=wthis.replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + ":" + cdbits[1].split(' ')[0] + " ","").replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + ":" + cdbits[1].split(' ')[0],"");
     } else if (wthis.indexOf(":") != -1) {
       cdbits=wthis.split(':');
       colonetcend=":" + ("0" + cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)]).slice(-2) + ("0" + cdbits[1].split(' ')[0]).slice(-2) + "00";
       wthis=wthis.replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + ":" + cdbits[1].split(' ')[0] + " ","").replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + ":" + cdbits[1].split(' ')[0],"");
     }
     if (wthis.indexOf("/") != -1) {
       cdbits=wthis.split('/');
       if (('' + ctz).indexOf("/") != -1) {
       ctz='' + ctz + "," + cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + "/" + cdbits[1].split(' ')[0];
       } else {
       ctz='' + cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + "/" + cdbits[1].split(' ')[0];
       }
       wthis=wthis.replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + "/" + cdbits[1].split(' ')[0] + " ","").replace(cdbits[0].split(' ')[eval(-1 + cdbits[0].split(' ').length)] + "/" + cdbits[1].split(' ')[0],"");
     }
     var crfound=false;
     while (wthis.indexOf(String.fromCharCode(10)) != -1) {
       if (!crfound) {
       wthis=(encodeURIComponent(String.fromCharCode(9)) + wthis + encodeURIComponent(String.fromCharCode(9))).replace(String.fromCharCode(10),encodeURIComponent(String.fromCharCode(9)));
       } else {
       wthis=wthis.replace(String.fromCharCode(10),encodeURIComponent(String.fromCharCode(9)));
       }
       crfound=true;
     }
     return wthis.replace(/\'/g,'`').replace(/\"/g,'``');  
   }
   
   function docalendar() {
    if (thiscalcmd >= 0 && thiscalcmd < calcmds.length) {
     document.title='Sending calendar email ' + eval(1 + thiscalcmd) + ' of ' + calcmds.length + ' ...';
     //alert(calcmds[thiscalcmd]);
     document.getElementById('mycalendartwo').src=calcmds[thiscalcmd];
     thiscalcmd++;
     setTimeout(docalendar, 3000);
    } else {
     window.location = iftoobig('',calwl);
    }
   }
   
   function maybeval(line_num, one_vs_two) {
     if (one_vs_two == 0) {
       if (lastoneval == ' ') {
         lastoneval=(location.search.split('ione' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : '');
         return lastoneval.replace(/\`/g,"'"); //(location.search.split('ione' + line_num + 'put=')[1] ? (" value='" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "'") : '');
       } else if (lasttwoval.trim() != '') {
         lastoneval=(location.search.split('ione' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : lasttwoval);
         return lastoneval.replace(/\`/g,"'"); //(location.search.split('ione' + line_num + 'put=')[1] ? (" value='" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "'") : '');
       } else {
         lastoneval=(location.search.split('ione' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : '');
         return lastoneval.replace(/\`/g,"'"); //(location.search.split('ione' + line_num + 'put=')[1] ? (" value='" + decodeURIComponent(location.search.split('ione' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "'") : '');
       }
     } else {
       if (lasttwoval == ' ') {
         lasttwoval=(location.search.split('itwo' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('itwo' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : '');
         return lasttwoval.replace(/\`/g,"'");
       } else if (lastoneval.trim() != '') {
         lasttwoval=(location.search.split('itwo' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('itwo' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : lastoneval);
         return lasttwoval.replace(/\`/g,"'");
       } else {
         lasttwoval=(location.search.split('itwo' + line_num + 'put=')[1] ? (" value=\"" + decodeURIComponent(location.search.split('itwo' + line_num + 'put=')[1].split('&')[0]).replace(/\+/g,' ') + "\"") : '');
         return lasttwoval.replace(/\`/g,"'").replace(/\"/g,"''");
       }
     }
     return '';
   }

   function goforth() {
   //alert("99 vs " + num);
     var ii=1;
     var dt = "";
     var ci = "";
     while (ii <= num) {
       if (7 == 5) {
       dt = dt + ci + cals1(ii,1);
       } else {
       dt = dt + ci + altcals1(ii,1);
       }
       dt = dt.replace("'", "~~").replace('"', '~');
       dt = dt.replace("'", "~~").replace('"', '~');
       dt = dt.replace("'", "~~").replace('"', '~');
       dt = dt.replace("'", "~~").replace('"', '~');
       ttitle = ttitle.replace("'", "~~").replace('"', '~');
       ttitle = ttitle.replace("'", "~~").replace('"', '~');
       ci = ",";
       ii = ii + 1;
       //alert(dt);
     }
     if (calcmds.length > 0) {
       calwl = "./annotatedtimeline_chart.php?title=" + ttitle.replace("'", "~~").replace('"', '~') + "&desc1=" + ttask1.replace("'", "~~").replace('"', '~') + "&title1=" + ttitle1.replace("'", "~~").replace('"', '~') + "&text1=" + ttext1.replace("'", "~~").replace('"', '~') + "&desc2=" + ttask2.replace("'", "~~").replace('"', '~') + "&title2=" + ttitle2.replace("'", "~~").replace('"', '~') + "&text2=" + ttext2.replace("'", "~~").replace('"', '~') + "&data=" + dt.replace("'", "~~").replace('"', '~');
       thiscalcmd=0;
       setTimeout(docalendar, 100);
     } else {
       var preurl="./annotatedtimeline_chart.php?title=" + ttitle.replace("'", "~~").replace('"', '~') + "&desc1=" + ttask1.replace("'", "~~").replace('"', '~') + "&title1=" + ttitle1.replace("'", "~~").replace('"', '~') + "&text1=" + ttext1.replace("'", "~~").replace('"', '~') + "&desc2=" + ttask2.replace("'", "~~").replace('"', '~') + "&title2=" + ttitle2.replace("'", "~~").replace('"', '~') + "&text2=" + ttext2.replace("'", "~~").replace('"', '~') + "&data=" + dt.replace("'", "~~").replace('"', '~');
       window.location = iftoobig('',preurl);
     }
   }
<?php
      if (isset($_GET['flash']) || isset($_POST['flash'])) {
        echo ' google.setOnLoadCallback(drawChart); ' . "\n";
      } else {
        echo ' google.charts.setOnLoadCallback(drawChart); ' . "\n";
      }
      echo " </script> \n";
      echo " </head> \n";
      if (!isset($_GET['desc1']) && !isset($_POST['desc1'])) {
      echo " <body class='yui-skin-sam' onload='setTimeout(later, 2 * 1000);'> \n";
      } else {
      echo " <body class='yui-skin-sam'> \n";
      }
      echo " <h1>" . $GETtitle . " Annotated Timeline Chart</h1> \n";
      if (isset($_GET['flash']) || isset($_POST['flash'])) {
    echo '<div id="chart_div" style="width: 800px; height: 400px; background-color: yellow;"></div><div id="bitsatend" style="display:inline;"></div>' . "\n";
      } else {
    echo '<div id="chart_div" style="width: 900px; height: 500px; background-color: yellow;"></div><div id="bitsatend" style="display:inline;"></div>' . "\n";
      }
?>
    <div id="calendar_table"></div>
    <a title="Annotated Timeline Chart" href="./annotatedtimeline_chart.php">Another annotated timeline chart?</a>
    <?php 
      if (!isset($_GET['desc1']) && !isset($_POST['desc1'])) {
      
        echo '<' . 'script' . '>' . "\n " . " function later() { \n" . ' var datalineprefix = " "; ' . "\n";
        echo ' var datalinesuffix = ""; ' . "\n";
        //echo ' var sgreen = "5px solid red"; ' . "\n";
        //echo ' var calcmds = []; ' . "\n";
        echo ' var extra = ""; ' . "\n";
        echo ' var bits = ""; ' . "\n";
        echo ' var task = ""; ' . "\n";
        echo ' var xtask = ""; ' . "\n";
        echo ' var ict = 0; ' . "\n";
        echo ' var thisline = 1; ' . "\n";
        echo ' var totalleft = 100.0; ' . "\n";
        if (isset($_GET['atc_title'])) {
        echo ' var title = "' . str_replace('+',' ',urldecode($_GET['atc_title'])) . '"; ' . "\n";
        } else {
        echo ' var title = prompt("Enter Annotated Timeline Chart Title (optionally suffix by &onclick=y for added onclick functionality, optionally suffix by &flash=y for Flash (legacy) usage)", "Sold Pencils and Sold Pens"); ' . "\n";
        }
        
        echo ' if (title != null) { ' . "\n";
        echo ' ttitle = title; ' . "\n";
        if (isset($_GET['atc_task'])) {
        echo ' task = "' . str_replace('+',' ',urldecode($_GET['atc_task'])) . '"; ' . "\n";
        } else {
        echo ' task = prompt("Number of Timeline Events for " + title, ""); ' . "\n";
        }
        
        echo ' if (task == null) { ' . "\n";
        echo '  title = title; ' . "\n";
        echo ' } else if (task != "0" && task.indexOf("-") == -1 && (task.length == 1 || task.length == 2)) { ' . "\n";
        if (isset($_GET['atc_task1'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_task1']))) . '";  ttask1 = xtask; ttitle1 = xtask + " " + ttitle1;  ttext1 = xtask + " " + ttext1;  ' . "\n";
        } else {
        echo ' xtask = prompt("Task1", ttask1); ttask1 = xtask; ttitle1 = xtask + " " + ttitle1;  ttext1 = xtask + " " + ttext1; ' . "\n";
        }
        if (isset($_GET['atc_title1'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_title1']))) . '";   ttitle1 = xtask;   ' . "\n";
        } else {
        echo ' xtask = prompt("Title1", ttitle1); ttitle1 = xtask; ' . "\n";
        }
        if (isset($_GET['atc_text1'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_text1']))) . '";  ttext1 = xtask;  ' . "\n";
        } else {
        echo ' xtask = prompt("Text1", ttext1); ttext1 = xtask; ' . "\n";
        }
        if (isset($_GET['atc_task2'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_task2']))) . '"; ttask2 = xtask; ttitle2 = xtask + " " + ttitle2;  ttext2 = xtask + " " + ttext2;   ' . "\n";
        } else {
        echo ' xtask = prompt("Task2", ttask2); ttask2 = xtask; ttitle2 = xtask + " " + ttitle2;  ttext2 = xtask + " " + ttext2;  ' . "\n";
        }
        if (isset($_GET['atc_title2'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_title2']))) . '";   ttitle2 = xtask;   ' . "\n";
        } else {
        echo ' xtask = prompt("Title2", ttitle2); ttitle2 = xtask; ' . "\n";
        }
        if (isset($_GET['atc_text2'])) {
        echo ' xtask = "' . str_replace("\t", "\n", str_replace('+',' ',urldecode($_GET['atc_text2']))) . '";  ttext2 = xtask;  ' . "\n";
        } else {
        echo ' xtask = prompt("Text2", ttext2); ttext2 = xtask; ' . "\n";
        }
        echo '  bits = "<br><a id=wafo href=# onclick=' . "'" . 'goforth();' . "'" . ' title=' . "'" . 'Show' . "'" . '>Click here to Show Chart when All Filled out Below ...</a><br><table border=1><tr><td>From</td><td>" + ttitle1 + "</td><td>" + ttext1 + "</td><td>" + ttask1 + "</td><td>" + ttask2 + "</td><td>" + ttitle2 + "</td><td>" + ttext2 + "</td><td style=display:none;>To</td></tr>";' . "\n";

        echo '  num = task;' . "\n" . 'while (ict != task) { ' . "\n";
        echo '    bits = bits + "<tr>";' . "\n";
        echo '    ict = ict + 1;' . "\n";
        echo '    bits = bits + "<td><div id=cal" + ict + "SContainer><input type=date id=sd" + ict + "put></input></div><input id=' . "'" . 'calzero" + ict + "store' . "'" . ' type=hidden value=\"\"></input><span onmousedown=\" this.style.opacity=1.0; this.style.border=sgreen; document.getElementById(' . "'" . 'calzero" + ict + "store' . "'" . ').value=' . "'" . '1' . "'" . ';\" id=' . "'" . 'calzero" + ict + "put' . "'" . ' style=\"z-index:5;opacity:1.0;font-size:100px;cursor:pointer;\" class=\"emojioverlay\">&128197;&128231;</span></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'width:8%' . "'" . '><input id=' . "'" . 'sone" + ict + "put' . "'" . ' type=text" + maybeval(ict,0) + "></input></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'width:8%' . "'" . '><textarea id=' . "'" . 'eone" + ict + "put' . "'" . ' data-type=text></textarea></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'background-color:lightgray;width:8%' . "'" . '><input id=' . "'" . 'ione" + ict + "put' . "'" . ' placeholder=' . "'" . 'Numeric, please' . "'" . ' type=number></input></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'background-color:lightgray;width:8%' . "'" . '><input id=' . "'" . 'itwo" + ict + "put' . "'" . ' placeholder=' . "'" . 'Numeric, please' . "'" . ' type=number></input></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'width:8%' . "'" . '><textarea id=' . "'" . 'stwo" + ict + "put' . "'" . ' data-type=text></textarea></td>";' . "\n";
        echo '    bits = bits + "<td style=' . "'" . 'width:8%' . "'" . '><input id=' . "'" . 'etwo" + ict + "put' . "'" . ' type=text" + maybeval(ict,1) + "></input></td>";' . "\n";
        echo '    bits = bits + "<td><div style=' . "'" . 'display:none;' . "'" . ' id=cal" + ict + "EContainer><input type=date id=ed" + ict + "put></input></div></td>";' . "\n";
        echo '    bits = bits + "</tr>";' . "\n";
        //echo '  alert(ict + " -- " + bits);' . "\n";
        echo '    } ' . "\n";

        echo '  } else { alert("Can only handle 99 or less."); window.location = "./annotatedtimeline_chart.php"; }' . "\n";
        echo '  bits = bits + "</table>";' . "\n";
        //echo '  alert(bits);' . "\n";
        echo ' var ct = document.getElementById("calendar_table"); ' . "\n";
        echo '  ct.innerHTML = bits;   location.href="#wafo"; ' . "\n";
        //echo '  alert(ct.innerHTML);' . "\n";
        echo '    if (ict != 0) { ict = 0; ' . "\n";
        echo '  while (ict != task) { ' . "\n";
        echo '    ict = ict + 1;' . "\n";
        echo '    if (7 == 5) { cals1(ict,0); } ' . "\n";
        echo '    } } ' . "\n checkforclass(); \n";
        echo ' } ' . "\n";
        

        echo "} \n" . '</' . 'script' . '>' . "\n";
      } 
    ?>
  <iframe id="mycalendartwo" scr="about:blank" style="display:none;width:1px;height:1px;"></iframe>
  </body>
</html>
