<?php
// column_chart.php
// Google Column Chart supervisor
// RJM Programming
// January, 2016
//
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";
}


// Command line Korn Shell interfacing code
if (!isset($_GET['data']) && !isset($_POST['data'])) {
if (strpos(strtolower(('' . $_SERVER['QUERY_STRING'])), 'listis=') !== false) {
$urlbase="https://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php";
$proposedform="<html><body onload=\"document.getElementById('clickme').click();\"><form id=myf style=display:none; target=_self action='" . $urlbase . "' method=POST><input type=hidden name=onclick value=y></input><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><input id=clickme type=submit value=Submit></input></form></body></html>";
$datavalis=explode("=", ('' . $_SERVER['QUERY_STRING']))[1];
$bitsbetween=["?title=", "&onclick=y&label=", "&value=", "&data="];
$bitsap=explode("__", explode("=", explode("?", ('?' . $_SERVER['QUERY_STRING']))[1])[0]);
for ($iuy=0; $iuy<sizeof($bitsap); $iuy++) {
if (strtolower(str_replace("_", "%20", $bitsap[$iuy])) == "listis") {
$proposedform=str_replace(" method=POST>", " method=POST><input type=hidden name='" . explode("=", explode("&", substr($bitsbetween[$iuy],1))[-1 + sizeof(explode("&", substr($bitsbetween[$iuy],1)))])[0] . "' value='" . str_replace("+"," ",urldecode($datavalis)) . "'></input>", $proposedform);
$urlbase.=$bitsbetween[$iuy] . '' . str_replace(" ", "%20", str_replace("+"," ",urldecode($datavalis)));
} else {
$proposedform=str_replace(" method=POST>", " method=POST><input type=hidden name='" . explode("=", explode("&", substr($bitsbetween[$iuy],1))[-1 + sizeof(explode("&", substr($bitsbetween[$iuy],1)))])[0] . "' value='" . str_replace("%2C", ",", str_replace("_", " ", $bitsap[$iuy])) . "'></input>", $proposedform);
$urlbase.=$bitsbetween[$iuy] . '' . str_replace("%2C", ",", str_replace("_", "%20", urlencode($bitsap[$iuy])));
}
}

if (strlen($urlbase) > 800) {
echo $proposedform;
} else {
header('Location: ' . $urlbase);
}
exit;
}
}


$GETextraopts = "";
if (isset($_GET['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_GET['extraopts'])); }
if (isset($_POST['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_POST['extraopts'])); }

$https = "http://";
$portbit = ":" . $_SERVER['SERVER_PORT'];
if(isset($_SERVER['HTTPS'])) {
if ($_SERVER['HTTPS'] == "on") {
$https = "https://";
$portbit = "";
}
} else if ($portbit == ":80") {
$portbit = "";
}

$superimposition="";
$overlay="";
$bdivstart="";
$bdivend="";
$cdivc="background-color: yellow;";
$nondefs="";
$op="0.5";
$tpy="0";
$lfx="0";

$amwv=false;
if ((strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile/') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari/') == false)) {
$amwv=true;
}

function retval($inv) {
if (strpos($inv, "E-") !== false) return "0";
return $inv;
}
?>
<html>
<head><style> body,h1 { margin: 0px 0px 0px 0px; } </style><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="//www.rjmprogramming.com.au/gchartgen.js?x=fdg"></script>
<title>Column Chart - RJM Programming - http://www.rjmprogramming.com.au (Copyright © 2013 rjmprogramming.com.au all rights reserved.)</title>
<?php
$data0 = "";
if (isset($_GET['data0'])) {
$data0 = "&data0=" . $_GET['data0'];
} else if (isset($_POST['data0'])) {
$data0 = "&data0=" . $_POST['data0'];
}

?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">

if (window.top) {
if (parent.document.getElementById('lhashis')) {
if (decodeURIComponent(('' + parent.document.getElementById('lhashis').value)).indexOf(',') != -1) {
location.hash=parent.document.getElementById('lhashis').value;
}
}
}

<?php
echo " var documentURL='' , locationhref='', returl='', dccnt=0, topmou='', etodi='emailee', etodicc='EmailCC', etodibcc='EmailBCC', etodisubject='EmailSubject';
if (document.URL.indexOf('file:') != 0) {
documentURL=document.URL;
documentURL=documentURL.split('#')[0];
}
";


$appval=$_SERVER['QUERY_STRING'];
if ($appval != '' && strpos($appval, '?') === false) {
$appval='?' . $_SERVER['QUERY_STRING'];
}
if (isset($_POST['data'])) {
$appval="";
$appvald="?";
if (strlen($_SERVER['QUERY_STRING']) > 1) $appvald="&";
foreach ($_POST as $name => $val) {
if ($name != "wouldlikeyouto" . "seekpermission") {
$appval.=$appvald . htmlspecialchars($name) . "=" . str_replace("+","%20",urlencode(htmlspecialchars($val)));
$appvald="&";
}
}
echo "\n documentURL=document.URL.split('#')[0] + \"" . str_replace("\n", " ", $appval) . "\"; \n";
}

if (isset($_GET['overlay'])) {
$op="0.5";
$tpy="0";
if (isset($_GET['top'])) {
$tpy=str_replace("px"," ",str_replace("+"," ",strtolower(urldecode($_GET['top']))));
if (substr(($tpy . " "),0,1) >= "1" && substr(($tpy . " "),0,1) <= "9") {
if ($tpy >= 240) {
$op="1.0";
}
}
}
$lfx="0";
if (isset($_GET['left'])) {
$lfx=str_replace("px"," ",str_replace("+"," ",strtolower(urldecode($_GET['left']))));
if (substr(($lfx . " "),0,1) >= "1" && substr(($lfx . " "),0,1) <= "9") {
if ($lfx >= 500) {
$op="1.0";
}
}
}
if (isset($_GET['opacity'])) {
$op=str_replace("+"," ",urldecode($_GET['overlay']));
}
if (substr(strtolower($_GET['overlay'] . " "),0,1) == 'b') {
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),1), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0],'',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aobar").click(); document.getElementById("aobar").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0],'',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aobar").click(); document.getElementById("aobar").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_GET['overlay'] . " "),0,1) == 'c') {
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),1), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' goother(null); goother(null); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"></iframe>';
} else {
$superimposition=' goother(null); goother(null); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_GET['overlay'] . " "),0,1) == 'l') {
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),1), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aoline").click(); document.getElementById("aoline").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aoline").click(); document.getElementById("aoline").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_GET['overlay'] . " "),0,1) == 'a') {
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),1), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aocolumn").click(); document.getElementById("aocolumn").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aocolumn").click(); document.getElementById("aocolumn").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),0), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' goother(null); goother(null); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . '"></iframe>';
$cdivc.='opacity:' . $op . ';';
}
} else if (isset($_POST['overlay'])) {
$op="0.5";
$tpy="0";
if (isset($_POST['top'])) {
$tpy=str_replace("px"," ",str_replace("+"," ",strtolower(urldecode($_POST['top']))));
if (substr(($tpy . " "),0,1) >= "1" && substr(($tpy . " "),0,1) <= "9") {
if ($tpy >= 240) {
$op="1.0";
}
}
}
$lfx="0";
if (isset($_POST['left'])) {
$lfx=str_replace("px"," ",str_replace("+"," ",strtolower(urldecode($_POST['left']))));
if (substr(($lfx . " "),0,1) >= "1" && substr(($lfx . " "),0,1) <= "9") {
if ($lfx >= 500) {
$op="1.0";
}
}
}
if (isset($_POST['opacity'])) {
$op=str_replace("+"," ",urldecode($_POST['overlay']));
}
if (substr(strtolower($_POST['overlay'] . " "),0,1) == 'b') {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aobar").click(); document.getElementById("aobar").click(); ';
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),1), ",") !== false) {
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aobar").click(); document.getElementById("aobar").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_POST['overlay'] . " "),0,1) == 'c') {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' goother(null); goother(null); ';
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),1), ",") !== false) {
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"></iframe>';
} else {
$superimposition=' goother(null); goother(null); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_POST['overlay'] . " "),0,1) == 'l') {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aoline").click(); document.getElementById("aoline").click(); ';
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),1), ",") !== false) {
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aoline").click(); document.getElementById("aoline").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (substr(strtolower($_POST['overlay'] . " "),0,1) == 'a') {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' document.getElementById("aocolumn").click(); document.getElementById("aocolumn").click(); ';
if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),1), ",") !== false) {
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"></iframe>';
} else {
$superimposition=' document.getElementById("aocolumn").click(); document.getElementById("aocolumn").click(); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' . $appval . '"></iframe>';
}
$cdivc.='opacity:' . $op . ';';
} else if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),0), ",") !== false) {
$superimposition=' locationhref="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"; documentURL=locationhref.replace("overlay=","overXlay=").replace("top=","toXp=").replace("left=","leXft="); returl=documentURL; locationhref=documentURL; ';
$superimposition.=' goother(null); goother(null); ';
$overlay='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:0.5;z-index:9;position:absolute;top:' . $tpy . 'px;left:' . $lfx . 'px;" src="' . $https . 'www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' . explode("data=",$appval)[0] . 'data=' . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . '"></iframe>';
$cdivc.='opacity:' . $op . ';';
}
}

if (isset($_POST['emailto'])) {
echo "\n etodi='" . urldecode($_POST['emailto']) . "'; \n";
if (isset($_POST['emailcc'])) echo "\n etodicc='" . urldecode($_POST['emailcc']) . "'; \n";
if (isset($_POST['emailbcc'])) echo "\n etodibcc='" . urldecode($_POST['emailbcc']) . "'; \n";
if (isset($_POST['emailsubject'])) echo "\n etodisubject='" . urldecode($_POST['emailsubject']) . "'; \n";
} else if (isset($_GET['emailto'])) {
echo "\n etodi='" . urldecode($_GET['emailto']) . "'; \n";
if (isset($_GET['emailcc'])) echo "\n etodicc='" . urldecode($_GET['emailcc']) . "'; \n";
if (isset($_GET['emailbcc'])) echo "\n etodibcc='" . urldecode($_GET['emailbcc']) . "'; \n";
if (isset($_GET['emailsubject'])) echo "\n etodisubject='" . urldecode($_GET['emailsubject']) . "'; \n";
}

