function setscrapeprovider(form)
{ var cmbsp=document.getElementById('selperiod');
form.action='NHS_scrape_provider.php?selperiod='+cmbsp.value;
form.submit();
}
function setscrapecovidbedsarea(form)
{ var cmbsp=document.getElementById('selarea');
form.action='NHS_scrape_covid_beds.php?selarea='+cmbsp.value;
form.submit();
}
function setscrapecovidbedspc(form)
{ var cmbsp=document.getElementById('selarea');
form.action='NHS_scrape_covid_bed_pc.php?selarea='+cmbsp.value;
form.submit();
}
function setscrapecovidventbeds(form)
{ var cmbsp=document.getElementById('selarea');
form.action='NHS_scrape_covid_ventbeds.php?selarea='+cmbsp.value;
form.submit();
}
function setscrapecancerwait(form)
{ var cmbsp=document.getElementById('selwait');
form.action='NHS_scrape_cancer_wait.php?selwait='+cmbsp.value;
form.submit();
}
function setscrapecancerwait1023(form)
{ var cmbsp=document.getElementById('selwait');
form.action='NHS_scrape_cancer_wait_1023.php?selwait='+cmbsp.value;
form.submit();
}
function setscrapeaewait(form)
{ var cmbsp=document.getElementById('selwaitae');
form.action='NHS_scrape_AE_wait.php?selwaitae='+cmbsp.value;
form.submit();
}
function sortchange(form,but)
{ switch (but)
{ case 0:
form.sortnum.value=1;
form.sorttitle.value=0;
form.sortarea.value=0;
break;
case 1:
form.sortnum.value=0;
form.sorttitle.value=1;
form.sortarea.value=0;
break;
case 2:
form.sortnum.value=0;
form.sorttitle.value=0;
form.sortarea.value=1;
break;
}
if (but<3)
{ form.method="post"
form.submit();
}
}
function reveal(id,show)
{ if (show)
document.getElementById(id).style.visibility='visible';
else
document.getElementById(id).style.visibility='hidden';
}
function ltoggle(id)
{ var t=document.getElementById(id);
if (t.style.visibility!='visible')
{ t.style.marginLeft=-1;
t.style.visibility='visible';
}
else
t.style.visibility='hidden';
}
function rtoggle(id)
{ var t=document.getElementById(id);
if (t.style.visibility!='visible')
{ t.style.marginLeft=396;
t.style.visibility='visible';
}
else
t.style.visibility='hidden';
}
function noaddress(form)
{ var ix,q,ptot=0;
if (form.address.value.length>0)
return false;
qlist=document.getElementById('selpaper');
if (qlist)
{ ix=qlist.selectedIndex;
ptot=(ix>0)? 1:0;
}
fld=document.getElementById('qty');
q=new Number(fld.value);
ptot*=q;
return (ptot>0);
}
function check_email(str)
{ if (str.indexOf("'")>=0)
return false;
if (str.indexOf(",")>=0)
return false;
ereg=new RegExp("^.+@.+\\..+$");
return ereg.test(str);
}
function postit(form,flag)
{ switch (flag)
{ case 1: form.action="utils/lhemailer.php"; break;
case 2:
if (!check_email(form.fromemail.value))
{ alert("Please check your email address");
form.fromemail.focus();
return false;
}
f=document.getElementById('fromemail2');
if (f)
{ if ((f.value.length) && (!check_email(f.value)))
{ alert("Please check your additional email address");
form.fromemail2.focus();
return false;
}
}
if (form.surname.value.length==0)
{ alert("Please tell us your name");
form.surname.focus();
return false;
}
else if (noaddress(form))
{ alert("Please enter your full address so that we can send you the newspapers");
form.address.focus();
return false;
}
else
form.action="utils/aform.php";
break;
case 3:
if (!check_email(form.fromemail.value))
{ alert("Please check your email address");
form.fromemail.focus();
return false;
}
if (form.surname.value.length==0)
{ alert("Please tell us your surname");
form.surname.focus();
return false;
}
else
form.action="utils/dform.php";
break;
case 9:
form.action="newspaper.php";
break;
case 11:
uname=form.unameqry.value;
pwd=form.pwdqry.value;
if ((uname.length>0) && (pwd.length>0))
form.action="hct_checkpass.php";
else
{ if (uname.length==0)
{ alert("Please enter your username");
form.unameqry.focus();
}
else if (pwd.length==0)
{ alert("Please enter your password");
form.pwdqry.focus();
}
return false;
}
break;
case 12:
if (form.fromemail.value.length==0)
{ alert("Please enter your email address");
form.fromemail.focus();
return false;
}
else if (form.surname.value.length==0)
{ alert("Please tell us your name");
form.surname.focus();
return false;
}
else if (noaddress(form))
{ alert("Please enter your full address");
form.address.focus();
return false;
}
else
form.action="utils/tform.php";
break;
default: return;
}
form.method="post"
if ((flag==1) || (flag==2) || (flag==3) || (flag==12))
{ reveal('sendbutton',false);
reveal('ack',true);
}
form.submit();
}
function nfour(number)
{ return (number < 1000) ? number + 1900 : number;}
function calcdate()
{ var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June',
'July','August','September','October','November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
today = days[now.getDay()]+" "+now.getDate()+" "+months[now.getMonth()]
+ " " +nfour(now.getYear());
return today;
}
function launch(form,pg)
{ form.method="get";
form.action=pg;
form.submit();
}
function getarticle(form)
{ var i=form.articles.selectedIndex;
rn=recarray[i];
form.action="diary.php?rn="+rn;
form.submit();
}
function getworldnews(form)
{ var i=form.articles.selectedIndex;
rn=recarray[i];
form.action="worldnews.php?rn="+rn;
form.submit();
}
function poplist(url)
{ var mapwin=window.open(url,'bertie','width=536, height=660, left=5, location=no, titlebar=no, menubar=no, scrollbars=1, toolbar=0, resizable=1', false);
if (mapwin)
mapwin.focus();
}
function text2caps(field)
{ field.value = field.value.toUpperCase();
return true;
}
function nformat(n)
{ var f,fs,len,t;
f=new Number(n);
t=new Number(Math.floor(f*100));
s=t.toString();
while (s.length<3)
s='0'+s;
len=s.length;
fs=s.substr(0,len-2)+'.'+s.substr(len-2,2);
return fs;
}
function calc(form)
{ var i,fs,tot=0,ptot=0,sptot=0,packtot=0,offertot=0;
qlist=document.getElementById('selfee');
if (qlist)
{ ix=qlist.selectedIndex;
switch (ix)
{ case 1: tot+=500; break;
case 2: tot+=300; break;
case 3: tot+=50; break;
case 4: break;
}
}
qlist=document.getElementById('selpaper');
if (qlist)
{ ix=qlist.selectedIndex;
switch (ix)
{ case 1: ptot+=10; break;
case 2: ptot+=15; break;
case 3: ptot+=25; break;
case 4: ptot+=30; break;
case 5: ptot+=35; break;
case 6: ptot+=45; break;
case 7: ptot+=80; break;
}
}
fld=document.getElementById('qty');
if (fld)
{ q=new Number(fld.value);
ptot=ptot*q;
tot+=ptot;
}
fs=nformat(ptot);
form.costpapers.value=fs;
qlist=document.getElementById('specialpaper');
if (qlist)
{ ix=qlist.selectedIndex;
switch (ix)
{ case 1: sptot+=10; break;
case 2: sptot+=25; break;
case 3: sptot+=35; break;
case 4: sptot+=40; break;
case 5: sptot+=45; break;
case 6: sptot+=55; break;
case 7: sptot+=70; break;
case 8: sptot+=120; break;
}
fld=document.getElementById('specialqty');
q=new Number(fld.value);
sptot=sptot*q;
tot+=sptot;
fs=nformat(sptot);
form.costspecial.value=fs;
}
qlist=document.getElementById('offerpaper');
if (qlist)
{ ix=qlist.selectedIndex;
switch (ix)
{ case 1: offertot+=30; break;
case 2: offertot+=75; break;
case 3: offertot+=105; break;
case 4: offertot+=120; break;
case 5: offertot+=135; break;
case 6: offertot+=165; break;
case 7: offertot+=210; break;
case 8: offertot+=360; break;
}
fld=document.getElementById('offerqty');
q=new Number(fld.value);
offertot=offertot*q;
tot+=offertot;
fs=nformat(offertot);
form.costoffer.value=fs;
}
qlist=document.getElementById('confpack20171104');
if (qlist)
{ ix=qlist.selectedIndex;
switch (ix)
{ case 1: packtot+=1.5; break;
case 2: packtot+=60; break;
case 3: packtot+=110; break;
}
fld=document.getElementById('confpackqty');
q=new Number(fld.value);
packtot=packtot*q;
tot+=packtot;
fs=nformat(packtot);
form.costconfpack.value=fs;
}
fld=document.getElementById('donation');
if (fld)
{ q=new Number(fld.value);
tot+=q;
}
fs=nformat(tot);
form.amount.value=fs;
ts=document.getElementById('totsent');
if (tot==0)
ts.innerHTML=': (choose a quantity above)';
else
ts.innerHTML='£'+fs;
}
function payhelp(form,n)
{ var ix,t;
var a=(n==0) ? 'Health Campaigns Together, c/o KONP, PO Box 78440, LONDON SE14 9FA':'HCT, 19 Northolt Grove, Great Barr, Birmingham B42 2JH';
qlist=document.getElementById('paymentmethod');
if (qlist)
{ ix=qlist.selectedIndex;
t=(ix==0) ? 'Please fill in and submit this form to let us know your contact details, then make payment to our Coop Bank account:
Sort Code 08-92-99, Account Number 65797921':'Please fill in and submit this form to let us know your contact details, then send your cheque to '+a+'';
ts=document.getElementById('paymenthelp');
ts.innerHTML=t;
}
}
function forcenum(field)
{ s=field.value;
t='';
for (i=0; i='0') && (s.charAt(i)<='9')))
t+=s.charAt(i);
field.value = t;
return true;
}
function forcereal(field)
{ s=field.value;
t='';
for (i=0; i='0') && (s.charAt(i)<='9')))
t+=s.charAt(i);
field.value = nformat(t);
return true;
}
function joinclear()
{ document.getElementById('donation').value='';
document.getElementById('selfee').selectedIndex=0;
}
function paperclear()
{ document.getElementById('selpaper').selectedIndex=0;
document.getElementById('qty').value='1';
}
function chartarea(form)
{ var calist;
calist=document.getElementById('selarea');
if (calist)
{ document.getElementById('areaid').value=calist.value;
form.submit();
}
}
function showchart(form)
{ var calist,chartlist;
chartlist=document.getElementById('selchart');
calist=document.getElementById('selarea');
if (chartlist)
{ document.getElementById('chartid').value=chartlist.value;
document.getElementById('areaid').value=calist.value;
form.submit();
}
}
function joinpmchange(opt)
{ var cheque=document.getElementById('joincheque');
var paypal=document.getElementById('joinpaypal');
cheque.style.display = (opt==0)? 'block':'none';
paypal.style.display = (opt==1)? 'block':'none';
}