function loadJS2(params){
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://www.taxtim.com/za/free-tax-season-reminders.php?'+params;
head.appendChild(script);
}
function showDiv(div,how){
if (document.getElementById(div)) document.getElementById(div).style.visibility = (how == 1 ? "visible" : "hidden");
if (document.getElementById(div)) document.getElementById(div).style.display = (how == 1 ? "block" : "none");
}
function validateEmail(eml){
var score = 0;
var errmessg="";
var atsign = eml.indexOf("@");
var dot = eml.indexOf(".");
if (atsign>0 && dot>0 && eml.indexOf(".",atsign)>0) score++;
else errmessg+="Please enter a valid email address.";
if (errmessg=="") {
loadJS2('widget=1&emailadd='+encodeURIComponent(eml)+'&from='+encodeURIComponent("TaxTim demo")+'&fromcode='+encodeURIComponent('77777'));
document.getElementById('alerts-success').innerHTML = "Sending... Please wait.";
showDiv("alerts-success",1);
showDiv("alerts-error",0);
showDiv("email-form",0);
}
else {
alert(errmessg);
}
}
function validateMobile(eml,mobl){
var errors = "";
if (mobl.charAt(0)!="0") errors = "Please enter a mobile number starting with 0 (zero).";
if (mobl.length!=10) errors = "Please enter a valid 10 digit mobile number.";
if (errors==""){
loadJS2('widget=1&emailadd2='+encodeURIComponent(eml)+'&mobilenum='+encodeURIComponent(mobl)+'&fromcode='+encodeURIComponent('77777'));
document.getElementById('alerts-success').innerHTML = "Sending... Please wait.";
showDiv("alerts-success",1);
showDiv("mobile-form",0);
showDiv("alerts-error",0);
}
else {
alert(errors);
}
}
function skipMobile(){
showDiv("alerts-success",0);
showDiv("alerts-error",0);
showDiv("mobile-form",0);
showDiv("all-done",1);
}document.getElementById('taxtim-alerts').innerHTML="
Get SARS Tax Dates and Deadlines in your Inbox
We'll tell you when you need to file, along with tax tips and updates.