?>

function delayurl() {
if (dccnt < 2) {
dccnt=0;
topmou='';
locationhref=toolongcheck(returl);
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
}
}

function prepareiframe(formidis) {
var rect;
if (document.getElementById('thedivoverlay') && topmou != '') {
if (document.getElementById('thedivoverlay').innerHTML == '' || !document.getElementById('thedivoverlayi')) {
if (formidis != '') {
rect = document.body.getBoundingClientRect();
document.getElementById('thedivoverlay').innerHTML='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:<?php echo $op; ?>;z-index:9;position:absolute;top:<?php echo $tpy; ?>px;left:<?php echo $lfx; ?>px;width:' + eval(rect.right - rect.left) + 'px;height:' + eval(rect.bottom - rect.top) + 'px;" src="' + 'about:blank' + '"></iframe>';
document.getElementById(formidis).target='thedivoverlayi';
} else {
rect = document.body.getBoundingClientRect();
document.getElementById('thedivoverlay').innerHTML='<iframe id=thedivoverlayi name=thedivoverlayi style="opacity:<?php echo $op; ?>;z-index:9;position:absolute;top:<?php echo $tpy; ?>px;left:<?php echo $lfx; ?>px;width:' + eval(rect.right - rect.left) + 'px;height:' + eval(rect.bottom - rect.top) + 'px;" src="' + locationhref + '"></iframe>';
}
} else if (document.getElementById('thedivoverlayi') && formidis != '') {
document.getElementById(formidis).target='thedivoverlayi';
} else if (document.getElementById('thedivoverlayi') && formidis == '') {
document.getElementById('thedivoverlayi').src=locationhref;
}
}
}

function yesoverlay(ovwhaturl) {
if (document.getElementById('thedivoverlay') && topmou != '') {
locationhref=ovwhaturl;
document.getElementById('chart_div').style.opacity='0.5';
prepareiframe('');
setTimeout(resetov, 2500);
} else {
location.href=ovwhaturl;
}
}

function resetov() {
dccnt=0;
topmou='';
}

function goother(aothis) {
var fromone='/ColumnChart';
var fromtwo='column_chart.php';
var returl=documentURL.split('#')[0];
if (!aothis) {
if (dccnt != 0) topmou='ColumnChart/column_chart.php';
<?php
if (isset($_GET['overlay'])) {
if (substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),0,1) == ',') {
echo "\n returl=returl.split('data=')[0] + 'data=" . urlencode(str_replace('+',' ',urldecode($_GET['overlay']))) . "'; \n";
} else if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_GET['overlay'])) . " "),0), ",") !== false) {
echo "\n returl=returl.split('data=')[0] + 'data=" . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_GET['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_GET['overlay'])))) . "'; \n";
}
} else if (isset($_POST['overlay'])) {
if (substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),0,1) == ',') {
echo "\n returl=returl.split('data=')[0] + 'data=" . urlencode(str_replace('+',' ',urldecode($_POST['overlay']))) . "'; \n";
} else if (strpos(substr(strtolower(str_replace('+',' ',urldecode($_POST['overlay'])) . " "),0), ",") !== false) {
echo "\n returl=returl.split('data=')[0] + 'data=" . urlencode(',' . str_replace(explode(",",str_replace('+',' ',urldecode($_POST['overlay'])))[0] . ',','',str_replace('+',' ',urldecode($_POST['overlay'])))) . "'; \n";
}
}
?>
} else if (aothis.innerHTML.toLowerCase().indexOf('area') != -1) {
if (dccnt != 0) topmou='AreaChart/area_chart.php';
returl=returl.replace(fromone,'/AreaChart').replace(fromtwo,'area_chart.php').replace('index.php','area_chart.php');
} else if (aothis.innerHTML.toLowerCase().indexOf('bar') != -1) {
if (dccnt != 0) topmou='BarChart/bar_chart.php';
returl=returl.replace(fromone,'/BarChart').replace(fromtwo,'bar_chart.php').replace('index.php','bar_chart.php');
} else if (aothis.innerHTML.toLowerCase().indexOf('column') != -1) {
if (dccnt != 0) topmou='ColumnChart/column_chart.php';
returl=returl.replace(fromone,'/ColumnChart').replace(fromtwo,'column_chart.php').replace('index.php','column_chart.php');
} else if (aothis.innerHTML.toLowerCase().indexOf('line') != -1) {
if (dccnt != 0) topmou='LineChart/line_chart.php';
returl=returl.replace(fromone,'/LineChart').replace(fromtwo,'line_chart.php').replace('index.php','line_chart.php');
}
postgoother(returl);
return returl;
}

function postgoother(retl) {
returl=retl;
if (dccnt == 0) {
setTimeout(delayurl, 2000);
dccnt=1;
} else {
dccnt=2;
locationhref=toolongcheck(returl);
if ((locationhref + ' ').substring(0,1) != '#') { if (1 == 1) { yesoverlay(locationhref); } else { location.href=locationhref; } }
setTimeout(resetov, 2500);
}
}

function toolongcheck(instis) {
if (instis.length > 900) {
prepareiframe('thisfcc');
document.getElementById('thisfcc').action=instis.split('?')[0];
//alert(instis.split('?')[0]);
var insti=instis.split('#')[0] + '&';
var getpis=insti.split('value=')[1].split('&')[0];
if (getpis.indexOf('%') != -1) {
document.getElementById('fvalue').value=decodeURIComponent(getpis);
} else {
document.getElementById('fvalue').value=getpis;
}
getpis=insti.split('mode=')[1].split('&')[0];
if (getpis.indexOf('%') != -1) {
document.getElementById('fmode').value=decodeURIComponent(getpis);
} else {
document.getElementById('fmode').value=getpis;
}
getpis=insti.split('label=')[1].split('&')[0];
if (getpis.indexOf('%') != -1) {
document.getElementById('flabel').value=decodeURIComponent(getpis);
} else {
document.getElementById('flabel').value=getpis;
}
getpis=insti.split('onclick=')[1].split('&')[0];
if (getpis.indexOf('%') != -1) {
document.getElementById('fonclick').value=decodeURIComponent(getpis);
} else {
document.getElementById('fonclick').value=getpis;
}
getpis=insti.split('data=')[1].split('&')[0];
if (getpis.indexOf('%') != -1) {
document.getElementById('fdata').value=decodeURIComponent(getpis);
} else {
document.getElementById('fdata').value=getpis;
}
//alert(98);
document.getElementById('fcsubmit').click();
return '#igchart'; //'#igchart';
} else {
return instis;
}
}

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);
}
}
}

var ready=false, x=-1, y=-1, elemLeft=0, elemTop=0, ir=-1, ic=-1, talkingpoint='';

var xpnum=1; // done here at supervisor
var allowed=true; // done here at supervisor
var nojwinextra=""; // done here at supervisor
<?php
if (!isset($_POST['data'])) {
echo "
if (document.URL.indexOf('nojwin') == -1 && navigator.userAgent.match(/iPhone|iPad/i)) {
if (document.URL.indexOf('?') == -1) {
location.href=document.URL.split('#')[0] + '?nojwin=Q';
} else {
location.href=document.URL.split('#')[0] + '&nojwin=Q';
}
}
";
}
?>
if (document.URL.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i)) {
nojwinextra="&nojwinyes=Y";
}

<?php
echo "
function selectevent(ans) {
if (ans != '' && ans != paramdata0) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata0 + '&csv0=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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('&ccb=y&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&ccb=y&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() == 'l') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/LineChart/line_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/AreaChart/area_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/BarChart/bar_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
}
} else if (ans.indexOf(String.fromCharCode(43)) != -1) {
topmou='/ColumnChart/column_chart.php';
postgoother(documentURL.split('&data=')[0] + '&data=' + ourencodeURIComponent(ans.replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'')));
postgoother(documentURL.split('&data=')[0] + '&data=' + ourencodeURIComponent(ans.replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'')));
} else if (pardata == '') {
//alert(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
locationhref=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else {
locationhref=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
}
}
}

function selecteventtwo(ans) {
if (ans != '' && ans != paramdata0) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata0 + '&csv0=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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('&ccb=y&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&ccb=y&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() == 'l') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/LineChart/line_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,documentURL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/AreaChart/area_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,documentURL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (ans.length > 1) {
if (ans.substring(1,2) == '+') {
topmou='/BarChart/bar_chart.php';
postgoother(documentURL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
postgoother(documentURL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
}
}
if (pardata == '' && topmou == '') {
locationhref=iftoobig(mou,(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else if (topmou == '') {
location.href=ifoverlay(mou,document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
}
} else if (ans.indexOf(String.fromCharCode(43)) != -1) {
topmou='/ColumnChart/column_chart.php';
postgoother(documentURL.split('&data=')[0] + '&data=' + ourencodeURIComponent(ans.replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'')));
postgoother(documentURL.split('&data=')[0] + '&data=' + ourencodeURIComponent(ans.replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'').replace(String.fromCharCode(43),'')));
} else if (pardata == '') {
//alert(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
locationhref=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
} else {
locationhref=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
if ((locationhref + ' ').substring(0,1) != '#') { location.href=locationhref; }
}
}
}

function selecteventthree(ans) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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('&cca=y&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&cca=y&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() == 'l') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php');
}
} else if (pardata == '') {
//alert(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
location.href=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
} else {
//alert('pardata=' + pardata);
location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}
}

function selecteventfour(ans) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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('&cca=y&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&cca=y&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() == 'l') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php');
}
} else if (pardata == '') {
//alert(document.URL + ' ?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
location.href=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
} else {
//alert('paRdata=' + pardata);
location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}

}

function selecteventfive(ans) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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() == 'l') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php');
}
} else if (pardata == '') {
//alert(document.URL + ' ?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
location.href=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
} else {
//alert('PardAta=' + pardata);
location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}
}

function selecteventsix(ans) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
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';


