// gchartgen.js
// Email functionality for H1 onclick event specifics for Google Chart work
// RJM Programming
// Robert Metcalfe
// January 2015
// Added event functionality in July 2015
var wua = navigator.userAgent;
var wisiPad = /iPad/i.test(wua) || /iPhone OS 3_1_2/i.test(wua) || /Android/i.test(wua) || /iPhone OS 3_2_2/i.test(wua);
var wisTouch = /touch/i.test(wua) || /Touch/i.test(wua);
var gcadvice = ' ... To email a snapshot of this Google Chart click me.';
var wisMobile = false;
var wisWebView = false;
var toobigform = null;
var ourbae = null;
var formid = '';
var xnewfbit = '';
var divid = '';
var emailtitle = 'Email Attachment Title suffixes are &ema' + 'ilto=[emailTo] &emailsubject=[EmailSubject] ';
var yesgo='noway' + 'okay' + '675';
var nogo=yesgo;
var yesgo2=yesgo;
var nogo2=yesgo;
var yesgo3=yesgo;
var nogo3=yesgo;
var yesgo4=yesgo;
var nogo4=yesgo;
var yesgo5=yesgo;
var nogo5=yesgo;
var ghurl='';
var ghform='';
var tdghuhta='';
var oncprefix='';
var remail='remail';
var deftois='';
var pnum=1, lastfi=false;
var issatisfied=false;
var satisfiedvalue=null;
var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
// var xpnum=1; // done back at supervisor
// var allowed=true; // done back at supervisor
if (typeof paramdata === "undefined") {
var paramdata="";
}
if (document.URL.indexOf('nojwin') != -1) { // || navigator.userAgent.match(/iPhone|iPad/i)) {
var prompt = function(zwords, defwords){
var vcancel='';
var vok='';
var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
}
if (vcancel != '') {
pnum++;
return null;
} else if (vok != '') {
pnum++;
return ansis;
} else if (document.getElementById('val' + pnum)) {
allowed=false;
lastfi=true;
document.getElementById('safariform').style.display='block';
document.getElementById('prompt').value=zwords;
document.getElementById('val' + pnum).value=defwords;
document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
if (zwords.split(String.fromCharCode(10)).length > eval('0' + document.getElementById('prompt').rows)) {
document.getElementById('prompt').rows=zwords.split(String.fromCharCode(10)).length;
} else if (zwords.split('
').length > eval('0' + document.getElementById('prompt').rows)) {
document.getElementById('prompt').rows=zwords.split('
').length;
}
document.getElementById('val' + pnum).focus();
pnum++;
return ansis;
} else if (lastfi) {
pnum++;
lastfi=false;
if (ansis == 'null') return null;
return ansis;
} else {
pnum++;
if (ansis == 'null') return null;
return ansis;
}
};
var alert = function(zwords){
var defwords='';
var vcancel='';
var vok='';
var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
}
if (vcancel != '') {
pnum++;
return null;
} else if (vok != '') {
pnum++;
return '';
} else if (document.getElementById('val' + pnum)) {
allowed=false;
lastfi=true;
document.getElementById('safariform').style.display='block';
document.getElementById('prompt').value=zwords;
document.getElementById('val' + pnum).value=defwords;
document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
document.getElementById('Cancel').style.display='none';
document.getElementById('bCancel').style.display='none';
document.getElementById('val' + pnum).style.display='none';
document.getElementById('OK').focus();
pnum++;
return ansis;
} else if (lastfi) {
pnum++;
lastfi=false;
if (ansis == 'null') return null;
return ansis;
} else {
pnum++;
if (ansis == 'null') return null;
return ansis;
}
};
var confirm = function(zwords){
//alert('val' + pnum + '=? ' + ' pnum=' + pnum + ' xpnum=' + xpnum + ' ' + document.URL);
var defwords='1trueYesOK';
var vcancel='';
var vok='';
var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
}
//alert('vok=' + vok);
if (vcancel != '') {
pnum++;
return null;
} else if (vok != '') {
pnum++;
return '1trueYesOK';
} else if (document.getElementById('val' + pnum)) {
allowed=false;
lastfi=true;
document.getElementById('safariform').style.display='block';
document.getElementById('prompt').value=zwords;
document.getElementById('val' + pnum).value=defwords;
document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
document.getElementById('val' + pnum).style.display='none';
document.getElementById('OK').focus();
pnum++;
return ansis;
} else if (lastfi) {
pnum++;
lastfi=false;
if (ansis == 'null') return null;
return ansis;
} else {
pnum++;
if (ansis == 'null') return null;
return ansis;
}
};
}
// Thanks to http://jennifermadden.com/javascript/stringEnterKeyDetector.html
function checkEnter(e){ //e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable
if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}
if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
document.getElementById('hval' + xpnum).value=encodeURIComponent(document.getElementById('val' + xpnum).value);
document.forms[-1 + eval(document.forms.length)].submit(); //submit the form
return false;
}
else{
return true;
}
}
function alatr() {
if (document.getElementById('psubm')) {
document.getElementById('psubm').click();
}
}
function toolong(inup) {
if (inup.split('&emailto=').length > 2) {
while (inup.split('&emailto=').length > 2) {
inup=inup.replace('&emailto=' + inup.split('&emailto=')[1].split('&')[0],'');
}
}
if (inup.split('&emailsubject=').length > 2) {
while (inup.split('&emailsubject=').length > 2) {
inup=inup.replace('&emailsubject=' + inup.split('&emailsubject=')[1].split('&')[0],'');
}
}
if (inup.split('&emailcc=').length > 2) {
while (inup.split('&emailcc=').length > 2) {
inup=inup.replace('&emailcc=' + inup.split('&emailcc=')[1].split('&')[0],'');
}
}
if (inup.split('&emailbcc=').length > 2) {
while (inup.split('&emailbcc=').length > 2) {
inup=inup.replace('&emailbcc=' + inup.split('&emailbcc=')[1].split('&')[0],'');
}
}
if (inup.indexOf('&email') > inup.indexOf('&data')) {
var putb=inup.substring(inup.indexOf('&email'));
inup=inup.replace(putb,'');
inup=inup.replace('&data', putb + '&data');
}
if (inup.length < 900) return inup;
var pform='