if (ansbits[0].indexOf('@') != -1) {
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() == 'l') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart.php', 'line_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'a') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart.php', 'area_chart.php');
}
} else if (ans.substring(0,1).toLowerCase() == 'b') {
if (pardata == '') {
location.href=iftoobig('',(document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(paramdata)).replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php'));
} else {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart.php', 'bar_chart.php');
}
} else if (pardata == '') {
//alert(document.URL + ' ?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
location.href=iftoobig('',document.URL + '?title=" . urlencode(str_replace(",","`",$GETtitle)) . '&label=' . urlencode($GETlabel) . '&onclick=y&value=' . urlencode($GETvalue) . "&data=' + ourencodeURIComponent(ans));
} else {
//alert('PardatA=' + pardata);
location.href=iftoobig('',document.URL.replace(pardata, ourencodeURIComponent(ans)));
//location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}

}

";
?>
<?php
echo "var mode='', chart, data, data0, columnChartBefore, columnChartAfter, columnChartDiff, pardata = (location.search.split('data=')[1] ? location.search.split('data=')[1].split('&')[0] : ''), paramdata=decodeURIComponent(pardata), pardata0 = (location.search.split('data0=')[1] ? location.search.split('data0=')[1].split('&')[0] : ''), paramdata0=decodeURIComponent(pardata0); \n";

$GETmode="";
if (isset($_GET['mode'])) echo "\n mode='" . urldecode($_GET['mode']) . "'; \n";
if (isset($_POST['mode'])) echo "\n mode='" . urldecode($_POST['mode']) . "'; \n";
if (isset($_GET['mode'])) $GETmode = urldecode($_GET['mode']);
if (isset($_POST['mode'])) $GETmode = urldecode($_POST['mode']);

$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";
}

$GETonclick = "";
$GETyonclick = "";
if (isset($_GET['onclick'])) $GETonclick = urldecode($_GET['onclick']);
if (isset($_POST['onclick'])) $GETonclick = urldecode($_POST['onclick']);
if (isset($_GET['onclick'])) $GETyonclick = '&onclick=' + urldecode($_GET['onclick']);
if (isset($_POST['onclick'])) $GETyonclick = '&onclick=' + urldecode($_POST['onclick']);

echo "var yonclick='" . $GETyonclick . "'; \n";

$GETtitle = "Company Performance";
$GETlabel = "Year";
$GETvalue = "Sales,Expenses";
$GETdata = ",['2004',1000,400],['2005',1170,460],['2006',660,1120],['2007',1030,540]";

if (isset($_POST['data'])) {
if (isset($_GET['title'])) {
$GETtitle = str_replace("\\'", "'", str_replace("+"," ",urldecode($_GET['title'])));
} else {
$GETtitle = str_replace("\\'", "'", str_replace("+"," ",urldecode($_POST['title'])));
}

$burl="";
if ($GETtitle != "") {
$ourtitles=explode(";", str_replace(";base64","|base64",urldecode($GETtitle)));
for ($ipa=0; $ipa<sizeof($ourtitles); $ipa++) {
$ourtitles[$ipa]=str_replace("|base64",";base64",$ourtitles[$ipa]);
}
$GETtitle = str_replace("\\'", "'", $ourtitles[sizeof($ourtitles) - 1]);
if (sizeof($ourtitles) > 1 && (strpos(strtolower($ourtitles[0]), "//") !== false || strpos(strtolower($ourtitles[0]), "data:") !== false)) {
while (sizeof($ourtitles) > 1 && (strpos(strtolower($ourtitles[0]), "//") !== false || strpos(strtolower($ourtitles[0]), "data:") !== false)) {
$burl="";
// Thanks to https://stackoverflow.com/questions/8828076/how-can-i-hack-a-background-image-into-google-chart-tools-dynamic-javascript-s
if (strpos($ourtitles[0], "data:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("data:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "DATA:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("DATA:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "Data:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("Data:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "https://") !== false) {
$burl="https://" . explode(" ", explode("https://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "Https://") !== false) {
$burl="Https://" . explode(" ", explode("Https://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "HTTPS://") !== false) {
$burl="HTTPS://" . explode(" ", explode("HTTPS://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "http://") !== false) {
$burl="http://" . explode(" ", explode("http://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "Http://") !== false) {
$burl="Http://" . explode(" ", explode("Http://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "HTTP://") !== false) {
$burl="HTTP://" . explode(" ", explode("HTTP://", $ourtitles[0])[1])[0];
} else {
$burl="//" . explode(" ", explode("//", $ourtitles[0])[1])[0];
}
if ($burl != "") {
$ourmimetype="";
if (strpos($burl, "data:") === false) {
$ourext=explode(".", $burl)[-1 + sizeof(explode(".", $burl))];
for ($im=0; $im<sizeof($exts); $im++) {
if (strtolower("." . $ourext) == strtolower($exts[$im])) $ourmimetype=$types[$im] . ";";
}
}
if (strpos($burl, "audio/") !== false || strpos($ourmimetype, "audio/") !== false) {
if ($bdivstart == "") $bdivstart="<div id='bkcol'>";
if ($bdivend == "") {
$bdivend="</div><audio type='audio/" . explode(';', explode('audio/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></audio>";
} else {
$bdivend=str_replace("</div>", "</div><audio type='audio/" . explode(';', explode('audio/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></audio>", $bdivend);
}
} else if (strpos($burl, "video/") !== false || strpos($ourmimetype, "video/") !== false) {
if ($bdivstart == "") $bdivstart="<div id='bkcol'>";
if ($bdivend == "") {
$bdivend="</div><video type='video/" . explode(';', explode('video/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></video>";
} else {
$bdivend=str_replace("</div>", "</div><video type='video/" . explode(';', explode('video/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></video>", $bdivend);
}
} else if ($burl != "") {
$bdivstart="<div id='bkcol' style=\"background: linear-gradient(rgba(255,255,255,0.4),rgba(255,255,255,0.4)),url('" . $burl . "'); background-repeat: repeat;\">";
if ($bdivend == "") $bdivend="</div>";
}
}
if (strpos($cdivc,"opacity") !== false) {
$cdivc=str_replace("yellow","none", $cdivc);
} else {
$cdivc="background-color: none; opacity:1.0; ";
}
array_shift($ourtitles);
}
if ($burl != "") {
$nondefs.=", backgroundColor: 'none' ";
$ourtitles=explode(";", urldecode($GETtitle));
} else {
$nondefs=$nondefs;
}
}
}

if (isset($_GET['label'])) {
$GETlabel = str_replace("\\'", "'", $_GET['label']);
} else {
$GETlabel = str_replace("\\'", "'", $_POST['label']);
}
if (isset($_GET['value'])) {
$GETvalue = str_replace("\\'", "'", $_GET['value']);
} else {
$GETvalue = str_replace("\\'", "'", $_POST['value']);
}
//$GETdata = str_replace("\\'", "'", $_POST['data']);
$GETdata = str_replace("~", "'", str_replace("\\'", "'", str_replace("+"," ",urldecode(checkdatadata0('POST',$_POST['data'])))));
//echo "\n pardata = " . '"' . $_POST['data'] . '"; ' . " \n";
echo "\n paramdata='" . str_replace("'",'~',$GETdata) . "'; \n setTimeout(fillindata, 300); \n setTimeout(filldata, 3000); \n"; // = decodeURIComponent(pardata); " . " \n";
}
if (isset($_GET['data'])) {
$GETtitle = str_replace("\\'", "'", str_replace("+"," ",urldecode($_GET['title'])));
$burl="";
if ($GETtitle != "") {
$ourtitles=explode(";", str_replace(";base64","|base64",urldecode($GETtitle)));
for ($ipa=0; $ipa<sizeof($ourtitles); $ipa++) {
$ourtitles[$ipa]=str_replace("|base64",";base64",$ourtitles[$ipa]);
}
$GETtitle = str_replace("\\'", "'", $ourtitles[sizeof($ourtitles) - 1]);
if (sizeof($ourtitles) > 1 && (strpos(strtolower($ourtitles[0]), "//") !== false || strpos(strtolower($ourtitles[0]), "data:") !== false)) {
while (sizeof($ourtitles) > 1 && (strpos(strtolower($ourtitles[0]), "//") !== false || strpos(strtolower($ourtitles[0]), "data:") !== false)) {
$burl="";
// Thanks to https://stackoverflow.com/questions/8828076/how-can-i-hack-a-background-image-into-google-chart-tools-dynamic-javascript-s
if (strpos($ourtitles[0], "data:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("data:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "DATA:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("DATA:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "Data:") !== false) {
$burl=str_replace("%2b","+","data:" . explode(" ", explode("Data:", substr($ourtitles[0],0,20) . explode(";",substr($ourtitles[0],20))[0] . " " )[1])[0]);
} else if (strpos($ourtitles[0], "https://") !== false) {
$burl="https://" . explode(" ", explode("https://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "Https://") !== false) {
$burl="Https://" . explode(" ", explode("Https://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "HTTPS://") !== false) {
$burl="HTTPS://" . explode(" ", explode("HTTPS://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "http://") !== false) {
$burl="http://" . explode(" ", explode("http://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "Http://") !== false) {
$burl="Http://" . explode(" ", explode("Http://", $ourtitles[0])[1])[0];
} else if (strpos($ourtitles[0], "HTTP://") !== false) {
$burl="HTTP://" . explode(" ", explode("HTTP://", $ourtitles[0])[1])[0];
} else {
$burl="//" . explode(" ", explode("//", $ourtitles[0])[1])[0];
}
if ($burl != "") {
$ourmimetype="";
if (strpos($burl, "data:") === false) {
$ourext=explode(".", $burl)[-1 + sizeof(explode(".", $burl))];
for ($im=0; $im<sizeof($exts); $im++) {
if (strtolower("." . $ourext) == strtolower($exts[$im])) $ourmimetype=$types[$im] . ";";
}
}
if (strpos($burl, "audio/") !== false || strpos($ourmimetype, "audio/") !== false) {
if ($bdivstart == "") $bdivstart="<div id='bkcol'>";
if ($bdivend == "") {
$bdivend="</div><audio type='audio/" . explode(';', explode('audio/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></audio>";
} else {
$bdivend=str_replace("</div>", "</div><audio type='audio/" . explode(';', explode('audio/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></audio>", $bdivend);
}
} else if (strpos($burl, "video/") !== false || strpos($ourmimetype, "video/") !== false) {
if ($bdivstart == "") $bdivstart="<div id='bkcol'>";
if ($bdivend == "") {
$bdivend="</div><video type='video/" . explode(';', explode('video/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></video>";
} else {
$bdivend=str_replace("</div>", "</div><video type='video/" . explode(';', explode('video/', $ourmimetype . $burl)[1])[0] . "' controls autoplay><source src=" . $burl . "></source></video>", $bdivend);
}
} else if ($burl != "") {
$bdivstart="<div id='bkcol' style=\"background: linear-gradient(rgba(255,255,255,0.4),rgba(255,255,255,0.4)),url('" . $burl . "'); background-repeat: repeat;\">";
if ($bdivend == "") $bdivend="</div>";
}
}
if (strpos($cdivc,"opacity") !== false) {
$cdivc=str_replace("yellow","none", $cdivc);
} else {
$cdivc="background-color: none; opacity:1.0; ";
}
array_shift($ourtitles);
}
if ($burl != "") {
$nondefs.=", backgroundColor: 'none' ";
$ourtitles=explode(";", urldecode($GETtitle));
} else {
$nondefs=$nondefs;
}
}
}

$GETlabel = str_replace("\\'", "'", str_replace("+"," ",urldecode($_GET['label'])));
$GETvalue = str_replace("\\'", "'", str_replace("+"," ",urldecode($_GET['value'])));
$GETdata = str_replace("\\'", "'", str_replace("+"," ",urldecode($_GET['data'])));
}

if (!isset($_GET['data']) && !isset($_POST['data']) && strpos($_SERVER['QUERY_STRING'],"title=") !== false) {
$bbits = explode("data=", file_get_contents('php://input'));
$GETtitle = str_replace("\\'", "'", urldecode(explode('&',explode("title=", $_SERVER['QUERY_STRING'])[1])[0]));
$GETlabel = str_replace("\\'", "'", urldecode(explode('&',explode("label=", $_SERVER['QUERY_STRING'])[1])[0]));
$GETvalue = str_replace("\\'", "'", urldecode(explode('&',explode("value=", $_SERVER['QUERY_STRING'])[1])[0]));
if (sizeof($bbits) > 1) {
$GETdata = str_replace("\\'", "'", urldecode(explode('&',$bbits[1])[0]));
} else {
$GETdata = "";
}
}

echo " var colnames= '" . $GETlabel . "," . str_replace("'", "", $GETvalue) . "'; \n";

if (isset($_GET['data0']) || isset($_POST['data0'])) {
echo " google.load('visualization', '1.1', {packages:['corechart']}); " . "\n";
echo ' google.setOnLoadCallback(drawChart); ' . "\n";
echo ' function drawChart() { ' . "\n";
if ($GETdata == "") {
echo ' var wert="data=google.visualization.arrayToDataTable([ [' . "'" . urldecode($GETlabel) . "','" . str_replace(",", "','", str_replace("'", "", urldecode($GETvalue))) . "'" . '],"; ' . "\n";
echo " wert+=parent.document.getElementById('data').value.replace(/\,\]/g,\",0\").replace(/\,\,/g,\",0,\").replace(/\,\]/g,\",0]\").replace(/\[\~/g,\"['\").replace(/\~\,/g,\"',\"); " . "\n";
echo ' wert+=" ])";' . "\n";
echo ' eval(wert); ' . "\n";
} else {
echo ' if (1 == 8 && decodeURIComponent(("" + location.hash).replace(/^undefined/g,"")).trim().indexOf(",") != -1) { ' . "\n";
echo ' var xwert="data=google.visualization.arrayToDataTable([ [' . "'" . $GETlabel . "','" . str_replace(",", "','", str_replace("'", "", $GETvalue)) . "'" . '],"; ' . "\n";
echo " xwert+=\"" . str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata))))) . "\" + decodeURIComponent(('' + location.hash).replace(/^\#/g,'').replace(/\%20/g,' ').replace(/\,\]/g,\",0\").replace(/\[\~/g,\"['\").replace(/\~\,/g,\"',\")); " . "\n";
echo ' xwert+=" ])"; xwert=xwert.replace(",,",","); ' . "\n";
echo ' eval(xwert); ' . "\n";
echo ' } else { ' . "\n";
echo ' data = google.visualization.arrayToDataTable([ ' . "\n";
echo " ['" . urldecode($GETlabel) . "','" . str_replace(",", "','", str_replace("'", "", urldecode($GETvalue))) . "'] \n";
echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata)))));
echo " ]);\n";
echo " } \n";
}
echo ' data0 = google.visualization.arrayToDataTable([ ' . "\n";
echo " ['" . urldecode($GETlabel) . "','" . str_replace(",", "','", str_replace("'", "", urldecode($GETvalue))) . "'] \n";
if (isset($_GET['data0'])) echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", urldecode($_GET['data0']))))));
if (isset($_POST['data0'])) echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", urldecode($_POST['data0']))))));
echo " ]);\n";

echo " columnChartBefore = new google.visualization.ColumnChart(document.getElementById('columnchart_before')); \n";
echo " columnChartAfter = new google.visualization.ColumnChart(document.getElementById('columnchart_after')); \n";
echo " columnChartDiff = new google.visualization.ColumnChart(document.getElementById('columnchart_diff')); \n";

if (trim($GETextraopts) != '') { $GETextraopts=str_replace(',,',',',trim($GETextraopts) . ','); }
echo " var options = { " . $GETextraopts . " legend: { position: 'top' }" . $nondefs . " }; \n";

if ($GETonclick != "") {
echo "google.visualization.events.addListener(columnChartBefore, 'select', myselectfunctionccb); \n function myselectfunctionccb() {
if (ready) {
var relist=['remail',''],ire,ansbits,ioffset=document.head.innerHTML.indexOf(']);'),ans=null,doit=true,avblurb=talkingpoint,kl,lk, thisnum, num=0,message = '', dparts, colparts=colnames.split(','), colav=new Array(), predparts, postdparts, diffcolnames=colnames,diffvalues;
var selection = columnChartBefore.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
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 {
ir=item.row;
ic=item.column;
//document.title=ir + ',' + ic;
}
var str = data0.getFormattedValue(item.row, item.column);
//document.title=str;
message=document.head.innerHTML.substring(ioffset);
while (message.indexOf(', [') != -1) {
message=message.replace(', [',',[');
}
dparts=message.split(',[');
//document.title='';
colav.push(0.0);
for (kl=1; kl<colparts.length; kl++) {
//document.title=1;
colav.push(0.0);
doit=true;
num=1;
for (lk=1; lk<dparts.length; lk++) {
if (doit) {
//document.title=3;
thisnum=dparts[lk].replace(']',',').split(',');
//if (kl == 1) document.title+=4 + ' .. ' + eval(thisnum[kl]) + ' ... ' + lk + ' ... ' + colav[kl] + ' ... ' + thisnum.length + ' ... ' + dparts[lk];
colav[kl] = eval(eval(colav[kl] * eval(-1 + num)) + eval(thisnum[kl])) / eval(0.0 + num);
//document.title=5;
if (dparts[lk].indexOf(';') != -1) doit=false;
if (doit) num++;
}
}
//document.title=7;
if (avblurb == '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
//document.title=8;
avblurb+='Average ' + colparts[kl] + ' over ' + num + ' ' + colparts[0] + ' values is ' + colav[kl] + String.fromCharCode(10);
//document.title=7;
}
if (avblurb != '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
if (eval(dparts.length) >= eval(1 + item.row)) {
postdparts=dparts[eval(1 + item.row)].replace(']',',').split(',');
if (eval(postdparts.length) >= eval(1 + item.column)) {
if (eval(colparts.length) == 3) {
if (1 == 1) {
avblurb+='With L B A and changed data options below to append + causes superimposition ... ' + String.fromCharCode(10) + String.fromCharCode(10);
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + 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+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb, paramdata0);
if (ans != null) {
selectevent(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb);
}
} else {
predparts=dparts[eval(1 + item.row)].split(']');
diffvalues=('~' + predparts[0] + '~').replace('~' + postdparts[0].replace(']','') + ',','~');
if (eval(0 + item.column) == 1) {
diffvalues=diffvalues.replace('~' + str + ',','').replace(/~/g,'');
} else if (eval(colparts.length) == eval(1 + item.column)) {
diffvalues=diffvalues.replace(',' + str + '~','').replace(/~/g,'');
} else {
diffvalues=diffvalues.replace(',' + str + ',',',').replace(/~/g,'');
}
diffcolnames=('~' + colnames + '~').replace('~' + colparts[0] + ',','~').replace('~' + colparts[eval(0 + item.column)] + ',','').replace(',' + colparts[eval(0 + item.column)] + '~','').replace(',' + colparts[eval(0 + item.column)] + ',',',').replace(/~/g,'');
if (1 == 1) {
avblurb+='With L B A and changed data options below to append + causes superimposition ... ' + String.fromCharCode(10) + String.fromCharCode(10);
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + 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+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb, paramdata0);
if (ans != null) {
selecteventtwo(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb);
}
}
}
}
message += '{row:' + item.row + ',column:' + item.column + '} = ' + str;
} else if (item.row != null) {
var str = data.getFormattedValue(item.row, 0);
message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str;
} else if (item.column != null) {
var str = data.getFormattedValue(0, item.column);
message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str;
}
}
if (message == '') {
message = 'nothing';
}
//document.title='1 ' + message;
if (1 == 2) console.log('You selected ' + message);
}
}
// );
";
}




echo " columnChartBefore.draw(data0, options); \n";
if ($GETr != "" && $GETc == "" && (isset($_GET['ccb']) || isset($_POST['ccb']))) echo " columnChartBefore.setSelection([{'row': " . $GETr . ", 'column': null}]); setTimeout(myselectfunctionccb,4100); \n";
if ($GETr == "" && $GETc != "" && (isset($_GET['ccb']) || isset($_POST['ccb']))) echo " columnChartBefore.setSelection([{'row': null, 'column': " . $GETc . "}]); setTimeout(myselectfunctionccb,4100); \n";
if ($GETr != "" && $GETc != "" && (isset($_GET['ccb']) || isset($_POST['ccb']))) echo " columnChartBefore.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]); setTimeout(myselectfunctionccb,4100); \n";



if ($GETonclick != "") {
echo "google.visualization.events.addListener(columnChartAfter, 'ready', function() { ready=true; }); \n";
echo "google.visualization.events.addListener(columnChartAfter, 'select', myselectfunctioncca); \n function myselectfunctioncca() {
if (ready) {
var relist=['remail',''],ire,ansbits,ioffset=0,ans=null,doit=true,avblurb=talkingpoint,kl,lk, thisnum, num=0,message = '', dparts, colparts=colnames.split(','), colav=new Array(), predparts, postdparts, diffcolnames=colnames,diffvalues;
var selection = columnChartAfter.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
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 {
ir=item.row;
ic=item.column;
//document.title=ir + ',' + ic;
}
var str = data.getFormattedValue(item.row, item.column);
//document.title=str;
message=document.head.innerHTML.substring(ioffset);
while (message.indexOf(', [') != -1) {
message=message.replace(', [',',[');
}
dparts=message.split(',[');
//document.title='';
colav.push(0.0);
for (kl=1; kl<colparts.length; kl++) {
//document.title=1;
colav.push(0.0);
doit=true;
num=1;
for (lk=1; lk<dparts.length; lk++) {
if (doit) {
//document.title=3;
thisnum=dparts[lk].replace(']',',').split(',');
//if (kl == 1) document.title+=4 + ' .. ' + eval(thisnum[kl]) + ' ... ' + lk + ' ... ' + colav[kl] + ' ... ' + thisnum.length + ' ... ' + dparts[lk];
colav[kl] = eval(eval(colav[kl] * eval(-1 + num)) + eval(thisnum[kl])) / eval(0.0 + num);
//document.title=5;
if (dparts[lk].indexOf(';') != -1) doit=false;
if (doit) num++;
}
}
//document.title=7;
if (avblurb == '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
//document.title=8;
avblurb+='Average ' + colparts[kl] + ' over ' + num + ' ' + colparts[0] + ' values is ' + colav[kl] + String.fromCharCode(10);
//document.title=7;
}
if (avblurb != '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
if (eval(dparts.length) >= eval(1 + item.row)) {
postdparts=dparts[eval(1 + item.row)].replace(']',',').split(',');
if (eval(postdparts.length) >= eval(1 + item.column)) {
if (eval(colparts.length) == 3) {
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + 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+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb, paramdata);
if (ans != null) {
selecteventthree(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb);
}
} else {
predparts=dparts[eval(1 + item.row)].split(']');
diffvalues=('~' + predparts[0] + '~').replace('~' + postdparts[0].replace(']','') + ',','~');
if (eval(0 + item.column) == 1) {
diffvalues=diffvalues.replace('~' + str + ',','').replace(/~/g,'');
} else if (eval(colparts.length) == eval(1 + item.column)) {
diffvalues=diffvalues.replace(',' + str + '~','').replace(/~/g,'');
} else {
diffvalues=diffvalues.replace(',' + str + ',',',').replace(/~/g,'');
}
diffcolnames=('~' + colnames + '~').replace('~' + colparts[0] + ',','~').replace('~' + colparts[eval(0 + item.column)] + ',','').replace(',' + colparts[eval(0 + item.column)] + '~','').replace(',' + colparts[eval(0 + item.column)] + ',',',').replace(/~/g,'');
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + 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+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb, paramdata);
if (ans != null) {
selecteventfour(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb);
}
}
}
}
message += '{row:' + item.row + ',column:' + item.column + '} = ' + str;
} else if (item.row != null) {
var str = data.getFormattedValue(item.row, 0);
message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str;
} else if (item.column != null) {
var str = data.getFormattedValue(0, item.column);
message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str;
}
}
if (message == '') {
message = 'nothing';
}
//document.title='2 ' + message;
if (1 == 2) console.log('You selected ' + message);
}
}
// );
";
}


echo " columnChartAfter.draw(data, options); \n";
if ($GETr != "" && $GETc == "" && (isset($_GET['cca']) || isset($_POST['cca']))) echo " columnChartAfter.setSelection([{'row': " . $GETr . ", 'column': null}]); setTimeout(myselectfunctioncca,4100); \n";
if ($GETr == "" && $GETc != "" && (isset($_GET['cca']) || isset($_POST['cca']))) echo " columnChartAfter.setSelection([{'row': null, 'column': " . $GETc . "}]); setTimeout(myselectfunctioncca,4100); \n";
if ($GETr != "" && $GETc != "" && (isset($_GET['cca']) || isset($_POST['cca']))) echo " columnChartAfter.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]); setTimeout(myselectfunctioncca,4100); \n";

echo " var diffData = columnChartDiff.computeDiff(data0, data); \n";
echo " columnChartDiff.draw(diffData, options); \n } \n";


echo " </script> \n";
echo " </head> \n";



if ($superimposition == "") {
echo " <body style='background-color: silver;'> \n";
} else {
echo " <body onload='" . $superimposition . "' style='background-color: silver;'> \n";
}

echo " <h1>" . $GETtitle . " Column Chart</h1> \n";

echo " <span id='columnchart_before' style='width: 450px; height: 250px; display: inline-block'></span>\n";
echo " <span id='columnchart_after' style='width: 450px; height: 250px; display: inline-block'></span>\n";
echo " <span id='columnchart_diff' style='width: 450px; height: 250px; display: inline-block'></span>\n";
} else {
echo ' data0 = "";' . "\n";

echo " google.load('visualization', '1', {packages:['corechart']}); " . "\n";
echo ' google.setOnLoadCallback(drawChart); ' . "\n";
echo ' function drawChart() { ' . "\n";
echo ' if (decodeURIComponent(("" + location.hash).replace(/^undefined/g,"")).trim().indexOf(",") != -1) { ' . "\n";
echo ' var xwert="data=google.visualization.arrayToDataTable([ [' . "'" . $GETlabel . "','" . str_replace(",", "','", str_replace("'", "", $GETvalue)) . "'" . '],"; ' . "\n";
echo " xwert+=\"" . str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata))))) . "\" + ('' + location.hash).replace(/^\#/g,'').replace(/\%20/g,'').replace(/\,\]/g,\",0\").replace(/\[\~/g,\"['\").replace(/\~\,/g,\"',\"); " . "\n";
echo ' xwert+=" ])"; xwert=xwert.replace(",,",","); ' . "\n";
echo ' eval(xwert); ' . "\n";
echo ' } else { ' . "\n";
echo ' data = google.visualization.arrayToDataTable([ ' . "\n";
echo " ['" . urldecode($GETlabel) . "','" . str_replace(",", "','", str_replace("'", "", urldecode($GETvalue))) . "'] \n";
echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata)))));
echo " ]);\n";
echo " } \n";

if (trim($GETextraopts) != '') { $GETextraopts=str_replace(',,',',',trim($GETextraopts) . ','); }
echo " var options = { " . $GETextraopts . " \n";
echo " title: '" . $GETtitle . "', \n";
echo " hAxis: {title: '" . $GETlabel . "', titleTextStyle: {color: 'red'}}" . $nondefs . " \n";
echo " }; \n";


echo " chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); \n";
if ($GETonclick != "") {
echo "google.visualization.events.addListener(chart, 'ready', function() { ready=true; }); \n";
echo "google.visualization.events.addListener(chart, 'select', myselectfunction); \n function myselectfunction() {
if (ready) {
var relist=['remail',''],ire,ansbits,ioffset=0,ans=null,doit=true,avblurb=talkingpoint,kl,lk, thisnum, num=0,message = '', dparts, colparts=colnames.split(','), colav=new Array(), predparts, postdparts, diffcolnames=colnames,diffvalues;
var selection = chart.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
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 {
ir=item.row;
ic=item.column;
//document.title=ir + ',' + ic;
}
var str = data.getFormattedValue(item.row, item.column);
//document.title=str;
message=document.head.innerHTML.substring(ioffset);
while (message.indexOf(', [') != -1) {
message=message.replace(', [',',[');
}
dparts=message.split(',[');
//document.title='';
colav.push(0.0);
for (kl=1; kl<colparts.length; kl++) {
//document.title=1;
colav.push(0.0);
doit=true;
num=1;
for (lk=1; lk<dparts.length; lk++) {
if (doit) {
//document.title=3;
thisnum=dparts[lk].replace(']',',').split(',');
//if (kl == 1) document.title+=4 + ' .. ' + eval(thisnum[kl]) + ' ... ' + lk + ' ... ' + colav[kl] + ' ... ' + thisnum.length + ' ... ' + dparts[lk];
colav[kl] = eval(eval(colav[kl] * eval(-1 + num)) + eval(thisnum[kl])) / eval(0.0 + num);
//document.title=5;
if (dparts[lk].indexOf(';') != -1) doit=false;
if (doit) num++;
}
}
//document.title=7;
if (avblurb == '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
//document.title=8;
avblurb+='Average ' + colparts[kl] + ' over ' + num + ' ' + colparts[0] + ' values is ' + colav[kl] + String.fromCharCode(10);
//document.title=7;
}
if (avblurb != '') avblurb+=String.fromCharCode(10) + String.fromCharCode(10);
if (eval(dparts.length) >= eval(1 + item.row)) {
postdparts=dparts[eval(1 + item.row)].replace(']',',').split(',');
if (eval(postdparts.length) >= eval(1 + item.column)) {
if (eval(colparts.length) == 3) {
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + 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+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb, paramdata);
if (ans != null) {
selecteventfive(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb);
}
} else {
predparts=dparts[eval(1 + item.row)].split(']');
diffvalues=('~' + predparts[0] + '~').replace('~' + postdparts[0].replace(']','') + ',','~');
if (eval(0 + item.column) == 1) {
diffvalues=diffvalues.replace('~' + str + ',','').replace(/~/g,'');
} else if (eval(colparts.length) == eval(1 + item.column)) {
diffvalues=diffvalues.replace(',' + str + '~','').replace(/~/g,'');
} else {
diffvalues=diffvalues.replace(',' + str + ',',',').replace(/~/g,'');
}
diffcolnames=('~' + colnames + '~').replace('~' + colparts[0] + ',','~').replace('~' + colparts[eval(0 + item.column)] + ',','').replace(',' + colparts[eval(0 + item.column)] + '~','').replace(',' + colparts[eval(0 + item.column)] + ',',',').replace(/~/g,'');
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + String.fromCharCode(10) + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10);
avblurb+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; }
ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb, paramdata);
if (ans != null) {
selecteventsix(ans);
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb);
}
}
}
}
message += '{row:' + item.row + ',column:' + item.column + '} = ' + str;
} else if (item.row != null) {
var str = data.getFormattedValue(item.row, 0);
message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str;
} else if (item.column != null) {
var str = data.getFormattedValue(0, item.column);
message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str;
}
}
if (message == '') {
message = 'nothing';
}
//document.title='2 ' + message;
if (1 == 2) console.log('You selected ' + message);
}
}
//);
";
}
echo " chart.draw(data, options); \n";
if ($GETr != "" && $GETc == "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': " . $GETr . ", 'column': null}]); setTimeout(myselectfunction,4100); \n";
if ($GETr == "" && $GETc != "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': null, 'column': " . $GETc . "}]); setTimeout(myselectfunction,4100); \n";
if ($GETr != "" && $GETc != "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]); setTimeout(myselectfunction,4100); \n";
echo " } \n";
echo " </script> \n";
echo " </head> \n";
if ($GETonclick != "") {
if ($superimposition == "") {
echo " <body style='background-color: silver;'> \n";
} else {
echo " <body onload='" . $superimposition . "' style='background-color: silver;'> \n";
}
} else {
echo " <body onload='" . $superimposition . " setTimeout(later, 2 * 1000);' style='background-color: silver;'> \n";
}
$statistics="";
$sarr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
$narr=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
$clprefix="";
$cl=-1;
$cpos=0;
$abbl="about:blank";
$dabbl="none";
$wabbl="";
if (strpos($GETmode,'Both') === 0 || strpos($GETmode,'Statistics') === 0) {
if (strpos($GETmode,'Both') === 0) $wabbl="Both";
if (strpos($GETmode,'Statistics') === 0) $wabbl="Statistics";
if (strpos($GETmode,'Both') === 0 && $GETmode != 'Both') {
$abbl=substr($GETmode,4);
$dabbl="block";
} else if (strpos($GETmode,'Statistics') === 0 && $GETmode != 'Statistics') {
$abbl=substr($GETmode,10);
$dabbl="block";
}
$thing_names=explode(",", $GETvalue);
$date_items=explode("~", $GETdata);
$data_items=explode("~,", $GETdata);
$matrix = array(array());
$rowarray = array();
$colarray = array();
$num_columns_is=sizeof($data_items) + 4;
//$statistics=$GETdata . "\n" . $GETvalue . "\n" . $GETlabel . "\n" . $GETtitle;
$subjideas=explode(" of ", $GETtitle);
$subjidea="";
if (strpos($GETtitle, "Timed Count") !== false) $subjidea="Vehicle";
if (sizeof($subjideas) > 1) {
$subjidea=explode(" ",$subjideas[1])[0];
}
$statistics.="<table id='tablestats'><tbody id='tbodystats'></tbody></table><br>";
$arow="<tr style='background-color:#777777;'><td id='topleft'></td></tr>";
for ($icpos=0; $icpos<$num_columns_is; $icpos++) {
if (($icpos % sizeof($sarr)) == 0 && $icpos != 0) {
$cl++;
$clprefix=$sarr[$cl];
}
if ($clprefix != "") $narr[sizeof($narr)]=0.0;
$arow = str_replace("</tr>", "<td id=" . $clprefix . $sarr[($icpos % sizeof($sarr))] . ">" . $clprefix . $sarr[($icpos % sizeof($sarr))] . "</td></tr>", $arow);
if (($icpos + 1) == sizeof($thing_names)) {
for ($jcpos=1; $jcpos<=5; $jcpos++) {
if ((($icpos + $jcpos) % sizeof($sarr)) == 0) {
$cl++;
$clprefix=$sarr[$cl];
}
if (1 == 4) $arow = str_replace("</tr>", "<td id=" . $clprefix . $sarr[(($icpos + $jcpos) % sizeof($sarr))] . ">" . $clprefix . $sarr[(($icpos + $jcpos) % sizeof($sarr))] . "</td></tr>", $arow);
}
}
}
$statistics=str_replace("</tbody>", $arow . "</tbody>", $statistics);
$arow="<tr style='background-color:white;'><td id='left1' style='background-color:#777777;'>1</td><td id=a1></td><td style=background-color:#f7f7f7; id=a2 colspan=" . (-5 + $num_columns_is) . ">" . $GETtitle . "</td><td colspan=4 id=a" . (-4 + + $num_columns_is) . "></td></tr>";
$statistics=str_replace("</tbody>", $arow . "</tbody>", $statistics);
$arow="<tr style='background-color:white;'><td id='left2' style='background-color:#777777;'>2</td><td id=a2><b>" . $subjidea . "</b></td></tr>";
$cl=2;
for ($icpos=0; $icpos<(-1 + sizeof($data_items)); $icpos++) {
$arow = str_replace("</tr>", "<td>" . str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",$date_items[2 * $icpos + 1])))) . "</td></tr>", $arow);
}
$arow = str_replace("</tr>", "<td style=padding-left:15px;><b>Total</b></td></tr>",$arow);
$arow = str_replace("</tr>", "<td><b>Average</b></td></tr>",$arow);
$arow = str_replace("</tr>", "<td><b>Median</b></td></tr>",$arow);
$arow = str_replace("</tr>", "<td><b>Mode</b></td></tr>",$arow);
$statistics=str_replace("</tbody>", $arow . "</tbody>", $statistics);
$aarow="";
$bbrow="";
$ccrow="";
$ddrow="";
$firsthuh="";
for ($icpos=0; $icpos<(-1 + sizeof($data_items)); $icpos++) {
$firsthuh.="?";
}
for ($icpos=0; $icpos<sizeof($thing_names); $icpos++) {
$rowarray = array();
$secondhuh=$firsthuh;
$sumis=0.0;
$movavg=0.0;
$arow="<tr style='background-color:white;'><td id=left" . ($icpos + 3) . " style='background-color:#777777;'>" . ($icpos + 3) . "</td></tr>";
$aarow="<tr style='background-color:white;'><td id=left" . ($icpos + 4) . " style='padding-top:15px;background-color:#777777;'>" . ($icpos + 4) . "</td></tr>";
$bbrow="<tr style='background-color:white;'><td id=left" . ($icpos + 5) . " style='background-color:#777777;'>" . ($icpos + 5) . "</td></tr>";
$ccrow="<tr style='background-color:white;'><td id=left" . ($icpos + 6) . " style='background-color:#777777;'>" . ($icpos + 6) . "</td></tr>";
$ddrow="<tr style='background-color:white;'><td id=left" . ($icpos + 7) . " style='background-color:#777777;'>" . ($icpos + 7) . "</td></tr>";
$arow = str_replace("</tr>", "<td>" . $thing_names[$icpos] . "</td></tr>", $arow);
$aarow = str_replace("</tr>", "<td style=padding-top:15px;><b>Total</b></td></tr>", $aarow);
$bbrow = str_replace("</tr>", "<td><b>Average</b></td></tr>", $bbrow);
$ccrow = str_replace("</tr>", "<td><b>Median</b></td></tr>", $ccrow);
$ddrow = str_replace("</tr>", "<td><b>Mode</b></td></tr>", $ddrow);
for ($jcpos=0; $jcpos<(-1 + sizeof($data_items)); $jcpos++) {
$rowarray[sizeof($rowarray)] = (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos]))));
$matrix[$icpos][$jcpos] = (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos]))));
$narr[$jcpos] += (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos]))));
$sumis += (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos]))));
$movavg = ($movavg * $jcpos + (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))) ) / (1 + $jcpos);
$arow = str_replace("</tr>", "<td style=background-color:#f0f0f0; id=cell" . $icpos . "_" . $jcpos . ">" . str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))) . "</td></tr>", $arow);
$aarow = str_replace("</tr>", "<td style=padding-top:15px;>" . $secondhuh . "</td></tr>", $aarow);
$bbrow = str_replace("</tr>", "<td>" . $secondhuh . "</td></tr>", $bbrow);
$ccrow = str_replace("</tr>", "<td>" . $secondhuh . "</td></tr>", $ccrow);
$ddrow = str_replace("</tr>", "<td>" . $secondhuh . "</td></tr>", $ddrow);
$secondhuh=substr($secondhuh,1);
}
$arow = str_replace("</tr>", "<td style=padding-left:15px;>" . $sumis . "</td></tr>", $arow);
$arow = str_replace("</tr>", "<td>" . $movavg . "</td></tr>", $arow);
sort($rowarray, SORT_NUMERIC);
$arow = str_replace("</tr>", "<td>" . $rowarray[(int)(sizeof($rowarray) / 2)] . "</td></tr>", $arow); // median
$sofar = $rowarray[0];
$lastnum = $rowarray[0];
$thissofarnum = 1;
$sofarnum = 1;
for ($imore=1; $imore<sizeof($rowarray); $imore++) {
if ($lastnum == $rowarray[$imore]) {
$thissofarnum++;
if ($thissofarnum > $sofarnum) {
$sofar = $rowarray[$imore];
$sofarnum = $thissofarnum;
} else {
$thissofarnum = 1;
}
$lastnum = $rowarray[$imore];
}
}
$arow = str_replace("</tr>", "<td>" . $sofar . "</td></tr>", $arow); // mode
$othercharts="<form target='igchart' action='http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' style='display:none;' id='thisfcc' method='POST'>
<input type=hidden name='title' id='ftitle' value=''></input>
<input type=hidden name='value' id='fvalue' value=''></input>
<input type=hidden name='onclick' id='fonclick' value='y'></input>
<input type=hidden name='mode' id='fmode' value=''></input>
<input type=hidden name='label' id='flabel' value='Time'></input>
<input type=hidden name='data' id='fdata' value=''></input>
<input type=submit id=fcsubmit value='Submit'></input>
</form>
<a id=emailclient href=\"#\"></a><iframe style='width:400px;height:400px;display:" . $dabbl . ";' id='igchart' src=\"about:blank\" title='Google Chart'></iframe><br>";
$othercharts.="<table border=6><TBODY><tr><th>Up Above</th><th>New Window</th><th>Email Client</th></tr><tr><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src=toolongcheck('http://www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' + String.fromCharCode(63) + 'title=" . str_replace("=Both","",str_replace("=Statistics","",explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1])) . "'); \" title='Google Chart Bar Chart'>Bar Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; window.open(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src)),'_blank','top=100,left=100,width=900,height=700'); \" title='Google Chart Bar Chart'>Bar Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/BarChart/bar_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; document.getElementById('emailclient').href='mailto:' + String.fromCharCode(63) + 'subject=Google%20Chart&body=' + encodeURIComponent(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src))); document.getElementById('emailclient').click(); \" title='Google Chart Bar Chart'>Bar Chart</a><br>";
$othercharts.="</td></tr><tr><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src=toolongcheck('http://www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' + String.fromCharCode(63) + 'title=" . str_replace("=Both","",str_replace("=Statistics","",explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1])) . "'); \" title='Google Chart Line Chart'>Line Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; window.open(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src)),'_blank','top=100,left=100,width=900,height=700'); \" title='Google Chart Line Chart'>Line Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/LineChart/line_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; document.getElementById('emailclient').href='mailto:' + String.fromCharCode(63) + 'subject=Google%20Chart&body=' + encodeURIComponent(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src))); document.getElementById('emailclient').click(); \" title='Google Chart Line Chart'>Line Chart</a><br>";
$othercharts.="</td></tr><tr><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src=toolongcheck('http://www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' + String.fromCharCode(63) + 'title=" . str_replace("=Both","",str_replace("=Statistics","",explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1])) . "'); \" title='Google Chart Area Chart'>Area Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; window.open(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src)),'_blank','top=100,left=100,width=900,height=700'); \" title='Google Chart Area Chart'>Area Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/AreaChart/area_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; document.getElementById('emailclient').href='mailto:' + String.fromCharCode(63) + 'subject=Google%20Chart&body=' + encodeURIComponent(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src))); document.getElementById('emailclient').click(); \" title='Google Chart Area Chart'>Area Chart</a><br>";
$othercharts.="</td></tr><tr><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src=toolongcheck('http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' + String.fromCharCode(63) + 'title=" . str_replace("=Both","",str_replace("=Statistics","",explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1])) . "'); \" title='Google Chart Column Chart'>Column Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; window.open(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src)),'_blank','top=100,left=100,width=900,height=700'); \" title='Google Chart Column Chart'>Column Chart</a><br>";
$othercharts.="</td><td><a href='#igchart' onclick=\" document.getElementById('igchart').style.display='block'; document.getElementById('igchart').src='http://www.rjmprogramming.com.au/PHP/ColumnChart/column_chart.php' + String.fromCharCode(63) + 'title=" . explode("tle=", substr($_SERVER['QUERY_STRING'],1))[1] . "'; document.getElementById('emailclient').href='mailto:' + String.fromCharCode(63) + 'subject=Google%20Chart&body=' + encodeURIComponent(document.URL.split('#')[0].replace('" . $wabbl . "','" . $wabbl . "' + encodeURIComponent(document.getElementById('igchart').src))); document.getElementById('emailclient').click(); \" title='Google Chart Column Chart'>Column Chart</a><br>";
$othercharts.="</td></tr></TBODY></table>";
if (str_replace("about:blank","",$abbl) != "") {
$leftis=explode(".php", $abbl);
$rightis=explode("title=", $abbl);
$othercharts.=" <scri" . "pt type='text/javascript'> function dothis() { document.getElementById('igchart').src='" . $leftis[0] . ".php' + String.fromCharCode(63) + 'title=" . $rightis[1] . "'; } setTimeout(dothis,1000); </sc" . "ript> ";
}
$aarow = str_replace("</tr>", "<td rowspan=4 colspan=4 style=padding-top:15px;><div id=gcmore>" . $othercharts . "</div></td></tr>", $aarow);
//$aarow = str_replace("</tr>", "<td style=padding-top:15px;></td></tr>", $aarow);
//$aarow = str_replace("</tr>", "<td style=padding-top:15px;></td></tr>", $aarow);
//$aarow = str_replace("</tr>", "<td style=padding-top:15px;></td></tr>", $aarow);
// $bbrow = str_replace("</tr>", "<td colspan=4></td></tr>", $bbrow);
//$bbrow = str_replace("</tr>", "<td></td></tr>", $bbrow);
//$bbrow = str_replace("</tr>", "<td></td></tr>", $bbrow);
//$bbrow = str_replace("</tr>", "<td></td></tr>", $bbrow);

// $ccrow = str_replace("</tr>", "<td colspan=4></td></tr>", $ccrow);
//$ccrow = str_replace("</tr>", "<td></td></tr>", $ccrow);
//$ccrow = str_replace("</tr>", "<td></td></tr>", $ccrow);
//$ccrow = str_replace("</tr>", "<td></td></tr>", $ccrow);
// $ddrow = str_replace("</tr>", "<td colspan=4></td></tr>", $ddrow);
//$ddrow = str_replace("</tr>", "<td></td></tr>", $ddrow);
//$ddrow = str_replace("</tr>", "<td></td></tr>", $ddrow);
//$ddrow = str_replace("</tr>", "<td></td></tr>", $ddrow);

$statistics=str_replace("</tbody>", $arow . "</tbody>", $statistics);
if ((1 + $icpos) == sizeof($thing_names)) {
$secondhuh=$firsthuh;
for ($iicpos=0; $iicpos<(-1 + sizeof($data_items)); $iicpos++) {
$colarray = array();
for ($jjcpos=0; $jjcpos<sizeof($thing_names); $jjcpos++) {
$colarray[sizeof($colarray)] = $matrix[$jjcpos][$iicpos];
}
sort($colarray, SORT_NUMERIC);
$aarow = str_replace($secondhuh, ("" . $narr[$iicpos]), $aarow);
$bbrow = str_replace($secondhuh, ("" . $narr[$iicpos] / sizeof($thing_names)), $bbrow);
$ccrow = str_replace($secondhuh, ("" . $colarray[(int)(sizeof($colarray) / 2)]), $ccrow); // temporary
$sofar = $colarray[0];
$lastnum = $colarray[0];
$thissofarnum = 1;
$sofarnum = 1;
for ($imore=1; $imore<sizeof($colarray); $imore++) {
if ($lastnum == $colarray[$imore]) {
$thissofarnum++;
if ($thissofarnum > $sofarnum) {
$sofar = $colarray[$imore];
$sofarnum = $thissofarnum;
} else {
$thissofarnum = 1;
}
$lastnum = $colarray[$imore];
}
}
$ddrow = str_replace($secondhuh, "" . $sofar, $ddrow); // temporary
$secondhuh=substr($secondhuh,1);
}
$statistics=str_replace("</tbody>", $aarow . "</tbody>", $statistics);
$statistics=str_replace("</tbody>", $bbrow . "</tbody>", $statistics);
$statistics=str_replace("</tbody>", $ccrow . "</tbody>", $statistics);
$statistics=str_replace("</tbody>", $ddrow . "</tbody>", $statistics);
}
}
}
if (strpos($GETmode,'Both') === 0) {
echo " <h1>" . $GETtitle . " Statistics Table and Column Chart</h1> \n";
echo '<div id="statistics_table" style="display:block;">' . $statistics . '</div>' . $bdivstart . '<div id="chart_div" style="display:block; ' . $cdivc . '"></div>' . $bdivend . '<div id="bitsatend" style="display:inline;"></div>' . " \n";
} else if (strpos($GETmode,'Statistics') !== 0) {
echo " <h1>" . $GETtitle . " Column Chart</h1> \n";
echo '<div id="statistics_table" style="display:none;"></div>' . $bdivstart . '<div id="chart_div" style="display:block;' . $cdivc . '"></div>' . $bdivend . '<div id="bitsatend" style="display:inline;"></div>' . " \n";
} else {
echo " <h1>" . $GETtitle . " Statistics Table</h1> \n";
echo '<div id="statistics_table" style="display:block;">' . $statistics . '</div>' . $bdivstart . '<div id="chart_div" style="display:none;' . $cdivc . '"></div>' . $bdivend . '<div id="bitsatend" style="display:inline;"></div>' . " \n";
}
}
//echo '<a id=another title="Another Column Chart to show differences for" href="./column_chart_diff.php">Another column chart to show differences for?</a>' . " \n";
echo '<a id=another title="Another Column Chart for" href="./column_chart.php">Another</a> <a id="aoarea" title="Another Area Chart ... double click for superimposition" style="text-decoration:underline;cursor:pointer;" onclick=goother(this);>area</a>/<a id="aobar" title="Another Bar Chart ... double click for superimposition" style="text-decoration:underline;cursor:pointer;" onclick=goother(this);>bar</a>/<a id="aoline" title="Another Line Chart ... double click for superimposition" style="text-decoration:underline;cursor:pointer;" onclick=goother(this);>line</a>/<a id=anothertwo title="Another Column Chart for" href="./column_chart.php">column chart?</a>' . " \n";
echo '<div id="thedivoverlay"><?php echo $overlay; ?></div>';
echo '<' . 'script' . '>' . "\n " . " function later() { \n";
if ((!isset($_GET['value']) && !isset($_POST['value'])) || (1 == 2 && $data0 == "")) {
if (isset($_GET['data'])) $data0 = "&data0=" . $_GET['data'];
if (isset($_POST['data'])) $data0 = "&data0=" . $_POST['data'];

echo " if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; } " . "\n";
echo ' var datalineprefix = " "; ' . "\n";
echo ' var datalinesuffix = ""; ' . "\n";
echo ' var extra = ""; ' . "\n";
echo ' var thisline = 1; ' . "\n";
echo ' var ii = 0; ' . "\n";
echo ' var thisdef = "0"; ' . "\n";
echo ' var totalleft = 100.0; ' . "\n";
if (isset($_GET['data']) || isset($_POST['data'])) {
echo " var title = '" . $GETtitle . "'; " . "\n";
} else {
echo ' var title = prompt("Enter Column Chart Title (background image URL or background image data URI ; separated (followed by ;) before title are available options, and suffix by &onclick=y for added onclick functionality, and/or suffix by &mode=Statistics for a spreadsheet type display or &mode=Both for both types of display, Email Attachment Title suffixes are &emailto=[emailTo] &emailsubject=[EmailSubject] and &top=[0], &left=[0], &opacity=[0.5], &overlay=[C] or A or B or L (and appended ,[~2010~,45,67] type data sets of overlay data, can be different to entries later) for superimposition purposes available)", "' . $GETtitle . '"); ' . "\n";
}
echo ' if (title != null) { ' . "\n";
if (isset($_GET['data']) || isset($_POST['data'])) {
echo " var label = '" . $GETlabel . "'; " . "\n";
echo " var value = '" . $GETvalue . "'; " . "\n";
} else {
echo ' var label = prompt("Enter Column Concept", "' . $GETlabel . '"); ' . "\n";
echo ' var value = prompt("Enter Column " + label + " Measure(s) (separated by ,)", "' . $GETvalue . '"); ' . "\n";
}
echo ' if (value.indexOf(",") != (0 - 1)) { ' . "\n";
echo ' for (ii=0; ii<value.length; ii++) { if (value.substring(ii,(ii+1)) == ",") thisdef = thisdef + ",0"; } ' . "\n";
echo ' } ' . "\n";
echo ' var datac = ""; ' . "\n";
echo ' var sq = "' . "'" . '"; ' . "\n";
echo ' datalineprefix = prompt("Enter " + label + " " + thisline, ""); ' . "\n";
echo ' while (datalineprefix.length != 0 && (value.indexOf("ercent") == (0 - 1) || value.indexOf(" ercent ") != (0 - 1) || (value.indexOf("ercent") != (0 - 1) && totalleft > 0))) { ' . "\n";
echo ' if (datalinesuffix.length != 0) datalineprefix = prompt("Enter " + label + " " + thisline + " (for no more hit Cancel button)", ""); ' . "\n";
echo ' if (datalineprefix == null) { ' . "\n";
echo ' datalineprefix = ""; ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (datalineprefix.length != 0) { ' . "\n";
echo ' extra = ""; ' . "\n";
echo ' if (value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) extra = " (for " + totalleft + " enter nothing or hit Cancel button)"; ' . "\n";
echo ' datalinesuffix = prompt("Enter " + value.replace(" ercent ", "") + " " + thisline + extra, thisdef); ' . "\n";
echo ' if (datalinesuffix == null && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) datalinesuffix = totalleft; ' . "\n";
echo ' if (datalinesuffix == null) datalinesuffix = "0"; ' . "\n";
echo ' if (datalinesuffix.length == 0) { ' . "\n";
echo ' datalinesuffix = eval(totalleft); ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(totalleft) == eval(datalinesuffix) && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' datalinesuffix = eval(totalleft); ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") == (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' value = value + " ercent "; ' . "\n";
echo ' } else { ' . "\n";
echo ' totalleft = eval(totalleft) - eval(datalinesuffix); ' . "\n";
echo ' } ' . "\n";
echo ' datac = datac + ", [~" + datalineprefix + "~," + datalinesuffix + "] "; ' . "\n";
echo ' thisline++; ' . "\n";
echo ' } ' . "\n";
echo ' } ' . "\n";
if (strpos($data0, "data0=") !== false) {
echo ' if (allowed) { var wl = toolong("./column_chart_diff.php?title=" + title + yonclick + "&label=" + label + nojwinextra + "&value=" + value.replace(" ercent ", "") + "' . $data0 . '&data=" + datac); if (wl != "#") { window.location=wl; } } ' . "\n";
} else {
echo ' if (allowed) { var wl = toolong("./column_chart.php?title=" + title + yonclick + "&label=" + label + nojwinextra + "&value=" + value.replace(" ercent ", "") + "' . $data0 . '&data=" + datac); if (wl != "#") { window.location=wl; } } ' . "\n";
}
echo "} \n" . "} \n";
} else {
echo " } \n";
}
echo '</' . 'script' . '>' . "\n";

?>
<script type='text/javascript'>
if (document.URL.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i)) {
//document.getElementById('pch1').innerHTML+='.';
var xansis='x', hiddenbits='';
xpnum=1;
if (document.URL.indexOf('?') != -1) {
var pairing, argsare=document.URL.split('#')[0].split('?')[1].split('&');
for (var iargsare=0; iargsare<argsare.length; iargsare++) {
pairing=argsare[iargsare].split('=');
if (('*' + pairing[0]).indexOf('*val') == -1 && ('*' + pairing[0]).indexOf('*prompt') == -1 && ('*' + pairing[0]).indexOf('*OK') == -1 && ('*' + pairing[0]).indexOf('*Cancel') == -1) {
hiddenbits+="<input type=hidden name=" + pairing[0] + " value='" + pairing[1] + "'></input>";
}
}
}
while (xansis != '') {
xansis=location.search.split('val' + xpnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + xpnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
if (document.URL.indexOf('val' + xpnum + '=') != -1) {
hiddenbits+="<input type=hidden name=val" + xpnum + " value='" + encodeURIComponent(xansis) + "'></input>";
xpnum++;
xansis='x';
} else {
xansis='';
}
}
var durl=document.URL;
if (document.URL.indexOf('nojwinyes=') != -1) {
document.write("<form onsubmit=\" if (document.getElementById('val" + xpnum + "').value.replace('null','') != '') { if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' In ') == 0) { selecteventsix(document.getElementById('val" + xpnum + "').value); } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' In ') == 0) { selecteventfive(document.getElementById('val" + xpnum + "').value); } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' In ') == 0) { selecteventfour(document.getElementById('val" + xpnum + "').value); } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' In ') == 0) { selecteventthree(document.getElementById('val" + xpnum + "').value); } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' In ') == 0) { selecteventtwo(document.getElementById('val" + xpnum + "').value); } else { selectevent(document.getElementById('val" + xpnum + "').value); } } else if (durl.indexOf('&data=') != -1) { location.href=durl; } else { this.style.display='none'; } xpnum++; return false; \" enctype='text/plain' style='opacity:0.9;display:none;position:absolute;top:70;left:2%;z-index:56;width:48%;background-color:rgba(255,165,0,0.8);border:2px solid red;' id=safariform method=GET action=" + document.URL.split('#')[0].split('?')[0] + " readonly>" + hiddenbits + "<textarea style='width:96%;background-color:#eeeeee;' rows=5 id='prompt' readonly='readonly'></textarea><br><input type=hidden value='' name=val" + xpnum + " id=hval" + xpnum + "></input><input onkeypress=\"checkEnter(event);\" onblur=\" document.getElementById('h' + this.id).value=encodeURIComponent(this.value); \" style='width:50%;background-color:yellow;' type=text value='' id=val" + xpnum + "></input>&nbsp;&nbsp;<input style='float:right;width:25%;' type=submit value=OK name=OK id=OK></input>&nbsp;<input style='display:none;' type=submit value=Cancel name=Cancel id=Cancel></input>&nbsp;<input type=button value=Cancel id=bCancel onclick=\" document.getElementById('val" + xpnum + "').value='null'; document.getElementById('hval" + xpnum + "').value=encodeURIComponent('null'); this.style.display='none'; document.getElementById('Cancel').style.display='block'; document.getElementById('Cancel').click(); \"></input>&nbsp;</input></form>");
//document.getElementById('pch1').innerHTML+='....';
} else {
document.write("<form enctype='text/plain' style='opacity:0.9;display:none;position:absolute;top:70;left:2%;z-index:56;width:48%;background-color:rgba(255,165,0,0.8);border:2px solid red;' id=safariform method=GET action=" + document.URL.split('#')[0].split('?')[0] + " readonly>" + hiddenbits + "<textarea style='width:96%;background-color:#eeeeee;' rows=2 id='prompt' readonly='readonly'></textarea><br><input type=hidden value='' name=val" + xpnum + " id=hval" + xpnum + "></input><input onkeypress=\"checkEnter(event);\" onblur=\" document.getElementById('h' + this.id).value=encodeURIComponent(this.value); \" style='width:50%;background-color:yellow;' type=text value='' id=val" + xpnum + "></input>&nbsp;&nbsp;<input style='float:right;width:25%;' type=submit value=OK name=OK id=OK></input>&nbsp;<input style='display:none;' type=submit value=Cancel name=Cancel id=Cancel></input>&nbsp;<input type=button value=Cancel id=bCancel onclick=\" document.getElementById('val" + xpnum + "').value='null'; document.getElementById('hval" + xpnum + "').value=encodeURIComponent('null'); this.style.display='none'; document.getElementById('Cancel').style.display='block'; document.getElementById('Cancel').click(); \"></input>&nbsp;</input></form>");
//document.getElementById('pch1').innerHTML+='..';
}
if (document.getElementById('another')) {
if (document.getElementById('another').href.indexOf('nojwin') == -1) {
document.getElementById('another').href+='?nojwin=Y';
}
}
}

function preclickforemail() {
<?php
if (isset($_POST['emailto'])) {
if (strpos(urldecode($_POST['emailto']), '@') !== false) {
if (isset($_POST['emailto'])) echo "\n if (document.getElementById('theto') && yesgo) { document.getElementById('theto').value='" . urldecode($_POST['emailto']) . "'; } \n";
if (isset($_POST['emailsubject'])) echo "\n if (document.getElementById('thesubject') && yesgo) { document.getElementById('thesubject').innerHTML=\"" . urldecode($_POST['emailsubject']) . "\"; } \n";
if (isset($_POST['emailcc'])) echo "\n if (document.getElementById('thecc') && yesgo) { document.getElementById('thecc').value='" . urldecode($_POST['emailcc']) . "'; } \n";
if (isset($_POST['emailbcc'])) echo "\n if (document.getElementById('thebcc') && yesgo) { document.getElementById('thebcc').value='" . urldecode($_POST['emailbcc']) . "'; } \n";
echo "\n
if (yesgo) {
yesgo3='MAILTO:" . urldecode($_POST['emailto']) . "';
nogo3='MAILTO:fillin.email@address';
yesgo2='\"' + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0] + '/PHP/butsel.php';
nogo2='\"//www.rjmprogramming.com.au/PHP/butsel.php';
if (document.getElementById('another')) {
yesgo=document.getElementById('another').href=document.URL.split('#')[0].split('?')[0];
nogo='./' + document.URL.split('#')[0].split('?')[0].split('/')[eval(-1 + document.URL.split('#')[0].split('?')[0].split('/').length)];
}
}
\n ";
echo "\n if (clickforemail) { clickforemail(); } else if (document.getElementById('thesemail')) { document.getElementById('thesemail').click(); } \n";
}
}
?>
}

<?php
if (isset($_POST['emailto'])) {
if (strpos(urldecode($_POST['emailto']), '@') !== false) {
echo "\n setTimeout(preclickforemail,4000); \n";
}
}
?>

</script>
<div id="thedivemail"></div>
</body>
</html>